-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add MVP suggestion for
unsafe_op_in_unsafe_fn
- Loading branch information
1 parent
e5a7d8f
commit 1f75da0
Showing
5 changed files
with
100 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// run-rustfix | ||
|
||
#![deny(unsafe_op_in_unsafe_fn)] | ||
|
||
unsafe fn unsf() {} | ||
|
||
pub unsafe fn foo() { unsafe { | ||
unsf(); //~ ERROR call to unsafe function is unsafe | ||
unsf(); //~ ERROR call to unsafe function is unsafe | ||
}} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// run-rustfix | ||
|
||
#![deny(unsafe_op_in_unsafe_fn)] | ||
|
||
unsafe fn unsf() {} | ||
|
||
pub unsafe fn foo() { | ||
unsf(); //~ ERROR call to unsafe function is unsafe | ||
unsf(); //~ ERROR call to unsafe function is unsafe | ||
} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
error: call to unsafe function is unsafe and requires unsafe block (error E0133) | ||
--> $DIR/wrapping-unsafe-block-sugg.rs:8:5 | ||
| | ||
LL | unsf(); | ||
| ^^^^^^ call to unsafe function | ||
| | ||
note: the lint level is defined here | ||
--> $DIR/wrapping-unsafe-block-sugg.rs:3:9 | ||
| | ||
LL | #![deny(unsafe_op_in_unsafe_fn)] | ||
| ^^^^^^^^^^^^^^^^^^^^^^ | ||
= note: consult the function's documentation for information on how to avoid undefined behavior | ||
help: consider wrapping the function 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 | ||
| | ||
LL | unsf(); | ||
| ^^^^^^ call to unsafe function | ||
| | ||
= note: consult the function's documentation for information on how to avoid undefined behavior | ||
|
||
error: aborting due to 2 previous errors | ||
|