]> git.lizzy.rs Git - rust.git/blob - tests/ui/unsafe/unsafe-not-inherited.rs
Rollup merge of #106717 - klensy:typo, r=lcnr
[rust.git] / tests / ui / unsafe / unsafe-not-inherited.rs
1 #![allow(unused, dead_code)]
2
3 static mut FOO: u64 = 0;
4
5 fn static_mod() {
6     unsafe {static BAR: u64 = FOO;}
7     //~^ ERROR: use of mutable static is unsafe
8     //~| NOTE: use of mutable static
9     //~| NOTE: mutable statics can be mutated by multiple threads
10     //~| NOTE: items do not inherit unsafety
11 }
12
13 unsafe fn unsafe_call() {}
14 fn foo() {
15     unsafe {
16     //~^ NOTE: items do not inherit unsafety
17         fn bar() {
18             unsafe_call();
19             //~^ ERROR: call to unsafe function
20             //~| NOTE: call to unsafe function
21             //~| NOTE: consult the function's documentation
22         }
23     }
24 }
25
26 fn main() {}