mirror of
https://github.com/rust-lang/rust.git
synced 2025-10-02 10:18:25 +00:00

also adjust the wording a little so that we don't say "the error occurred here" for two different spans
17 lines
366 B
Rust
17 lines
366 B
Rust
const unsafe fn foo(x: bool) -> bool {
|
|
match x {
|
|
true => true,
|
|
false => std::hint::unreachable_unchecked(),
|
|
//~^ NOTE inside `foo`
|
|
//~| NOTE the failure occurred here
|
|
}
|
|
}
|
|
|
|
const BAR: bool = unsafe { foo(false) };
|
|
//~^ NOTE failed inside this call
|
|
//~| ERROR entering unreachable code
|
|
|
|
fn main() {
|
|
assert_eq!(BAR, true);
|
|
}
|