@@ -36,12 +36,13 @@ use crate::traits::{Obligation, PredicateObligations};
36
36
37
37
use rustc_ast:: ast;
38
38
use rustc_hir:: def_id:: DefId ;
39
+ use rustc_middle:: traits:: ObligationCause ;
39
40
use rustc_middle:: ty:: error:: TypeError ;
40
41
use rustc_middle:: ty:: relate:: { self , Relate , RelateResult , TypeRelation } ;
41
42
use rustc_middle:: ty:: subst:: SubstsRef ;
42
43
use rustc_middle:: ty:: { self , InferConst , ToPredicate , Ty , TyCtxt , TypeFoldable } ;
43
44
use rustc_middle:: ty:: { IntType , UintType } ;
44
- use rustc_span:: { Span , DUMMY_SP } ;
45
+ use rustc_span:: DUMMY_SP ;
45
46
46
47
#[ derive( Clone ) ]
47
48
pub struct CombineFields < ' infcx , ' tcx > {
@@ -367,10 +368,11 @@ impl<'infcx, 'tcx> CombineFields<'infcx, 'tcx> {
367
368
} ;
368
369
369
370
debug ! ( "generalize: for_universe = {:?}" , for_universe) ;
371
+ debug ! ( "generalize: trace = {:?}" , self . trace) ;
370
372
371
373
let mut generalize = Generalizer {
372
374
infcx : self . infcx ,
373
- span : self . trace . cause . span ,
375
+ cause : & self . trace . cause ,
374
376
for_vid_sub_root : self . infcx . inner . borrow_mut ( ) . type_variables ( ) . sub_root_var ( for_vid) ,
375
377
for_universe,
376
378
ambient_variance,
@@ -414,7 +416,7 @@ struct Generalizer<'cx, 'tcx> {
414
416
infcx : & ' cx InferCtxt < ' cx , ' tcx > ,
415
417
416
418
/// The span, used when creating new type variables and things.
417
- span : Span ,
419
+ cause : & ' cx ObligationCause < ' tcx > ,
418
420
419
421
/// The vid of the type variable that is in the process of being
420
422
/// instantiated; if we find this within the type we are folding,
@@ -639,7 +641,7 @@ impl TypeRelation<'tcx> for Generalizer<'_, 'tcx> {
639
641
640
642
// FIXME: This is non-ideal because we don't give a
641
643
// 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 ) )
643
645
}
644
646
645
647
fn consts (
0 commit comments