@@ -14,7 +14,7 @@ use crate::mir::interpret::ConstValue;
1414use std:: sync:: atomic:: Ordering ;
1515use crate :: ty:: fold:: { TypeFoldable , TypeFolder } ;
1616use crate :: ty:: subst:: Kind ;
17- use crate :: ty:: { self , BoundVar , InferConst , Lift , List , Ty , TyCtxt , TypeFlags } ;
17+ use crate :: ty:: { self , BoundVar , InferConst , List , Ty , TyCtxt , TypeFlags } ;
1818use crate :: ty:: flags:: FlagComputation ;
1919
2020use rustc_data_structures:: fx:: FxHashMap ;
@@ -43,7 +43,7 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
4343 query_state : & mut OriginalQueryValues < ' tcx > ,
4444 ) -> Canonicalized < ' tcx , V >
4545 where
46- V : TypeFoldable < ' tcx > + Lift < ' tcx > ,
46+ V : TypeFoldable < ' tcx > ,
4747 {
4848 self . tcx
4949 . sess
@@ -87,7 +87,7 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
8787 /// [c]: https://rust-lang.github.io/rustc-guide/traits/canonicalization.html#canonicalizing-the-query-result
8888 pub fn canonicalize_response < V > ( & self , value : & V ) -> Canonicalized < ' tcx , V >
8989 where
90- V : TypeFoldable < ' tcx > + Lift < ' tcx > ,
90+ V : TypeFoldable < ' tcx > ,
9191 {
9292 let mut query_state = OriginalQueryValues :: default ( ) ;
9393 Canonicalizer :: canonicalize (
@@ -101,7 +101,7 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
101101
102102 pub fn canonicalize_user_type_annotation < V > ( & self , value : & V ) -> Canonicalized < ' tcx , V >
103103 where
104- V : TypeFoldable < ' tcx > + Lift < ' tcx > ,
104+ V : TypeFoldable < ' tcx > ,
105105 {
106106 let mut query_state = OriginalQueryValues :: default ( ) ;
107107 Canonicalizer :: canonicalize (
@@ -132,7 +132,7 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
132132 query_state : & mut OriginalQueryValues < ' tcx > ,
133133 ) -> Canonicalized < ' tcx , V >
134134 where
135- V : TypeFoldable < ' tcx > + Lift < ' tcx > ,
135+ V : TypeFoldable < ' tcx > ,
136136 {
137137 self . tcx
138138 . sess
@@ -506,7 +506,7 @@ impl<'cx, 'tcx> Canonicalizer<'cx, 'tcx> {
506506 query_state : & mut OriginalQueryValues < ' tcx > ,
507507 ) -> Canonicalized < ' tcx , V >
508508 where
509- V : TypeFoldable < ' tcx > + Lift < ' tcx > ,
509+ V : TypeFoldable < ' tcx > ,
510510 {
511511 let needs_canonical_flags = if canonicalize_region_mode. any ( ) {
512512 TypeFlags :: KEEP_IN_LOCAL_TCX |
@@ -520,20 +520,12 @@ impl<'cx, 'tcx> Canonicalizer<'cx, 'tcx> {
520520 TypeFlags :: HAS_CT_PLACEHOLDER
521521 } ;
522522
523- let gcx = tcx. global_tcx ( ) ;
524-
525523 // Fast path: nothing that needs to be canonicalized.
526524 if !value. has_type_flags ( needs_canonical_flags) {
527- let out_value = gcx. lift ( value) . unwrap_or_else ( || {
528- bug ! (
529- "failed to lift `{:?}` (nothing to canonicalize)" ,
530- value
531- )
532- } ) ;
533525 let canon_value = Canonical {
534526 max_universe : ty:: UniverseIndex :: ROOT ,
535527 variables : List :: empty ( ) ,
536- value : out_value ,
528+ value : value . clone ( ) ,
537529 } ;
538530 return canon_value;
539531 }
@@ -553,13 +545,7 @@ impl<'cx, 'tcx> Canonicalizer<'cx, 'tcx> {
553545 // Once we have canonicalized `out_value`, it should not
554546 // contain anything that ties it to this inference context
555547 // anymore, so it should live in the global arena.
556- let out_value = gcx. lift ( & out_value) . unwrap_or_else ( || {
557- bug ! (
558- "failed to lift `{:?}`, canonicalized from `{:?}`" ,
559- out_value,
560- value
561- )
562- } ) ;
548+ debug_assert ! ( !out_value. has_type_flags( TypeFlags :: KEEP_IN_LOCAL_TCX ) ) ;
563549
564550 let canonical_variables = tcx. intern_canonical_var_infos ( & canonicalizer. variables ) ;
565551
0 commit comments