@@ -18,7 +18,6 @@ use rustc_target::abi::{call::FnAbi, HasDataLayout, PointeeInfo, Size, TargetDat
1818use rustc_target:: spec:: { HasTargetSpec , Target , TlsModel } ;
1919
2020use crate :: callee:: get_fn;
21- use crate :: errors:: LayoutSizeOverflow ;
2221
2322#[ derive( Clone ) ]
2423pub struct FuncSig < ' gcc > {
@@ -294,7 +293,7 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> {
294293 self . is_native_int_type ( typ) || self . is_non_native_int_type ( typ) || typ. is_compatible_with ( self . bool_type )
295294 }
296295
297- pub fn sess ( & self ) -> & Session {
296+ pub fn sess ( & self ) -> & ' tcx Session {
298297 & self . tcx . sess
299298 }
300299
@@ -478,24 +477,7 @@ impl<'gcc, 'tcx> LayoutOfHelpers<'tcx> for CodegenCx<'gcc, 'tcx> {
478477 #[ inline]
479478 fn handle_layout_err ( & self , err : LayoutError < ' tcx > , span : Span , ty : Ty < ' tcx > ) -> ! {
480479 if let LayoutError :: SizeOverflow ( _) = err {
481- let _ = respan ( span, err) ;
482- // error: lifetime may not live long enough
483- // --> src/context.rs:483:13
484- // |
485- // 475 | impl<'gcc, 'tcx> LayoutOfHelpers<'tcx> for CodegenCx<'gcc, 'tcx> {
486- // | ---- ---- lifetime `'tcx` defined here
487- // | |
488- // | lifetime `'gcc` defined here
489- // ...
490- // 483 | self.sess().emit_fatal(respan(span, err))
491- // | ^^^^^^^^^^^ argument requires that `'gcc` must outlive `'tcx`
492- // |
493- // = help: consider adding the following bound: `'gcc: 'tcx`
494- // = note: requirement occurs because of the type `CodegenCx<'_, '_>`, which makes the generic argument `'_` invariant
495- // = note: the struct `CodegenCx<'gcc, 'tcx>` is invariant over the parameter `'gcc`
496- // = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
497- // self.sess().emit_fatal(respan(span, err))
498- self . sess ( ) . emit_fatal ( LayoutSizeOverflow { span, error : err. to_string ( ) } )
480+ self . sess ( ) . emit_fatal ( respan ( span, err) )
499481 } else {
500482 span_bug ! ( span, "failed to get layout for `{}`: {}" , ty, err)
501483 }
@@ -513,7 +495,7 @@ impl<'gcc, 'tcx> FnAbiOfHelpers<'tcx> for CodegenCx<'gcc, 'tcx> {
513495 fn_abi_request : FnAbiRequest < ' tcx > ,
514496 ) -> ! {
515497 if let FnAbiError :: Layout ( LayoutError :: SizeOverflow ( _) ) = err {
516- self . sess ( ) . emit_fatal ( LayoutSizeOverflow { span, error : err. to_string ( ) } )
498+ self . sess ( ) . emit_fatal ( respan ( span, err) )
517499 } else {
518500 match fn_abi_request {
519501 FnAbiRequest :: OfFnPtr { sig, extra_args } => {
0 commit comments