@@ -23,11 +23,12 @@ fn equate_intrinsic_type<'tcx>(
23
23
n_tps : usize ,
24
24
sig : ty:: PolyFnSig < ' tcx > ,
25
25
) {
26
+ let it_span = tcx. hir ( ) . span ( it. hir_id ( ) ) ;
26
27
match it. kind {
27
28
hir:: ForeignItemKind :: Fn ( ..) => { }
28
29
_ => {
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" )
31
32
. emit ( ) ;
32
33
return ;
33
34
}
@@ -49,7 +50,7 @@ fn equate_intrinsic_type<'tcx>(
49
50
}
50
51
51
52
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 ) ;
53
54
require_same_types ( tcx, & cause, tcx. mk_fn_ptr ( tcx. fn_sig ( it. def_id ) ) , fty) ;
54
55
}
55
56
@@ -130,7 +131,8 @@ pub fn check_intrinsic_type(tcx: TyCtxt<'_>, it: &hir::ForeignItem<'_>) {
130
131
| "umin" => ( 1 , vec ! [ tcx. mk_mut_ptr( param( 0 ) ) , param( 0 ) ] , param ( 0 ) ) ,
131
132
"fence" | "singlethreadfence" => ( 0 , Vec :: new ( ) , tcx. mk_unit ( ) ) ,
132
133
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 } ) ;
134
136
return ;
135
137
}
136
138
} ;
@@ -359,7 +361,8 @@ pub fn check_intrinsic_type(tcx: TyCtxt<'_>, it: &hir::ForeignItem<'_>) {
359
361
sym:: nontemporal_store => ( 1 , vec ! [ tcx. mk_mut_ptr( param( 0 ) ) , param( 0 ) ] , tcx. mk_unit ( ) ) ,
360
362
361
363
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 } ) ;
363
366
return ;
364
367
}
365
368
} ;
@@ -440,14 +443,16 @@ pub fn check_platform_intrinsic_type(tcx: TyCtxt<'_>, it: &hir::ForeignItem<'_>)
440
443
( 2 , params, param ( 1 ) )
441
444
}
442
445
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 } ) ;
444
448
return ;
445
449
}
446
450
}
447
451
}
448
452
_ => {
449
453
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 ( ) ;
451
456
return ;
452
457
}
453
458
} ;
0 commit comments