Skip to content

Commit a7fa264

Browse files
committed
Auto merge of rust-lang#74821 - oli-obk:const_eval_read_uninit_fast_path, r=wesleywiser
Check whether locals are too large instead of whether accesses into them are too large Essentially this stops const prop from attempting to optimize ```rust let mut x = [0_u8; 5000]; x[42] = 3; ``` I don't expect this to be a perf improvement without rust-lang#73656 (which is also where the lack of this PR will be a perf regression). r? @wesleywiser
2 parents a285b58 + 98f3c79 commit a7fa264

File tree

1 file changed

+1
-21
lines changed

1 file changed

+1
-21
lines changed

tests/ui/indexing_slicing_index.stderr

+1-21
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,3 @@
1-
error: this operation will panic at runtime
2-
--> $DIR/indexing_slicing_index.rs:11:5
3-
|
4-
LL | x[4]; // Ok, let rustc's `const_err` lint handle `usize` indexing on arrays.
5-
| ^^^^ index out of bounds: the len is 4 but the index is 4
6-
|
7-
= note: `#[deny(unconditional_panic)]` on by default
8-
9-
error: this operation will panic at runtime
10-
--> $DIR/indexing_slicing_index.rs:12:5
11-
|
12-
LL | x[1 << 3]; // Ok, let rustc's `const_err` lint handle `usize` indexing on arrays.
13-
| ^^^^^^^^^ index out of bounds: the len is 4 but the index is 8
14-
15-
error: this operation will panic at runtime
16-
--> $DIR/indexing_slicing_index.rs:27:5
17-
|
18-
LL | x[N]; // Ok, let rustc's `const_err` lint handle `usize` indexing on arrays.
19-
| ^^^^ index out of bounds: the len is 4 but the index is 15
20-
211
error: indexing may panic.
222
--> $DIR/indexing_slicing_index.rs:10:5
233
|
@@ -75,5 +55,5 @@ LL | v[M];
7555
|
7656
= help: Consider using `.get(n)` or `.get_mut(n)` instead
7757

78-
error: aborting due to 10 previous errors
58+
error: aborting due to 7 previous errors
7959

0 commit comments

Comments
 (0)