@@ -36,12 +36,13 @@ use crate::traits::{Obligation, PredicateObligations};
3636
3737use rustc_ast:: ast;
3838use rustc_hir:: def_id:: DefId ;
39+ use rustc_middle:: traits:: ObligationCause ;
3940use rustc_middle:: ty:: error:: TypeError ;
4041use rustc_middle:: ty:: relate:: { self , Relate , RelateResult , TypeRelation } ;
4142use rustc_middle:: ty:: subst:: SubstsRef ;
4243use rustc_middle:: ty:: { self , InferConst , ToPredicate , Ty , TyCtxt , TypeFoldable } ;
4344use rustc_middle:: ty:: { IntType , UintType } ;
44- use rustc_span:: { Span , DUMMY_SP } ;
45+ use rustc_span:: DUMMY_SP ;
4546
4647#[ derive( Clone ) ]
4748pub struct CombineFields < ' infcx , ' tcx > {
@@ -367,10 +368,11 @@ impl<'infcx, 'tcx> CombineFields<'infcx, 'tcx> {
367368 } ;
368369
369370 debug ! ( "generalize: for_universe = {:?}" , for_universe) ;
371+ debug ! ( "generalize: trace = {:?}" , self . trace) ;
370372
371373 let mut generalize = Generalizer {
372374 infcx : self . infcx ,
373- span : self . trace . cause . span ,
375+ cause : & self . trace . cause ,
374376 for_vid_sub_root : self . infcx . inner . borrow_mut ( ) . type_variables ( ) . sub_root_var ( for_vid) ,
375377 for_universe,
376378 ambient_variance,
@@ -414,7 +416,7 @@ struct Generalizer<'cx, 'tcx> {
414416 infcx : & ' cx InferCtxt < ' cx , ' tcx > ,
415417
416418 /// The span, used when creating new type variables and things.
417- span : Span ,
419+ cause : & ' cx ObligationCause < ' tcx > ,
418420
419421 /// The vid of the type variable that is in the process of being
420422 /// instantiated; if we find this within the type we are folding,
@@ -639,7 +641,7 @@ impl TypeRelation<'tcx> for Generalizer<'_, 'tcx> {
639641
640642 // FIXME: This is non-ideal because we don't give a
641643 // very descriptive origin for this region variable.
642- Ok ( self . infcx . next_region_var_in_universe ( MiscVariable ( self . span ) , self . for_universe ) )
644+ Ok ( self . infcx . next_region_var_in_universe ( MiscVariable ( self . cause . span ) , self . for_universe ) )
643645 }
644646
645647 fn consts (
0 commit comments