From 37ff26cc4ebb33f4ef905a4e3133752af720166b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20K=C3=A5re=20Alsaker?= Date: Sun, 5 Apr 2026 12:38:18 +0200 Subject: [PATCH] Add better default spans for the `Ty` impl of `QueryKey` --- compiler/rustc_middle/src/query/keys.rs | 60 ++++++++++++++++++- tests/ui/consts/const-size_of-cycle.stderr | 6 +- tests/ui/consts/issue-44415.stderr | 6 +- tests/ui/layout/layout-cycle.rs | 2 +- tests/ui/layout/layout-cycle.stderr | 10 +++- tests/ui/layout/post-mono-layout-cycle.rs | 2 +- tests/ui/layout/post-mono-layout-cycle.stderr | 13 +++- ...on-structural-match-types-cycle-err.stderr | 9 ++- .../issue-26548-recursion-via-normalize.rs | 12 ++-- ...issue-26548-recursion-via-normalize.stderr | 13 +++- tests/ui/sized/recursive-type-binding.rs | 6 +- tests/ui/sized/recursive-type-binding.stderr | 12 +++- .../recursive-type-coercion-from-never.rs | 6 +- .../recursive-type-coercion-from-never.stderr | 12 +++- .../sized/stack-overflow-trait-infer-98842.rs | 2 +- .../stack-overflow-trait-infer-98842.stderr | 7 ++- ...cursive-enum-and-array-impl.current.stderr | 16 ++++- ...-recursive-enum-and-array-impl.next.stderr | 16 ++++- .../129541-recursive-enum-and-array-impl.rs | 3 +- .../self-in-enum-definition.stderr | 6 +- 20 files changed, 182 insertions(+), 37 deletions(-) diff --git a/compiler/rustc_middle/src/query/keys.rs b/compiler/rustc_middle/src/query/keys.rs index e5e56b8e28b27..7390a0378b018 100644 --- a/compiler/rustc_middle/src/query/keys.rs +++ b/compiler/rustc_middle/src/query/keys.rs @@ -5,6 +5,7 @@ use std::fmt::Debug; use std::hash::Hash; use rustc_ast::tokenstream::TokenStream; +use rustc_data_structures::sso::SsoHashSet; use rustc_data_structures::stable_hasher::HashStable; use rustc_hir::def_id::{CrateNum, DefId, LOCAL_CRATE, LocalDefId, LocalModDefId}; use rustc_hir::hir_id::OwnerId; @@ -257,8 +258,8 @@ impl<'tcx> QueryKey for GenericArg<'tcx> { } impl<'tcx> QueryKey for Ty<'tcx> { - fn default_span(&self, _: TyCtxt<'_>) -> Span { - DUMMY_SP + fn default_span(&self, tcx: TyCtxt<'_>) -> Span { + def_id_of_type(*self).map(|def_id| tcx.def_span(def_id)).unwrap_or(DUMMY_SP) } } @@ -361,3 +362,58 @@ impl<'tcx> QueryKey for (ty::Instance<'tcx>, CollectionMode) { self.0.default_span(tcx) } } + +/// Gets a `DefId` associated with a type +/// +/// Visited set is needed to avoid full iteration over +/// deeply nested tuples that have no DefId. +fn def_id_of_type_cached<'a>(ty: Ty<'a>, visited: &mut SsoHashSet>) -> Option { + match *ty.kind() { + ty::Adt(adt_def, _) => Some(adt_def.did()), + + ty::Dynamic(data, ..) => data.principal_def_id(), + + ty::Pat(subty, _) | ty::Array(subty, _) | ty::Slice(subty) => { + def_id_of_type_cached(subty, visited) + } + + ty::RawPtr(ty, _) => def_id_of_type_cached(ty, visited), + + ty::Ref(_, ty, _) => def_id_of_type_cached(ty, visited), + + ty::Tuple(tys) => tys.iter().find_map(|ty| { + if visited.insert(ty) { + return def_id_of_type_cached(ty, visited); + } + return None; + }), + + ty::FnDef(def_id, _) + | ty::Closure(def_id, _) + | ty::CoroutineClosure(def_id, _) + | ty::Coroutine(def_id, _) + | ty::CoroutineWitness(def_id, _) + | ty::Foreign(def_id) => Some(def_id), + + ty::Alias(_, ty) => Some(ty.def_id), + + ty::Bool + | ty::Char + | ty::Int(_) + | ty::Uint(_) + | ty::Str + | ty::FnPtr(..) + | ty::UnsafeBinder(_) + | ty::Placeholder(..) + | ty::Param(_) + | ty::Infer(_) + | ty::Bound(..) + | ty::Error(_) + | ty::Never + | ty::Float(_) => None, + } +} + +fn def_id_of_type(ty: Ty<'_>) -> Option { + def_id_of_type_cached(ty, &mut SsoHashSet::new()) +} diff --git a/tests/ui/consts/const-size_of-cycle.stderr b/tests/ui/consts/const-size_of-cycle.stderr index 01aa5e726b451..6a7f44ed35893 100644 --- a/tests/ui/consts/const-size_of-cycle.stderr +++ b/tests/ui/consts/const-size_of-cycle.stderr @@ -10,7 +10,11 @@ note: ...which requires simplifying constant for the type system `core::mem::Siz --> $SRC_DIR/core/src/mem/mod.rs:LL:COL note: ...which requires const-evaluating + checking `core::mem::SizedTypeProperties::SIZE`... --> $SRC_DIR/core/src/mem/mod.rs:LL:COL - = note: ...which requires computing layout of `Foo`... +note: ...which requires computing layout of `Foo`... + --> $DIR/const-size_of-cycle.rs:1:1 + | +LL | struct Foo { + | ^^^^^^^^^^ = note: ...which requires computing layout of `[u8; std::mem::size_of::()]`... note: ...which requires normalizing `[u8; std::mem::size_of::()]`... --> $DIR/const-size_of-cycle.rs:2:17 diff --git a/tests/ui/consts/issue-44415.stderr b/tests/ui/consts/issue-44415.stderr index 0e3f2e6199f76..28f6813717337 100644 --- a/tests/ui/consts/issue-44415.stderr +++ b/tests/ui/consts/issue-44415.stderr @@ -9,7 +9,11 @@ note: ...which requires const-evaluating + checking `Foo::bytes::{constant#0}`.. | LL | bytes: [u8; unsafe { intrinsics::size_of::() }], | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: ...which requires computing layout of `Foo`... +note: ...which requires computing layout of `Foo`... + --> $DIR/issue-44415.rs:5:1 + | +LL | struct Foo { + | ^^^^^^^^^^ = note: ...which requires computing layout of `[u8; unsafe { intrinsics::size_of::() }]`... note: ...which requires normalizing `[u8; unsafe { intrinsics::size_of::() }]`... --> $DIR/issue-44415.rs:6:17 diff --git a/tests/ui/layout/layout-cycle.rs b/tests/ui/layout/layout-cycle.rs index 846ce0882cad1..e873fcdaa97a9 100644 --- a/tests/ui/layout/layout-cycle.rs +++ b/tests/ui/layout/layout-cycle.rs @@ -1,11 +1,11 @@ //@ build-fail -//~^ ERROR: cycle detected when computing layout of // Issue #111176 -- ensure that we do not emit ICE on layout cycles use std::mem; pub struct S { + //~^ ERROR: cycle detected when computing layout of pub f: ::I, } diff --git a/tests/ui/layout/layout-cycle.stderr b/tests/ui/layout/layout-cycle.stderr index 28c35d431226e..0652f032c9dba 100644 --- a/tests/ui/layout/layout-cycle.stderr +++ b/tests/ui/layout/layout-cycle.stderr @@ -1,6 +1,14 @@ error[E0391]: cycle detected when computing layout of `S>` + --> $DIR/layout-cycle.rs:7:1 | - = note: ...which requires computing layout of ` as Tr>::I`... +LL | pub struct S { + | ^^^^^^^^^^^^^^^^^^^ + | +note: ...which requires computing layout of ` as Tr>::I`... + --> $DIR/layout-cycle.rs:13:5 + | +LL | type I: Tr; + | ^^^^^^^^^^ = note: ...which again requires computing layout of `S>`, completing the cycle note: cycle used when const-evaluating + checking `core::mem::SizedTypeProperties::SIZE` --> $SRC_DIR/core/src/mem/mod.rs:LL:COL diff --git a/tests/ui/layout/post-mono-layout-cycle.rs b/tests/ui/layout/post-mono-layout-cycle.rs index 841fc30a50bcf..71ccc8de94da2 100644 --- a/tests/ui/layout/post-mono-layout-cycle.rs +++ b/tests/ui/layout/post-mono-layout-cycle.rs @@ -1,5 +1,4 @@ //@ build-fail -//~^ ERROR cycle detected when computing layout of `Wrapper<()>` trait Trait { type Assoc; @@ -10,6 +9,7 @@ impl Trait for () { } struct Wrapper { + //~^ ERROR cycle detected when computing layout of `Wrapper<()>` _x: ::Assoc, } diff --git a/tests/ui/layout/post-mono-layout-cycle.stderr b/tests/ui/layout/post-mono-layout-cycle.stderr index b9b1b988499e6..05c57d20b8feb 100644 --- a/tests/ui/layout/post-mono-layout-cycle.stderr +++ b/tests/ui/layout/post-mono-layout-cycle.stderr @@ -1,8 +1,17 @@ error[E0391]: cycle detected when computing layout of `Wrapper<()>` + --> $DIR/post-mono-layout-cycle.rs:11:1 | - = note: ...which requires computing layout of `<() as Trait>::Assoc`... +LL | struct Wrapper { + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: ...which requires computing layout of `<() as Trait>::Assoc`... + --> $DIR/post-mono-layout-cycle.rs:4:5 + | +LL | type Assoc; + | ^^^^^^^^^^ = note: ...which again requires computing layout of `Wrapper<()>`, completing the cycle - = note: cycle used when computing layout of `core::option::Option>` +note: cycle used when computing layout of `core::option::Option>` + --> $SRC_DIR/core/src/option.rs:LL:COL = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information error: aborting due to 1 previous error diff --git a/tests/ui/pattern/non-structural-match-types-cycle-err.stderr b/tests/ui/pattern/non-structural-match-types-cycle-err.stderr index 2f4ac63fc570a..a7dd597d96142 100644 --- a/tests/ui/pattern/non-structural-match-types-cycle-err.stderr +++ b/tests/ui/pattern/non-structural-match-types-cycle-err.stderr @@ -14,8 +14,13 @@ note: ...which requires const-evaluating + checking ` = None; | ^^^^^^^^^^^^^^^^^^^^^ - = note: ...which requires computing layout of `core::option::Option<{async block@$DIR/non-structural-match-types-cycle-err.rs:18:16: 18:21}>`... - = note: ...which requires computing layout of `{async block@$DIR/non-structural-match-types-cycle-err.rs:18:16: 18:21}`... +note: ...which requires computing layout of `core::option::Option<{async block@$DIR/non-structural-match-types-cycle-err.rs:18:16: 18:21}>`... + --> $SRC_DIR/core/src/option.rs:LL:COL +note: ...which requires computing layout of `{async block@$DIR/non-structural-match-types-cycle-err.rs:18:16: 18:21}`... + --> $DIR/non-structural-match-types-cycle-err.rs:18:16 + | +LL | match Some(async {}) { + | ^^^^^ note: ...which requires optimizing MIR for `defines::{closure#0}`... --> $DIR/non-structural-match-types-cycle-err.rs:18:16 | diff --git a/tests/ui/recursion/issue-26548-recursion-via-normalize.rs b/tests/ui/recursion/issue-26548-recursion-via-normalize.rs index 6c7fc4beb543d..a7eeccbfbd544 100644 --- a/tests/ui/recursion/issue-26548-recursion-via-normalize.rs +++ b/tests/ui/recursion/issue-26548-recursion-via-normalize.rs @@ -1,9 +1,8 @@ -//~ ERROR cycle detected when computing layout of `core::option::Option` -//~| NOTE see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information -//~| NOTE ...which requires computing layout of `S`... -//~| NOTE ...which requires computing layout of `core::option::Option<::It>`... -//~| NOTE ...which again requires computing layout of `core::option::Option`, completing the cycle -//~| NOTE cycle used when computing layout of `core::option::Option<::It>` +//~? ERROR cycle detected when computing layout of `core::option::Option` +//~? NOTE see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information +//~? NOTE ...which requires computing layout of `core::option::Option<::It>`... +//~? NOTE ...which again requires computing layout of `core::option::Option`, completing the cycle +//~? NOTE cycle used when computing layout of `core::option::Option<::It>` trait Mirror { type It: ?Sized; @@ -12,6 +11,7 @@ impl Mirror for T { type It = Self; } struct S(Option<::It>); +//~^ NOTE ...which requires computing layout of `S`... fn main() { let _s = S(None); diff --git a/tests/ui/recursion/issue-26548-recursion-via-normalize.stderr b/tests/ui/recursion/issue-26548-recursion-via-normalize.stderr index e77fb025bcf19..daf9240ec5c9a 100644 --- a/tests/ui/recursion/issue-26548-recursion-via-normalize.stderr +++ b/tests/ui/recursion/issue-26548-recursion-via-normalize.stderr @@ -1,9 +1,16 @@ error[E0391]: cycle detected when computing layout of `core::option::Option` + --> $SRC_DIR/core/src/option.rs:LL:COL | - = note: ...which requires computing layout of `S`... - = note: ...which requires computing layout of `core::option::Option<::It>`... +note: ...which requires computing layout of `S`... + --> $DIR/issue-26548-recursion-via-normalize.rs:13:1 + | +LL | struct S(Option<::It>); + | ^^^^^^^^ +note: ...which requires computing layout of `core::option::Option<::It>`... + --> $SRC_DIR/core/src/option.rs:LL:COL = note: ...which again requires computing layout of `core::option::Option`, completing the cycle - = note: cycle used when computing layout of `core::option::Option<::It>` +note: cycle used when computing layout of `core::option::Option<::It>` + --> $SRC_DIR/core/src/option.rs:LL:COL = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information error: aborting due to 1 previous error diff --git a/tests/ui/sized/recursive-type-binding.rs b/tests/ui/sized/recursive-type-binding.rs index 52de04afd66d3..c67e8369a3b73 100644 --- a/tests/ui/sized/recursive-type-binding.rs +++ b/tests/ui/sized/recursive-type-binding.rs @@ -1,12 +1,14 @@ //@ build-fail -//~^ ERROR cycle detected when computing layout of `Foo<()>` -trait A { type Assoc: ?Sized; } +trait A { + type Assoc: ?Sized; +} impl A for () { type Assoc = Foo<()>; } struct Foo(T::Assoc); +//~^ ERROR cycle detected when computing layout of `Foo<()>` fn main() { let x: Foo<()>; diff --git a/tests/ui/sized/recursive-type-binding.stderr b/tests/ui/sized/recursive-type-binding.stderr index d9c2efa4d53b7..290262c16a079 100644 --- a/tests/ui/sized/recursive-type-binding.stderr +++ b/tests/ui/sized/recursive-type-binding.stderr @@ -1,9 +1,17 @@ error[E0391]: cycle detected when computing layout of `Foo<()>` + --> $DIR/recursive-type-binding.rs:10:1 | - = note: ...which requires computing layout of `<() as A>::Assoc`... +LL | struct Foo(T::Assoc); + | ^^^^^^^^^^^^^^^^ + | +note: ...which requires computing layout of `<() as A>::Assoc`... + --> $DIR/recursive-type-binding.rs:4:5 + | +LL | type Assoc: ?Sized; + | ^^^^^^^^^^^^^^^^^^ = note: ...which again requires computing layout of `Foo<()>`, completing the cycle note: cycle used when elaborating drops for `main` - --> $DIR/recursive-type-binding.rs:11:1 + --> $DIR/recursive-type-binding.rs:13:1 | LL | fn main() { | ^^^^^^^^^ diff --git a/tests/ui/sized/recursive-type-coercion-from-never.rs b/tests/ui/sized/recursive-type-coercion-from-never.rs index 7bd87ae06c5e4..7bb535bb20a75 100644 --- a/tests/ui/sized/recursive-type-coercion-from-never.rs +++ b/tests/ui/sized/recursive-type-coercion-from-never.rs @@ -1,15 +1,17 @@ //@ build-fail -//~^ ERROR cycle detected when computing layout of `Foo<()>` // Regression test for a stack overflow: https://github.com/rust-lang/rust/issues/113197 -trait A { type Assoc; } +trait A { + type Assoc; +} impl A for () { type Assoc = Foo<()>; } struct Foo(T::Assoc); +//~^ ERROR cycle detected when computing layout of `Foo<()>` fn main() { Foo::<()>(todo!()); diff --git a/tests/ui/sized/recursive-type-coercion-from-never.stderr b/tests/ui/sized/recursive-type-coercion-from-never.stderr index 7580e780dda59..1e04c2ab396f0 100644 --- a/tests/ui/sized/recursive-type-coercion-from-never.stderr +++ b/tests/ui/sized/recursive-type-coercion-from-never.stderr @@ -1,9 +1,17 @@ error[E0391]: cycle detected when computing layout of `Foo<()>` + --> $DIR/recursive-type-coercion-from-never.rs:13:1 | - = note: ...which requires computing layout of `<() as A>::Assoc`... +LL | struct Foo(T::Assoc); + | ^^^^^^^^^^^^^^^^ + | +note: ...which requires computing layout of `<() as A>::Assoc`... + --> $DIR/recursive-type-coercion-from-never.rs:6:5 + | +LL | type Assoc; + | ^^^^^^^^^^ = note: ...which again requires computing layout of `Foo<()>`, completing the cycle note: cycle used when elaborating drops for `main` - --> $DIR/recursive-type-coercion-from-never.rs:14:1 + --> $DIR/recursive-type-coercion-from-never.rs:16:1 | LL | fn main() { | ^^^^^^^^^ diff --git a/tests/ui/sized/stack-overflow-trait-infer-98842.rs b/tests/ui/sized/stack-overflow-trait-infer-98842.rs index d6522e3cfb643..ff080eb19d03c 100644 --- a/tests/ui/sized/stack-overflow-trait-infer-98842.rs +++ b/tests/ui/sized/stack-overflow-trait-infer-98842.rs @@ -2,11 +2,11 @@ // issue: rust-lang/rust#98842 //@ check-fail //@ edition:2021 -//~^^^^ ERROR cycle detected when computing layout of `Foo` // If the inner `Foo` is named through an associated type, // the "infinite size" error does not occur. struct Foo(<&'static Foo as ::core::ops::Deref>::Target); +//~^ ERROR cycle detected when computing layout of `Foo` // But Rust will be unable to know whether `Foo` is sized or not, // and it will infinitely recurse somewhere trying to figure out the // size of this pointer (is my guess): diff --git a/tests/ui/sized/stack-overflow-trait-infer-98842.stderr b/tests/ui/sized/stack-overflow-trait-infer-98842.stderr index 5557a6fc45b89..f15d95ea94804 100644 --- a/tests/ui/sized/stack-overflow-trait-infer-98842.stderr +++ b/tests/ui/sized/stack-overflow-trait-infer-98842.stderr @@ -1,6 +1,11 @@ error[E0391]: cycle detected when computing layout of `Foo` + --> $DIR/stack-overflow-trait-infer-98842.rs:8:1 | - = note: ...which requires computing layout of `<&'static Foo as core::ops::deref::Deref>::Target`... +LL | struct Foo(<&'static Foo as ::core::ops::Deref>::Target); + | ^^^^^^^^^^ + | +note: ...which requires computing layout of `<&'static Foo as core::ops::deref::Deref>::Target`... + --> $SRC_DIR/core/src/ops/deref.rs:LL:COL = note: ...which again requires computing layout of `Foo`, completing the cycle note: cycle used when const-evaluating + checking `_` --> $DIR/stack-overflow-trait-infer-98842.rs:13:1 diff --git a/tests/ui/traits/solver-cycles/129541-recursive-enum-and-array-impl.current.stderr b/tests/ui/traits/solver-cycles/129541-recursive-enum-and-array-impl.current.stderr index 50dcea0bfac69..d429b08c8c986 100644 --- a/tests/ui/traits/solver-cycles/129541-recursive-enum-and-array-impl.current.stderr +++ b/tests/ui/traits/solver-cycles/129541-recursive-enum-and-array-impl.current.stderr @@ -1,8 +1,20 @@ error[E0391]: cycle detected when computing layout of `<[Hello] as Normalize>::Assoc` + --> $DIR/129541-recursive-enum-and-array-impl.rs:8:5 | - = note: ...which requires computing layout of `Hello`... +LL | type Assoc; + | ^^^^^^^^^^ + | +note: ...which requires computing layout of `Hello`... + --> $DIR/129541-recursive-enum-and-array-impl.rs:21:1 + | +LL | enum Hello { + | ^^^^^^^^^^ = note: ...which again requires computing layout of `<[Hello] as Normalize>::Assoc`, completing the cycle - = note: cycle used when computing layout of `Hello` +note: cycle used when computing layout of `Hello` + --> $DIR/129541-recursive-enum-and-array-impl.rs:21:1 + | +LL | enum Hello { + | ^^^^^^^^^^ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information error: aborting due to 1 previous error diff --git a/tests/ui/traits/solver-cycles/129541-recursive-enum-and-array-impl.next.stderr b/tests/ui/traits/solver-cycles/129541-recursive-enum-and-array-impl.next.stderr index 50dcea0bfac69..d429b08c8c986 100644 --- a/tests/ui/traits/solver-cycles/129541-recursive-enum-and-array-impl.next.stderr +++ b/tests/ui/traits/solver-cycles/129541-recursive-enum-and-array-impl.next.stderr @@ -1,8 +1,20 @@ error[E0391]: cycle detected when computing layout of `<[Hello] as Normalize>::Assoc` + --> $DIR/129541-recursive-enum-and-array-impl.rs:8:5 | - = note: ...which requires computing layout of `Hello`... +LL | type Assoc; + | ^^^^^^^^^^ + | +note: ...which requires computing layout of `Hello`... + --> $DIR/129541-recursive-enum-and-array-impl.rs:21:1 + | +LL | enum Hello { + | ^^^^^^^^^^ = note: ...which again requires computing layout of `<[Hello] as Normalize>::Assoc`, completing the cycle - = note: cycle used when computing layout of `Hello` +note: cycle used when computing layout of `Hello` + --> $DIR/129541-recursive-enum-and-array-impl.rs:21:1 + | +LL | enum Hello { + | ^^^^^^^^^^ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information error: aborting due to 1 previous error diff --git a/tests/ui/traits/solver-cycles/129541-recursive-enum-and-array-impl.rs b/tests/ui/traits/solver-cycles/129541-recursive-enum-and-array-impl.rs index 5b7bf5f3404c3..6c0411135dad0 100644 --- a/tests/ui/traits/solver-cycles/129541-recursive-enum-and-array-impl.rs +++ b/tests/ui/traits/solver-cycles/129541-recursive-enum-and-array-impl.rs @@ -1,6 +1,4 @@ // Regression test for #129541 -//~^ ERROR cycle detected when computing layout of `<[Hello] as Normalize>::Assoc` [E0391] - //@ revisions: current next //@ ignore-compare-mode-next-solver (explicit revisions) //@[next] compile-flags: -Znext-solver @@ -8,6 +6,7 @@ trait Bound {} trait Normalize { type Assoc; + //~^ ERROR cycle detected when computing layout of `<[Hello] as Normalize>::Assoc` [E0391] } impl Normalize for T { diff --git a/tests/ui/type-alias-enum-variants/self-in-enum-definition.stderr b/tests/ui/type-alias-enum-variants/self-in-enum-definition.stderr index 13ae6dfcaa354..8b6d11b8df85c 100644 --- a/tests/ui/type-alias-enum-variants/self-in-enum-definition.stderr +++ b/tests/ui/type-alias-enum-variants/self-in-enum-definition.stderr @@ -9,7 +9,11 @@ note: ...which requires const-evaluating + checking `Alpha::V3::{constant#0}`... | LL | V3 = Self::V1 {} as u8 + 2, | ^^^^^^^^^^^^^^^^^^^^^ - = note: ...which requires computing layout of `Alpha`... +note: ...which requires computing layout of `Alpha`... + --> $DIR/self-in-enum-definition.rs:2:1 + | +LL | enum Alpha { + | ^^^^^^^^^^ = note: ...which again requires simplifying constant for the type system `Alpha::V3::{constant#0}`, completing the cycle note: cycle used when checking that `Alpha` is well-formed --> $DIR/self-in-enum-definition.rs:2:1