@@ -26,7 +26,6 @@ use rustc_middle::ty::{
2626use rustc_middle:: ty:: { GenericParamDef , GenericParamDefKind } ;
2727use rustc_session:: lint:: builtin:: { AMBIGUOUS_ASSOCIATED_ITEMS , LATE_BOUND_LIFETIME_ARGUMENTS } ;
2828use rustc_session:: parse:: feature_err;
29- use rustc_session:: Session ;
3029use rustc_span:: symbol:: { sym, Ident , Symbol } ;
3130use rustc_span:: { MultiSpan , Span , DUMMY_SP } ;
3231use rustc_target:: spec:: abi;
@@ -260,12 +259,13 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
260259 } ) ;
261260
262261 if explicit && impl_trait {
262+ let hir = tcx. hir ( ) ;
263263 let spans = seg
264264 . generic_args ( )
265265 . args
266266 . iter ( )
267267 . filter_map ( |arg| match arg {
268- GenericArg :: Type ( _) => Some ( arg . span ( ) ) ,
268+ GenericArg :: Type ( _) => Some ( hir . span ( arg . id ( ) ) ) ,
269269 _ => None ,
270270 } )
271271 . collect :: < Vec < _ > > ( ) ;
@@ -388,7 +388,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
388388 // we want to point to the unexpected arguments.
389389 let spans: Vec < Span > = args. args [ offset + permitted..offset + provided]
390390 . iter ( )
391- . map ( |arg| arg . span ( ) )
391+ . map ( |arg| tcx . hir ( ) . span ( arg . id ( ) ) )
392392 . collect ( ) ;
393393 unexpected_spans. extend ( spans. clone ( ) ) ;
394394 ( spans, format ! ( "unexpected {} argument" , kind) )
@@ -475,10 +475,10 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
475475
476476 /// Report an error that a generic argument did not match the generic parameter that was
477477 /// expected.
478- fn generic_arg_mismatch_err ( sess : & Session , arg : & GenericArg < ' _ > , kind : & ' static str ) {
478+ fn generic_arg_mismatch_err ( tcx : TyCtxt < ' _ > , arg : & GenericArg < ' _ > , kind : & ' static str ) {
479479 let mut err = struct_span_err ! (
480- sess,
481- arg . span( ) ,
480+ tcx . sess,
481+ tcx . hir ( ) . span( arg . id ( ) ) ,
482482 E0747 ,
483483 "{} provided when a {} was expected" ,
484484 arg. descr( ) ,
@@ -648,7 +648,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
648648 if arg_count. correct . is_ok ( )
649649 && arg_count. explicit_late_bound == ExplicitLateBound :: No
650650 {
651- Self :: generic_arg_mismatch_err ( tcx. sess , arg, kind. descr ( ) ) ;
651+ Self :: generic_arg_mismatch_err ( tcx, arg, kind. descr ( ) ) ;
652652 }
653653
654654 // We've reported the error, but we want to make sure that this
@@ -680,7 +680,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
680680 assert_eq ! ( kind, "lifetime" ) ;
681681 let provided =
682682 force_infer_lt. expect ( "lifetimes ought to have been inferred" ) ;
683- Self :: generic_arg_mismatch_err ( tcx. sess , provided, kind) ;
683+ Self :: generic_arg_mismatch_err ( tcx, provided, kind) ;
684684 }
685685
686686 break ;
@@ -2539,7 +2539,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
25392539 let msg = "cannot specify lifetime arguments explicitly \
25402540 if late bound lifetime parameters are present";
25412541 let note = "the late bound lifetime parameter is introduced here" ;
2542- let span = args. args [ 0 ] . span ( ) ;
2542+ let span = tcx . hir ( ) . span ( args. args [ 0 ] . id ( ) ) ;
25432543 if position == GenericArgPosition :: Value
25442544 && arg_counts. lifetimes != param_counts. lifetimes
25452545 {
0 commit comments