@@ -3,7 +3,6 @@ use crate::thir::cx::region::Scope;
33use crate :: thir:: cx:: Cx ;
44use crate :: thir:: util:: UserAnnotatedTyHelpers ;
55use itertools:: Itertools ;
6- use rustc_ast:: LitKind ;
76use rustc_data_structures:: stack:: ensure_sufficient_stack;
87use rustc_hir as hir;
98use rustc_hir:: def:: { CtorKind , CtorOf , DefKind , Res } ;
@@ -22,8 +21,7 @@ use rustc_middle::ty::{
2221 self , AdtKind , InlineConstArgs , InlineConstArgsParts , ScalarInt , Ty , UpvarArgs , UserType ,
2322} ;
2423use rustc_middle:: { bug, span_bug} ;
25- use rustc_span:: source_map:: Spanned ;
26- use rustc_span:: { sym, Span , DUMMY_SP } ;
24+ use rustc_span:: { sym, Span } ;
2725use rustc_target:: abi:: { FieldIdx , FIRST_VARIANT } ;
2826use tracing:: { debug, info, instrument, trace} ;
2927
@@ -899,14 +897,10 @@ impl<'tcx> Cx<'tcx> {
899897 let hir_id = self . tcx . local_def_id_to_hir_id ( def_id. expect_local ( ) ) ;
900898 let generics = self . tcx . generics_of ( hir_id. owner ) ;
901899 let Some ( & index) = generics. param_def_id_to_index . get ( & def_id) else {
902- let guar = self . tcx . dcx ( ) . has_errors ( ) . unwrap ( ) ;
903- // We already errored about a late bound const
904-
905- let lit = self
906- . tcx
907- . hir_arena
908- . alloc ( Spanned { span : DUMMY_SP , node : LitKind :: Err ( guar) } ) ;
909- return ExprKind :: Literal { lit, neg : false } ;
900+ span_bug ! (
901+ expr. span,
902+ "Should have already errored about late bound consts: {def_id:?}"
903+ ) ;
910904 } ;
911905 let name = self . tcx . hir ( ) . name ( hir_id) ;
912906 let param = ty:: ParamConst :: new ( index, name) ;
0 commit comments