@@ -30,8 +30,9 @@ use middle::subst::Substs;
3030use middle:: subst:: Subst ;
3131use middle:: traits:: { self , FulfillmentContext , Normalized ,
3232 SelectionContext , ObligationCause } ;
33- use middle:: ty:: { TyVid , IntVid , FloatVid , RegionVid , UnconstrainedNumeric } ;
34- use middle:: ty:: { self , Ty , TypeError , HasTypeFlags } ;
33+ use middle:: ty:: { TyVid , IntVid , FloatVid , RegionVid } ;
34+ use middle:: ty:: { self , Ty , HasTypeFlags } ;
35+ use middle:: ty:: error:: { ExpectedFound , TypeError , UnconstrainedNumeric } ;
3536use middle:: ty:: fold:: { TypeFolder , TypeFoldable } ;
3637use middle:: ty:: relate:: { Relate , RelateResult , TypeRelation } ;
3738use rustc_data_structures:: unify:: { self , UnificationTable } ;
@@ -171,9 +172,9 @@ impl fmt::Display for TypeOrigin {
171172/// See `error_reporting.rs` for more details
172173#[ derive( Clone , Debug ) ]
173174pub enum ValuePairs < ' tcx > {
174- Types ( ty :: ExpectedFound < Ty < ' tcx > > ) ,
175- TraitRefs ( ty :: ExpectedFound < ty:: TraitRef < ' tcx > > ) ,
176- PolyTraitRefs ( ty :: ExpectedFound < ty:: PolyTraitRef < ' tcx > > ) ,
175+ Types ( ExpectedFound < Ty < ' tcx > > ) ,
176+ TraitRefs ( ExpectedFound < ty:: TraitRef < ' tcx > > ) ,
177+ PolyTraitRefs ( ExpectedFound < ty:: PolyTraitRef < ' tcx > > ) ,
177178}
178179
179180/// The trace designates the path through inference that we took to
@@ -479,12 +480,12 @@ pub fn mk_sub_poly_trait_refs<'a, 'tcx>(cx: &InferCtxt<'a, 'tcx>,
479480fn expected_found < T > ( a_is_expected : bool ,
480481 a : T ,
481482 b : T )
482- -> ty :: ExpectedFound < T >
483+ -> ExpectedFound < T >
483484{
484485 if a_is_expected {
485- ty :: ExpectedFound { expected : a, found : b}
486+ ExpectedFound { expected : a, found : b}
486487 } else {
487- ty :: ExpectedFound { expected : b, found : a}
488+ ExpectedFound { expected : b, found : a}
488489 }
489490}
490491
@@ -656,7 +657,8 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
656657 }
657658
658659 pub fn type_is_unconstrained_numeric ( & ' a self , ty : Ty ) -> UnconstrainedNumeric {
659- use middle:: ty:: UnconstrainedNumeric :: { Neither , UnconstrainedInt , UnconstrainedFloat } ;
660+ use middle:: ty:: error:: UnconstrainedNumeric :: Neither ;
661+ use middle:: ty:: error:: UnconstrainedNumeric :: { UnconstrainedInt , UnconstrainedFloat } ;
660662 match ty. sty {
661663 ty:: TyInfer ( ty:: IntVar ( vid) ) => {
662664 if self . int_unification_table . borrow_mut ( ) . has_value ( vid) {
@@ -1312,7 +1314,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
13121314 sp : Span ,
13131315 mk_msg : M ,
13141316 actual_ty : String ,
1315- err : Option < & ty :: TypeError < ' tcx > > ) where
1317+ err : Option < & TypeError < ' tcx > > ) where
13161318 M : FnOnce ( Option < String > , String ) -> String ,
13171319 {
13181320 self . type_error_message_str_with_expected ( sp, mk_msg, None , actual_ty, err)
@@ -1323,7 +1325,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
13231325 mk_msg : M ,
13241326 expected_ty : Option < Ty < ' tcx > > ,
13251327 actual_ty : String ,
1326- err : Option < & ty :: TypeError < ' tcx > > ) where
1328+ err : Option < & TypeError < ' tcx > > ) where
13271329 M : FnOnce ( Option < String > , String ) -> String ,
13281330 {
13291331 debug ! ( "hi! expected_ty = {:?}, actual_ty = {}" , expected_ty, actual_ty) ;
@@ -1349,7 +1351,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
13491351 sp : Span ,
13501352 mk_msg : M ,
13511353 actual_ty : Ty < ' tcx > ,
1352- err : Option < & ty :: TypeError < ' tcx > > ) where
1354+ err : Option < & TypeError < ' tcx > > ) where
13531355 M : FnOnce ( String ) -> String ,
13541356 {
13551357 let actual_ty = self . resolve_type_vars_if_possible ( & actual_ty) ;
@@ -1368,10 +1370,10 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
13681370 span : Span ,
13691371 expected : Ty < ' tcx > ,
13701372 actual : Ty < ' tcx > ,
1371- err : & ty :: TypeError < ' tcx > ) {
1373+ err : & TypeError < ' tcx > ) {
13721374 let trace = TypeTrace {
13731375 origin : Misc ( span) ,
1374- values : Types ( ty :: ExpectedFound {
1376+ values : Types ( ExpectedFound {
13751377 expected : expected,
13761378 found : actual
13771379 } )
@@ -1385,14 +1387,14 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
13851387 actual : type_variable:: Default < ' tcx > ) {
13861388 let trace = TypeTrace {
13871389 origin : Misc ( span) ,
1388- values : Types ( ty :: ExpectedFound {
1390+ values : Types ( ExpectedFound {
13891391 expected : expected. ty ,
13901392 found : actual. ty
13911393 } )
13921394 } ;
13931395
13941396 self . report_and_explain_type_error ( trace,
1395- & TypeError :: TyParamDefaultMismatch ( ty :: ExpectedFound {
1397+ & TypeError :: TyParamDefaultMismatch ( ExpectedFound {
13961398 expected : expected,
13971399 found : actual
13981400 } ) ) ;
@@ -1406,8 +1408,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
14061408 -> ( T , FnvHashMap < ty:: BoundRegion , ty:: Region > )
14071409 where T : TypeFoldable < ' tcx >
14081410 {
1409- ty:: fold:: replace_late_bound_regions (
1410- self . tcx ,
1411+ self . tcx . replace_late_bound_regions (
14111412 value,
14121413 |br| self . next_region_var ( LateBoundRegion ( span, br, lbrct) ) )
14131414 }
@@ -1555,7 +1556,7 @@ impl<'tcx> TypeTrace<'tcx> {
15551556 pub fn dummy ( tcx : & ty:: ctxt < ' tcx > ) -> TypeTrace < ' tcx > {
15561557 TypeTrace {
15571558 origin : Misc ( codemap:: DUMMY_SP ) ,
1558- values : Types ( ty :: ExpectedFound {
1559+ values : Types ( ExpectedFound {
15591560 expected : tcx. types . err ,
15601561 found : tcx. types . err ,
15611562 } )
0 commit comments