4
4
//! other areas of the compiler as well.
5
5
6
6
use rustc_infer:: infer:: TyCtxtInferExt ;
7
- use rustc_middle:: traits:: { DefiningAnchor , ObligationCause } ;
7
+ use rustc_middle:: traits:: ObligationCause ;
8
8
use rustc_middle:: ty:: { ParamEnv , Ty , TyCtxt , Variance } ;
9
9
use rustc_trait_selection:: traits:: ObligationCtxt ;
10
10
@@ -33,9 +33,6 @@ pub fn is_equal_up_to_subtyping<'tcx>(
33
33
/// When validating assignments, the variance should be `Covariant`. When checking
34
34
/// during `MirPhase` >= `MirPhase::Runtime(RuntimePhase::Initial)` variance should be `Invariant`
35
35
/// because we want to check for type equality.
36
- ///
37
- /// This mostly ignores opaque types as it can be used in constraining contexts
38
- /// while still computing the final underlying type.
39
36
pub fn relate_types < ' tcx > (
40
37
tcx : TyCtxt < ' tcx > ,
41
38
param_env : ParamEnv < ' tcx > ,
@@ -47,8 +44,7 @@ pub fn relate_types<'tcx>(
47
44
return true ;
48
45
}
49
46
50
- let mut builder =
51
- tcx. infer_ctxt ( ) . ignoring_regions ( ) . with_opaque_type_inference ( DefiningAnchor :: Bubble ) ;
47
+ let mut builder = tcx. infer_ctxt ( ) . ignoring_regions ( ) ;
52
48
let infcx = builder. build ( ) ;
53
49
let ocx = ObligationCtxt :: new ( & infcx) ;
54
50
let cause = ObligationCause :: dummy ( ) ;
@@ -58,20 +54,5 @@ pub fn relate_types<'tcx>(
58
54
Ok ( ( ) ) => { }
59
55
Err ( _) => return false ,
60
56
} ;
61
- let errors = ocx. select_all_or_error ( ) ;
62
- // With `Reveal::All`, opaque types get normalized away, with `Reveal::UserFacing`
63
- // we would get unification errors because we're unable to look into opaque types,
64
- // even if they're constrained in our current function.
65
- for ( key, ty) in infcx. take_opaque_types ( ) {
66
- let hidden_ty = tcx. type_of ( key. def_id ) . instantiate ( tcx, key. args ) ;
67
- if hidden_ty != ty. hidden_type . ty {
68
- span_bug ! (
69
- ty. hidden_type. span,
70
- "{}, {}" ,
71
- tcx. type_of( key. def_id) . instantiate( tcx, key. args) ,
72
- ty. hidden_type. ty
73
- ) ;
74
- }
75
- }
76
- errors. is_empty ( )
57
+ ocx. select_all_or_error ( ) . is_empty ( )
77
58
}
0 commit comments