@@ -22,8 +22,6 @@ pub enum Cause {
22
22
pub trait TypeRelation < ' tcx > : Sized {
23
23
fn tcx ( & self ) -> TyCtxt < ' tcx > ;
24
24
25
- fn intercrate ( & self ) -> bool ;
26
-
27
25
fn param_env ( & self ) -> ty:: ParamEnv < ' tcx > ;
28
26
29
27
/// Returns a static string we can use for printouts.
@@ -33,9 +31,6 @@ pub trait TypeRelation<'tcx>: Sized {
33
31
/// relation. Just affects error messages.
34
32
fn a_is_expected ( & self ) -> bool ;
35
33
36
- /// Used during coherence. If called, must emit an always-ambiguous obligation.
37
- fn mark_ambiguous ( & mut self ) ;
38
-
39
34
fn with_cause < F , R > ( & mut self , _cause : Cause , f : F ) -> R
40
35
where
41
36
F : FnOnce ( & mut Self ) -> R ,
@@ -559,23 +554,16 @@ pub fn super_relate_tys<'tcx, R: TypeRelation<'tcx>>(
559
554
& ty:: Alias ( ty:: Opaque , ty:: AliasTy { def_id : a_def_id, substs : a_substs, .. } ) ,
560
555
& ty:: Alias ( ty:: Opaque , ty:: AliasTy { def_id : b_def_id, substs : b_substs, .. } ) ,
561
556
) if a_def_id == b_def_id => {
562
- if relation. intercrate ( ) {
563
- // During coherence, opaque types should be treated as equal to each other, even if their generic params
564
- // differ, as they could resolve to the same hidden type, even for different generic params.
565
- relation. mark_ambiguous ( ) ;
566
- Ok ( a)
567
- } else {
568
- let opt_variances = tcx. variances_of ( a_def_id) ;
569
- let substs = relate_substs_with_variances (
570
- relation,
571
- a_def_id,
572
- opt_variances,
573
- a_substs,
574
- b_substs,
575
- false , // do not fetch `type_of(a_def_id)`, as it will cause a cycle
576
- ) ?;
577
- Ok ( tcx. mk_opaque ( a_def_id, substs) )
578
- }
557
+ let opt_variances = tcx. variances_of ( a_def_id) ;
558
+ let substs = relate_substs_with_variances (
559
+ relation,
560
+ a_def_id,
561
+ opt_variances,
562
+ a_substs,
563
+ b_substs,
564
+ false , // do not fetch `type_of(a_def_id)`, as it will cause a cycle
565
+ ) ?;
566
+ Ok ( tcx. mk_opaque ( a_def_id, substs) )
579
567
}
580
568
581
569
_ => Err ( TypeError :: Sorts ( expected_found ( relation, a, b) ) ) ,
0 commit comments