2022-12-01 17:54:06 -06:00
|
|
|
// check-pass
|
|
|
|
// revisions: mir thir
|
2023-10-05 09:57:14 -05:00
|
|
|
// [mir]ignore-test This is currently broken
|
2022-12-01 17:54:06 -06:00
|
|
|
// [thir]compile-flags: -Z thir-unsafeck
|
|
|
|
|
|
|
|
#![allow(incomplete_features)]
|
|
|
|
#![warn(unused_unsafe)]
|
|
|
|
#![feature(inline_const_pat)]
|
|
|
|
|
2023-10-05 09:57:14 -05:00
|
|
|
const unsafe fn require_unsafe() -> usize {
|
|
|
|
1
|
|
|
|
}
|
2022-12-01 17:54:06 -06:00
|
|
|
|
|
|
|
fn main() {
|
|
|
|
unsafe {
|
|
|
|
match () {
|
|
|
|
const {
|
|
|
|
require_unsafe();
|
|
|
|
unsafe {}
|
|
|
|
//~^ WARNING unnecessary `unsafe` block
|
|
|
|
} => (),
|
|
|
|
}
|
2023-10-05 09:57:14 -05:00
|
|
|
|
|
|
|
match 1 {
|
|
|
|
const {
|
|
|
|
unsafe {}
|
|
|
|
//~^ WARNING unnecessary `unsafe` block
|
|
|
|
require_unsafe()
|
|
|
|
}..=4 => (),
|
|
|
|
_ => (),
|
|
|
|
}
|
2022-12-01 17:54:06 -06:00
|
|
|
}
|
|
|
|
}
|