Only enable ConstProp at mir-opt-level >= 2.
This commit is contained in:
parent
3312a3053b
commit
8a515aab76
8 changed files with 1 additions and 49 deletions
|
@ -54,7 +54,7 @@ pub struct ConstProp;
|
||||||
|
|
||||||
impl<'tcx> MirPass<'tcx> for ConstProp {
|
impl<'tcx> MirPass<'tcx> for ConstProp {
|
||||||
fn is_enabled(&self, sess: &rustc_session::Session) -> bool {
|
fn is_enabled(&self, sess: &rustc_session::Session) -> bool {
|
||||||
sess.mir_opt_level() >= 1
|
sess.mir_opt_level() >= 2
|
||||||
}
|
}
|
||||||
|
|
||||||
#[instrument(skip(self, tcx), level = "debug")]
|
#[instrument(skip(self, tcx), level = "debug")]
|
||||||
|
|
|
@ -26,14 +26,6 @@ LL | assert_eq!(<() as Tr>::B, 0); // causes the error above
|
||||||
|
|
|
|
||||||
= note: this note originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this note originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|
||||||
note: erroneous constant used
|
|
||||||
--> $DIR/defaults-not-assumed-fail.rs:33:5
|
|
||||||
|
|
|
||||||
LL | assert_eq!(<() as Tr>::B, 0); // causes the error above
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
|
||||||
= note: this note originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0080`.
|
For more information about this error, try `rustc --explain E0080`.
|
||||||
|
|
|
@ -28,12 +28,6 @@ note: erroneous constant used
|
||||||
LL | black_box((S::<i32>::FOO, S::<u32>::FOO));
|
LL | black_box((S::<i32>::FOO, S::<u32>::FOO));
|
||||||
| ^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^
|
||||||
|
|
||||||
note: erroneous constant used
|
|
||||||
--> $DIR/const-err-late.rs:19:16
|
|
||||||
|
|
|
||||||
LL | black_box((S::<i32>::FOO, S::<u32>::FOO));
|
|
||||||
| ^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0080`.
|
For more information about this error, try `rustc --explain E0080`.
|
||||||
|
|
|
@ -26,14 +26,6 @@ LL | println!("{}", <Bar<u16, u8> as Foo>::AMT);
|
||||||
|
|
|
|
||||||
= 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)
|
= 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)
|
||||||
|
|
||||||
note: erroneous constant used
|
|
||||||
--> $DIR/issue-44578.rs:25:20
|
|
||||||
|
|
|
||||||
LL | println!("{}", <Bar<u16, u8> as Foo>::AMT);
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
|
||||||
= 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)
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0080`.
|
For more information about this error, try `rustc --explain E0080`.
|
||||||
|
|
|
@ -25,12 +25,6 @@ note: erroneous constant used
|
||||||
LL | let y = <String as Bar<Vec<u32>, String>>::F;
|
LL | let y = <String as Bar<Vec<u32>, String>>::F;
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
note: erroneous constant used
|
|
||||||
--> $DIR/assoc_const.rs:29:13
|
|
||||||
|
|
|
||||||
LL | let y = <String as Bar<Vec<u32>, String>>::F;
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
warning: skipping const checks
|
warning: skipping const checks
|
||||||
|
|
|
|
||||||
help: skipping check that does not even have a feature gate
|
help: skipping check that does not even have a feature gate
|
||||||
|
|
|
@ -16,12 +16,6 @@ note: erroneous constant used
|
||||||
LL | let y = <String as Bar<String>>::F;
|
LL | let y = <String as Bar<String>>::F;
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
note: erroneous constant used
|
|
||||||
--> $DIR/assoc_const_2.rs:27:13
|
|
||||||
|
|
|
||||||
LL | let y = <String as Bar<String>>::F;
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0080`.
|
For more information about this error, try `rustc --explain E0080`.
|
||||||
|
|
|
@ -657,12 +657,6 @@ note: erroneous constant used
|
||||||
LL | dbg!(i32::CONSTANT);
|
LL | dbg!(i32::CONSTANT);
|
||||||
| ^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^
|
||||||
|
|
||||||
note: erroneous constant used
|
|
||||||
--> $DIR/uninhabited-const-issue-61744.rs:18:10
|
|
||||||
|
|
|
||||||
LL | dbg!(i32::CONSTANT);
|
|
||||||
| ^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0080`.
|
For more information about this error, try `rustc --explain E0080`.
|
||||||
|
|
|
@ -25,14 +25,6 @@ LL | println!("Size: {}", std::mem::size_of::<[u8; u64::MAX as usize]>());
|
||||||
|
|
|
|
||||||
= 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)
|
= 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)
|
||||||
|
|
||||||
note: erroneous constant used
|
|
||||||
--> $DIR/issue-55878.rs:7:26
|
|
||||||
|
|
|
||||||
LL | println!("Size: {}", std::mem::size_of::<[u8; u64::MAX as usize]>());
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
|
||||||
= 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)
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0080`.
|
For more information about this error, try `rustc --explain E0080`.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue