|
1 | 1 | error: call to unsafe function is unsafe and requires unsafe block (error E0133)
|
2 |
| - --> $DIR/wrapping-unsafe-block-sugg.rs:8:5 |
| 2 | + --> $DIR/wrapping-unsafe-block-sugg.rs:9:5 |
3 | 3 | |
|
4 | 4 | LL | unsf();
|
5 | 5 | | ^^^^^^ call to unsafe function
|
6 | 6 | |
|
7 | 7 | = note: consult the function's documentation for information on how to avoid undefined behavior
|
| 8 | +note: an unsafe function restricts its caller, but its body is safe by default |
| 9 | + --> $DIR/wrapping-unsafe-block-sugg.rs:7:1 |
| 10 | + | |
| 11 | +LL | pub unsafe fn foo() { |
| 12 | + | ^^^^^^^^^^^^^^^^^^^ |
8 | 13 | note: the lint level is defined here
|
9 | 14 | --> $DIR/wrapping-unsafe-block-sugg.rs:3:9
|
10 | 15 | |
|
11 | 16 | LL | #![deny(unsafe_op_in_unsafe_fn)]
|
12 | 17 | | ^^^^^^^^^^^^^^^^^^^^^^
|
13 | 18 |
|
14 | 19 | error: call to unsafe function is unsafe and requires unsafe block (error E0133)
|
15 |
| - --> $DIR/wrapping-unsafe-block-sugg.rs:9:5 |
| 20 | + --> $DIR/wrapping-unsafe-block-sugg.rs:12:5 |
16 | 21 | |
|
17 | 22 | LL | unsf();
|
18 | 23 | | ^^^^^^ call to unsafe function
|
19 | 24 | |
|
20 | 25 | = note: consult the function's documentation for information on how to avoid undefined behavior
|
21 | 26 |
|
22 | 27 | error: dereference of raw pointer is unsafe and requires unsafe block (error E0133)
|
23 |
| - --> $DIR/wrapping-unsafe-block-sugg.rs:13:13 |
| 28 | + --> $DIR/wrapping-unsafe-block-sugg.rs:19:13 |
24 | 29 | |
|
25 | 30 | LL | let y = *x;
|
26 | 31 | | ^^ dereference of raw pointer
|
27 | 32 | |
|
28 | 33 | = note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior
|
| 34 | +note: an unsafe function restricts its caller, but its body is safe by default |
| 35 | + --> $DIR/wrapping-unsafe-block-sugg.rs:17:1 |
| 36 | + | |
| 37 | +LL | pub unsafe fn bar(x: *const i32) -> i32 { |
| 38 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
29 | 39 |
|
30 | 40 | error: dereference of raw pointer is unsafe and requires unsafe block (error E0133)
|
31 |
| - --> $DIR/wrapping-unsafe-block-sugg.rs:14:9 |
| 41 | + --> $DIR/wrapping-unsafe-block-sugg.rs:22:9 |
32 | 42 | |
|
33 | 43 | LL | y + *x
|
34 | 44 | | ^^ dereference of raw pointer
|
35 | 45 | |
|
36 | 46 | = note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior
|
37 | 47 |
|
38 | 48 | error: use of mutable static is unsafe and requires unsafe block (error E0133)
|
39 |
| - --> $DIR/wrapping-unsafe-block-sugg.rs:19:13 |
| 49 | + --> $DIR/wrapping-unsafe-block-sugg.rs:30:13 |
40 | 50 | |
|
41 | 51 | LL | let y = BAZ;
|
42 | 52 | | ^^^ use of mutable static
|
43 | 53 | |
|
44 | 54 | = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior
|
| 55 | +note: an unsafe function restricts its caller, but its body is safe by default |
| 56 | + --> $DIR/wrapping-unsafe-block-sugg.rs:28:1 |
| 57 | + | |
| 58 | +LL | pub unsafe fn baz() -> i32 { |
| 59 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ |
45 | 60 |
|
46 | 61 | error: use of mutable static is unsafe and requires unsafe block (error E0133)
|
47 |
| - --> $DIR/wrapping-unsafe-block-sugg.rs:20:9 |
| 62 | + --> $DIR/wrapping-unsafe-block-sugg.rs:33:9 |
48 | 63 | |
|
49 | 64 | LL | y + BAZ
|
50 | 65 | | ^^^ use of mutable static
|
|
0 commit comments