diff options
Diffstat (limited to 'src/test/ui/typeck/issue-55810-must-typeck-match-pats-before-guards.rs')
-rw-r--r-- | src/test/ui/typeck/issue-55810-must-typeck-match-pats-before-guards.rs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/test/ui/typeck/issue-55810-must-typeck-match-pats-before-guards.rs b/src/test/ui/typeck/issue-55810-must-typeck-match-pats-before-guards.rs new file mode 100644 index 000000000..23ea0ad61 --- /dev/null +++ b/src/test/ui/typeck/issue-55810-must-typeck-match-pats-before-guards.rs @@ -0,0 +1,23 @@ +// check-pass + +// rust-lang/rust#55810: types for a binding in a match arm can be +// inferred from arms that come later in the match. + +struct S; + +impl S { + fn method(&self) -> bool { + unimplemented!() + } +} + +fn get<T>() -> T { + unimplemented!() +} + +fn main() { + match get() { + x if x.method() => {} + &S => {} + } +} |