Skip to content

Commit d2c2ba8

Browse files
Run THIR unsafeck on unsafe_op_in_unsafe_fn test
1 parent f837077 commit d2c2ba8

3 files changed

+141
-16
lines changed

src/test/ui/unsafe/rfc-2585-unsafe_op_in_unsafe_fn.stderr renamed to src/test/ui/unsafe/rfc-2585-unsafe_op_in_unsafe_fn.mir.stderr

+16-16
Original file line numberDiff line numberDiff line change
@@ -1,90 +1,90 @@
11
error: call to unsafe function is unsafe and requires unsafe block (error E0133)
2-
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:9:5
2+
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:12:5
33
|
44
LL | unsf();
55
| ^^^^^^ call to unsafe function
66
|
77
note: the lint level is defined here
8-
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:1:9
8+
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:4:9
99
|
1010
LL | #![deny(unsafe_op_in_unsafe_fn)]
1111
| ^^^^^^^^^^^^^^^^^^^^^^
1212
= note: consult the function's documentation for information on how to avoid undefined behavior
1313

1414
error: dereference of raw pointer is unsafe and requires unsafe block (error E0133)
15-
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:11:5
15+
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:14:5
1616
|
1717
LL | *PTR;
1818
| ^^^^ dereference of raw pointer
1919
|
2020
= note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior
2121

2222
error: use of mutable static is unsafe and requires unsafe block (error E0133)
23-
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:13:5
23+
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:16:5
2424
|
2525
LL | VOID = ();
2626
| ^^^^^^^^^ use of mutable static
2727
|
2828
= note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior
2929

3030
error: unnecessary `unsafe` block
31-
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:16:5
31+
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:19:5
3232
|
3333
LL | unsafe {}
3434
| ^^^^^^ unnecessary `unsafe` block
3535
|
3636
note: the lint level is defined here
37-
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:2:9
37+
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:5:9
3838
|
3939
LL | #![deny(unused_unsafe)]
4040
| ^^^^^^^^^^^^^
4141

4242
error: call to unsafe function is unsafe and requires unsafe block (error E0133)
43-
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:24:5
43+
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:27:5
4444
|
4545
LL | unsf();
4646
| ^^^^^^ call to unsafe function
4747
|
4848
note: the lint level is defined here
49-
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:22:8
49+
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:25:8
5050
|
5151
LL | #[deny(warnings)]
5252
| ^^^^^^^^
5353
= note: `#[deny(unsafe_op_in_unsafe_fn)]` implied by `#[deny(warnings)]`
5454
= note: consult the function's documentation for information on how to avoid undefined behavior
5555

5656
error: dereference of raw pointer is unsafe and requires unsafe block (error E0133)
57-
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:26:5
57+
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:29:5
5858
|
5959
LL | *PTR;
6060
| ^^^^ dereference of raw pointer
6161
|
6262
= note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior
6363

6464
error: use of mutable static is unsafe and requires unsafe block (error E0133)
65-
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:28:5
65+
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:31:5
6666
|
6767
LL | VOID = ();
6868
| ^^^^^^^^^ use of mutable static
6969
|
7070
= note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior
7171

7272
error: unnecessary `unsafe` block
73-
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:30:5
73+
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:33:5
7474
|
7575
LL | unsafe {}
7676
| ^^^^^^ unnecessary `unsafe` block
7777

7878
error: unnecessary `unsafe` block
79-
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:44:14
79+
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:47:14
8080
|
8181
LL | unsafe { unsafe { unsf() } }
8282
| ------ ^^^^^^ unnecessary `unsafe` block
8383
| |
8484
| because it's nested under this `unsafe` block
8585

8686
error: unnecessary `unsafe` block
87-
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:55:5
87+
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:58:5
8888
|
8989
LL | unsafe fn allow_level() {
9090
| ----------------------- because it's nested under this `unsafe` fn
@@ -93,7 +93,7 @@ LL | unsafe { unsf() }
9393
| ^^^^^^ unnecessary `unsafe` block
9494

9595
error: unnecessary `unsafe` block
96-
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:67:9
96+
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:70:9
9797
|
9898
LL | unsafe fn nested_allow_level() {
9999
| ------------------------------ because it's nested under this `unsafe` fn
@@ -102,15 +102,15 @@ LL | unsafe { unsf() }
102102
| ^^^^^^ unnecessary `unsafe` block
103103

104104
error[E0133]: call to unsafe function is unsafe and requires unsafe block
105-
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:73:5
105+
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:76:5
106106
|
107107
LL | unsf();
108108
| ^^^^^^ call to unsafe function
109109
|
110110
= note: consult the function's documentation for information on how to avoid undefined behavior
111111

112112
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
113-
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:77:9
113+
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:80:9
114114
|
115115
LL | unsf();
116116
| ^^^^^^ call to unsafe function

src/test/ui/unsafe/rfc-2585-unsafe_op_in_unsafe_fn.rs

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// revisions: mir thir
2+
// [thir]compile-flags: -Zthir-unsafeck
3+
14
#![deny(unsafe_op_in_unsafe_fn)]
25
#![deny(unused_unsafe)]
36

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
error: call to unsafe function is unsafe and requires unsafe block (error E0133)
2+
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:12:5
3+
|
4+
LL | unsf();
5+
| ^^^^^^ call to unsafe function
6+
|
7+
note: the lint level is defined here
8+
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:4:9
9+
|
10+
LL | #![deny(unsafe_op_in_unsafe_fn)]
11+
| ^^^^^^^^^^^^^^^^^^^^^^
12+
= note: consult the function's documentation for information on how to avoid undefined behavior
13+
14+
error: dereference of raw pointer is unsafe and requires unsafe block (error E0133)
15+
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:14:5
16+
|
17+
LL | *PTR;
18+
| ^^^^ dereference of raw pointer
19+
|
20+
= note: raw pointers may be NULL, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior
21+
22+
error: use of mutable static is unsafe and requires unsafe block (error E0133)
23+
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:16:5
24+
|
25+
LL | VOID = ();
26+
| ^^^^ use of mutable static
27+
|
28+
= note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior
29+
30+
error: unnecessary `unsafe` block
31+
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:19:5
32+
|
33+
LL | unsafe {}
34+
| ^^^^^^ unnecessary `unsafe` block
35+
|
36+
note: the lint level is defined here
37+
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:5:9
38+
|
39+
LL | #![deny(unused_unsafe)]
40+
| ^^^^^^^^^^^^^
41+
42+
error: call to unsafe function is unsafe and requires unsafe block (error E0133)
43+
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:27:5
44+
|
45+
LL | unsf();
46+
| ^^^^^^ call to unsafe function
47+
|
48+
note: the lint level is defined here
49+
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:25:8
50+
|
51+
LL | #[deny(warnings)]
52+
| ^^^^^^^^
53+
= note: `#[deny(unsafe_op_in_unsafe_fn)]` implied by `#[deny(warnings)]`
54+
= note: consult the function's documentation for information on how to avoid undefined behavior
55+
56+
error: dereference of raw pointer is unsafe and requires unsafe block (error E0133)
57+
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:29:5
58+
|
59+
LL | *PTR;
60+
| ^^^^ dereference of raw pointer
61+
|
62+
= note: raw pointers may be NULL, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior
63+
64+
error: use of mutable static is unsafe and requires unsafe block (error E0133)
65+
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:31:5
66+
|
67+
LL | VOID = ();
68+
| ^^^^ use of mutable static
69+
|
70+
= note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior
71+
72+
error: unnecessary `unsafe` block
73+
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:33:5
74+
|
75+
LL | unsafe {}
76+
| ^^^^^^ unnecessary `unsafe` block
77+
78+
error: unnecessary `unsafe` block
79+
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:47:14
80+
|
81+
LL | unsafe { unsafe { unsf() } }
82+
| ------ ^^^^^^ unnecessary `unsafe` block
83+
| |
84+
| because it's nested under this `unsafe` block
85+
86+
error: unnecessary `unsafe` block
87+
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:58:5
88+
|
89+
LL | unsafe fn allow_level() {
90+
| ----------------------- because it's nested under this `unsafe` fn
91+
...
92+
LL | unsafe { unsf() }
93+
| ^^^^^^ unnecessary `unsafe` block
94+
95+
error: unnecessary `unsafe` block
96+
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:70:9
97+
|
98+
LL | unsafe fn nested_allow_level() {
99+
| ------------------------------ because it's nested under this `unsafe` fn
100+
...
101+
LL | unsafe { unsf() }
102+
| ^^^^^^ unnecessary `unsafe` block
103+
104+
error[E0133]: call to unsafe function is unsafe and requires unsafe block
105+
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:76:5
106+
|
107+
LL | unsf();
108+
| ^^^^^^ call to unsafe function
109+
|
110+
= note: consult the function's documentation for information on how to avoid undefined behavior
111+
112+
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
113+
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:80:9
114+
|
115+
LL | unsf();
116+
| ^^^^^^ call to unsafe function
117+
|
118+
= note: consult the function's documentation for information on how to avoid undefined behavior
119+
120+
error: aborting due to 13 previous errors
121+
122+
For more information about this error, try `rustc --explain E0133`.

0 commit comments

Comments
 (0)