diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5410613548c05..ce841cdbad78b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,6 +46,9 @@ jobs: - name: x86_64-gnu-llvm-12 os: ubuntu-20.04-xl env: {} + - name: dist-i586-gnu-i586-i686-musl + os: ubuntu-20.04-xl + env: {} - name: x86_64-gnu-tools env: CI_ONLY_WHEN_SUBMODULES_CHANGED: 1 diff --git a/compiler/rustc_mir_transform/src/const_prop.rs b/compiler/rustc_mir_transform/src/const_prop.rs index 85ad6b8f2feff..d3f9c5493aace 100644 --- a/compiler/rustc_mir_transform/src/const_prop.rs +++ b/compiler/rustc_mir_transform/src/const_prop.rs @@ -468,11 +468,6 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> { /// Returns the value, if any, of evaluating `c`. fn eval_constant(&mut self, c: &Constant<'tcx>) -> Option> { - // FIXME we need to revisit this for #67176 - if c.needs_subst() { - return None; - } - self.ecx.mir_const_to_op(&c.literal, None).ok() } diff --git a/compiler/rustc_mir_transform/src/const_prop_lint.rs b/compiler/rustc_mir_transform/src/const_prop_lint.rs index 3ae6a88a140ea..ecc437dd67059 100644 --- a/compiler/rustc_mir_transform/src/const_prop_lint.rs +++ b/compiler/rustc_mir_transform/src/const_prop_lint.rs @@ -514,11 +514,6 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> { | Rvalue::NullaryOp(..) => {} } - // FIXME we need to revisit this for #67176 - if rvalue.needs_subst() { - return None; - } - self.use_ecx(source_info, |this| this.ecx.eval_rvalue_into_place(rvalue, place)) } } diff --git a/src/ci/github-actions/ci.yml b/src/ci/github-actions/ci.yml index 3ad4e3f97a3bc..9d2f0d60c6c6b 100644 --- a/src/ci/github-actions/ci.yml +++ b/src/ci/github-actions/ci.yml @@ -286,7 +286,10 @@ jobs: - name: x86_64-gnu-llvm-12 <<: *job-linux-xl - + + - name: dist-i586-gnu-i586-i686-musl + <<: *job-linux-xl + - name: x86_64-gnu-tools env: CI_ONLY_WHEN_SUBMODULES_CHANGED: 1 diff --git a/src/test/ui/consts/const-eval/erroneous-const.rs b/src/test/ui/consts/const-eval/erroneous-const.rs index bee5a7cb3ba72..65bfe7cc0eca5 100644 --- a/src/test/ui/consts/const-eval/erroneous-const.rs +++ b/src/test/ui/consts/const-eval/erroneous-const.rs @@ -6,6 +6,8 @@ impl PrintName { const VOID: () = [()][2]; //~WARN any use of this value will cause an error //~^ WARN this operation will panic at runtime //~| WARN this was previously accepted by the compiler but is being phased out + //~| WARN this was previously accepted by the compiler but is being phased out + //~| WARN any use of this value will cause an error } const fn no_codegen() { diff --git a/src/test/ui/consts/const-eval/erroneous-const.stderr b/src/test/ui/consts/const-eval/erroneous-const.stderr index adfb4cc61cc62..e9539507fb5a2 100644 --- a/src/test/ui/consts/const-eval/erroneous-const.stderr +++ b/src/test/ui/consts/const-eval/erroneous-const.stderr @@ -24,19 +24,28 @@ LL | #![warn(const_err, unconditional_panic)] = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 +warning: any use of this value will cause an error + --> $DIR/erroneous-const.rs:6:22 + | +LL | const VOID: () = [()][2]; + | -------------- ^^^^^^^ index out of bounds: the length is 1 but the index is 2 + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + error[E0080]: could not evaluate static initializer - --> $DIR/erroneous-const.rs:15:17 + --> $DIR/erroneous-const.rs:17:17 | LL | let _ = PrintName::::VOID; | ^^^^^^^^^^^^^^^^^^^^ | | | referenced constant has errors - | inside `no_codegen::` at $DIR/erroneous-const.rs:15:17 + | inside `no_codegen::` at $DIR/erroneous-const.rs:17:17 ... LL | pub static FOO: () = no_codegen::(); - | ------------------- inside `FOO` at $DIR/erroneous-const.rs:19:22 + | ------------------- inside `FOO` at $DIR/erroneous-const.rs:21:22 -error: aborting due to previous error; 2 warnings emitted +error: aborting due to previous error; 3 warnings emitted For more information about this error, try `rustc --explain E0080`. Future incompatibility report: Future breakage diagnostic: @@ -54,3 +63,18 @@ LL | #![warn(const_err, unconditional_panic)] = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 +Future breakage diagnostic: +warning: any use of this value will cause an error + --> $DIR/erroneous-const.rs:6:22 + | +LL | const VOID: () = [()][2]; + | -------------- ^^^^^^^ index out of bounds: the length is 1 but the index is 2 + | +note: the lint level is defined here + --> $DIR/erroneous-const.rs:2:9 + | +LL | #![warn(const_err, unconditional_panic)] + | ^^^^^^^^^ + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + diff --git a/src/test/ui/consts/const-eval/issue-50814.rs b/src/test/ui/consts/const-eval/issue-50814.rs index 98229f919dd13..5554d7dc3edce 100644 --- a/src/test/ui/consts/const-eval/issue-50814.rs +++ b/src/test/ui/consts/const-eval/issue-50814.rs @@ -14,12 +14,15 @@ struct Sum(A,B); impl Unsigned for Sum { const MAX: u8 = A::MAX + B::MAX; //~^ ERROR any use of this value will cause an error [const_err] + //~| ERROR any use of this value will cause an error + //~| WARN this was previously accepted by the compiler but is being phased out //~| WARN this was previously accepted by the compiler but is being phased out } fn foo(_: T) -> &'static u8 { &Sum::::MAX //~^ ERROR E0080 + //~| ERROR evaluation of `foo::` failed } fn main() { diff --git a/src/test/ui/consts/const-eval/issue-50814.stderr b/src/test/ui/consts/const-eval/issue-50814.stderr index 6ceef91a042aa..bd92bf484d8e5 100644 --- a/src/test/ui/consts/const-eval/issue-50814.stderr +++ b/src/test/ui/consts/const-eval/issue-50814.stderr @@ -8,19 +8,34 @@ LL | const MAX: u8 = A::MAX + B::MAX; = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 +error[E0080]: evaluation of `foo::` failed + --> $DIR/issue-50814.rs:23:6 + | +LL | &Sum::::MAX + | ^^^^^^^^^^^^^^^^^ referenced constant has errors + +error: any use of this value will cause an error + --> $DIR/issue-50814.rs:15:21 + | +LL | const MAX: u8 = A::MAX + B::MAX; + | ------------- ^^^^^^^^^^^^^^^ attempt to compute `u8::MAX + u8::MAX`, which would overflow + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + error[E0080]: evaluation of `foo::` failed - --> $DIR/issue-50814.rs:21:6 + --> $DIR/issue-50814.rs:23:6 | LL | &Sum::::MAX | ^^^^^^^^^^^^^^^^^ referenced constant has errors note: the above error was encountered while instantiating `fn foo::` - --> $DIR/issue-50814.rs:26:5 + --> $DIR/issue-50814.rs:29:5 | LL | foo(0); | ^^^^^^ -error: aborting due to 2 previous errors +error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0080`. Future incompatibility report: Future breakage diagnostic: @@ -34,3 +49,14 @@ LL | const MAX: u8 = A::MAX + B::MAX; = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 +Future breakage diagnostic: +error: any use of this value will cause an error + --> $DIR/issue-50814.rs:15:21 + | +LL | const MAX: u8 = A::MAX + B::MAX; + | ------------- ^^^^^^^^^^^^^^^ attempt to compute `u8::MAX + u8::MAX`, which would overflow + | + = note: `#[deny(const_err)]` on by default + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 +