Fix unused_unsafe with compiler-generated unsafe
This commit is contained in:
parent
39260f6d49
commit
b07bb6d698
9 changed files with 43 additions and 25 deletions
|
|
@ -1,11 +1,11 @@
|
|||
error: unnecessary `unsafe` block
|
||||
--> $DIR/unsafe-around-compiler-generated-unsafe.rs:9:5
|
||||
--> $DIR/unsafe-around-compiler-generated-unsafe.rs:9:9
|
||||
|
|
||||
LL | unsafe { println!("foo"); }
|
||||
| ^^^^^^ unnecessary `unsafe` block
|
||||
LL | unsafe { async {}.await; }
|
||||
| ^^^^^^ unnecessary `unsafe` block
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/unsafe-around-compiler-generated-unsafe.rs:6:9
|
||||
--> $DIR/unsafe-around-compiler-generated-unsafe.rs:5:9
|
||||
|
|
||||
LL | #![deny(unused_unsafe)]
|
||||
| ^^^^^^^^^^^^^
|
||||
|
|
|
|||
|
|
@ -1,10 +1,11 @@
|
|||
// issue #12418
|
||||
|
||||
// edition:2018
|
||||
// revisions: mir thir
|
||||
// [thir]compile-flags: -Z thir-unsafeck
|
||||
|
||||
#![deny(unused_unsafe)]
|
||||
|
||||
fn main() {
|
||||
unsafe { println!("foo"); } //~ ERROR unnecessary `unsafe`
|
||||
let _ = async {
|
||||
unsafe { async {}.await; } //~ ERROR unnecessary `unsafe`
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
error: unnecessary `unsafe` block
|
||||
--> $DIR/unsafe-around-compiler-generated-unsafe.rs:9:5
|
||||
--> $DIR/unsafe-around-compiler-generated-unsafe.rs:9:9
|
||||
|
|
||||
LL | unsafe { println!("foo"); }
|
||||
| ^^^^^^ unnecessary `unsafe` block
|
||||
LL | unsafe { async {}.await; }
|
||||
| ^^^^^^ unnecessary `unsafe` block
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/unsafe-around-compiler-generated-unsafe.rs:6:9
|
||||
--> $DIR/unsafe-around-compiler-generated-unsafe.rs:5:9
|
||||
|
|
||||
LL | #![deny(unused_unsafe)]
|
||||
| ^^^^^^^^^^^^^
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue