@@ -10,7 +10,7 @@ use crate::ty::visit::{TypeSuperVisitable, TypeVisitable, TypeVisitor};
1010use crate :: ty:: { self , AliasTy , InferConst , Lift , Term , TermKind , Ty , TyCtxt } ;
1111use rustc_hir:: def:: Namespace ;
1212use rustc_target:: abi:: TyAndLayout ;
13- use rustc_type_ir:: { ConstKind , DebugWithInfcx , InferCtxtLike , OptWithInfcx } ;
13+ use rustc_type_ir:: { ConstKind , DebugWithInfcx , InferCtxtLike , WithInfcx } ;
1414
1515use std:: fmt:: { self , Debug } ;
1616use std:: ops:: ControlFlow ;
@@ -89,12 +89,12 @@ impl fmt::Debug for ty::FreeRegion {
8989
9090impl < ' tcx > fmt:: Debug for ty:: FnSig < ' tcx > {
9191 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
92- OptWithInfcx :: new_no_ctx ( self ) . fmt ( f)
92+ WithInfcx :: with_no_infcx ( self ) . fmt ( f)
9393 }
9494}
9595impl < ' tcx > DebugWithInfcx < TyCtxt < ' tcx > > for ty:: FnSig < ' tcx > {
96- fn fmt < Infcx : InferCtxtLike < TyCtxt < ' tcx > > > (
97- this : OptWithInfcx < ' _ , TyCtxt < ' tcx > , Infcx , & Self > ,
96+ fn fmt < Infcx : InferCtxtLike < Interner = TyCtxt < ' tcx > > > (
97+ this : WithInfcx < ' _ , Infcx , & Self > ,
9898 f : & mut core:: fmt:: Formatter < ' _ > ,
9999 ) -> core:: fmt:: Result {
100100 let sig = this. data ;
@@ -149,8 +149,8 @@ impl<'tcx> fmt::Debug for ty::TraitRef<'tcx> {
149149}
150150
151151impl < ' tcx > ty:: DebugWithInfcx < TyCtxt < ' tcx > > for Ty < ' tcx > {
152- fn fmt < Infcx : InferCtxtLike < TyCtxt < ' tcx > > > (
153- this : OptWithInfcx < ' _ , TyCtxt < ' tcx > , Infcx , & Self > ,
152+ fn fmt < Infcx : InferCtxtLike < Interner = TyCtxt < ' tcx > > > (
153+ this : WithInfcx < ' _ , Infcx , & Self > ,
154154 f : & mut core:: fmt:: Formatter < ' _ > ,
155155 ) -> core:: fmt:: Result {
156156 this. data . fmt ( f)
@@ -238,12 +238,12 @@ impl<'tcx> fmt::Debug for ty::PredicateKind<'tcx> {
238238
239239impl < ' tcx > fmt:: Debug for AliasTy < ' tcx > {
240240 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
241- OptWithInfcx :: new_no_ctx ( self ) . fmt ( f)
241+ WithInfcx :: with_no_infcx ( self ) . fmt ( f)
242242 }
243243}
244244impl < ' tcx > DebugWithInfcx < TyCtxt < ' tcx > > for AliasTy < ' tcx > {
245- fn fmt < Infcx : InferCtxtLike < TyCtxt < ' tcx > > > (
246- this : OptWithInfcx < ' _ , TyCtxt < ' tcx > , Infcx , & Self > ,
245+ fn fmt < Infcx : InferCtxtLike < Interner = TyCtxt < ' tcx > > > (
246+ this : WithInfcx < ' _ , Infcx , & Self > ,
247247 f : & mut core:: fmt:: Formatter < ' _ > ,
248248 ) -> core:: fmt:: Result {
249249 f. debug_struct ( "AliasTy" )
@@ -263,12 +263,12 @@ impl<'tcx> fmt::Debug for ty::InferConst<'tcx> {
263263 }
264264}
265265impl < ' tcx > DebugWithInfcx < TyCtxt < ' tcx > > for ty:: InferConst < ' tcx > {
266- fn fmt < Infcx : InferCtxtLike < TyCtxt < ' tcx > > > (
267- this : OptWithInfcx < ' _ , TyCtxt < ' tcx > , Infcx , & Self > ,
266+ fn fmt < Infcx : InferCtxtLike < Interner = TyCtxt < ' tcx > > > (
267+ this : WithInfcx < ' _ , Infcx , & Self > ,
268268 f : & mut core:: fmt:: Formatter < ' _ > ,
269269 ) -> core:: fmt:: Result {
270270 use ty:: InferConst :: * ;
271- match this. infcx . and_then ( |infcx| infcx . universe_of_ct ( * this. data ) ) {
271+ match this. infcx . universe_of_ct ( * this. data ) {
272272 None => write ! ( f, "{:?}" , this. data) ,
273273 Some ( universe) => match * this. data {
274274 Var ( vid) => write ! ( f, "?{}_{}c" , vid. index, universe. index( ) ) ,
@@ -283,12 +283,12 @@ impl<'tcx> DebugWithInfcx<TyCtxt<'tcx>> for ty::InferConst<'tcx> {
283283
284284impl < ' tcx > fmt:: Debug for ty:: consts:: Expr < ' tcx > {
285285 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
286- OptWithInfcx :: new_no_ctx ( self ) . fmt ( f)
286+ WithInfcx :: with_no_infcx ( self ) . fmt ( f)
287287 }
288288}
289289impl < ' tcx > DebugWithInfcx < TyCtxt < ' tcx > > for ty:: consts:: Expr < ' tcx > {
290- fn fmt < Infcx : InferCtxtLike < TyCtxt < ' tcx > > > (
291- this : OptWithInfcx < ' _ , TyCtxt < ' tcx > , Infcx , & Self > ,
290+ fn fmt < Infcx : InferCtxtLike < Interner = TyCtxt < ' tcx > > > (
291+ this : WithInfcx < ' _ , Infcx , & Self > ,
292292 f : & mut core:: fmt:: Formatter < ' _ > ,
293293 ) -> core:: fmt:: Result {
294294 match this. data {
@@ -316,12 +316,12 @@ impl<'tcx> DebugWithInfcx<TyCtxt<'tcx>> for ty::consts::Expr<'tcx> {
316316
317317impl < ' tcx > fmt:: Debug for ty:: UnevaluatedConst < ' tcx > {
318318 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
319- OptWithInfcx :: new_no_ctx ( self ) . fmt ( f)
319+ WithInfcx :: with_no_infcx ( self ) . fmt ( f)
320320 }
321321}
322322impl < ' tcx > DebugWithInfcx < TyCtxt < ' tcx > > for ty:: UnevaluatedConst < ' tcx > {
323- fn fmt < Infcx : InferCtxtLike < TyCtxt < ' tcx > > > (
324- this : OptWithInfcx < ' _ , TyCtxt < ' tcx > , Infcx , & Self > ,
323+ fn fmt < Infcx : InferCtxtLike < Interner = TyCtxt < ' tcx > > > (
324+ this : WithInfcx < ' _ , Infcx , & Self > ,
325325 f : & mut core:: fmt:: Formatter < ' _ > ,
326326 ) -> core:: fmt:: Result {
327327 f. debug_struct ( "UnevaluatedConst" )
@@ -333,12 +333,12 @@ impl<'tcx> DebugWithInfcx<TyCtxt<'tcx>> for ty::UnevaluatedConst<'tcx> {
333333
334334impl < ' tcx > fmt:: Debug for ty:: Const < ' tcx > {
335335 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
336- OptWithInfcx :: new_no_ctx ( self ) . fmt ( f)
336+ WithInfcx :: with_no_infcx ( self ) . fmt ( f)
337337 }
338338}
339339impl < ' tcx > DebugWithInfcx < TyCtxt < ' tcx > > for ty:: Const < ' tcx > {
340- fn fmt < Infcx : InferCtxtLike < TyCtxt < ' tcx > > > (
341- this : OptWithInfcx < ' _ , TyCtxt < ' tcx > , Infcx , & Self > ,
340+ fn fmt < Infcx : InferCtxtLike < Interner = TyCtxt < ' tcx > > > (
341+ this : WithInfcx < ' _ , Infcx , & Self > ,
342342 f : & mut core:: fmt:: Formatter < ' _ > ,
343343 ) -> core:: fmt:: Result {
344344 // If this is a value, we spend some effort to make it look nice.
@@ -395,8 +395,8 @@ impl<'tcx> fmt::Debug for GenericArg<'tcx> {
395395 }
396396}
397397impl < ' tcx > DebugWithInfcx < TyCtxt < ' tcx > > for GenericArg < ' tcx > {
398- fn fmt < Infcx : InferCtxtLike < TyCtxt < ' tcx > > > (
399- this : OptWithInfcx < ' _ , TyCtxt < ' tcx > , Infcx , & Self > ,
398+ fn fmt < Infcx : InferCtxtLike < Interner = TyCtxt < ' tcx > > > (
399+ this : WithInfcx < ' _ , Infcx , & Self > ,
400400 f : & mut core:: fmt:: Formatter < ' _ > ,
401401 ) -> core:: fmt:: Result {
402402 match this. data . unpack ( ) {
@@ -413,29 +413,29 @@ impl<'tcx> fmt::Debug for Region<'tcx> {
413413 }
414414}
415415impl < ' tcx > DebugWithInfcx < TyCtxt < ' tcx > > for Region < ' tcx > {
416- fn fmt < Infcx : InferCtxtLike < TyCtxt < ' tcx > > > (
417- this : OptWithInfcx < ' _ , TyCtxt < ' tcx > , Infcx , & Self > ,
416+ fn fmt < Infcx : InferCtxtLike < Interner = TyCtxt < ' tcx > > > (
417+ this : WithInfcx < ' _ , Infcx , & Self > ,
418418 f : & mut core:: fmt:: Formatter < ' _ > ,
419419 ) -> core:: fmt:: Result {
420420 write ! ( f, "{:?}" , & this. map( |data| data. kind( ) ) )
421421 }
422422}
423423
424424impl < ' tcx > DebugWithInfcx < TyCtxt < ' tcx > > for ty:: RegionVid {
425- fn fmt < Infcx : InferCtxtLike < TyCtxt < ' tcx > > > (
426- this : OptWithInfcx < ' _ , TyCtxt < ' tcx > , Infcx , & Self > ,
425+ fn fmt < Infcx : InferCtxtLike < Interner = TyCtxt < ' tcx > > > (
426+ this : WithInfcx < ' _ , Infcx , & Self > ,
427427 f : & mut core:: fmt:: Formatter < ' _ > ,
428428 ) -> core:: fmt:: Result {
429- match this. infcx . and_then ( |infcx| infcx . universe_of_lt ( * this. data ) ) {
429+ match this. infcx . universe_of_lt ( * this. data ) {
430430 Some ( universe) => write ! ( f, "'?{}_{}" , this. data. index( ) , universe. index( ) ) ,
431431 None => write ! ( f, "{:?}" , this. data) ,
432432 }
433433 }
434434}
435435
436436impl < ' tcx , T : DebugWithInfcx < TyCtxt < ' tcx > > > DebugWithInfcx < TyCtxt < ' tcx > > for ty:: Binder < ' tcx , T > {
437- fn fmt < Infcx : InferCtxtLike < TyCtxt < ' tcx > > > (
438- this : OptWithInfcx < ' _ , TyCtxt < ' tcx > , Infcx , & Self > ,
437+ fn fmt < Infcx : InferCtxtLike < Interner = TyCtxt < ' tcx > > > (
438+ this : WithInfcx < ' _ , Infcx , & Self > ,
439439 f : & mut core:: fmt:: Formatter < ' _ > ,
440440 ) -> core:: fmt:: Result {
441441 f. debug_tuple ( "Binder" )
0 commit comments