@@ -470,14 +470,15 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
470
470
block. and ( place_builder)
471
471
}
472
472
473
- ExprKind :: PlaceTypeAscription { source, ref user_ty } => {
473
+ ExprKind :: PlaceTypeAscription { source, ref user_ty, user_ty_span } => {
474
474
let place_builder = unpack ! (
475
475
block = this. expr_as_place( block, source, mutability, fake_borrow_temps, )
476
476
) ;
477
477
if let Some ( user_ty) = user_ty {
478
+ let ty_source_info = this. source_info ( user_ty_span) ;
478
479
let annotation_index =
479
480
this. canonical_user_type_annotations . push ( CanonicalUserTypeAnnotation {
480
- span : source_info . span ,
481
+ span : user_ty_span ,
481
482
user_ty : user_ty. clone ( ) ,
482
483
inferred_ty : expr. ty ,
483
484
} ) ;
@@ -486,7 +487,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
486
487
this. cfg . push (
487
488
block,
488
489
Statement {
489
- source_info,
490
+ source_info : ty_source_info ,
490
491
kind : StatementKind :: AscribeUserType (
491
492
Box :: new ( (
492
493
place,
@@ -499,22 +500,23 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
499
500
}
500
501
block. and ( place_builder)
501
502
}
502
- ExprKind :: ValueTypeAscription { source, ref user_ty } => {
503
+ ExprKind :: ValueTypeAscription { source, ref user_ty, user_ty_span } => {
503
504
let source_expr = & this. thir [ source] ;
504
505
let temp = unpack ! (
505
506
block = this. as_temp( block, source_expr. temp_lifetime, source, mutability)
506
507
) ;
507
508
if let Some ( user_ty) = user_ty {
509
+ let ty_source_info = this. source_info ( user_ty_span) ;
508
510
let annotation_index =
509
511
this. canonical_user_type_annotations . push ( CanonicalUserTypeAnnotation {
510
- span : source_info . span ,
512
+ span : user_ty_span ,
511
513
user_ty : user_ty. clone ( ) ,
512
514
inferred_ty : expr. ty ,
513
515
} ) ;
514
516
this. cfg . push (
515
517
block,
516
518
Statement {
517
- source_info,
519
+ source_info : ty_source_info ,
518
520
kind : StatementKind :: AscribeUserType (
519
521
Box :: new ( (
520
522
Place :: from ( temp) ,
0 commit comments