2021-03-14 21:25:42 +00:00
|
|
|
// revisions: mir thir
|
|
|
|
// [thir]compile-flags: -Z thir-unsafeck
|
|
|
|
|
2018-02-18 03:31:14 +00: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-22 02:43:13 +00:00
|
|
|
|
2018-02-18 03:31:14 +00: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-22 02:43:13 +00:00
|
|
|
// `()` is fine to zero-initialize as it is zero sized and inhabited.
|
|
|
|
let () = ::std::mem::zeroed();
|
2018-02-18 03:31:14 +00:00
|
|
|
|
|
|
|
inner()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {}
|