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
b3827e4f3728b77bd3e60587487ebfc3cc8d901b
rust/tests/ui/resolve/issue-10200.rs

10 lines
181 B
Rust
Raw Normal View History

Do not accept functions in enum patterns past resolve
2014-10-21 03:40:04 +02:00
struct Foo(bool);
Update compile fail tests to use usize.
2015-01-08 22:02:42 +11:00
fn foo(_: usize) -> Foo { Foo(false) }
Do not accept functions in enum patterns past resolve
2014-10-21 03:40:04 +02:00
fn main() {
match Foo(true) {
On function and method calls in patterns, link to the book ``` error: expected a pattern, found an expression --> f889.rs:3:13 | 3 | let (x, y.drop()) = (1, 2); //~ ERROR | ^^^^^^^^ not a pattern | = note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch18-00-patterns.html> error[E0532]: expected a pattern, found a function call --> f889.rs:2:13 | 2 | let (x, drop(y)) = (1, 2); //~ ERROR | ^^^^ not a tuple struct or tuple variant | = note: function calls are not allowed in patterns: <https://doc.rust-lang.org/book/ch18-00-patterns.html> ``` Fix #97200.
2024-10-06 01:44:59 +00:00
foo(x) //~ ERROR expected a pattern, found a function call
Do not accept functions in enum patterns past resolve
2014-10-21 03:40:04 +02:00
=> ()
}
}
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.24.6 Page: 5009ms Template: 3ms
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