Skip to content

Commit 8a515aa

Browse files
committed
Only enable ConstProp at mir-opt-level >= 2.
1 parent 3312a30 commit 8a515aa

File tree

8 files changed

+1
-49
lines changed

8 files changed

+1
-49
lines changed

compiler/rustc_mir_transform/src/const_prop.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ pub struct ConstProp;
5454

5555
impl<'tcx> MirPass<'tcx> for ConstProp {
5656
fn is_enabled(&self, sess: &rustc_session::Session) -> bool {
57-
sess.mir_opt_level() >= 1
57+
sess.mir_opt_level() >= 2
5858
}
5959

6060
#[instrument(skip(self, tcx), level = "debug")]

tests/ui/associated-consts/defaults-not-assumed-fail.stderr

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,6 @@ LL | assert_eq!(<() as Tr>::B, 0); // causes the error above
2626
|
2727
= note: this note originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)
2828

29-
note: erroneous constant used
30-
--> $DIR/defaults-not-assumed-fail.rs:33:5
31-
|
32-
LL | assert_eq!(<() as Tr>::B, 0); // causes the error above
33-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
34-
|
35-
= note: this note originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)
36-
3729
error: aborting due to previous error
3830

3931
For more information about this error, try `rustc --explain E0080`.

tests/ui/consts/const-err-late.stderr

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,6 @@ note: erroneous constant used
2828
LL | black_box((S::<i32>::FOO, S::<u32>::FOO));
2929
| ^^^^^^^^^^^^^
3030

31-
note: erroneous constant used
32-
--> $DIR/const-err-late.rs:19:16
33-
|
34-
LL | black_box((S::<i32>::FOO, S::<u32>::FOO));
35-
| ^^^^^^^^^^^^^
36-
3731
error: aborting due to 2 previous errors
3832

3933
For more information about this error, try `rustc --explain E0080`.

tests/ui/consts/const-eval/issue-44578.stderr

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,6 @@ LL | println!("{}", <Bar<u16, u8> as Foo>::AMT);
2626
|
2727
= note: this note originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
2828

29-
note: erroneous constant used
30-
--> $DIR/issue-44578.rs:25:20
31-
|
32-
LL | println!("{}", <Bar<u16, u8> as Foo>::AMT);
33-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
34-
|
35-
= note: this note originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
36-
3729
error: aborting due to previous error
3830

3931
For more information about this error, try `rustc --explain E0080`.

tests/ui/consts/miri_unleashed/assoc_const.stderr

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,6 @@ note: erroneous constant used
2525
LL | let y = <String as Bar<Vec<u32>, String>>::F;
2626
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2727

28-
note: erroneous constant used
29-
--> $DIR/assoc_const.rs:29:13
30-
|
31-
LL | let y = <String as Bar<Vec<u32>, String>>::F;
32-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
33-
3428
warning: skipping const checks
3529
|
3630
help: skipping check that does not even have a feature gate

tests/ui/consts/miri_unleashed/assoc_const_2.stderr

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,6 @@ note: erroneous constant used
1616
LL | let y = <String as Bar<String>>::F;
1717
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
1818

19-
note: erroneous constant used
20-
--> $DIR/assoc_const_2.rs:27:13
21-
|
22-
LL | let y = <String as Bar<String>>::F;
23-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
24-
2519
error: aborting due to previous error
2620

2721
For more information about this error, try `rustc --explain E0080`.

tests/ui/consts/uninhabited-const-issue-61744.stderr

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -657,12 +657,6 @@ note: erroneous constant used
657657
LL | dbg!(i32::CONSTANT);
658658
| ^^^^^^^^^^^^^
659659

660-
note: erroneous constant used
661-
--> $DIR/uninhabited-const-issue-61744.rs:18:10
662-
|
663-
LL | dbg!(i32::CONSTANT);
664-
| ^^^^^^^^^^^^^
665-
666660
error: aborting due to previous error
667661

668662
For more information about this error, try `rustc --explain E0080`.

tests/ui/limits/issue-55878.stderr

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,6 @@ LL | println!("Size: {}", std::mem::size_of::<[u8; u64::MAX as usize]>());
2525
|
2626
= note: this note originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
2727

28-
note: erroneous constant used
29-
--> $DIR/issue-55878.rs:7:26
30-
|
31-
LL | println!("Size: {}", std::mem::size_of::<[u8; u64::MAX as usize]>());
32-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
33-
|
34-
= note: this note originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
35-
3628
error: aborting due to previous error
3729

3830
For more information about this error, try `rustc --explain E0080`.

0 commit comments

Comments
 (0)