@@ -470,14 +470,15 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
470470 block. and ( place_builder)
471471 }
472472
473- ExprKind :: PlaceTypeAscription { source, ref user_ty } => {
473+ ExprKind :: PlaceTypeAscription { source, ref user_ty, user_ty_span } => {
474474 let place_builder = unpack ! (
475475 block = this. expr_as_place( block, source, mutability, fake_borrow_temps, )
476476 ) ;
477477 if let Some ( user_ty) = user_ty {
478+ let ty_source_info = this. source_info ( user_ty_span) ;
478479 let annotation_index =
479480 this. canonical_user_type_annotations . push ( CanonicalUserTypeAnnotation {
480- span : source_info . span ,
481+ span : user_ty_span ,
481482 user_ty : user_ty. clone ( ) ,
482483 inferred_ty : expr. ty ,
483484 } ) ;
@@ -486,7 +487,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
486487 this. cfg . push (
487488 block,
488489 Statement {
489- source_info,
490+ source_info : ty_source_info ,
490491 kind : StatementKind :: AscribeUserType (
491492 Box :: new ( (
492493 place,
@@ -499,22 +500,23 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
499500 }
500501 block. and ( place_builder)
501502 }
502- ExprKind :: ValueTypeAscription { source, ref user_ty } => {
503+ ExprKind :: ValueTypeAscription { source, ref user_ty, user_ty_span } => {
503504 let source_expr = & this. thir [ source] ;
504505 let temp = unpack ! (
505506 block = this. as_temp( block, source_expr. temp_lifetime, source, mutability)
506507 ) ;
507508 if let Some ( user_ty) = user_ty {
509+ let ty_source_info = this. source_info ( user_ty_span) ;
508510 let annotation_index =
509511 this. canonical_user_type_annotations . push ( CanonicalUserTypeAnnotation {
510- span : source_info . span ,
512+ span : user_ty_span ,
511513 user_ty : user_ty. clone ( ) ,
512514 inferred_ty : expr. ty ,
513515 } ) ;
514516 this. cfg . push (
515517 block,
516518 Statement {
517- source_info,
519+ source_info : ty_source_info ,
518520 kind : StatementKind :: AscribeUserType (
519521 Box :: new ( (
520522 Place :: from ( temp) ,
0 commit comments