@@ -88,8 +88,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
8888 let kind = hir:: ExprKind :: Box ( self . lower_expr ( & inner) ) ;
8989 return hir:: Expr { hir_id, kind, span : self . lower_span ( e. span ) } ;
9090 } else {
91- self . tcx . sess . emit_err ( RustcBoxAttributeError { span : e. span } ) ;
92- hir:: ExprKind :: Err
91+ let guar = self . tcx . sess . emit_err ( RustcBoxAttributeError { span : e. span } ) ;
92+ hir:: ExprKind :: Err ( guar )
9393 }
9494 } else if let Some ( legacy_args) = self . resolver . legacy_const_generic_args ( f) {
9595 self . lower_legacy_const_generics ( ( * * f) . clone ( ) , args. clone ( ) , & legacy_args)
@@ -266,8 +266,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
266266 self . lower_expr_range ( e. span , e1. as_deref ( ) , e2. as_deref ( ) , * lims)
267267 }
268268 ExprKind :: Underscore => {
269- self . tcx . sess . emit_err ( UnderscoreExprLhsAssign { span : e. span } ) ;
270- hir:: ExprKind :: Err
269+ let guar = self . tcx . sess . emit_err ( UnderscoreExprLhsAssign { span : e. span } ) ;
270+ hir:: ExprKind :: Err ( guar )
271271 }
272272 ExprKind :: Path ( qself, path) => {
273273 let qpath = self . lower_qpath (
@@ -299,8 +299,9 @@ impl<'hir> LoweringContext<'_, 'hir> {
299299 let rest = match & se. rest {
300300 StructRest :: Base ( e) => Some ( self . lower_expr ( e) ) ,
301301 StructRest :: Rest ( sp) => {
302- self . tcx . sess . emit_err ( BaseExpressionDoubleDot { span : * sp } ) ;
303- Some ( & * self . arena . alloc ( self . expr_err ( * sp) ) )
302+ let guar =
303+ self . tcx . sess . emit_err ( BaseExpressionDoubleDot { span : * sp } ) ;
304+ Some ( & * self . arena . alloc ( self . expr_err ( * sp, guar) ) )
304305 }
305306 StructRest :: None => None ,
306307 } ;
@@ -318,7 +319,9 @@ impl<'hir> LoweringContext<'_, 'hir> {
318319 )
319320 }
320321 ExprKind :: Yield ( opt_expr) => self . lower_expr_yield ( e. span , opt_expr. as_deref ( ) ) ,
321- ExprKind :: Err => hir:: ExprKind :: Err ,
322+ ExprKind :: Err => hir:: ExprKind :: Err (
323+ self . tcx . sess . delay_span_bug ( e. span , "lowered ExprKind::Err" ) ,
324+ ) ,
322325 ExprKind :: Try ( sub_expr) => self . lower_expr_try ( e. span , sub_expr) ,
323326
324327 ExprKind :: Paren ( _) | ExprKind :: ForLoop ( ..) => unreachable ! ( "already handled" ) ,
@@ -761,7 +764,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
761764 self . expr_ident_mut ( span, task_context_ident, task_context_hid)
762765 } else {
763766 // Use of `await` outside of an async context, we cannot use `task_context` here.
764- self . expr_err ( span)
767+ self . expr_err ( span, self . tcx . sess . delay_span_bug ( span , "no task_context hir id" ) )
765768 } ;
766769 let new_unchecked = self . expr_call_lang_item_fn_mut (
767770 span,
0 commit comments