summaryrefslogtreecommitdiff
path: root/tests/ui/unsafe/wrapping-unsafe-block-sugg.fixed
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/unsafe/wrapping-unsafe-block-sugg.fixed')
-rw-r--r--tests/ui/unsafe/wrapping-unsafe-block-sugg.fixed17
1 files changed, 16 insertions, 1 deletions
diff --git a/tests/ui/unsafe/wrapping-unsafe-block-sugg.fixed b/tests/ui/unsafe/wrapping-unsafe-block-sugg.fixed
index c36aabb7c92..8fdc21ee109 100644
--- a/tests/ui/unsafe/wrapping-unsafe-block-sugg.fixed
+++ b/tests/ui/unsafe/wrapping-unsafe-block-sugg.fixed
@@ -1,23 +1,38 @@
// run-rustfix
-#![deny(unsafe_op_in_unsafe_fn)]
+#![deny(unsafe_op_in_unsafe_fn)] //~ NOTE
unsafe fn unsf() {}
pub unsafe fn foo() { unsafe {
+ //~^ NOTE an unsafe function restricts its caller, but its body is safe by default
unsf(); //~ ERROR call to unsafe function is unsafe
+ //~^ NOTE
+ //~| NOTE
unsf(); //~ ERROR call to unsafe function is unsafe
+ //~^ NOTE
+ //~| NOTE
}}
pub unsafe fn bar(x: *const i32) -> i32 { unsafe {
+ //~^ NOTE an unsafe function restricts its caller, but its body is safe by default
let y = *x; //~ ERROR dereference of raw pointer is unsafe and requires unsafe block
+ //~^ NOTE
+ //~| NOTE
y + *x //~ ERROR dereference of raw pointer is unsafe and requires unsafe block
+ //~^ NOTE
+ //~| NOTE
}}
static mut BAZ: i32 = 0;
pub unsafe fn baz() -> i32 { unsafe {
+ //~^ NOTE an unsafe function restricts its caller, but its body is safe by default
let y = BAZ; //~ ERROR use of mutable static is unsafe and requires unsafe block
+ //~^ NOTE
+ //~| NOTE
y + BAZ //~ ERROR use of mutable static is unsafe and requires unsafe block
+ //~^ NOTE
+ //~| NOTE
}}
fn main() {}