@@ -23,11 +23,12 @@ fn equate_intrinsic_type<'tcx>(
2323 n_tps : usize ,
2424 sig : ty:: PolyFnSig < ' tcx > ,
2525) {
26+ let it_span = tcx. hir ( ) . span ( it. hir_id ( ) ) ;
2627 match it. kind {
2728 hir:: ForeignItemKind :: Fn ( ..) => { }
2829 _ => {
29- struct_span_err ! ( tcx. sess, it . span , E0622 , "intrinsic must be a function" )
30- . span_label ( it . span , "expected a function" )
30+ struct_span_err ! ( tcx. sess, it_span , E0622 , "intrinsic must be a function" )
31+ . span_label ( it_span , "expected a function" )
3132 . emit ( ) ;
3233 return ;
3334 }
@@ -49,7 +50,7 @@ fn equate_intrinsic_type<'tcx>(
4950 }
5051
5152 let fty = tcx. mk_fn_ptr ( sig) ;
52- let cause = ObligationCause :: new ( it . span , it. hir_id ( ) , ObligationCauseCode :: IntrinsicType ) ;
53+ let cause = ObligationCause :: new ( it_span , it. hir_id ( ) , ObligationCauseCode :: IntrinsicType ) ;
5354 require_same_types ( tcx, & cause, tcx. mk_fn_ptr ( tcx. fn_sig ( it. def_id ) ) , fty) ;
5455}
5556
@@ -130,7 +131,8 @@ pub fn check_intrinsic_type(tcx: TyCtxt<'_>, it: &hir::ForeignItem<'_>) {
130131 | "umin" => ( 1 , vec ! [ tcx. mk_mut_ptr( param( 0 ) ) , param( 0 ) ] , param ( 0 ) ) ,
131132 "fence" | "singlethreadfence" => ( 0 , Vec :: new ( ) , tcx. mk_unit ( ) ) ,
132133 op => {
133- tcx. sess . emit_err ( UnrecognizedAtomicOperation { span : it. span , op } ) ;
134+ let it_span = tcx. hir ( ) . span ( it. hir_id ( ) ) ;
135+ tcx. sess . emit_err ( UnrecognizedAtomicOperation { span : it_span, op } ) ;
134136 return ;
135137 }
136138 } ;
@@ -359,7 +361,8 @@ pub fn check_intrinsic_type(tcx: TyCtxt<'_>, it: &hir::ForeignItem<'_>) {
359361 sym:: nontemporal_store => ( 1 , vec ! [ tcx. mk_mut_ptr( param( 0 ) ) , param( 0 ) ] , tcx. mk_unit ( ) ) ,
360362
361363 other => {
362- tcx. sess . emit_err ( UnrecognizedIntrinsicFunction { span : it. span , name : other } ) ;
364+ let it_span = tcx. hir ( ) . span ( it. hir_id ( ) ) ;
365+ tcx. sess . emit_err ( UnrecognizedIntrinsicFunction { span : it_span, name : other } ) ;
363366 return ;
364367 }
365368 } ;
@@ -440,14 +443,16 @@ pub fn check_platform_intrinsic_type(tcx: TyCtxt<'_>, it: &hir::ForeignItem<'_>)
440443 ( 2 , params, param ( 1 ) )
441444 }
442445 Err ( _) => {
443- tcx. sess . emit_err ( SimdShuffleMissingLength { span : it. span , name } ) ;
446+ let it_span = tcx. hir ( ) . span ( it. hir_id ( ) ) ;
447+ tcx. sess . emit_err ( SimdShuffleMissingLength { span : it_span, name } ) ;
444448 return ;
445449 }
446450 }
447451 }
448452 _ => {
449453 let msg = format ! ( "unrecognized platform-specific intrinsic function: `{}`" , name) ;
450- tcx. sess . struct_span_err ( it. span , & msg) . emit ( ) ;
454+ let it_span = tcx. hir ( ) . span ( it. hir_id ( ) ) ;
455+ tcx. sess . struct_span_err ( it_span, & msg) . emit ( ) ;
451456 return ;
452457 }
453458 } ;
0 commit comments