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