You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
warning: call to unsafe function is unsafe and requires unsafe block (error E0133)
2
-
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:8:5
1
+
error: call to unsafe function is unsafe and requires unsafe block (error E0133)
2
+
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:18:5
3
3
|
4
4
LL | unsf();
5
5
| ^^^^^^ call to unsafe function
6
6
|
7
7
note: the lint level is defined here
8
8
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:2:9
9
9
|
10
-
LL | #![warn(unsafe_op_in_unsafe_fn)]
10
+
LL | #![deny(unsafe_op_in_unsafe_fn)]
11
11
| ^^^^^^^^^^^^^^^^^^^^^^
12
12
= note: consult the function's documentation for information on how to avoid undefined behavior
13
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:20: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:22: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: borrow of packed field is unsafe and requires unsafe block (error E0133)
31
+
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:24:5
32
+
|
33
+
LL | &PACKED.data;
34
+
| ^^^^^^^^^^^^ borrow of packed field
35
+
|
36
+
note: the lint level is defined here
37
+
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:4:9
38
+
|
39
+
LL | #![deny(safe_packed_borrows)]
40
+
| ^^^^^^^^^^^^^^^^^^^
41
+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
42
+
= note: for more information, see issue #46043 <https://github.com/rust-lang/rust/issues/46043>
43
+
= note: fields of packed structs might be misaligned: dereferencing a misaligned pointer or even just creating a misaligned reference is undefined behavior
44
+
45
+
error: call to unsafe function is unsafe and requires unsafe block (error E0133)
46
+
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:33:5
47
+
|
48
+
LL | unsf();
49
+
| ^^^^^^ call to unsafe function
50
+
|
51
+
note: the lint level is defined here
52
+
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:31:8
53
+
|
54
+
LL | #[deny(warnings)]
55
+
| ^^^^^^^^
56
+
= note: `#[deny(unsafe_op_in_unsafe_fn)]` implied by `#[deny(warnings)]`
57
+
= note: consult the function's documentation for information on how to avoid undefined behavior
58
+
59
+
error: dereference of raw pointer is unsafe and requires unsafe block (error E0133)
60
+
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:35:5
61
+
|
62
+
LL | *PTR;
63
+
| ^^^^ dereference of raw pointer
64
+
|
65
+
= note: raw pointers may be NULL, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior
66
+
67
+
error: use of mutable static is unsafe and requires unsafe block (error E0133)
68
+
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:37:5
69
+
|
70
+
LL | VOID = ();
71
+
| ^^^^^^^^^ use of mutable static
72
+
|
73
+
= note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior
74
+
75
+
error: borrow of packed field is unsafe and requires unsafe block (error E0133)
76
+
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:39:5
77
+
|
78
+
LL | &PACKED.data;
79
+
| ^^^^^^^^^^^^ borrow of packed field
80
+
|
81
+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
82
+
= note: for more information, see issue #46043 <https://github.com/rust-lang/rust/issues/46043>
83
+
= note: fields of packed structs might be misaligned: dereferencing a misaligned pointer or even just creating a misaligned reference is undefined behavior
84
+
14
85
error: unnecessary `unsafe` block
15
-
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:17:14
86
+
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:55:14
16
87
|
17
88
LL | unsafe { unsafe { unsf() } }
18
89
| ------ ^^^^^^ unnecessary `unsafe` block
@@ -25,20 +96,49 @@ note: the lint level is defined here
25
96
LL | #![deny(unused_unsafe)]
26
97
| ^^^^^^^^^^^^^
27
98
99
+
warning: borrow of packed field is unsafe and requires unsafe block (error E0133)
100
+
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:61:5
101
+
|
102
+
LL | &PACKED.data;
103
+
| ^^^^^^^^^^^^ borrow of packed field
104
+
|
105
+
note: the lint level is defined here
106
+
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:59:8
107
+
|
108
+
LL | #[warn(safe_packed_borrows)]
109
+
| ^^^^^^^^^^^^^^^^^^^
110
+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
111
+
= note: for more information, see issue #46043 <https://github.com/rust-lang/rust/issues/46043>
112
+
= note: fields of packed structs might be misaligned: dereferencing a misaligned pointer or even just creating a misaligned reference is undefined behavior
113
+
28
114
error: unnecessary `unsafe` block
29
-
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:25:5
115
+
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:79:5
30
116
|
31
117
LL | unsafe { unsf() }
32
118
| ^^^^^^ unnecessary `unsafe` block
33
119
34
-
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
35
-
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:30:5
120
+
error: unnecessary `unsafe` block
121
+
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:92:9
36
122
|
37
-
LL | unsf()
123
+
LL | unsafe { unsf() }
124
+
| ^^^^^^ unnecessary `unsafe` block
125
+
126
+
error[E0133]: call to unsafe function is unsafe and requires unsafe block
127
+
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:98:5
128
+
|
129
+
LL | unsf();
38
130
| ^^^^^^ call to unsafe function
39
131
|
40
132
= note: consult the function's documentation for information on how to avoid undefined behavior
41
133
42
-
error: aborting due to 3 previous errors; 1 warning emitted
134
+
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
135
+
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:102:9
136
+
|
137
+
LL | unsf();
138
+
| ^^^^^^ call to unsafe function
139
+
|
140
+
= note: consult the function's documentation for information on how to avoid undefined behavior
141
+
142
+
error: aborting due to 13 previous errors; 1 warning emitted
43
143
44
144
For more information about this error, try `rustc --explain E0133`.
0 commit comments