-
Notifications
You must be signed in to change notification settings - Fork 167
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
backend: Allow anything as a match scrutinee
gcc/rust/ChangeLog: * backend/rust-compile-expr.cc (check_match_scrutinee): Allow anything to be used as a match scrutinee, not just ADTs. gcc/testsuite/ChangeLog: * rust/compile/match_scrutinee.rs: New test.
- Loading branch information
1 parent
b87fd67
commit 5fa1a1d
Showing
2 changed files
with
37 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
struct Foo { | ||
a: i32, | ||
b: bool, | ||
} | ||
|
||
fn foo() -> Foo { | ||
Foo { a: 145, b: false } | ||
} | ||
|
||
fn main() { | ||
let x = 15; | ||
|
||
match x { | ||
15 => {}, | ||
_ => {}, | ||
}; | ||
|
||
match 14 { | ||
14 => {}, | ||
_ => {}, | ||
}; | ||
|
||
match foo() { | ||
mut foo => { | ||
let _ = foo.a; | ||
let _ = foo.b; | ||
}, | ||
}; | ||
} |