blob: 21c5b2b0dfe8fc3efd8fa536210166fbd159643d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
warning: integer-to-pointer cast
--> tests/pass/ptr_int_casts.rs:LL:CC
|
LL | assert_eq!(1 as *const i32 as usize, 1);
| ^^^^^^^^^^^^^^^ integer-to-pointer cast
|
= help: this program is using integer-to-pointer casts or (equivalently) `ptr::with_exposed_provenance`, which means that Miri might miss pointer bugs in this program
= help: see https://doc.rust-lang.org/nightly/std/ptr/fn.with_exposed_provenance.html for more details on that operation
= help: to ensure that Miri does not miss bugs in your program, use Strict Provenance APIs (https://doc.rust-lang.org/nightly/std/ptr/index.html#strict-provenance, https://crates.io/crates/sptr) instead
= help: you can then set `MIRIFLAGS=-Zmiri-strict-provenance` to ensure you are not relying on `with_exposed_provenance` semantics
= help: Tree Borrows does not support integer-to-pointer casts, so the program is likely to go wrong when this pointer gets used
= note: BACKTRACE:
= note: inside `ptr_int_casts` at tests/pass/ptr_int_casts.rs:LL:CC
note: inside `main`
--> tests/pass/ptr_int_casts.rs:LL:CC
|
LL | ptr_int_casts();
| ^^^^^^^^^^^^^^^
warning: integer-to-pointer cast
--> tests/pass/ptr_int_casts.rs:LL:CC
|
LL | assert_eq!((1 as *const i32).wrapping_offset(4) as usize, 1 + 4 * 4);
| ^^^^^^^^^^^^^^^^^ integer-to-pointer cast
|
= note: BACKTRACE:
= note: inside `ptr_int_casts` at tests/pass/ptr_int_casts.rs:LL:CC
note: inside `main`
--> tests/pass/ptr_int_casts.rs:LL:CC
|
LL | ptr_int_casts();
| ^^^^^^^^^^^^^^^
warning: integer-to-pointer cast
--> tests/pass/ptr_int_casts.rs:LL:CC
|
LL | *val = (1 as *const u8).wrapping_offset(-4);
| ^^^^^^^^^^^^^^^^ integer-to-pointer cast
|
= note: BACKTRACE:
= note: inside `ptr_int_casts` at tests/pass/ptr_int_casts.rs:LL:CC
note: inside `main`
--> tests/pass/ptr_int_casts.rs:LL:CC
|
LL | ptr_int_casts();
| ^^^^^^^^^^^^^^^
warning: integer-to-pointer cast
--> tests/pass/ptr_int_casts.rs:LL:CC
|
LL | let y = y as *const _;
| ^^^^^^^^^^^^^ integer-to-pointer cast
|
= note: BACKTRACE:
= note: inside `ptr_int_casts` at tests/pass/ptr_int_casts.rs:LL:CC
note: inside `main`
--> tests/pass/ptr_int_casts.rs:LL:CC
|
LL | ptr_int_casts();
| ^^^^^^^^^^^^^^^
warning: integer-to-pointer cast
--> tests/pass/ptr_int_casts.rs:LL:CC
|
LL | let x: fn() -> i32 = unsafe { mem::transmute(y as *mut u8) };
| ^^^^^^^^^^^^ integer-to-pointer cast
|
= note: BACKTRACE:
= note: inside `ptr_int_casts` at tests/pass/ptr_int_casts.rs:LL:CC
note: inside `main`
--> tests/pass/ptr_int_casts.rs:LL:CC
|
LL | ptr_int_casts();
| ^^^^^^^^^^^^^^^
warning: integer-to-pointer cast
--> tests/pass/ptr_int_casts.rs:LL:CC
|
LL | assert_eq!((-1i32) as usize as *const i32 as usize, (-1i32) as usize);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ integer-to-pointer cast
|
= note: BACKTRACE:
= note: inside `ptr_int_casts` at tests/pass/ptr_int_casts.rs:LL:CC
note: inside `main`
--> tests/pass/ptr_int_casts.rs:LL:CC
|
LL | ptr_int_casts();
| ^^^^^^^^^^^^^^^
|