@@ -4,7 +4,6 @@ use rustc_errors::{DiagnosticArgValue, DiagnosticMessage, IntoDiagnostic, IntoDi
44use rustc_middle:: mir:: AssertKind ;
55use rustc_middle:: ty:: TyCtxt ;
66use rustc_middle:: ty:: { layout:: LayoutError , ConstInt } ;
7- use rustc_span:: source_map:: Spanned ;
87use rustc_span:: { ErrorGuaranteed , Span , Symbol } ;
98
109use super :: InterpCx ;
@@ -132,35 +131,17 @@ where
132131{
133132 // Special handling for certain errors
134133 match error {
135- // Don't emit a new diagnostic for these errors
134+ // Don't emit a new diagnostic for these errors, they are already reported elsewhere or
135+ // should remain silent.
136136 err_inval ! ( Layout ( LayoutError :: Unknown ( _) ) ) | err_inval ! ( TooGeneric ) => {
137137 ErrorHandled :: TooGeneric
138138 }
139139 err_inval ! ( AlreadyReported ( guar) ) => ErrorHandled :: Reported ( guar) ,
140140 err_inval ! ( Layout ( LayoutError :: ReferencesError ( guar) ) ) => {
141141 ErrorHandled :: Reported ( guar. into ( ) )
142142 }
143- err_inval ! ( Layout ( layout_error @ LayoutError :: SizeOverflow ( _) ) ) => {
144- // We must *always* hard error on these, even if the caller wants just a lint.
145- // The `message` makes little sense here, this is a more serious error than the
146- // caller thinks anyway.
147- // See <https://github.com/rust-lang/rust/pull/63152>.
148- let ( our_span, frames) = get_span_and_frames ( ) ;
149- let span = span. unwrap_or ( our_span) ;
150- let mut err =
151- tcx. sess . create_err ( Spanned { span, node : layout_error. into_diagnostic ( ) } ) ;
152- err. code ( rustc_errors:: error_code!( E0080 ) ) ;
153- let Some ( ( mut err, handler) ) = err. into_diagnostic ( ) else {
154- panic ! ( "did not emit diag" ) ;
155- } ;
156- for frame in frames {
157- err. eager_subdiagnostic ( handler, frame) ;
158- }
159-
160- ErrorHandled :: Reported ( handler. emit_diagnostic ( & mut err) . unwrap ( ) . into ( ) )
161- }
143+ // Report remaining errors.
162144 _ => {
163- // Report as hard error.
164145 let ( our_span, frames) = get_span_and_frames ( ) ;
165146 let span = span. unwrap_or ( our_span) ;
166147 let err = mk ( span, frames) ;
0 commit comments