@@ -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 ;
@@ -87,12 +87,12 @@ impl fmt::Debug for ty::FreeRegion {
8787
8888impl < ' tcx > fmt:: Debug for ty:: FnSig < ' tcx > {
8989 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
90- OptWithInfcx :: new_no_ctx ( self ) . fmt ( f)
90+ WithInfcx :: with_no_infcx ( self ) . fmt ( f)
9191 }
9292}
9393impl < ' tcx > DebugWithInfcx < TyCtxt < ' tcx > > for ty:: FnSig < ' tcx > {
94- fn fmt < InfCtx : InferCtxtLike < TyCtxt < ' tcx > > > (
95- this : OptWithInfcx < ' _ , TyCtxt < ' tcx > , InfCtx , & Self > ,
94+ fn fmt < Infcx : InferCtxtLike < Interner = TyCtxt < ' tcx > > > (
95+ this : WithInfcx < ' _ , Infcx , & Self > ,
9696 f : & mut core:: fmt:: Formatter < ' _ > ,
9797 ) -> core:: fmt:: Result {
9898 let sig = this. data ;
@@ -147,8 +147,8 @@ impl<'tcx> fmt::Debug for ty::TraitRef<'tcx> {
147147}
148148
149149impl < ' tcx > ty:: DebugWithInfcx < TyCtxt < ' tcx > > for Ty < ' tcx > {
150- fn fmt < InfCtx : InferCtxtLike < TyCtxt < ' tcx > > > (
151- this : OptWithInfcx < ' _ , TyCtxt < ' tcx > , InfCtx , & Self > ,
150+ fn fmt < Infcx : InferCtxtLike < Interner = TyCtxt < ' tcx > > > (
151+ this : WithInfcx < ' _ , Infcx , & Self > ,
152152 f : & mut core:: fmt:: Formatter < ' _ > ,
153153 ) -> core:: fmt:: Result {
154154 this. data . fmt ( f)
@@ -236,12 +236,12 @@ impl<'tcx> fmt::Debug for ty::PredicateKind<'tcx> {
236236
237237impl < ' tcx > fmt:: Debug for AliasTy < ' tcx > {
238238 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
239- OptWithInfcx :: new_no_ctx ( self ) . fmt ( f)
239+ WithInfcx :: with_no_infcx ( self ) . fmt ( f)
240240 }
241241}
242242impl < ' tcx > DebugWithInfcx < TyCtxt < ' tcx > > for AliasTy < ' tcx > {
243- fn fmt < InfCtx : InferCtxtLike < TyCtxt < ' tcx > > > (
244- this : OptWithInfcx < ' _ , TyCtxt < ' tcx > , InfCtx , & Self > ,
243+ fn fmt < Infcx : InferCtxtLike < Interner = TyCtxt < ' tcx > > > (
244+ this : WithInfcx < ' _ , Infcx , & Self > ,
245245 f : & mut core:: fmt:: Formatter < ' _ > ,
246246 ) -> core:: fmt:: Result {
247247 f. debug_struct ( "AliasTy" )
@@ -261,12 +261,12 @@ impl<'tcx> fmt::Debug for ty::InferConst<'tcx> {
261261 }
262262}
263263impl < ' tcx > DebugWithInfcx < TyCtxt < ' tcx > > for ty:: InferConst < ' tcx > {
264- fn fmt < InfCtx : InferCtxtLike < TyCtxt < ' tcx > > > (
265- this : OptWithInfcx < ' _ , TyCtxt < ' tcx > , InfCtx , & Self > ,
264+ fn fmt < Infcx : InferCtxtLike < Interner = TyCtxt < ' tcx > > > (
265+ this : WithInfcx < ' _ , Infcx , & Self > ,
266266 f : & mut core:: fmt:: Formatter < ' _ > ,
267267 ) -> core:: fmt:: Result {
268268 use ty:: InferConst :: * ;
269- match this. infcx . and_then ( |infcx| infcx . universe_of_ct ( * this. data ) ) {
269+ match this. infcx . universe_of_ct ( * this. data ) {
270270 None => write ! ( f, "{:?}" , this. data) ,
271271 Some ( universe) => match * this. data {
272272 Var ( vid) => write ! ( f, "?{}_{}c" , vid. index, universe. index( ) ) ,
@@ -281,12 +281,12 @@ impl<'tcx> DebugWithInfcx<TyCtxt<'tcx>> for ty::InferConst<'tcx> {
281281
282282impl < ' tcx > fmt:: Debug for ty:: consts:: Expr < ' tcx > {
283283 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
284- OptWithInfcx :: new_no_ctx ( self ) . fmt ( f)
284+ WithInfcx :: with_no_infcx ( self ) . fmt ( f)
285285 }
286286}
287287impl < ' tcx > DebugWithInfcx < TyCtxt < ' tcx > > for ty:: consts:: Expr < ' tcx > {
288- fn fmt < InfCtx : InferCtxtLike < TyCtxt < ' tcx > > > (
289- this : OptWithInfcx < ' _ , TyCtxt < ' tcx > , InfCtx , & Self > ,
288+ fn fmt < Infcx : InferCtxtLike < Interner = TyCtxt < ' tcx > > > (
289+ this : WithInfcx < ' _ , Infcx , & Self > ,
290290 f : & mut core:: fmt:: Formatter < ' _ > ,
291291 ) -> core:: fmt:: Result {
292292 match this. data {
@@ -314,12 +314,12 @@ impl<'tcx> DebugWithInfcx<TyCtxt<'tcx>> for ty::consts::Expr<'tcx> {
314314
315315impl < ' tcx > fmt:: Debug for ty:: UnevaluatedConst < ' tcx > {
316316 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
317- OptWithInfcx :: new_no_ctx ( self ) . fmt ( f)
317+ WithInfcx :: with_no_infcx ( self ) . fmt ( f)
318318 }
319319}
320320impl < ' tcx > DebugWithInfcx < TyCtxt < ' tcx > > for ty:: UnevaluatedConst < ' tcx > {
321- fn fmt < InfCtx : InferCtxtLike < TyCtxt < ' tcx > > > (
322- this : OptWithInfcx < ' _ , TyCtxt < ' tcx > , InfCtx , & Self > ,
321+ fn fmt < Infcx : InferCtxtLike < Interner = TyCtxt < ' tcx > > > (
322+ this : WithInfcx < ' _ , Infcx , & Self > ,
323323 f : & mut core:: fmt:: Formatter < ' _ > ,
324324 ) -> core:: fmt:: Result {
325325 f. debug_struct ( "UnevaluatedConst" )
@@ -331,12 +331,12 @@ impl<'tcx> DebugWithInfcx<TyCtxt<'tcx>> for ty::UnevaluatedConst<'tcx> {
331331
332332impl < ' tcx > fmt:: Debug for ty:: Const < ' tcx > {
333333 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
334- OptWithInfcx :: new_no_ctx ( self ) . fmt ( f)
334+ WithInfcx :: with_no_infcx ( self ) . fmt ( f)
335335 }
336336}
337337impl < ' tcx > DebugWithInfcx < TyCtxt < ' tcx > > for ty:: Const < ' tcx > {
338- fn fmt < InfCtx : InferCtxtLike < TyCtxt < ' tcx > > > (
339- this : OptWithInfcx < ' _ , TyCtxt < ' tcx > , InfCtx , & Self > ,
338+ fn fmt < Infcx : InferCtxtLike < Interner = TyCtxt < ' tcx > > > (
339+ this : WithInfcx < ' _ , Infcx , & Self > ,
340340 f : & mut core:: fmt:: Formatter < ' _ > ,
341341 ) -> core:: fmt:: Result {
342342 // If this is a value, we spend some effort to make it look nice.
@@ -392,8 +392,8 @@ impl<'tcx> fmt::Debug for GenericArg<'tcx> {
392392 }
393393}
394394impl < ' tcx > DebugWithInfcx < TyCtxt < ' tcx > > for GenericArg < ' tcx > {
395- fn fmt < InfCtx : InferCtxtLike < TyCtxt < ' tcx > > > (
396- this : OptWithInfcx < ' _ , TyCtxt < ' tcx > , InfCtx , & Self > ,
395+ fn fmt < Infcx : InferCtxtLike < Interner = TyCtxt < ' tcx > > > (
396+ this : WithInfcx < ' _ , Infcx , & Self > ,
397397 f : & mut core:: fmt:: Formatter < ' _ > ,
398398 ) -> core:: fmt:: Result {
399399 match this. data . unpack ( ) {
@@ -410,29 +410,29 @@ impl<'tcx> fmt::Debug for Region<'tcx> {
410410 }
411411}
412412impl < ' tcx > DebugWithInfcx < TyCtxt < ' tcx > > for Region < ' tcx > {
413- fn fmt < InfCtx : InferCtxtLike < TyCtxt < ' tcx > > > (
414- this : OptWithInfcx < ' _ , TyCtxt < ' tcx > , InfCtx , & Self > ,
413+ fn fmt < Infcx : InferCtxtLike < Interner = TyCtxt < ' tcx > > > (
414+ this : WithInfcx < ' _ , Infcx , & Self > ,
415415 f : & mut core:: fmt:: Formatter < ' _ > ,
416416 ) -> core:: fmt:: Result {
417417 write ! ( f, "{:?}" , & this. map( |data| data. kind( ) ) )
418418 }
419419}
420420
421421impl < ' tcx > DebugWithInfcx < TyCtxt < ' tcx > > for ty:: RegionVid {
422- fn fmt < InfCtx : InferCtxtLike < TyCtxt < ' tcx > > > (
423- this : OptWithInfcx < ' _ , TyCtxt < ' tcx > , InfCtx , & Self > ,
422+ fn fmt < Infcx : InferCtxtLike < Interner = TyCtxt < ' tcx > > > (
423+ this : WithInfcx < ' _ , Infcx , & Self > ,
424424 f : & mut core:: fmt:: Formatter < ' _ > ,
425425 ) -> core:: fmt:: Result {
426- match this. infcx . and_then ( |infcx| infcx . universe_of_lt ( * this. data ) ) {
426+ match this. infcx . universe_of_lt ( * this. data ) {
427427 Some ( universe) => write ! ( f, "'?{}_{}" , this. data. index( ) , universe. index( ) ) ,
428428 None => write ! ( f, "{:?}" , this. data) ,
429429 }
430430 }
431431}
432432
433433impl < ' tcx , T : DebugWithInfcx < TyCtxt < ' tcx > > > DebugWithInfcx < TyCtxt < ' tcx > > for ty:: Binder < ' tcx , T > {
434- fn fmt < InfCtx : InferCtxtLike < TyCtxt < ' tcx > > > (
435- this : OptWithInfcx < ' _ , TyCtxt < ' tcx > , InfCtx , & Self > ,
434+ fn fmt < Infcx : InferCtxtLike < Interner = TyCtxt < ' tcx > > > (
435+ this : WithInfcx < ' _ , Infcx , & Self > ,
436436 f : & mut core:: fmt:: Formatter < ' _ > ,
437437 ) -> core:: fmt:: Result {
438438 f. debug_tuple ( "Binder" )
0 commit comments