Hide suggestion to wrap function in unsafe block

This commit is contained in:
Wim Looman 2023-05-27 22:19:09 +02:00
parent aca61b2c07
commit 62a712a8bb
No known key found for this signature in database
GPG Key ID: C6F5748C6DD1607B
3 changed files with 1 additions and 38 deletions

View File

@ -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,

View File

@ -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

View File

@ -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