2021-03-14 16:25:42 -05:00
|
|
|
// revisions: mir thir
|
|
|
|
// [thir]compile-flags: -Z thir-unsafeck
|
|
|
|
|
2018-02-17 21:31:14 -06:00
|
|
|
// This note is annotated because the purpose of the test
|
|
|
|
// is to ensure that certain other notes are not generated.
|
|
|
|
#![deny(unused_unsafe)] //~ NOTE
|
2019-12-21 20:43:13 -06:00
|
|
|
|
2018-02-17 21:31:14 -06:00
|
|
|
|
|
|
|
// (test that no note is generated on this unsafe fn)
|
|
|
|
pub unsafe fn a() {
|
|
|
|
fn inner() {
|
|
|
|
unsafe { /* unnecessary */ } //~ ERROR unnecessary `unsafe`
|
|
|
|
//~^ NOTE
|
|
|
|
}
|
|
|
|
|
|
|
|
inner()
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn b() {
|
|
|
|
// (test that no note is generated on this unsafe block)
|
|
|
|
unsafe {
|
|
|
|
fn inner() {
|
|
|
|
unsafe { /* unnecessary */ } //~ ERROR unnecessary `unsafe`
|
|
|
|
//~^ NOTE
|
|
|
|
}
|
2019-12-21 20:43:13 -06:00
|
|
|
// `()` is fine to zero-initialize as it is zero sized and inhabited.
|
|
|
|
let () = ::std::mem::zeroed();
|
2018-02-17 21:31:14 -06:00
|
|
|
|
|
|
|
inner()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {}
|