-
Notifications
You must be signed in to change notification settings - Fork 191
Open
Labels
Description
I tried this code:
enum Foo {
A,
B(i32),
}
fn main() -> i32 {
let result = Foo::B(123);
// { dg-warning "statement will never be executed" "" { target *-*-* } .+1 }
let value = match result {
A => 15,
Foo::B(x) => x,
};
value - 15
}
I expected to see this happen: running this program exits with a 0
exit code.
The "equivalent" Rust code being:
enum Foo {
A,
B(i32),
}
fn main() {
let result = Foo::B(123);
// { dg-error "statement will never be executed" "" { target *-*-* } .+1 }
let value = match result {
A => 15,
Foo::B(x) => x,
};
println!("{}", value - 15)
}
which gives out a lot of warnings but prints zero.
Instead, this happened: the code exited with 108
as a return value, which is 123 - 15
Meta
- What version of Rust GCC were you using: 428a318
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Todo