Skip to content

Commit d5ea294

Browse files
Test -Zthir-unsafeck for unused unsafe blocks
1 parent a95b342 commit d5ea294

6 files changed

+45
-5
lines changed

src/test/ui/issues/issue-48131.stderr renamed to src/test/ui/issues/issue-48131.mir.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
error: unnecessary `unsafe` block
2-
--> $DIR/issue-48131.rs:9:9
2+
--> $DIR/issue-48131.rs:12:9
33
|
44
LL | unsafe { /* unnecessary */ }
55
| ^^^^^^ unnecessary `unsafe` block
66
|
77
note: the lint level is defined here
8-
--> $DIR/issue-48131.rs:3:9
8+
--> $DIR/issue-48131.rs:6:9
99
|
1010
LL | #![deny(unused_unsafe)]
1111
| ^^^^^^^^^^^^^
1212

1313
error: unnecessary `unsafe` block
14-
--> $DIR/issue-48131.rs:20:13
14+
--> $DIR/issue-48131.rs:23:13
1515
|
1616
LL | unsafe { /* unnecessary */ }
1717
| ^^^^^^ unnecessary `unsafe` block

src/test/ui/issues/issue-48131.rs

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// revisions: mir thir
2+
// [thir]compile-flags: -Z thir-unsafeck
3+
14
// This note is annotated because the purpose of the test
25
// is to ensure that certain other notes are not generated.
36
#![deny(unused_unsafe)] //~ NOTE
+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
error: unnecessary `unsafe` block
2+
--> $DIR/issue-48131.rs:12:9
3+
|
4+
LL | unsafe { /* unnecessary */ }
5+
| ^^^^^^ unnecessary `unsafe` block
6+
|
7+
note: the lint level is defined here
8+
--> $DIR/issue-48131.rs:6:9
9+
|
10+
LL | #![deny(unused_unsafe)]
11+
| ^^^^^^^^^^^^^
12+
13+
error: unnecessary `unsafe` block
14+
--> $DIR/issue-48131.rs:23:13
15+
|
16+
LL | unsafe { /* unnecessary */ }
17+
| ^^^^^^ unnecessary `unsafe` block
18+
19+
error: aborting due to 2 previous errors
20+

src/test/ui/unsafe/unsafe-around-compiler-generated-unsafe.stderr renamed to src/test/ui/unsafe/unsafe-around-compiler-generated-unsafe.mir.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
error: unnecessary `unsafe` block
2-
--> $DIR/unsafe-around-compiler-generated-unsafe.rs:6:5
2+
--> $DIR/unsafe-around-compiler-generated-unsafe.rs:9:5
33
|
44
LL | unsafe { println!("foo"); }
55
| ^^^^^^ unnecessary `unsafe` block
66
|
77
note: the lint level is defined here
8-
--> $DIR/unsafe-around-compiler-generated-unsafe.rs:3:9
8+
--> $DIR/unsafe-around-compiler-generated-unsafe.rs:6:9
99
|
1010
LL | #![deny(unused_unsafe)]
1111
| ^^^^^^^^^^^^^

src/test/ui/unsafe/unsafe-around-compiler-generated-unsafe.rs

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
// issue #12418
22

3+
// revisions: mir thir
4+
// [thir]compile-flags: -Z thir-unsafeck
5+
36
#![deny(unused_unsafe)]
47

58
fn main() {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
error: unnecessary `unsafe` block
2+
--> $DIR/unsafe-around-compiler-generated-unsafe.rs:9:5
3+
|
4+
LL | unsafe { println!("foo"); }
5+
| ^^^^^^ unnecessary `unsafe` block
6+
|
7+
note: the lint level is defined here
8+
--> $DIR/unsafe-around-compiler-generated-unsafe.rs:6:9
9+
|
10+
LL | #![deny(unused_unsafe)]
11+
| ^^^^^^^^^^^^^
12+
13+
error: aborting due to previous error
14+

0 commit comments

Comments
 (0)