diff --git a/compiler/rustc_codegen_llvm/src/context.rs b/compiler/rustc_codegen_llvm/src/context.rs index cc4c5e2c92913..6a6f9f61f3e5d 100644 --- a/compiler/rustc_codegen_llvm/src/context.rs +++ b/compiler/rustc_codegen_llvm/src/context.rs @@ -1135,11 +1135,7 @@ impl<'tcx> FnAbiOfHelpers<'tcx> for CodegenCx<'_, 'tcx> { fn_abi_request: FnAbiRequest<'tcx>, ) -> ! { match err { - FnAbiError::Layout( - LayoutError::SizeOverflow(_) - | LayoutError::Cycle(_) - | LayoutError::InvalidSimd { .. }, - ) => { + FnAbiError::Layout(LayoutError::SizeOverflow(_) | LayoutError::InvalidSimd { .. }) => { self.tcx.dcx().emit_fatal(Spanned { span, node: err }); } _ => match fn_abi_request { diff --git a/compiler/rustc_const_eval/src/interpret/eval_context.rs b/compiler/rustc_const_eval/src/interpret/eval_context.rs index 0bfe012bfe7a4..04f0e7099d840 100644 --- a/compiler/rustc_const_eval/src/interpret/eval_context.rs +++ b/compiler/rustc_const_eval/src/interpret/eval_context.rs @@ -107,8 +107,7 @@ impl<'tcx, M: Machine<'tcx>> LayoutOfHelpers<'tcx> for InterpCx<'tcx, M> { | LayoutError::SizeOverflow(_) | LayoutError::InvalidSimd { .. } | LayoutError::TooGeneric(_) - | LayoutError::ReferencesError(_) - | LayoutError::Cycle(_) => {} + | LayoutError::ReferencesError(_) => {} } err_inval!(Layout(err)) } diff --git a/compiler/rustc_hir_analysis/src/hir_ty_lowering/cmse.rs b/compiler/rustc_hir_analysis/src/hir_ty_lowering/cmse.rs index 58c296d92c24e..a1b169c6a1661 100644 --- a/compiler/rustc_hir_analysis/src/hir_ty_lowering/cmse.rs +++ b/compiler/rustc_hir_analysis/src/hir_ty_lowering/cmse.rs @@ -194,8 +194,7 @@ fn should_emit_layout_error<'tcx>(abi: ExternAbi, layout_err: &'tcx LayoutError< | SizeOverflow(..) | InvalidSimd { .. } | NormalizationFailure(..) - | ReferencesError(..) - | Cycle(..) => { + | ReferencesError(..) => { false // not our job to report these } } diff --git a/compiler/rustc_middle/src/ty/layout.rs b/compiler/rustc_middle/src/ty/layout.rs index 4ca51c078bef5..46682abc823d8 100644 --- a/compiler/rustc_middle/src/ty/layout.rs +++ b/compiler/rustc_middle/src/ty/layout.rs @@ -260,8 +260,6 @@ pub enum LayoutError<'tcx> { NormalizationFailure(Ty<'tcx>, NormalizationError<'tcx>), /// A non-layout error is reported elsewhere. ReferencesError(ErrorGuaranteed), - /// A type has cyclic layout, i.e. the type contains itself without indirection. - Cycle(ErrorGuaranteed), } impl<'tcx> fmt::Display for LayoutError<'tcx> { @@ -286,7 +284,6 @@ impl<'tcx> fmt::Display for LayoutError<'tcx> { t, e.get_type_for_failure() ), - LayoutError::Cycle(_) => write!(f, "a cycle occurred during layout computation"), LayoutError::ReferencesError(_) => write!(f, "the type has an unknown layout"), } } @@ -358,8 +355,7 @@ impl<'tcx> SizeSkeleton<'tcx> { Err(err @ LayoutError::TooGeneric(_)) => err, // We can't extract SizeSkeleton info from other layout errors Err( - e @ LayoutError::Cycle(_) - | e @ LayoutError::Unknown(_) + e @ LayoutError::Unknown(_) | e @ LayoutError::SizeOverflow(_) | e @ LayoutError::InvalidSimd { .. } | e @ LayoutError::NormalizationFailure(..) diff --git a/compiler/rustc_query_impl/src/from_cycle_error.rs b/compiler/rustc_query_impl/src/from_cycle_error.rs index fa508419b52f2..b86cbb8db297f 100644 --- a/compiler/rustc_query_impl/src/from_cycle_error.rs +++ b/compiler/rustc_query_impl/src/from_cycle_error.rs @@ -12,7 +12,6 @@ use rustc_middle::dep_graph::DepKind; use rustc_middle::queries::{QueryVTables, TaggedQueryKey}; use rustc_middle::query::CycleError; use rustc_middle::query::erase::erase_val; -use rustc_middle::ty::layout::LayoutError; use rustc_middle::ty::{self, Ty, TyCtxt}; use rustc_middle::{bug, span_bug}; use rustc_span::def_id::{DefId, LocalDefId}; @@ -226,8 +225,7 @@ fn layout_of<'tcx>( || report_cycle(tcx, &cycle_error), ); - let guar = diag.emit(); - tcx.arena.alloc(LayoutError::Cycle(guar)) + diag.emit().raise_fatal() } // item_and_field_ids should form a cycle where each field contains the diff --git a/compiler/rustc_transmute/src/layout/tree.rs b/compiler/rustc_transmute/src/layout/tree.rs index 1202ed2384315..1bfe6e94cc3b6 100644 --- a/compiler/rustc_transmute/src/layout/tree.rs +++ b/compiler/rustc_transmute/src/layout/tree.rs @@ -282,7 +282,6 @@ pub(crate) mod rustc { | LayoutError::InvalidSimd { .. } | LayoutError::NormalizationFailure(..) => Self::UnknownLayout, LayoutError::SizeOverflow(..) => Self::SizeOverflow, - LayoutError::Cycle(err) => Self::TypeError(*err), } } } diff --git a/src/librustdoc/html/templates/type_layout.html b/src/librustdoc/html/templates/type_layout.html index 49153d58fe98c..4d4222a34956a 100644 --- a/src/librustdoc/html/templates/type_layout.html +++ b/src/librustdoc/html/templates/type_layout.html @@ -60,11 +60,6 @@
{# #} - Note: Encountered an error during type layout; {#+ #} - the type's layout depended on the type's layout itself. {# #} -
{% when Err(LayoutError::InvalidSimd {..}) %} {# #}
Note: Encountered an error during type layout; {#+ #}
diff --git a/src/tools/miri/src/eval.rs b/src/tools/miri/src/eval.rs
index 1e75df7d278fb..cf4f7d689ac22 100644
--- a/src/tools/miri/src/eval.rs
+++ b/src/tools/miri/src/eval.rs
@@ -10,6 +10,7 @@ use std::{iter, thread};
use rustc_abi::ExternAbi;
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
+use rustc_errors::FatalErrorMarker;
use rustc_hir::def::Namespace;
use rustc_hir::def_id::DefId;
use rustc_middle::ty::layout::{HasTyCtxt, HasTypingEnv, LayoutCx};
@@ -477,7 +478,11 @@ pub fn eval_entry<'tcx>(
let res: thread::Result> as std::mem::SizedTypeProperties>::SIZE` failed here
-
-error: aborting due to 2 previous errors
+error: aborting due to 1 previous error
-Some errors have detailed explanations: E0080, E0391.
-For more information about an error, try `rustc --explain E0080`.
+For more information about this error, try `rustc --explain E0391`.
diff --git a/tests/ui/layout/layout-cycle.rs b/tests/ui/layout/layout-cycle.rs
index b38bd52c6ade9..846ce0882cad1 100644
--- a/tests/ui/layout/layout-cycle.rs
+++ b/tests/ui/layout/layout-cycle.rs
@@ -1,6 +1,5 @@
//@ build-fail
//~^ ERROR: cycle detected when computing layout of
-//~? ERROR: a cycle occurred during layout computation
// Issue #111176 -- ensure that we do not emit ICE on layout cycles
diff --git a/tests/ui/layout/layout-cycle.stderr b/tests/ui/layout/layout-cycle.stderr
index e05ff614567c4..28c35d431226e 100644
--- a/tests/ui/layout/layout-cycle.stderr
+++ b/tests/ui/layout/layout-cycle.stderr
@@ -6,18 +6,6 @@ note: cycle used when const-evaluating + checking `core::mem::SizedTypePropertie
--> $SRC_DIR/core/src/mem/mod.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[E0080]: a cycle occurred during layout computation
- --> $SRC_DIR/core/src/mem/mod.rs:LL:COL
- |
- = note: evaluation of `> as std::mem::SizedTypeProperties>::SIZE` failed here
-
-note: the above error was encountered while instantiating `fn std::mem::size_of::>>`
- --> $DIR/layout-cycle.rs:26:5
- |
-LL | mem::size_of::>()
- | ^^^^^^^^^^^^^^^^^^^^^^
-
-error: aborting due to 2 previous errors
+error: aborting due to 1 previous error
-Some errors have detailed explanations: E0080, E0391.
-For more information about an error, try `rustc --explain E0080`.
+For more information about this error, try `rustc --explain E0391`.
diff --git a/tests/ui/layout/post-mono-layout-cycle.stderr b/tests/ui/layout/post-mono-layout-cycle.stderr
index 7f246b3d409ad..b9b1b988499e6 100644
--- a/tests/ui/layout/post-mono-layout-cycle.stderr
+++ b/tests/ui/layout/post-mono-layout-cycle.stderr
@@ -5,12 +5,6 @@ error[E0391]: cycle detected when computing layout of `Wrapper<()>`
= note: cycle used when computing layout of `core::option::Option