@@ -14,7 +14,7 @@ use crate::mir::interpret::ConstValue;
14
14
use std:: sync:: atomic:: Ordering ;
15
15
use crate :: ty:: fold:: { TypeFoldable , TypeFolder } ;
16
16
use 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 } ;
18
18
use crate :: ty:: flags:: FlagComputation ;
19
19
20
20
use rustc_data_structures:: fx:: FxHashMap ;
@@ -43,7 +43,7 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
43
43
query_state : & mut OriginalQueryValues < ' tcx > ,
44
44
) -> Canonicalized < ' tcx , V >
45
45
where
46
- V : TypeFoldable < ' tcx > + Lift < ' tcx > ,
46
+ V : TypeFoldable < ' tcx > ,
47
47
{
48
48
self . tcx
49
49
. sess
@@ -87,7 +87,7 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
87
87
/// [c]: https://rust-lang.github.io/rustc-guide/traits/canonicalization.html#canonicalizing-the-query-result
88
88
pub fn canonicalize_response < V > ( & self , value : & V ) -> Canonicalized < ' tcx , V >
89
89
where
90
- V : TypeFoldable < ' tcx > + Lift < ' tcx > ,
90
+ V : TypeFoldable < ' tcx > ,
91
91
{
92
92
let mut query_state = OriginalQueryValues :: default ( ) ;
93
93
Canonicalizer :: canonicalize (
@@ -101,7 +101,7 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
101
101
102
102
pub fn canonicalize_user_type_annotation < V > ( & self , value : & V ) -> Canonicalized < ' tcx , V >
103
103
where
104
- V : TypeFoldable < ' tcx > + Lift < ' tcx > ,
104
+ V : TypeFoldable < ' tcx > ,
105
105
{
106
106
let mut query_state = OriginalQueryValues :: default ( ) ;
107
107
Canonicalizer :: canonicalize (
@@ -132,7 +132,7 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
132
132
query_state : & mut OriginalQueryValues < ' tcx > ,
133
133
) -> Canonicalized < ' tcx , V >
134
134
where
135
- V : TypeFoldable < ' tcx > + Lift < ' tcx > ,
135
+ V : TypeFoldable < ' tcx > ,
136
136
{
137
137
self . tcx
138
138
. sess
@@ -506,7 +506,7 @@ impl<'cx, 'tcx> Canonicalizer<'cx, 'tcx> {
506
506
query_state : & mut OriginalQueryValues < ' tcx > ,
507
507
) -> Canonicalized < ' tcx , V >
508
508
where
509
- V : TypeFoldable < ' tcx > + Lift < ' tcx > ,
509
+ V : TypeFoldable < ' tcx > ,
510
510
{
511
511
let needs_canonical_flags = if canonicalize_region_mode. any ( ) {
512
512
TypeFlags :: KEEP_IN_LOCAL_TCX |
@@ -520,20 +520,12 @@ impl<'cx, 'tcx> Canonicalizer<'cx, 'tcx> {
520
520
TypeFlags :: HAS_CT_PLACEHOLDER
521
521
} ;
522
522
523
- let gcx = tcx. global_tcx ( ) ;
524
-
525
523
// Fast path: nothing that needs to be canonicalized.
526
524
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
- } ) ;
533
525
let canon_value = Canonical {
534
526
max_universe : ty:: UniverseIndex :: ROOT ,
535
527
variables : List :: empty ( ) ,
536
- value : out_value ,
528
+ value : value . clone ( ) ,
537
529
} ;
538
530
return canon_value;
539
531
}
@@ -553,13 +545,7 @@ impl<'cx, 'tcx> Canonicalizer<'cx, 'tcx> {
553
545
// Once we have canonicalized `out_value`, it should not
554
546
// contain anything that ties it to this inference context
555
547
// 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 ) ) ;
563
549
564
550
let canonical_variables = tcx. intern_canonical_var_infos ( & canonicalizer. variables ) ;
565
551
0 commit comments