@@ -13,7 +13,7 @@ use rustc_middle::mir::mono::CodegenUnit;
13
13
use rustc_middle:: ty:: { self , Instance , ParamEnv , PolyExistentialTraitRef , Ty , TyCtxt } ;
14
14
use rustc_middle:: ty:: layout:: { FnAbiError , FnAbiOfHelpers , FnAbiRequest , HasParamEnv , HasTyCtxt , LayoutError , TyAndLayout , LayoutOfHelpers } ;
15
15
use rustc_session:: Session ;
16
- use rustc_span:: Span ;
16
+ use rustc_span:: { Span , source_map :: respan } ;
17
17
use rustc_target:: abi:: { call:: FnAbi , HasDataLayout , PointeeInfo , Size , TargetDataLayout , VariantIdx } ;
18
18
use rustc_target:: spec:: { HasTargetSpec , Target , TlsModel } ;
19
19
@@ -293,7 +293,7 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> {
293
293
self . is_native_int_type ( typ) || self . is_non_native_int_type ( typ) || typ. is_compatible_with ( self . bool_type )
294
294
}
295
295
296
- pub fn sess ( & self ) -> & Session {
296
+ pub fn sess ( & self ) -> & ' tcx Session {
297
297
& self . tcx . sess
298
298
}
299
299
@@ -416,10 +416,6 @@ impl<'gcc, 'tcx> MiscMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
416
416
self . codegen_unit
417
417
}
418
418
419
- fn used_statics ( & self ) -> & RefCell < Vec < RValue < ' gcc > > > {
420
- unimplemented ! ( ) ;
421
- }
422
-
423
419
fn set_frame_pointer_type ( & self , _llfn : RValue < ' gcc > ) {
424
420
// TODO(antoyo)
425
421
}
@@ -428,10 +424,6 @@ impl<'gcc, 'tcx> MiscMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
428
424
// TODO(antoyo)
429
425
}
430
426
431
- fn create_used_variable ( & self ) {
432
- unimplemented ! ( ) ;
433
- }
434
-
435
427
fn declare_c_main ( & self , fn_type : Self :: Type ) -> Option < Self :: Function > {
436
428
if self . get_declared_value ( "main" ) . is_none ( ) {
437
429
Some ( self . declare_cfn ( "main" , fn_type) )
@@ -443,14 +435,6 @@ impl<'gcc, 'tcx> MiscMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
443
435
None
444
436
}
445
437
}
446
-
447
- fn compiler_used_statics ( & self ) -> & RefCell < Vec < RValue < ' gcc > > > {
448
- unimplemented ! ( )
449
- }
450
-
451
- fn create_compiler_used_variable ( & self ) {
452
- unimplemented ! ( )
453
- }
454
438
}
455
439
456
440
impl < ' gcc , ' tcx > HasTyCtxt < ' tcx > for CodegenCx < ' gcc , ' tcx > {
@@ -477,7 +461,7 @@ impl<'gcc, 'tcx> LayoutOfHelpers<'tcx> for CodegenCx<'gcc, 'tcx> {
477
461
#[ inline]
478
462
fn handle_layout_err ( & self , err : LayoutError < ' tcx > , span : Span , ty : Ty < ' tcx > ) -> ! {
479
463
if let LayoutError :: SizeOverflow ( _) = err {
480
- self . sess ( ) . span_fatal ( span, & err. to_string ( ) )
464
+ self . sess ( ) . emit_fatal ( respan ( span, err) )
481
465
} else {
482
466
span_bug ! ( span, "failed to get layout for `{}`: {}" , ty, err)
483
467
}
@@ -495,7 +479,7 @@ impl<'gcc, 'tcx> FnAbiOfHelpers<'tcx> for CodegenCx<'gcc, 'tcx> {
495
479
fn_abi_request : FnAbiRequest < ' tcx > ,
496
480
) -> ! {
497
481
if let FnAbiError :: Layout ( LayoutError :: SizeOverflow ( _) ) = err {
498
- self . sess ( ) . span_fatal ( span, & err. to_string ( ) )
482
+ self . sess ( ) . emit_fatal ( respan ( span, err) )
499
483
} else {
500
484
match fn_abi_request {
501
485
FnAbiRequest :: OfFnPtr { sig, extra_args } => {
0 commit comments