Logo
Explore Help
Register Sign In
rust-lang/rust
1
0
Fork 0
You've already forked rust
Code Issues Pull Requests Actions 1 Packages Projects Releases Wiki Activity
Files
901b340c1f5d208561d4261cc3ee634973b35326
rust/tests/ui/pattern/usefulness/issue-30240-rpass.rs

15 lines
265 B
Rust
Raw Normal View History

[AUTO-GENERATED] Migrate ui tests from `//` to `//@` directives
2024-02-16 20:02:50 +00:00
//@ run-pass
handle string literals correctly in match checking The root of the problem is that a string literal pattern is essentially of the form `&LITERAL`, in a single block, while match checking wants to split that. To fix that, I added a type field to the patterns in match checking, which allows us to distinguish between a full and split pattern. That file is ugly and needs to be cleaned. However, `trans::_match` calls it, so I think we should delay the cleanup until we kill that. Fixes #30240
2016-06-05 23:56:11 +03:00
fn main() {
let &ref a = &[0i32] as &[_];
assert_eq!(a, &[0i32] as &[_]);
let &ref a = "hello";
assert_eq!(a, "hello");
match "foo" {
"fool" => unreachable!(),
"foo" => {},
ref _x => unreachable!()
}
}
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.24.6 Page: 4716ms Template: 4ms
English
Bahasa Indonesia Deutsch English Español Français Gaeilge Italiano Latviešu Magyar nyelv Nederlands Polski Português de Portugal Português do Brasil Suomi Svenska Türkçe Čeština Ελληνικά Български Русский Українська فارسی മലയാളം 日本語 简体中文 繁體中文(台灣) 繁體中文(香港) 한국어
Licenses API