]> git.lizzy.rs Git - rust.git/commitdiff
Address review comments
authorOliver Scherer <github35764891676564198441@oli-obk.de>
Mon, 7 Sep 2020 15:30:38 +0000 (17:30 +0200)
committerOliver Scherer <github35764891676564198441@oli-obk.de>
Sat, 19 Sep 2020 08:36:36 +0000 (10:36 +0200)
29 files changed:
compiler/rustc_middle/src/mir/interpret/error.rs
compiler/rustc_middle/src/mir/interpret/mod.rs
compiler/rustc_middle/src/mir/interpret/value.rs
compiler/rustc_middle/src/query/mod.rs
compiler/rustc_mir/src/const_eval/eval_queries.rs
compiler/rustc_mir/src/interpret/memory.rs
compiler/rustc_mir/src/interpret/place.rs
compiler/rustc_mir/src/interpret/validity.rs
src/test/ui/associated-const/defaults-cyclic-fail.stderr
src/test/ui/associated-consts/issue-24949-assoc-const-static-recursion-impl.stderr
src/test/ui/associated-consts/issue-24949-assoc-const-static-recursion-trait-default.stderr
src/test/ui/associated-consts/issue-24949-assoc-const-static-recursion-trait.stderr
src/test/ui/consts/const-eval/const-eval-query-stack.stderr
src/test/ui/consts/const-size_of-cycle.stderr
src/test/ui/consts/recursive-zst-static.default.stderr
src/test/ui/consts/recursive-zst-static.rs
src/test/ui/consts/recursive-zst-static.unleash.stderr
src/test/ui/infinite/infinite-recursion-const-fn.rs
src/test/ui/infinite/infinite-recursion-const-fn.stderr
src/test/ui/issues/issue-17252.stderr
src/test/ui/issues/issue-23302-1.stderr
src/test/ui/issues/issue-23302-2.stderr
src/test/ui/issues/issue-23302-3.stderr
src/test/ui/issues/issue-36163.stderr
src/test/ui/recursion/recursive-static-definition.rs
src/test/ui/recursion/recursive-static-definition.stderr
src/test/ui/type-alias-enum-variants/self-in-enum-definition.rs
src/test/ui/type-alias-enum-variants/self-in-enum-definition.stderr
src/test/ui/write-to-static-mut-in-static.stderr

index 62d02250fe0b1a5ba187684769484dd49ccb490a..13333dc45de0c4bbac2b16ce930c590095ee5644 100644 (file)
@@ -1,4 +1,4 @@
-use super::{AllocId, Pointer, RawConst, Scalar};
+use super::{AllocId, ConstAlloc, Pointer, Scalar};
 
 use crate::mir::interpret::ConstValue;
 use crate::ty::{layout, query::TyCtxtAt, tls, FnSig, Ty};
@@ -27,7 +27,7 @@ pub enum ErrorHandled {
     ErrorHandled,
 }
 
-pub type EvalToAllocationRawResult<'tcx> = Result<RawConst<'tcx>, ErrorHandled>;
+pub type EvalToAllocationRawResult<'tcx> = Result<ConstAlloc<'tcx>, ErrorHandled>;
 pub type EvalToConstValueResult<'tcx> = Result<ConstValue<'tcx>, ErrorHandled>;
 
 pub fn struct_error<'tcx>(tcx: TyCtxtAt<'tcx>, msg: &str) -> DiagnosticBuilder<'tcx> {
index 71a99cf95f819bdf4b73929691b1f2c730eea8d4..adf551ee43306f7f39ac856238c9b349b1dc0980 100644 (file)
@@ -123,7 +123,7 @@ macro_rules! throw_machine_stop {
     ResourceExhaustionInfo, UndefinedBehaviorInfo, UninitBytesAccess, UnsupportedOpInfo,
 };
 
-pub use self::value::{get_slice_bytes, ConstValue, RawConst, Scalar, ScalarMaybeUninit};
+pub use self::value::{get_slice_bytes, ConstAlloc, ConstValue, Scalar, ScalarMaybeUninit};
 
 pub use self::allocation::{Allocation, AllocationExtra, InitMask, Relocations};
 
index 930487153c327159ee95f305daf0c94723a9ddb4..ded1a9c62762b12782fc4449a728fee6c494b2ad 100644 (file)
@@ -14,7 +14,7 @@
 
 /// Represents the result of const evaluation via the `eval_to_allocation` query.
 #[derive(Clone, HashStable)]
-pub struct RawConst<'tcx> {
+pub struct ConstAlloc<'tcx> {
     // the value lives here, at offset 0, and that allocation definitely is a `AllocKind::Memory`
     // (so you can use `AllocMap::unwrap_memory`).
     pub alloc_id: AllocId,
index ece9dcf66a3215ac91d7537c1b6593bd76a90acf..dbc0e73968bc18f9088e7b51b9662bf74eeb786a 100644 (file)
@@ -713,7 +713,7 @@ fn describe_as_module(def_id: LocalDefId, tcx: TyCtxt<'_>) -> String {
         query eval_to_allocation_raw(key: ty::ParamEnvAnd<'tcx, GlobalId<'tcx>>)
             -> EvalToAllocationRawResult<'tcx> {
             desc { |tcx|
-                "const-evaluating `{}`",
+                "const-evaluating + checking `{}`",
                 key.value.display(tcx)
             }
         }
@@ -727,7 +727,7 @@ fn describe_as_module(def_id: LocalDefId, tcx: TyCtxt<'_>) -> String {
         query eval_to_const_value(key: ty::ParamEnvAnd<'tcx, GlobalId<'tcx>>)
             -> EvalToConstValueResult<'tcx> {
             desc { |tcx|
-                "const-evaluating + checking `{}`",
+                "simplifying constant for the type system `{}`",
                 key.value.display(tcx)
             }
             cache_on_disk_if(_, opt_result) {
index 7dae12cf411277d93e4b69a69bb6ccc3f5017d0e..00b675dbc4adf521e5f74ca38924a56946a5a511 100644 (file)
@@ -2,7 +2,7 @@
 use crate::interpret::eval_nullary_intrinsic;
 use crate::interpret::{
     intern_const_alloc_recursive, Allocation, ConstValue, GlobalId, Immediate, InternKind,
-    InterpCx, InterpResult, MPlaceTy, MemoryKind, OpTy, RawConst, RefTracking, Scalar,
+    InterpCx, InterpResult, MPlaceTy, MemoryKind, OpTy, ConstAlloc, RefTracking, Scalar,
     ScalarMaybeUninit, StackPopCleanup,
 };
 
@@ -184,9 +184,9 @@ pub(super) fn op_to_const<'tcx>(
     }
 }
 
-fn turn_into_const<'tcx>(
+fn turn_into_const_value<'tcx>(
     tcx: TyCtxt<'tcx>,
-    constant: RawConst<'tcx>,
+    constant: ConstAlloc<'tcx>,
     key: ty::ParamEnvAnd<'tcx, GlobalId<'tcx>>,
 ) -> ConstValue<'tcx> {
     let cid = key.value;
@@ -237,7 +237,7 @@ pub fn eval_to_const_value_provider<'tcx>(
         });
     }
 
-    tcx.eval_to_allocation_raw(key).map(|val| turn_into_const(tcx, val, key))
+    tcx.eval_to_allocation_raw(key).map(|val| turn_into_const_value(tcx, val, key))
 }
 
 pub fn eval_to_allocation_raw_provider<'tcx>(
@@ -402,7 +402,7 @@ pub fn eval_to_allocation_raw_provider<'tcx>(
                 ))
             } else {
                 // Convert to raw constant
-                Ok(RawConst { alloc_id: mplace.ptr.assert_ptr().alloc_id, ty: mplace.layout.ty })
+                Ok(ConstAlloc { alloc_id: mplace.ptr.assert_ptr().alloc_id, ty: mplace.layout.ty })
             }
         }
     }
index 64918a7685718f23fc3b36a14dab925c14dba9f5..86e242c67d520439172fba2032f913b4ef920fe5 100644 (file)
@@ -469,7 +469,7 @@ fn get_global_alloc(
                 // Notice that every static has two `AllocId` that will resolve to the same
                 // thing here: one maps to `GlobalAlloc::Static`, this is the "lazy" ID,
                 // and the other one is maps to `GlobalAlloc::Memory`, this is returned by
-                // `const_eval` and it is the "resolved" ID.
+                // `eval_static_initializer` and it is the "resolved" ID.
                 // The resolved ID is never used by the interpreted program, it is hidden.
                 // This is relied upon for soundness of const-patterns; a pointer to the resolved
                 // ID would "sidestep" the checks that make sure consts do not point to statics!
index 9e16063bd21af2a0ca6bd656d273404914e58e7f..055141a3de63d50bbe751c9834727ce751767b5f 100644 (file)
@@ -13,9 +13,9 @@
 use rustc_target::abi::{HasDataLayout, LayoutOf, Size, VariantIdx, Variants};
 
 use super::{
-    mir_assign_valid_types, truncate, AllocId, AllocMap, Allocation, AllocationExtra, ImmTy,
-    Immediate, InterpCx, InterpResult, LocalValue, Machine, MemoryKind, OpTy, Operand, Pointer,
-    PointerArithmetic, RawConst, Scalar, ScalarMaybeUninit,
+    mir_assign_valid_types, truncate, AllocId, AllocMap, Allocation, AllocationExtra, ConstAlloc,
+    ImmTy, Immediate, InterpCx, InterpResult, LocalValue, Machine, MemoryKind, OpTy, Operand,
+    Pointer, PointerArithmetic, Scalar, ScalarMaybeUninit,
 };
 
 #[derive(Copy, Clone, Debug, Hash, PartialEq, Eq, HashStable)]
@@ -1122,7 +1122,7 @@ pub fn write_discriminant(
 
     pub fn raw_const_to_mplace(
         &self,
-        raw: RawConst<'tcx>,
+        raw: ConstAlloc<'tcx>,
     ) -> InterpResult<'tcx, MPlaceTy<'tcx, M::PointerTag>> {
         // This must be an allocation in `tcx`
         let _ = self.tcx.global_alloc(raw.alloc_id);
index 7d9507c08fa1849637ae0432415057bd400c9f98..2b83e1c8134efe75508140c3e04fa7f4e4002c13 100644 (file)
@@ -426,27 +426,27 @@ fn check_safe_pointer(
                 if let Some(GlobalAlloc::Static(did)) = alloc_kind {
                     assert!(!self.ecx.tcx.is_thread_local_static(did));
                     assert!(self.ecx.tcx.is_static(did));
-                    // See const_eval::machine::MemoryExtra::can_access_statics for why
-                    // this check is so important.
-                    // This check is reachable when the const just referenced the static,
-                    // but never read it (so we never entered `before_access_global`).
-                    // We also need to do it here instead of going on to avoid running
-                    // into the `before_access_global` check during validation.
-                    if !self.may_ref_to_static {
+                    if self.may_ref_to_static {
+                        // We skip checking other statics. These statics must be sound by
+                        // themselves, and the only way to get broken statics here is by using
+                        // unsafe code.
+                        // The reasons we don't check other statics is twofold. For one, in all
+                        // sound cases, the static was already validated on its own, and second, we
+                        // trigger cycle errors if we try to compute the value of the other static
+                        // and that static refers back to us.
+                        // We might miss const-invalid data,
+                        // but things are still sound otherwise (in particular re: consts
+                        // referring to statics).
+                        return Ok(());
+                    } else {
+                        // See const_eval::machine::MemoryExtra::can_access_statics for why
+                        // this check is so important.
+                        // This check is reachable when the const just referenced the static,
+                        // but never read it (so we never entered `before_access_global`).
                         throw_validation_failure!(self.path,
                             { "a {} pointing to a static variable", kind }
                         );
                     }
-                    // We skip checking other statics. These statics must be sound by themselves,
-                    // and the only way to get broken statics here is by using unsafe code.
-                    // The reasons we don't check other statics is twofold. For one, in all sound
-                    // cases, the static was already validated on its own, and second, we trigger
-                    // cycle errors if we try to compute the value of the other static and that
-                    // static refers back to us.
-                    // We might miss const-invalid data,
-                    // but things are still sound otherwise (in particular re: consts
-                    // referring to statics).
-                    return Ok(());
                 }
             }
             // Proceed recursively even for ZST, no reason to skip them!
index e6075f745776a5a6d663995af4ed8fbbc8ca9bbb..616ac9053fd539af2e3bdde5b3be319843a37a74 100644 (file)
@@ -1,38 +1,38 @@
 error[E0391]: cycle detected when normalizing `<() as Tr>::A`
    |
-note: ...which requires const-evaluating + checking `Tr::A`...
+note: ...which requires simplifying constant for the type system `Tr::A`...
   --> $DIR/defaults-cyclic-fail.rs:6:5
    |
 LL |     const A: u8 = Self::B;
    |     ^^^^^^^^^^^^^^^^^^^^^^
-note: ...which requires const-evaluating + checking `Tr::A`...
+note: ...which requires simplifying constant for the type system `Tr::A`...
   --> $DIR/defaults-cyclic-fail.rs:6:5
    |
 LL |     const A: u8 = Self::B;
    |     ^^^^^^^^^^^^^^^^^^^^^^
-note: ...which requires const-evaluating `Tr::A`...
+note: ...which requires const-evaluating + checking `Tr::A`...
   --> $DIR/defaults-cyclic-fail.rs:6:5
    |
 LL |     const A: u8 = Self::B;
    |     ^^^^^^^^^^^^^^^^^^^^^^
    = note: ...which requires normalizing `<() as Tr>::B`...
-note: ...which requires const-evaluating + checking `Tr::B`...
+note: ...which requires simplifying constant for the type system `Tr::B`...
   --> $DIR/defaults-cyclic-fail.rs:8:5
    |
 LL |     const B: u8 = Self::A;
    |     ^^^^^^^^^^^^^^^^^^^^^^
-note: ...which requires const-evaluating + checking `Tr::B`...
+note: ...which requires simplifying constant for the type system `Tr::B`...
   --> $DIR/defaults-cyclic-fail.rs:8:5
    |
 LL |     const B: u8 = Self::A;
    |     ^^^^^^^^^^^^^^^^^^^^^^
-note: ...which requires const-evaluating `Tr::B`...
+note: ...which requires const-evaluating + checking `Tr::B`...
   --> $DIR/defaults-cyclic-fail.rs:8:5
    |
 LL |     const B: u8 = Self::A;
    |     ^^^^^^^^^^^^^^^^^^^^^^
    = note: ...which again requires normalizing `<() as Tr>::A`, completing the cycle
-note: cycle used when const-evaluating `main::promoted[2]`
+note: cycle used when const-evaluating + checking `main::promoted[2]`
   --> $DIR/defaults-cyclic-fail.rs:14:1
    |
 LL | fn main() {
index 1b4326ea56aaaaa7baea21921be6166fcce37b9a..d9bb7386565fa83612499055fd0da8b1da85f88f 100644 (file)
@@ -1,31 +1,31 @@
-error[E0391]: cycle detected when const-evaluating + checking `IMPL_REF_BAR`
+error[E0391]: cycle detected when simplifying constant for the type system `IMPL_REF_BAR`
   --> $DIR/issue-24949-assoc-const-static-recursion-impl.rs:7:1
    |
 LL | const IMPL_REF_BAR: u32 = GlobalImplRef::BAR;
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
-note: ...which requires const-evaluating + checking `IMPL_REF_BAR`...
+note: ...which requires simplifying constant for the type system `IMPL_REF_BAR`...
   --> $DIR/issue-24949-assoc-const-static-recursion-impl.rs:7:1
    |
 LL | const IMPL_REF_BAR: u32 = GlobalImplRef::BAR;
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-note: ...which requires const-evaluating `IMPL_REF_BAR`...
+note: ...which requires const-evaluating + checking `IMPL_REF_BAR`...
   --> $DIR/issue-24949-assoc-const-static-recursion-impl.rs:7:1
    |
 LL | const IMPL_REF_BAR: u32 = GlobalImplRef::BAR;
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: ...which requires normalizing `<impl at $DIR/issue-24949-assoc-const-static-recursion-impl.rs:11:1: 13:2>::BAR`...
-note: ...which requires const-evaluating + checking `<impl at $DIR/issue-24949-assoc-const-static-recursion-impl.rs:11:1: 13:2>::BAR`...
+note: ...which requires simplifying constant for the type system `<impl at $DIR/issue-24949-assoc-const-static-recursion-impl.rs:11:1: 13:2>::BAR`...
   --> $DIR/issue-24949-assoc-const-static-recursion-impl.rs:12:5
    |
 LL |     const BAR: u32 = IMPL_REF_BAR;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-note: ...which requires const-evaluating + checking `<impl at $DIR/issue-24949-assoc-const-static-recursion-impl.rs:11:1: 13:2>::BAR`...
+note: ...which requires simplifying constant for the type system `<impl at $DIR/issue-24949-assoc-const-static-recursion-impl.rs:11:1: 13:2>::BAR`...
   --> $DIR/issue-24949-assoc-const-static-recursion-impl.rs:12:5
    |
 LL |     const BAR: u32 = IMPL_REF_BAR;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-note: ...which requires const-evaluating `<impl at $DIR/issue-24949-assoc-const-static-recursion-impl.rs:11:1: 13:2>::BAR`...
+note: ...which requires const-evaluating + checking `<impl at $DIR/issue-24949-assoc-const-static-recursion-impl.rs:11:1: 13:2>::BAR`...
   --> $DIR/issue-24949-assoc-const-static-recursion-impl.rs:12:5
    |
 LL |     const BAR: u32 = IMPL_REF_BAR;
@@ -36,7 +36,7 @@ note: ...which requires optimizing MIR for `<impl at $DIR/issue-24949-assoc-cons
 LL |     const BAR: u32 = IMPL_REF_BAR;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: ...which requires normalizing `IMPL_REF_BAR`...
-   = note: ...which again requires const-evaluating + checking `IMPL_REF_BAR`, completing the cycle
+   = note: ...which again requires simplifying constant for the type system `IMPL_REF_BAR`, completing the cycle
    = note: cycle used when running analysis passes on this crate
 
 error: aborting due to previous error
index 8efa56a9a2e63133c6fe770db3753a5e70e89dd5..d000d8ac097a486f99b580bfaff03ab7e7eeb0b2 100644 (file)
@@ -1,31 +1,31 @@
-error[E0391]: cycle detected when const-evaluating + checking `DEFAULT_REF_BAR`
+error[E0391]: cycle detected when simplifying constant for the type system `DEFAULT_REF_BAR`
   --> $DIR/issue-24949-assoc-const-static-recursion-trait-default.rs:11:1
    |
 LL | const DEFAULT_REF_BAR: u32 = <GlobalDefaultRef>::BAR;
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
-note: ...which requires const-evaluating + checking `DEFAULT_REF_BAR`...
+note: ...which requires simplifying constant for the type system `DEFAULT_REF_BAR`...
   --> $DIR/issue-24949-assoc-const-static-recursion-trait-default.rs:11:1
    |
 LL | const DEFAULT_REF_BAR: u32 = <GlobalDefaultRef>::BAR;
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-note: ...which requires const-evaluating `DEFAULT_REF_BAR`...
+note: ...which requires const-evaluating + checking `DEFAULT_REF_BAR`...
   --> $DIR/issue-24949-assoc-const-static-recursion-trait-default.rs:11:1
    |
 LL | const DEFAULT_REF_BAR: u32 = <GlobalDefaultRef>::BAR;
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: ...which requires normalizing `<GlobalDefaultRef as FooDefault>::BAR`...
-note: ...which requires const-evaluating + checking `FooDefault::BAR`...
+note: ...which requires simplifying constant for the type system `FooDefault::BAR`...
   --> $DIR/issue-24949-assoc-const-static-recursion-trait-default.rs:8:5
    |
 LL |     const BAR: u32 = DEFAULT_REF_BAR;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-note: ...which requires const-evaluating + checking `FooDefault::BAR`...
+note: ...which requires simplifying constant for the type system `FooDefault::BAR`...
   --> $DIR/issue-24949-assoc-const-static-recursion-trait-default.rs:8:5
    |
 LL |     const BAR: u32 = DEFAULT_REF_BAR;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-note: ...which requires const-evaluating `FooDefault::BAR`...
+note: ...which requires const-evaluating + checking `FooDefault::BAR`...
   --> $DIR/issue-24949-assoc-const-static-recursion-trait-default.rs:8:5
    |
 LL |     const BAR: u32 = DEFAULT_REF_BAR;
@@ -36,7 +36,7 @@ note: ...which requires optimizing MIR for `FooDefault::BAR`...
 LL |     const BAR: u32 = DEFAULT_REF_BAR;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: ...which requires normalizing `DEFAULT_REF_BAR`...
-   = note: ...which again requires const-evaluating + checking `DEFAULT_REF_BAR`, completing the cycle
+   = note: ...which again requires simplifying constant for the type system `DEFAULT_REF_BAR`, completing the cycle
    = note: cycle used when running analysis passes on this crate
 
 error: aborting due to previous error
index 78ce1a28a3fdcfb1c8f0a6dd641b9d13aa9153ae..62d2051b6c23aab13a3bb8bc697f136ebf86768f 100644 (file)
@@ -1,31 +1,31 @@
-error[E0391]: cycle detected when const-evaluating + checking `TRAIT_REF_BAR`
+error[E0391]: cycle detected when simplifying constant for the type system `TRAIT_REF_BAR`
   --> $DIR/issue-24949-assoc-const-static-recursion-trait.rs:7:1
    |
 LL | const TRAIT_REF_BAR: u32 = <GlobalTraitRef>::BAR;
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
-note: ...which requires const-evaluating + checking `TRAIT_REF_BAR`...
+note: ...which requires simplifying constant for the type system `TRAIT_REF_BAR`...
   --> $DIR/issue-24949-assoc-const-static-recursion-trait.rs:7:1
    |
 LL | const TRAIT_REF_BAR: u32 = <GlobalTraitRef>::BAR;
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-note: ...which requires const-evaluating `TRAIT_REF_BAR`...
+note: ...which requires const-evaluating + checking `TRAIT_REF_BAR`...
   --> $DIR/issue-24949-assoc-const-static-recursion-trait.rs:7:1
    |
 LL | const TRAIT_REF_BAR: u32 = <GlobalTraitRef>::BAR;
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: ...which requires normalizing `<GlobalTraitRef as Foo>::BAR`...
-note: ...which requires const-evaluating + checking `<impl at $DIR/issue-24949-assoc-const-static-recursion-trait.rs:11:1: 13:2>::BAR`...
+note: ...which requires simplifying constant for the type system `<impl at $DIR/issue-24949-assoc-const-static-recursion-trait.rs:11:1: 13:2>::BAR`...
   --> $DIR/issue-24949-assoc-const-static-recursion-trait.rs:12:5
    |
 LL |     const BAR: u32 = TRAIT_REF_BAR;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-note: ...which requires const-evaluating + checking `<impl at $DIR/issue-24949-assoc-const-static-recursion-trait.rs:11:1: 13:2>::BAR`...
+note: ...which requires simplifying constant for the type system `<impl at $DIR/issue-24949-assoc-const-static-recursion-trait.rs:11:1: 13:2>::BAR`...
   --> $DIR/issue-24949-assoc-const-static-recursion-trait.rs:12:5
    |
 LL |     const BAR: u32 = TRAIT_REF_BAR;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-note: ...which requires const-evaluating `<impl at $DIR/issue-24949-assoc-const-static-recursion-trait.rs:11:1: 13:2>::BAR`...
+note: ...which requires const-evaluating + checking `<impl at $DIR/issue-24949-assoc-const-static-recursion-trait.rs:11:1: 13:2>::BAR`...
   --> $DIR/issue-24949-assoc-const-static-recursion-trait.rs:12:5
    |
 LL |     const BAR: u32 = TRAIT_REF_BAR;
@@ -36,7 +36,7 @@ note: ...which requires optimizing MIR for `<impl at $DIR/issue-24949-assoc-cons
 LL |     const BAR: u32 = TRAIT_REF_BAR;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: ...which requires normalizing `TRAIT_REF_BAR`...
-   = note: ...which again requires const-evaluating + checking `TRAIT_REF_BAR`, completing the cycle
+   = note: ...which again requires simplifying constant for the type system `TRAIT_REF_BAR`, completing the cycle
    = note: cycle used when running analysis passes on this crate
 
 error: aborting due to previous error
index 672076f0affef8183dceeb9f8c5ad7ec47ac95a2..26d396a181983508f3de2769edd73f593f9f67a6 100644 (file)
@@ -9,9 +9,9 @@ LL |     let x: &'static i32 = &(1 / 0);
    = note: `#[deny(const_err)]` on by default
 
 query stack during panic:
-#0 [eval_to_allocation_raw] const-evaluating `main::promoted[1]`
-#1 [eval_to_const_value] const-evaluating + checking `main::promoted[1]`
-#2 [eval_to_const_value] const-evaluating + checking `main::promoted[1]`
+#0 [eval_to_allocation_raw] const-evaluating + checking `main::promoted[1]`
+#1 [eval_to_const_value] simplifying constant for the type system `main::promoted[1]`
+#2 [eval_to_const_value] simplifying constant for the type system `main::promoted[1]`
 #3 [normalize_generic_arg_after_erasing_regions] normalizing `main::promoted[1]`
 #4 [optimized_mir] optimizing MIR for `main`
 #5 [collect_and_partition_mono_items] collect_and_partition_mono_items
index f4bff31c995599eb76f5c8ae71652a114fbd4e1d..58d5e9ac58c2eab811a6bbd90df93994890a3ee1 100644 (file)
@@ -1,32 +1,32 @@
-error[E0391]: cycle detected when const-evaluating + checking `Foo::bytes::{{constant}}#0`
+error[E0391]: cycle detected when simplifying constant for the type system `Foo::bytes::{{constant}}#0`
   --> $DIR/const-size_of-cycle.rs:4:17
    |
 LL |     bytes: [u8; std::mem::size_of::<Foo>()]
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
-note: ...which requires const-evaluating + checking `Foo::bytes::{{constant}}#0`...
+note: ...which requires simplifying constant for the type system `Foo::bytes::{{constant}}#0`...
   --> $DIR/const-size_of-cycle.rs:4:17
    |
 LL |     bytes: [u8; std::mem::size_of::<Foo>()]
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
-note: ...which requires const-evaluating `Foo::bytes::{{constant}}#0`...
+note: ...which requires const-evaluating + checking `Foo::bytes::{{constant}}#0`...
   --> $DIR/const-size_of-cycle.rs:4:17
    |
 LL |     bytes: [u8; std::mem::size_of::<Foo>()]
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
-note: ...which requires const-evaluating `std::mem::size_of`...
+note: ...which requires const-evaluating + checking `std::mem::size_of`...
   --> $SRC_DIR/core/src/mem/mod.rs:LL:COL
    |
 LL | pub const fn size_of<T>() -> usize {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-note: ...which requires const-evaluating + checking `std::intrinsics::size_of`...
+note: ...which requires simplifying constant for the type system `std::intrinsics::size_of`...
   --> $SRC_DIR/core/src/intrinsics.rs:LL:COL
    |
 LL |     pub fn size_of<T>() -> usize;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: ...which requires computing layout of `Foo`...
    = note: ...which requires normalizing `[u8; _]`...
-   = note: ...which again requires const-evaluating + checking `Foo::bytes::{{constant}}#0`, completing the cycle
+   = note: ...which again requires simplifying constant for the type system `Foo::bytes::{{constant}}#0`, completing the cycle
 note: cycle used when checking that `Foo` is well-formed
   --> $DIR/const-size_of-cycle.rs:3:1
    |
index d58f044cf6d04513a27ce94c980a93cd6bc3e66f..03f8f5c5a0e5da7e5c6e37538fbf02d3b707e045 100644 (file)
@@ -1,15 +1,15 @@
-error[E0391]: cycle detected when const-evaluating `FOO`
+error[E0391]: cycle detected when const-evaluating + checking `FOO`
   --> $DIR/recursive-zst-static.rs:10:1
    |
 LL | static FOO: () = FOO;
    | ^^^^^^^^^^^^^^^^^^^^^
    |
-note: ...which requires const-evaluating `FOO`...
+note: ...which requires const-evaluating + checking `FOO`...
   --> $DIR/recursive-zst-static.rs:10:1
    |
 LL | static FOO: () = FOO;
    | ^^^^^^^^^^^^^^^^^^^^^
-   = note: ...which again requires const-evaluating `FOO`, completing the cycle
+   = note: ...which again requires const-evaluating + checking `FOO`, completing the cycle
    = note: cycle used when running analysis passes on this crate
 
 error: aborting due to previous error
index 29a467c006a492d6f16e3676672ce2452795ddbc..4e61634b349e0596baee98a5dc41e3f412d060b7 100644 (file)
@@ -7,7 +7,7 @@
 // can depend on this fact and will thus do unsound things when it is violated.
 // See https://github.com/rust-lang/rust/issues/71078 for more details.
 
-static FOO: () = FOO; //~ cycle detected when const-evaluating `FOO`
+static FOO: () = FOO; //~ cycle detected when const-evaluating + checking `FOO`
 
 fn main() {
     FOO
index d58f044cf6d04513a27ce94c980a93cd6bc3e66f..03f8f5c5a0e5da7e5c6e37538fbf02d3b707e045 100644 (file)
@@ -1,15 +1,15 @@
-error[E0391]: cycle detected when const-evaluating `FOO`
+error[E0391]: cycle detected when const-evaluating + checking `FOO`
   --> $DIR/recursive-zst-static.rs:10:1
    |
 LL | static FOO: () = FOO;
    | ^^^^^^^^^^^^^^^^^^^^^
    |
-note: ...which requires const-evaluating `FOO`...
+note: ...which requires const-evaluating + checking `FOO`...
   --> $DIR/recursive-zst-static.rs:10:1
    |
 LL | static FOO: () = FOO;
    | ^^^^^^^^^^^^^^^^^^^^^
-   = note: ...which again requires const-evaluating `FOO`, completing the cycle
+   = note: ...which again requires const-evaluating + checking `FOO`, completing the cycle
    = note: cycle used when running analysis passes on this crate
 
 error: aborting due to previous error
index 8289a3db6fc5b6ee56c940318a25bc2a859f3be1..34580407926f18cf12d650e378efd406b903b2d1 100644 (file)
@@ -1,7 +1,12 @@
 //https://github.com/rust-lang/rust/issues/31364
 
-const fn a() -> usize { b() } //~ ERROR cycle detected when const-evaluating `a` [E0391]
-const fn b() -> usize { a() }
+const fn a() -> usize {
+    //~^ ERROR cycle detected when const-evaluating + checking `a` [E0391]
+    b()
+}
+const fn b() -> usize {
+    a()
+}
 const ARR: [i32; a()] = [5; 6];
 
-fn main(){}
+fn main() {}
index de0c579f6308990f401fd99c5c1180267c993814..3c106895305dcc41f0ad28962979eed1fa33e4da 100644 (file)
@@ -1,17 +1,17 @@
-error[E0391]: cycle detected when const-evaluating `a`
+error[E0391]: cycle detected when const-evaluating + checking `a`
   --> $DIR/infinite-recursion-const-fn.rs:3:1
    |
-LL | const fn a() -> usize { b() }
+LL | const fn a() -> usize {
    | ^^^^^^^^^^^^^^^^^^^^^
    |
-note: ...which requires const-evaluating `b`...
-  --> $DIR/infinite-recursion-const-fn.rs:4:1
+note: ...which requires const-evaluating + checking `b`...
+  --> $DIR/infinite-recursion-const-fn.rs:7:1
    |
-LL | const fn b() -> usize { a() }
+LL | const fn b() -> usize {
    | ^^^^^^^^^^^^^^^^^^^^^
-   = note: ...which again requires const-evaluating `a`, completing the cycle
-note: cycle used when const-evaluating `ARR::{{constant}}#0`
-  --> $DIR/infinite-recursion-const-fn.rs:5:18
+   = note: ...which again requires const-evaluating + checking `a`, completing the cycle
+note: cycle used when const-evaluating + checking `ARR::{{constant}}#0`
+  --> $DIR/infinite-recursion-const-fn.rs:10:18
    |
 LL | const ARR: [i32; a()] = [5; 6];
    |                  ^^^
index ee621a8cb147309deb514880bb1cf5e3eb806b14..0a27848b801c9539bf859faf79b9751a5d3e7911 100644 (file)
@@ -1,22 +1,22 @@
 error[E0391]: cycle detected when normalizing `FOO`
    |
-note: ...which requires const-evaluating + checking `FOO`...
+note: ...which requires simplifying constant for the type system `FOO`...
   --> $DIR/issue-17252.rs:1:1
    |
 LL | const FOO: usize = FOO;
    | ^^^^^^^^^^^^^^^^^^^^^^^
-note: ...which requires const-evaluating + checking `FOO`...
+note: ...which requires simplifying constant for the type system `FOO`...
   --> $DIR/issue-17252.rs:1:1
    |
 LL | const FOO: usize = FOO;
    | ^^^^^^^^^^^^^^^^^^^^^^^
-note: ...which requires const-evaluating `FOO`...
+note: ...which requires const-evaluating + checking `FOO`...
   --> $DIR/issue-17252.rs:1:1
    |
 LL | const FOO: usize = FOO;
    | ^^^^^^^^^^^^^^^^^^^^^^^
    = note: ...which again requires normalizing `FOO`, completing the cycle
-note: cycle used when const-evaluating `main::{{constant}}#0`
+note: cycle used when const-evaluating + checking `main::{{constant}}#0`
   --> $DIR/issue-17252.rs:4:18
    |
 LL |     let _x: [u8; FOO]; // caused stack overflow prior to fix
index b6c85b9e22749c9053cb5000a4d34efcc0744174..45372c7f53bd4811dca45cc4fe2bb96b0e9d050d 100644 (file)
@@ -1,21 +1,21 @@
-error[E0391]: cycle detected when const-evaluating + checking `X::A::{{constant}}#0`
+error[E0391]: cycle detected when simplifying constant for the type system `X::A::{{constant}}#0`
   --> $DIR/issue-23302-1.rs:4:9
    |
 LL |     A = X::A as isize,
    |         ^^^^^^^^^^^^^
    |
-note: ...which requires const-evaluating + checking `X::A::{{constant}}#0`...
+note: ...which requires simplifying constant for the type system `X::A::{{constant}}#0`...
   --> $DIR/issue-23302-1.rs:4:9
    |
 LL |     A = X::A as isize,
    |         ^^^^^^^^^^^^^
-note: ...which requires const-evaluating `X::A::{{constant}}#0`...
+note: ...which requires const-evaluating + checking `X::A::{{constant}}#0`...
   --> $DIR/issue-23302-1.rs:4:9
    |
 LL |     A = X::A as isize,
    |         ^^^^^^^^^^^^^
    = note: ...which requires normalizing `X::A as isize`...
-   = note: ...which again requires const-evaluating + checking `X::A::{{constant}}#0`, completing the cycle
+   = note: ...which again requires simplifying constant for the type system `X::A::{{constant}}#0`, completing the cycle
 note: cycle used when collecting item types in top-level module
   --> $DIR/issue-23302-1.rs:3:1
    |
index d014922fe2069a5c5838c8e7f5578fdaab635d39..33bc1f6c48d5e5096549e4bb9ed857432ce2ac55 100644 (file)
@@ -1,21 +1,21 @@
-error[E0391]: cycle detected when const-evaluating + checking `Y::A::{{constant}}#0`
+error[E0391]: cycle detected when simplifying constant for the type system `Y::A::{{constant}}#0`
   --> $DIR/issue-23302-2.rs:4:9
    |
 LL |     A = Y::B as isize,
    |         ^^^^^^^^^^^^^
    |
-note: ...which requires const-evaluating + checking `Y::A::{{constant}}#0`...
+note: ...which requires simplifying constant for the type system `Y::A::{{constant}}#0`...
   --> $DIR/issue-23302-2.rs:4:9
    |
 LL |     A = Y::B as isize,
    |         ^^^^^^^^^^^^^
-note: ...which requires const-evaluating `Y::A::{{constant}}#0`...
+note: ...which requires const-evaluating + checking `Y::A::{{constant}}#0`...
   --> $DIR/issue-23302-2.rs:4:9
    |
 LL |     A = Y::B as isize,
    |         ^^^^^^^^^^^^^
    = note: ...which requires normalizing `Y::B as isize`...
-   = note: ...which again requires const-evaluating + checking `Y::A::{{constant}}#0`, completing the cycle
+   = note: ...which again requires simplifying constant for the type system `Y::A::{{constant}}#0`, completing the cycle
 note: cycle used when collecting item types in top-level module
   --> $DIR/issue-23302-2.rs:3:1
    |
index b30b1214271a06354e0900c238c621e744a244c0..5233b832ecc796f1bf351011b9e376e400d521f0 100644 (file)
@@ -1,37 +1,37 @@
-error[E0391]: cycle detected when const-evaluating + checking `A`
+error[E0391]: cycle detected when simplifying constant for the type system `A`
   --> $DIR/issue-23302-3.rs:1:1
    |
 LL | const A: i32 = B;
    | ^^^^^^^^^^^^^^^^^
    |
-note: ...which requires const-evaluating + checking `A`...
+note: ...which requires simplifying constant for the type system `A`...
   --> $DIR/issue-23302-3.rs:1:1
    |
 LL | const A: i32 = B;
    | ^^^^^^^^^^^^^^^^^
-note: ...which requires const-evaluating `A`...
+note: ...which requires const-evaluating + checking `A`...
   --> $DIR/issue-23302-3.rs:1:1
    |
 LL | const A: i32 = B;
    | ^^^^^^^^^^^^^^^^^
    = note: ...which requires normalizing `B`...
-note: ...which requires const-evaluating + checking `B`...
+note: ...which requires simplifying constant for the type system `B`...
   --> $DIR/issue-23302-3.rs:3:1
    |
 LL | const B: i32 = A;
    | ^^^^^^^^^^^^^^^^^
-note: ...which requires const-evaluating + checking `B`...
+note: ...which requires simplifying constant for the type system `B`...
   --> $DIR/issue-23302-3.rs:3:1
    |
 LL | const B: i32 = A;
    | ^^^^^^^^^^^^^^^^^
-note: ...which requires const-evaluating `B`...
+note: ...which requires const-evaluating + checking `B`...
   --> $DIR/issue-23302-3.rs:3:1
    |
 LL | const B: i32 = A;
    | ^^^^^^^^^^^^^^^^^
    = note: ...which requires normalizing `A`...
-   = note: ...which again requires const-evaluating + checking `A`, completing the cycle
+   = note: ...which again requires simplifying constant for the type system `A`, completing the cycle
    = note: cycle used when running analysis passes on this crate
 
 error: aborting due to previous error
index 7c2da9dce6e9da41cc45a1809c0d2efa07257910..3fd1f4b59beca79db78673b9c9ee1ecda4e0ad0b 100644 (file)
@@ -1,37 +1,37 @@
-error[E0391]: cycle detected when const-evaluating + checking `Foo::B::{{constant}}#0`
+error[E0391]: cycle detected when simplifying constant for the type system `Foo::B::{{constant}}#0`
   --> $DIR/issue-36163.rs:4:9
    |
 LL |     B = A,
    |         ^
    |
-note: ...which requires const-evaluating + checking `Foo::B::{{constant}}#0`...
+note: ...which requires simplifying constant for the type system `Foo::B::{{constant}}#0`...
   --> $DIR/issue-36163.rs:4:9
    |
 LL |     B = A,
    |         ^
-note: ...which requires const-evaluating `Foo::B::{{constant}}#0`...
+note: ...which requires const-evaluating + checking `Foo::B::{{constant}}#0`...
   --> $DIR/issue-36163.rs:4:9
    |
 LL |     B = A,
    |         ^
    = note: ...which requires normalizing `A`...
-note: ...which requires const-evaluating + checking `A`...
+note: ...which requires simplifying constant for the type system `A`...
   --> $DIR/issue-36163.rs:1:1
    |
 LL | const A: isize = Foo::B as isize;
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-note: ...which requires const-evaluating + checking `A`...
+note: ...which requires simplifying constant for the type system `A`...
   --> $DIR/issue-36163.rs:1:1
    |
 LL | const A: isize = Foo::B as isize;
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-note: ...which requires const-evaluating `A`...
+note: ...which requires const-evaluating + checking `A`...
   --> $DIR/issue-36163.rs:1:1
    |
 LL | const A: isize = Foo::B as isize;
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: ...which requires normalizing `A`...
-   = note: ...which again requires const-evaluating + checking `Foo::B::{{constant}}#0`, completing the cycle
+   = note: ...which again requires simplifying constant for the type system `Foo::B::{{constant}}#0`, completing the cycle
 note: cycle used when collecting item types in top-level module
   --> $DIR/issue-36163.rs:1:1
    |
index e816ce4e0c45261b562c7473ec99438dab05f8fb..f59ef7316d8905d4aaf1bc0287a45dd47929d12b 100644 (file)
@@ -1,4 +1,4 @@
 pub static FOO: u32 = FOO;
-//~^ ERROR cycle detected when const-evaluating `FOO`
+//~^ ERROR cycle detected when const-evaluating + checking `FOO`
 
 fn main() {}
index 97e42a1f126c96786f8c4ac75e35831ce27cb173..ee73b026a0b75b14d9a2356b2df2e3ac34cf7d30 100644 (file)
@@ -1,15 +1,15 @@
-error[E0391]: cycle detected when const-evaluating `FOO`
+error[E0391]: cycle detected when const-evaluating + checking `FOO`
   --> $DIR/recursive-static-definition.rs:1:1
    |
 LL | pub static FOO: u32 = FOO;
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
-note: ...which requires const-evaluating `FOO`...
+note: ...which requires const-evaluating + checking `FOO`...
   --> $DIR/recursive-static-definition.rs:1:1
    |
 LL | pub static FOO: u32 = FOO;
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^
-   = note: ...which again requires const-evaluating `FOO`, completing the cycle
+   = note: ...which again requires const-evaluating + checking `FOO`, completing the cycle
    = note: cycle used when running analysis passes on this crate
 
 error: aborting due to previous error
index 63b21faa62bd2ce0486cad546d4299ec5a6f6a88..8dadd77fc16d5d4bbd1bf7dcbd91306749132d62 100644 (file)
@@ -1,8 +1,8 @@
 #[repr(u8)]
 enum Alpha {
     V1 = 41,
-    V2 = Self::V1 as u8 + 1, // OK; See #50072.
-    V3 = Self::V1 {} as u8 + 2, //~ ERROR cycle detected when const-evaluating
+    V2 = Self::V1 as u8 + 1,    // OK; See #50072.
+    V3 = Self::V1 {} as u8 + 2, //~ ERROR cycle detected when simplifying constant
 }
 
 fn main() {}
index db535b53fcf3743aa727baca240afca29f822e5d..fbe6279ca92267a076c6bc2b82284957d99b2a35 100644 (file)
@@ -1,28 +1,28 @@
-error[E0391]: cycle detected when const-evaluating + checking `Alpha::V3::{{constant}}#0`
+error[E0391]: cycle detected when simplifying constant for the type system `Alpha::V3::{{constant}}#0`
   --> $DIR/self-in-enum-definition.rs:5:10
    |
 LL |     V3 = Self::V1 {} as u8 + 2,
    |          ^^^^^^^^
    |
-note: ...which requires const-evaluating + checking `Alpha::V3::{{constant}}#0`...
+note: ...which requires simplifying constant for the type system `Alpha::V3::{{constant}}#0`...
   --> $DIR/self-in-enum-definition.rs:5:10
    |
 LL |     V3 = Self::V1 {} as u8 + 2,
    |          ^^^^^^^^
-note: ...which requires const-evaluating `Alpha::V3::{{constant}}#0`...
+note: ...which requires const-evaluating + checking `Alpha::V3::{{constant}}#0`...
   --> $DIR/self-in-enum-definition.rs:5:10
    |
 LL |     V3 = Self::V1 {} as u8 + 2,
    |          ^^^^^^^^
    = note: ...which requires computing layout of `Alpha`...
-   = note: ...which again requires const-evaluating + checking `Alpha::V3::{{constant}}#0`, completing the cycle
+   = note: ...which again requires simplifying constant for the type system `Alpha::V3::{{constant}}#0`, completing the cycle
 note: cycle used when collecting item types in top-level module
   --> $DIR/self-in-enum-definition.rs:1:1
    |
 LL | / #[repr(u8)]
 LL | | enum Alpha {
 LL | |     V1 = 41,
-LL | |     V2 = Self::V1 as u8 + 1, // OK; See #50072.
+LL | |     V2 = Self::V1 as u8 + 1,    // OK; See #50072.
 ...  |
 LL | |
 LL | | fn main() {}
index 6f21539c119e0a66ce26a33a0bf646b76975d129..789919bd1668d2949ddf245708434ceebc20ecaa 100644 (file)
@@ -4,18 +4,18 @@ error[E0080]: could not evaluate static initializer
 LL | pub static mut B: () = unsafe { A = 1; };
    |                                 ^^^^^ modifying a static's initial value from another static's initializer
 
-error[E0391]: cycle detected when const-evaluating `C`
+error[E0391]: cycle detected when const-evaluating + checking `C`
   --> $DIR/write-to-static-mut-in-static.rs:5:1
    |
 LL | pub static mut C: u32 = unsafe { C = 1; 0 };
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
-note: ...which requires const-evaluating `C`...
+note: ...which requires const-evaluating + checking `C`...
   --> $DIR/write-to-static-mut-in-static.rs:5:1
    |
 LL | pub static mut C: u32 = unsafe { C = 1; 0 };
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   = note: ...which again requires const-evaluating `C`, completing the cycle
+   = note: ...which again requires const-evaluating + checking `C`, completing the cycle
    = note: cycle used when running analysis passes on this crate
 
 error: aborting due to 2 previous errors