]> git.lizzy.rs Git - rust.git/blob - src/test/ui/issues/issue-48131.rs
Merge commit 'b40ea209e7f14c8193ddfc98143967b6a2f4f5c9' into clippyup
[rust.git] / src / test / ui / issues / issue-48131.rs
1 // This note is annotated because the purpose of the test
2 // is to ensure that certain other notes are not generated.
3 #![deny(unused_unsafe)] //~ NOTE
4
5
6 // (test that no note is generated on this unsafe fn)
7 pub unsafe fn a() {
8     fn inner() {
9         unsafe { /* unnecessary */ } //~ ERROR unnecessary `unsafe`
10                                      //~^ NOTE
11     }
12
13     inner()
14 }
15
16 pub fn b() {
17     // (test that no note is generated on this unsafe block)
18     unsafe {
19         fn inner() {
20             unsafe { /* unnecessary */ } //~ ERROR unnecessary `unsafe`
21                                          //~^ NOTE
22         }
23         // `()` is fine to zero-initialize as it is zero sized and inhabited.
24         let () = ::std::mem::zeroed();
25
26         inner()
27     }
28 }
29
30 fn main() {}