From 6733bc30667b18c0c2deef39c8318b7b39ed6536 Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Sat, 23 Jul 2022 14:42:54 +0200 Subject: [PATCH] Remove guess_head_span. --- compiler/rustc_lint/src/builtin.rs | 25 +++-------- compiler/rustc_mir_build/src/lints.rs | 2 +- compiler/rustc_privacy/src/lib.rs | 3 +- compiler/rustc_query_system/src/query/job.rs | 8 +--- compiler/rustc_resolve/src/diagnostics.rs | 6 +-- .../rustc_resolve/src/late/diagnostics.rs | 7 +--- .../src/traits/error_reporting/suggestions.rs | 1 - compiler/rustc_typeck/src/check/_match.rs | 12 ++++-- compiler/rustc_typeck/src/check/expr.rs | 11 ++++- src/test/ui/async-await/no-const-async.stderr | 2 +- src/test/ui/consts/issue-44415.stderr | 6 +-- .../cycle-trait-default-type-trait.stderr | 18 ++++++-- .../cycle-trait-supertrait-direct.stderr | 6 ++- .../ui/hrtb/hrtb-perfect-forwarding.stderr | 42 +++++++------------ src/test/ui/issues/issue-12511.stderr | 6 ++- src/test/ui/lint/unreachable_pub.stderr | 14 +++---- src/test/ui/resolve/issue-23305.stderr | 10 ++++- .../issue-91949-hangs-on-recursion.stderr | 9 ++-- .../cyclic-trait-resolution.stderr | 2 +- .../self-in-enum-definition.stderr | 6 +-- 20 files changed, 93 insertions(+), 103 deletions(-) diff --git a/compiler/rustc_lint/src/builtin.rs b/compiler/rustc_lint/src/builtin.rs index 9e4dc702f07..c1c7f72d311 100644 --- a/compiler/rustc_lint/src/builtin.rs +++ b/compiler/rustc_lint/src/builtin.rs @@ -1364,7 +1364,6 @@ impl UnreachablePub { cx: &LateContext<'_>, what: &str, def_id: LocalDefId, - span: Span, vis_span: Span, exportable: bool, ) { @@ -1373,7 +1372,7 @@ impl UnreachablePub { if vis_span.from_expansion() { applicability = Applicability::MaybeIncorrect; } - let def_span = cx.tcx.sess.source_map().guess_head_span(span); + let def_span = cx.tcx.def_span(def_id); cx.struct_span_lint(UNREACHABLE_PUB, def_span, |lint| { let mut err = lint.build(fluent::lint::builtin_unreachable_pub); err.set_arg("what", what); @@ -1399,36 +1398,22 @@ impl<'tcx> LateLintPass<'tcx> for UnreachablePub { if let hir::ItemKind::Use(_, hir::UseKind::ListStem) = &item.kind { return; } - self.perform_lint(cx, "item", item.def_id, item.span, item.vis_span, true); + self.perform_lint(cx, "item", item.def_id, item.vis_span, true); } fn check_foreign_item(&mut self, cx: &LateContext<'_>, foreign_item: &hir::ForeignItem<'tcx>) { - self.perform_lint( - cx, - "item", - foreign_item.def_id, - foreign_item.span, - foreign_item.vis_span, - true, - ); + self.perform_lint(cx, "item", foreign_item.def_id, foreign_item.vis_span, true); } fn check_field_def(&mut self, cx: &LateContext<'_>, field: &hir::FieldDef<'_>) { let def_id = cx.tcx.hir().local_def_id(field.hir_id); - self.perform_lint(cx, "field", def_id, field.span, field.vis_span, false); + self.perform_lint(cx, "field", def_id, field.vis_span, false); } fn check_impl_item(&mut self, cx: &LateContext<'_>, impl_item: &hir::ImplItem<'_>) { // Only lint inherent impl items. if cx.tcx.associated_item(impl_item.def_id).trait_item_def_id.is_none() { - self.perform_lint( - cx, - "item", - impl_item.def_id, - impl_item.span, - impl_item.vis_span, - false, - ); + self.perform_lint(cx, "item", impl_item.def_id, impl_item.vis_span, false); } } } diff --git a/compiler/rustc_mir_build/src/lints.rs b/compiler/rustc_mir_build/src/lints.rs index d21a8c4f9b9..9cefc99d3fd 100644 --- a/compiler/rustc_mir_build/src/lints.rs +++ b/compiler/rustc_mir_build/src/lints.rs @@ -41,8 +41,8 @@ pub(crate) fn check<'tcx>(tcx: TyCtxt<'tcx>, body: &Body<'tcx>) { vis.reachable_recursive_calls.sort(); + let sp = tcx.def_span(def_id); let hir_id = tcx.hir().local_def_id_to_hir_id(def_id); - let sp = tcx.sess.source_map().guess_head_span(tcx.hir().span_with_body(hir_id)); tcx.struct_span_lint_hir(UNCONDITIONAL_RECURSION, hir_id, sp, |lint| { let mut db = lint.build("function cannot return without recursing"); db.span_label(sp, "cannot return without recursing"); diff --git a/compiler/rustc_privacy/src/lib.rs b/compiler/rustc_privacy/src/lib.rs index 390d6f5a856..43e4d252676 100644 --- a/compiler/rustc_privacy/src/lib.rs +++ b/compiler/rustc_privacy/src/lib.rs @@ -1754,8 +1754,7 @@ impl SearchInterfaceForPrivateItemsVisitor<'_> { || self.in_assoc_ty || self.tcx.resolutions(()).has_pub_restricted { - let vis_span = - self.tcx.sess.source_map().guess_head_span(self.tcx.def_span(def_id)); + let vis_span = self.tcx.def_span(def_id); if kind == "trait" { self.tcx.sess.emit_err(InPublicInterfaceTraits { span, diff --git a/compiler/rustc_query_system/src/query/job.rs b/compiler/rustc_query_system/src/query/job.rs index 9f5779194af..68c7a137e06 100644 --- a/compiler/rustc_query_system/src/query/job.rs +++ b/compiler/rustc_query_system/src/query/job.rs @@ -1,4 +1,3 @@ -use crate::dep_graph::DepContext; use crate::query::plumbing::CycleError; use crate::query::{QueryContext, QueryStackFrame}; use rustc_hir::def::DefKind; @@ -536,9 +535,7 @@ pub(crate) fn report_cycle<'a>( ) -> DiagnosticBuilder<'a, ErrorGuaranteed> { assert!(!stack.is_empty()); - let fix_span = |span: Span, query: &QueryStackFrame| { - sess.source_map().guess_head_span(query.default_span(span)) - }; + let fix_span = |span: Span, query: &QueryStackFrame| query.default_span(span); let span = fix_span(stack[1 % stack.len()].span, &stack[0].query); let mut err = @@ -606,8 +603,7 @@ pub fn print_query_stack( Level::FailureNote, &format!("#{} [{}] {}", i, query_info.query.name, query_info.query.description), ); - diag.span = - tcx.dep_context().sess().source_map().guess_head_span(query_info.job.span).into(); + diag.span = query_info.job.span.into(); handler.force_print_diagnostic(diag); current_query = query_info.job.parent; diff --git a/compiler/rustc_resolve/src/diagnostics.rs b/compiler/rustc_resolve/src/diagnostics.rs index 22a307a15ed..8839fb1a151 100644 --- a/compiler/rustc_resolve/src/diagnostics.rs +++ b/compiler/rustc_resolve/src/diagnostics.rs @@ -1587,11 +1587,7 @@ impl<'a> Resolver<'a> { }; let def_span = suggestion.res.opt_def_id().and_then(|def_id| match def_id.krate { LOCAL_CRATE => self.opt_span(def_id), - _ => Some( - self.session - .source_map() - .guess_head_span(self.cstore().get_span_untracked(def_id, self.session)), - ), + _ => Some(self.cstore().get_span_untracked(def_id, self.session)), }); if let Some(def_span) = def_span { if span.overlaps(def_span) { diff --git a/compiler/rustc_resolve/src/late/diagnostics.rs b/compiler/rustc_resolve/src/late/diagnostics.rs index 6b49c6b1ac6..2b1f2b88ec4 100644 --- a/compiler/rustc_resolve/src/late/diagnostics.rs +++ b/compiler/rustc_resolve/src/late/diagnostics.rs @@ -136,12 +136,7 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> { fn def_span(&self, def_id: DefId) -> Option { match def_id.krate { LOCAL_CRATE => self.r.opt_span(def_id), - _ => Some( - self.r - .session - .source_map() - .guess_head_span(self.r.cstore().get_span_untracked(def_id, self.r.session)), - ), + _ => Some(self.r.cstore().get_span_untracked(def_id, self.r.session)), } } diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs index 6c8faed0df4..50b1674dd3c 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs @@ -1933,7 +1933,6 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> { )); let original_span = err.span.primary_span().unwrap(); - let original_span = self.tcx.sess.source_map().guess_head_span(original_span); let mut span = MultiSpan::from_span(original_span); let message = outer_generator diff --git a/compiler/rustc_typeck/src/check/_match.rs b/compiler/rustc_typeck/src/check/_match.rs index 147d87e7594..60daaa4af0a 100644 --- a/compiler/rustc_typeck/src/check/_match.rs +++ b/compiler/rustc_typeck/src/check/_match.rs @@ -292,6 +292,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { pub(crate) fn if_cause( &self, span: Span, + cond_span: Span, then_expr: &'tcx hir::Expr<'tcx>, else_expr: &'tcx hir::Expr<'tcx>, then_ty: Ty<'tcx>, @@ -354,10 +355,13 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { // 6 | | }; // | |_____^ expected integer, found `()` // ``` - if block.expr.is_none() && block.stmts.is_empty() - && let Some(outer_span) = &mut outer_span - { - *outer_span = self.tcx.sess.source_map().guess_head_span(*outer_span); + if block.expr.is_none() && block.stmts.is_empty() && outer_span.is_some() { + let sp = if let Some(cs) = cond_span.find_ancestor_inside(span) { + span.with_hi(cs.hi()) + } else { + span + }; + outer_span = Some(sp); } (self.find_block_span(block), block.hir_id) diff --git a/compiler/rustc_typeck/src/check/expr.rs b/compiler/rustc_typeck/src/check/expr.rs index ba5ef5edc86..550d49dafb9 100644 --- a/compiler/rustc_typeck/src/check/expr.rs +++ b/compiler/rustc_typeck/src/check/expr.rs @@ -1003,8 +1003,15 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { let else_diverges = self.diverges.get(); let opt_suggest_box_span = self.opt_suggest_box_span(else_ty, orig_expected); - let if_cause = - self.if_cause(sp, then_expr, else_expr, then_ty, else_ty, opt_suggest_box_span); + let if_cause = self.if_cause( + sp, + cond_expr.span, + then_expr, + else_expr, + then_ty, + else_ty, + opt_suggest_box_span, + ); coerce.coerce(self, &if_cause, else_expr, else_ty); diff --git a/src/test/ui/async-await/no-const-async.stderr b/src/test/ui/async-await/no-const-async.stderr index fd76c282f96..e6f6e9e9f65 100644 --- a/src/test/ui/async-await/no-const-async.stderr +++ b/src/test/ui/async-await/no-const-async.stderr @@ -35,7 +35,7 @@ note: cycle used when checking item types in top-level module --> $DIR/no-const-async.rs:4:1 | LL | pub const async fn x() {} - | ^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/consts/issue-44415.stderr b/src/test/ui/consts/issue-44415.stderr index c085beb0ea5..57f94f8c6ab 100644 --- a/src/test/ui/consts/issue-44415.stderr +++ b/src/test/ui/consts/issue-44415.stderr @@ -2,18 +2,18 @@ error[E0391]: cycle detected when evaluating type-level constant --> $DIR/issue-44415.rs:6:17 | LL | bytes: [u8; unsafe { intrinsics::size_of::() }], - | ^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: ...which requires const-evaluating + checking `Foo::bytes::{constant#0}`... --> $DIR/issue-44415.rs:6:17 | LL | bytes: [u8; unsafe { intrinsics::size_of::() }], - | ^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: ...which requires const-evaluating + checking `Foo::bytes::{constant#0}`... --> $DIR/issue-44415.rs:6:17 | LL | bytes: [u8; unsafe { intrinsics::size_of::() }], - | ^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: ...which requires computing layout of `Foo`... = note: ...which requires computing layout of `[u8; _]`... = note: ...which requires normalizing `[u8; _]`... diff --git a/src/test/ui/cycle-trait/cycle-trait-default-type-trait.stderr b/src/test/ui/cycle-trait/cycle-trait-default-type-trait.stderr index fc842fada5a..d4976a0f9c9 100644 --- a/src/test/ui/cycle-trait/cycle-trait-default-type-trait.stderr +++ b/src/test/ui/cycle-trait/cycle-trait-default-type-trait.stderr @@ -8,8 +8,13 @@ LL | trait Foo> { note: cycle used when collecting item types in top-level module --> $DIR/cycle-trait-default-type-trait.rs:4:1 | -LL | trait Foo> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | / trait Foo> { +LL | | +LL | | +LL | | } +LL | | +LL | | fn main() { } + | |_____________^ error[E0391]: cycle detected when computing type of `Foo::X` --> $DIR/cycle-trait-default-type-trait.rs:4:23 @@ -21,8 +26,13 @@ LL | trait Foo> { note: cycle used when collecting item types in top-level module --> $DIR/cycle-trait-default-type-trait.rs:4:1 | -LL | trait Foo> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | / trait Foo> { +LL | | +LL | | +LL | | } +LL | | +LL | | fn main() { } + | |_____________^ error: aborting due to 2 previous errors diff --git a/src/test/ui/cycle-trait/cycle-trait-supertrait-direct.stderr b/src/test/ui/cycle-trait/cycle-trait-supertrait-direct.stderr index ee54b2fd151..f6ffcc4b5aa 100644 --- a/src/test/ui/cycle-trait/cycle-trait-supertrait-direct.stderr +++ b/src/test/ui/cycle-trait/cycle-trait-supertrait-direct.stderr @@ -13,8 +13,10 @@ LL | trait Chromosome: Chromosome { note: cycle used when collecting item types in top-level module --> $DIR/cycle-trait-supertrait-direct.rs:3:1 | -LL | trait Chromosome: Chromosome { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | / trait Chromosome: Chromosome { +LL | | +LL | | } + | |_^ error: aborting due to previous error diff --git a/src/test/ui/hrtb/hrtb-perfect-forwarding.stderr b/src/test/ui/hrtb/hrtb-perfect-forwarding.stderr index 68da46d46bd..1461e7fd2dd 100644 --- a/src/test/ui/hrtb/hrtb-perfect-forwarding.stderr +++ b/src/test/ui/hrtb/hrtb-perfect-forwarding.stderr @@ -4,12 +4,10 @@ warning: function cannot return without recursing LL | / fn no_hrtb<'b, T>(mut t: T) LL | | where LL | | T: Bar<&'b isize>, -LL | | { -... | -LL | | no_hrtb(&mut t); - | | --------------- recursive call site -LL | | } - | |_^ cannot return without recursing + | |______________________^ cannot return without recursing +... +LL | no_hrtb(&mut t); + | --------------- recursive call site | = note: `#[warn(unconditional_recursion)]` on by default = help: a `loop` may express intention better if this is on purpose @@ -20,12 +18,10 @@ warning: function cannot return without recursing LL | / fn bar_hrtb(mut t: T) LL | | where LL | | T: for<'b> Bar<&'b isize>, -LL | | { -... | -LL | | bar_hrtb(&mut t); - | | ---------------- recursive call site -LL | | } - | |_^ cannot return without recursing + | |______________________________^ cannot return without recursing +... +LL | bar_hrtb(&mut t); + | ---------------- recursive call site | = help: a `loop` may express intention better if this is on purpose @@ -35,14 +31,10 @@ warning: function cannot return without recursing LL | / fn foo_hrtb_bar_not<'b, T>(mut t: T) LL | | where LL | | T: for<'a> Foo<&'a isize> + Bar<&'b isize>, -LL | | { -... | -LL | | foo_hrtb_bar_not(&mut t); - | | ------------------------ recursive call site -LL | | -LL | | -LL | | } - | |_^ cannot return without recursing + | |_______________________________________________^ cannot return without recursing +... +LL | foo_hrtb_bar_not(&mut t); + | ------------------------ recursive call site | = help: a `loop` may express intention better if this is on purpose @@ -70,12 +62,10 @@ warning: function cannot return without recursing LL | / fn foo_hrtb_bar_hrtb(mut t: T) LL | | where LL | | T: for<'a> Foo<&'a isize> + for<'b> Bar<&'b isize>, -LL | | { -LL | | // OK -- now we have `T : for<'b> Bar<&'b isize>`. -LL | | foo_hrtb_bar_hrtb(&mut t); - | | ------------------------- recursive call site -LL | | } - | |_^ cannot return without recursing + | |_______________________________________________________^ cannot return without recursing +... +LL | foo_hrtb_bar_hrtb(&mut t); + | ------------------------- recursive call site | = help: a `loop` may express intention better if this is on purpose diff --git a/src/test/ui/issues/issue-12511.stderr b/src/test/ui/issues/issue-12511.stderr index 5f2b98c5237..789a1141c04 100644 --- a/src/test/ui/issues/issue-12511.stderr +++ b/src/test/ui/issues/issue-12511.stderr @@ -23,8 +23,10 @@ LL | trait T2 : T1 { note: cycle used when collecting item types in top-level module --> $DIR/issue-12511.rs:1:1 | -LL | trait T1 : T2 { - | ^^^^^^^^^^^^^ +LL | / trait T1 : T2 { +LL | | +LL | | } + | |_^ error: aborting due to previous error diff --git a/src/test/ui/lint/unreachable_pub.stderr b/src/test/ui/lint/unreachable_pub.stderr index ce22eca1b8c..e021f500c66 100644 --- a/src/test/ui/lint/unreachable_pub.stderr +++ b/src/test/ui/lint/unreachable_pub.stderr @@ -1,8 +1,8 @@ warning: unreachable `pub` item - --> $DIR/unreachable_pub.rs:8:5 + --> $DIR/unreachable_pub.rs:8:13 | LL | pub use std::fmt; - | ---^^^^^^^^^^^^^^ + | --- ^^^^^^^^ | | | help: consider restricting its visibility: `pub(crate)` | @@ -93,7 +93,7 @@ warning: unreachable `pub` item --> $DIR/unreachable_pub.rs:33:5 | LL | pub const CARBON: usize = 1; - | ---^^^^^^^^^^^^^^^^^^^^^^^^^ + | ---^^^^^^^^^^^^^^^^^^^^ | | | help: consider restricting its visibility: `pub(crate)` | @@ -103,7 +103,7 @@ warning: unreachable `pub` item --> $DIR/unreachable_pub.rs:34:5 | LL | pub static NITROGEN: usize = 2; - | ---^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ---^^^^^^^^^^^^^^^^^^^^^^^ | | | help: consider restricting its visibility: `pub(crate)` | @@ -113,7 +113,7 @@ warning: unreachable `pub` item --> $DIR/unreachable_pub.rs:35:5 | LL | pub type Oxygen = bool; - | ---^^^^^^^^^^^^^^^^^^^^ + | ---^^^^^^^^^^^^ | | | help: consider restricting its visibility: `pub(crate)` | @@ -123,7 +123,7 @@ warning: unreachable `pub` item --> $DIR/unreachable_pub.rs:38:47 | LL | ($visibility: vis, $name: ident) => { $visibility struct $name {} } - | ^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ... LL | define_empty_struct_with_visibility!(pub, Fluorine); | --------------------------------------------------- @@ -138,7 +138,7 @@ warning: unreachable `pub` item --> $DIR/unreachable_pub.rs:44:9 | LL | pub fn catalyze() -> bool; - | ---^^^^^^^^^^^^^^^^^^^^^^^ + | ---^^^^^^^^^^^^^^^^^^^^^^ | | | help: consider restricting its visibility: `pub(crate)` | diff --git a/src/test/ui/resolve/issue-23305.stderr b/src/test/ui/resolve/issue-23305.stderr index f839bd42432..20aeb7b995a 100644 --- a/src/test/ui/resolve/issue-23305.stderr +++ b/src/test/ui/resolve/issue-23305.stderr @@ -8,8 +8,14 @@ LL | impl dyn ToNbt {} note: cycle used when collecting item types in top-level module --> $DIR/issue-23305.rs:1:1 | -LL | pub trait ToNbt { - | ^^^^^^^^^^^^^^^^^^ +LL | / pub trait ToNbt { +LL | | fn new(val: T) -> Self; +LL | | } +LL | | +... | +LL | | +LL | | fn main() {} + | |____________^ error: aborting due to previous error diff --git a/src/test/ui/traits/issue-91949-hangs-on-recursion.stderr b/src/test/ui/traits/issue-91949-hangs-on-recursion.stderr index 86dbd0aac03..f5d6d72afc2 100644 --- a/src/test/ui/traits/issue-91949-hangs-on-recursion.stderr +++ b/src/test/ui/traits/issue-91949-hangs-on-recursion.stderr @@ -4,11 +4,10 @@ warning: function cannot return without recursing LL | / fn recurse(elements: T) -> Vec LL | | where LL | | T: Iterator, -LL | | { -LL | | recurse(IteratorOfWrapped(elements).map(|t| t.0)) - | | ------------------------------------------------- recursive call site -LL | | } - | |_^ cannot return without recursing + | |___________________________^ cannot return without recursing +LL | { +LL | recurse(IteratorOfWrapped(elements).map(|t| t.0)) + | ------------------------------------------------- recursive call site | = note: `#[warn(unconditional_recursion)]` on by default = help: a `loop` may express intention better if this is on purpose diff --git a/src/test/ui/traits/trait-upcasting/cyclic-trait-resolution.stderr b/src/test/ui/traits/trait-upcasting/cyclic-trait-resolution.stderr index ac005725ab4..15faab16abe 100644 --- a/src/test/ui/traits/trait-upcasting/cyclic-trait-resolution.stderr +++ b/src/test/ui/traits/trait-upcasting/cyclic-trait-resolution.stderr @@ -14,7 +14,7 @@ note: cycle used when collecting item types in top-level module --> $DIR/cyclic-trait-resolution.rs:1:1 | LL | trait A: B + A {} - | ^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/type-alias-enum-variants/self-in-enum-definition.stderr b/src/test/ui/type-alias-enum-variants/self-in-enum-definition.stderr index 277f4e84240..4775e68820b 100644 --- a/src/test/ui/type-alias-enum-variants/self-in-enum-definition.stderr +++ b/src/test/ui/type-alias-enum-variants/self-in-enum-definition.stderr @@ -2,18 +2,18 @@ error[E0391]: cycle detected when simplifying constant for the type system `Alph --> $DIR/self-in-enum-definition.rs:5:10 | LL | V3 = Self::V1 {} as u8 + 2, - | ^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^ | 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 + 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 simplifying constant for the type system `Alpha::V3::{constant#0}`, completing the cycle note: cycle used when collecting item types in top-level module