Update and bless tests for const read out of bounds · rust-lang/rust@4aa1267 (original) (raw)
1
``
`-
error: any use of this value will cause an error
`
``
1
`+
error[E0080]: evaluation of constant value failed
`
2
2
` --> $SRC_DIR/core/src/intrinsics.rs:LL:COL
`
3
3
` |
`
4
4
`LL | unsafe { copy_nonoverlapping(src, dst, count) }
`
5
5
` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`
6
6
` | |
`
7
7
` | memory access failed: pointer must be in-bounds at offset 8, but is outside bounds of alloc6 which has size 4
`
8
8
`` | inside copy_nonoverlapping::<u32>
at $SRC_DIR/core/src/intrinsics.rs:LL:COL
``
9
``
`` -
| inside std::ptr::read::<u32>
at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
``
10
``
`` -
| inside _READ
at $DIR/out_of_bounds_read.rs:13:33
``
11
9
` |
`
12
``
`-
::: $DIR/out_of_bounds_read.rs:13:5
`
``
10
`+
::: $SRC_DIR/core/src/ptr/mod.rs:LL:COL
`
13
11
` |
`
14
``
`-
LL | const _READ: u32 = unsafe { ptr::read(PAST_END_PTR) };
`
15
``
`-
| ------------------------------------------------------
`
``
12
`+
LL | copy_nonoverlapping(src, tmp.as_mut_ptr(), 1);
`
``
13
`` +
| --------------------------------------------- inside std::ptr::read::<u32>
at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
``
``
14
`+
|
`
``
15
`+
::: $DIR/out_of_bounds_read.rs:13:33
`
16
16
` |
`
17
``
`` -
= note: #[deny(const_err)]
on by default
``
18
``
`-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
`
19
``
`-
= note: for more information, see issue #71800 https://github.com/rust-lang/rust/issues/71800
`
``
17
`+
LL | const _READ: u32 = unsafe { ptr::read(PAST_END_PTR) };
`
``
18
`` +
| ----------------------- inside _READ
at $DIR/out_of_bounds_read.rs:13:33
``
20
19
``
21
``
`-
error: any use of this value will cause an error
`
``
20
`+
error[E0080]: evaluation of constant value failed
`
22
21
` --> $SRC_DIR/core/src/intrinsics.rs:LL:COL
`
23
22
` |
`
24
23
`LL | unsafe { copy_nonoverlapping(src, dst, count) }
`
25
24
` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`
26
25
` | |
`
27
26
` | memory access failed: pointer must be in-bounds at offset 8, but is outside bounds of alloc6 which has size 4
`
28
27
`` | inside copy_nonoverlapping::<u32>
at $SRC_DIR/core/src/intrinsics.rs:LL:COL
``
29
``
`` -
| inside std::ptr::read::<u32>
at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
``
30
``
`` -
| inside ptr::const_ptr::<impl *const u32>::read
at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
``
31
``
`` -
| inside _CONST_READ
at $DIR/out_of_bounds_read.rs:14:39
``
32
28
` |
`
33
``
`-
::: $DIR/out_of_bounds_read.rs:14:5
`
``
29
`+
::: $SRC_DIR/core/src/ptr/mod.rs:LL:COL
`
34
30
` |
`
35
``
`-
LL | const _CONST_READ: u32 = unsafe { PAST_END_PTR.read() };
`
36
``
`-
| --------------------------------------------------------
`
``
31
`+
LL | copy_nonoverlapping(src, tmp.as_mut_ptr(), 1);
`
``
32
`` +
| --------------------------------------------- inside std::ptr::read::<u32>
at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
``
``
33
`+
|
`
``
34
`+
::: $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
`
``
35
`+
|
`
``
36
`+
LL | unsafe { read(self) }
`
``
37
`` +
| ---------- inside ptr::const_ptr::<impl *const u32>::read
at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
``
``
38
`+
|
`
``
39
`+
::: $DIR/out_of_bounds_read.rs:14:39
`
37
40
` |
`
38
``
`-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
`
39
``
`-
= note: for more information, see issue #71800 https://github.com/rust-lang/rust/issues/71800
`
``
41
`+
LL | const _CONST_READ: u32 = unsafe { PAST_END_PTR.read() };
`
``
42
`` +
| ------------------- inside _CONST_READ
at $DIR/out_of_bounds_read.rs:14:39
``
40
43
``
41
``
`-
error: any use of this value will cause an error
`
``
44
`+
error[E0080]: evaluation of constant value failed
`
42
45
` --> $SRC_DIR/core/src/intrinsics.rs:LL:COL
`
43
46
` |
`
44
47
`LL | unsafe { copy_nonoverlapping(src, dst, count) }
`
45
48
` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`
46
49
` | |
`
47
50
` | memory access failed: pointer must be in-bounds at offset 8, but is outside bounds of alloc6 which has size 4
`
48
51
`` | inside copy_nonoverlapping::<u32>
at $SRC_DIR/core/src/intrinsics.rs:LL:COL
``
49
``
`` -
| inside std::ptr::read::<u32>
at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
``
50
``
`` -
| inside ptr::mut_ptr::<impl *mut u32>::read
at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
``
51
``
`` -
| inside _MUT_READ
at $DIR/out_of_bounds_read.rs:15:37
``
52
52
` |
`
53
``
`-
::: $DIR/out_of_bounds_read.rs:15:5
`
``
53
`+
::: $SRC_DIR/core/src/ptr/mod.rs:LL:COL
`
54
54
` |
`
55
``
`-
LL | const _MUT_READ: u32 = unsafe { (PAST_END_PTR as *mut u32).read() };
`
56
``
`-
| --------------------------------------------------------------------
`
``
55
`+
LL | copy_nonoverlapping(src, tmp.as_mut_ptr(), 1);
`
``
56
`` +
| --------------------------------------------- inside std::ptr::read::<u32>
at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
``
``
57
`+
|
`
``
58
`+
::: $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
`
57
59
` |
`
58
``
`-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
`
59
``
`-
= note: for more information, see issue #71800 https://github.com/rust-lang/rust/issues/71800
`
``
60
`+
LL | unsafe { read(self) }
`
``
61
`` +
| ---------- inside ptr::mut_ptr::<impl *mut u32>::read
at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
``
``
62
`+
|
`
``
63
`+
::: $DIR/out_of_bounds_read.rs:15:37
`
``
64
`+
|
`
``
65
`+
LL | const _MUT_READ: u32 = unsafe { (PAST_END_PTR as *mut u32).read() };
`
``
66
`` +
| --------------------------------- inside _MUT_READ
at $DIR/out_of_bounds_read.rs:15:37
``
60
67
``
61
68
`error: aborting due to 3 previous errors
`
62
69
``
``
70
`` +
For more information about this error, try rustc --explain E0080
.
``