2024-02-16 14:02:50 -06:00
|
|
|
//@ check-pass
|
2022-12-01 17:54:06 -06:00
|
|
|
|
|
|
|
#![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
|
|
|
}
|
|
|
|
}
|