diff --git a/compiler/rustc_mir_transform/src/errors.rs b/compiler/rustc_mir_transform/src/errors.rs index b546e34f037..6570da51bcc 100644 --- a/compiler/rustc_mir_transform/src/errors.rs +++ b/compiler/rustc_mir_transform/src/errors.rs @@ -147,7 +147,7 @@ impl<'a> DecorateLint<'a, ()> for UnsafeOpInUnsafeFn { diag.note(self.details.note()); if let Some((start, end)) = self.suggest_unsafe_block { - diag.multipart_suggestion_verbose( + diag.tool_only_multipart_suggestion( crate::fluent_generated::mir_transform_suggestion, vec![(start, " unsafe {".into()), (end, "}".into())], Applicability::MaybeIncorrect, diff --git a/tests/ui/unsafe/rfc-2585-unsafe_op_in_unsafe_fn.mir.stderr b/tests/ui/unsafe/rfc-2585-unsafe_op_in_unsafe_fn.mir.stderr index 2333f710c40..6f005fe8958 100644 --- a/tests/ui/unsafe/rfc-2585-unsafe_op_in_unsafe_fn.mir.stderr +++ b/tests/ui/unsafe/rfc-2585-unsafe_op_in_unsafe_fn.mir.stderr @@ -10,14 +10,6 @@ note: the lint level is defined here | LL | #![deny(unsafe_op_in_unsafe_fn)] | ^^^^^^^^^^^^^^^^^^^^^^ -help: consider wrapping the function body in an unsafe block - | -LL ~ unsafe fn deny_level() { unsafe { -LL | unsf(); - ... -LL | -LL ~ }} - | error: dereference of raw pointer is unsafe and requires unsafe block (error E0133) --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:15:5 @@ -60,14 +52,6 @@ note: the lint level is defined here LL | #[deny(warnings)] | ^^^^^^^^ = note: `#[deny(unsafe_op_in_unsafe_fn)]` implied by `#[deny(warnings)]` -help: consider wrapping the function body in an unsafe block - | -LL ~ unsafe fn warning_level() { unsafe { -LL | unsf(); - ... -LL | -LL ~ }} - | error: dereference of raw pointer is unsafe and requires unsafe block (error E0133) --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:31:5 diff --git a/tests/ui/unsafe/wrapping-unsafe-block-sugg.stderr b/tests/ui/unsafe/wrapping-unsafe-block-sugg.stderr index b05d87069ab..b22c5b74b56 100644 --- a/tests/ui/unsafe/wrapping-unsafe-block-sugg.stderr +++ b/tests/ui/unsafe/wrapping-unsafe-block-sugg.stderr @@ -10,13 +10,6 @@ note: the lint level is defined here | LL | #![deny(unsafe_op_in_unsafe_fn)] | ^^^^^^^^^^^^^^^^^^^^^^ -help: consider wrapping the function body in an unsafe block - | -LL ~ pub unsafe fn foo() { unsafe { -LL | unsf(); -LL | unsf(); -LL ~ }} - | error: call to unsafe function is unsafe and requires unsafe block (error E0133) --> $DIR/wrapping-unsafe-block-sugg.rs:9:5 @@ -33,13 +26,6 @@ LL | let y = *x; | ^^ dereference of raw pointer | = note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior -help: consider wrapping the function body in an unsafe block - | -LL ~ pub unsafe fn bar(x: *const i32) -> i32 { unsafe { -LL | let y = *x; -LL | y + *x -LL ~ }} - | error: dereference of raw pointer is unsafe and requires unsafe block (error E0133) --> $DIR/wrapping-unsafe-block-sugg.rs:14:9 @@ -56,13 +42,6 @@ LL | let y = BAZ; | ^^^ use of mutable static | = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior -help: consider wrapping the function body in an unsafe block - | -LL ~ pub unsafe fn baz() -> i32 { unsafe { -LL | let y = BAZ; -LL | y + BAZ -LL ~ }} - | error: use of mutable static is unsafe and requires unsafe block (error E0133) --> $DIR/wrapping-unsafe-block-sugg.rs:20:9