1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
struct Foo(String);
struct Bar { baz: String }
fn foo(foo: Foo) -> bool {
match foo {
Foo("hi".to_owned()) => true,
//~^ error: expected a pattern, found an expression
_ => false
}
}
fn bar(bar: Bar) -> bool {
match bar {
Bar { baz: "hi".to_owned() } => true,
//~^ error: expected a pattern, found an expression
_ => false
}
}
/// Issue #90121
fn baz() {
let foo = vec!["foo".to_string()];
match foo.as_slice() {
&["foo".to_string()] => {}
//~^ error: expected a pattern, found an expression
_ => {}
};
}
/// Issue #104996
fn qux() {
struct Magic(pub u16);
const MAGIC: Magic = Magic(42);
if let Some(MAGIC.0 as usize) = None::<usize> {}
//~^ error: expected a pattern, found an expression
}
fn main() {
if let (-1.some(4)) = (0, Some(4)) {}
//~^ error: expected a pattern, found an expression
if let (-1.Some(4)) = (0, Some(4)) {}
//~^ error: expected a pattern, found an expression
}
|