Skip to content

Commit 6b0125c

Browse files
Remove unnecessary StructurallyRelateAliases from CombineFields/TypeRelating
1 parent 30e7682 commit 6b0125c

File tree

4 files changed

+9
-21
lines changed

4 files changed

+9
-21
lines changed

compiler/rustc_infer/src/infer/at.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ use rustc_middle::bug;
2929
use rustc_middle::ty::{Const, ImplSubject};
3030

3131
use super::*;
32-
use crate::infer::relate::{Relate, StructurallyRelateAliases, TypeRelation};
32+
use crate::infer::relate::{Relate, TypeRelation};
3333
use crate::traits::Obligation;
3434

3535
/// Whether we should define opaque types or just treat them opaquely.
@@ -169,7 +169,7 @@ impl<'a, 'tcx> At<'a, 'tcx> {
169169
T: Relate<TyCtxt<'tcx>>,
170170
{
171171
let mut fields = CombineFields::new(self.infcx, trace, self.param_env, define_opaque_types);
172-
fields.equate(StructurallyRelateAliases::No).relate(expected, actual)?;
172+
fields.equate().relate(expected, actual)?;
173173
Ok(InferOk {
174174
value: (),
175175
obligations: fields

compiler/rustc_infer/src/infer/relate/combine.rs

+4-8
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
//! return value of `Equate` or `Sub` shouldn't really be used.
2020
2121
use rustc_middle::traits::solve::Goal;
22-
use rustc_middle::ty::relate::StructurallyRelateAliases;
2322
pub use rustc_middle::ty::relate::combine::*;
2423
use rustc_middle::ty::{self, TyCtxt, Upcast};
2524

@@ -72,19 +71,16 @@ impl<'infcx, 'tcx> CombineFields<'infcx, 'tcx> {
7271
self.infcx.tcx
7372
}
7473

75-
pub fn equate<'a>(
76-
&'a mut self,
77-
structurally_relate_aliases: StructurallyRelateAliases,
78-
) -> TypeRelating<'a, 'infcx, 'tcx> {
79-
TypeRelating::new(self, structurally_relate_aliases, ty::Invariant)
74+
pub fn equate<'a>(&'a mut self) -> TypeRelating<'a, 'infcx, 'tcx> {
75+
TypeRelating::new(self, ty::Invariant)
8076
}
8177

8278
pub fn sub<'a>(&'a mut self) -> TypeRelating<'a, 'infcx, 'tcx> {
83-
TypeRelating::new(self, StructurallyRelateAliases::No, ty::Covariant)
79+
TypeRelating::new(self, ty::Covariant)
8480
}
8581

8682
pub fn sup<'a>(&'a mut self) -> TypeRelating<'a, 'infcx, 'tcx> {
87-
TypeRelating::new(self, StructurallyRelateAliases::No, ty::Contravariant)
83+
TypeRelating::new(self, ty::Contravariant)
8884
}
8985

9086
pub(crate) fn lub<'a>(&'a mut self) -> LatticeOp<'a, 'infcx, 'tcx> {

compiler/rustc_infer/src/infer/relate/lattice.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ impl<'tcx> TypeRelation<TyCtxt<'tcx>> for LatticeOp<'_, '_, 'tcx> {
7171
b: T,
7272
) -> RelateResult<'tcx, T> {
7373
match variance {
74-
ty::Invariant => self.fields.equate(StructurallyRelateAliases::No).relate(a, b),
74+
ty::Invariant => self.fields.equate().relate(a, b),
7575
ty::Covariant => self.relate(a, b),
7676
// FIXME(#41044) -- not correct, need test
7777
ty::Bivariant => Ok(a),

compiler/rustc_infer/src/infer/relate/type_relating.rs

+2-10
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ pub struct TypeRelating<'combine, 'a, 'tcx> {
1919
// resulting nested `goals`.
2020
fields: &'combine mut CombineFields<'a, 'tcx>,
2121

22-
// Immutable field.
23-
structurally_relate_aliases: StructurallyRelateAliases,
2422
// Mutable field.
2523
ambient_variance: ty::Variance,
2624

@@ -52,15 +50,9 @@ pub struct TypeRelating<'combine, 'a, 'tcx> {
5250
impl<'combine, 'infcx, 'tcx> TypeRelating<'combine, 'infcx, 'tcx> {
5351
pub fn new(
5452
f: &'combine mut CombineFields<'infcx, 'tcx>,
55-
structurally_relate_aliases: StructurallyRelateAliases,
5653
ambient_variance: ty::Variance,
5754
) -> TypeRelating<'combine, 'infcx, 'tcx> {
58-
TypeRelating {
59-
fields: f,
60-
structurally_relate_aliases,
61-
ambient_variance,
62-
cache: Default::default(),
63-
}
55+
TypeRelating { fields: f, ambient_variance, cache: Default::default() }
6456
}
6557
}
6658

@@ -341,7 +333,7 @@ impl<'tcx> PredicateEmittingRelation<InferCtxt<'tcx>> for TypeRelating<'_, '_, '
341333
}
342334

343335
fn structurally_relate_aliases(&self) -> StructurallyRelateAliases {
344-
self.structurally_relate_aliases
336+
StructurallyRelateAliases::No
345337
}
346338

347339
fn register_predicates(

0 commit comments

Comments
 (0)