Skip to content

Commit 918d0ac

Browse files
committed
Auto merge of #104986 - compiler-errors:opaques, r=oli-obk
Combine `ty::Projection` and `ty::Opaque` into `ty::Alias` Implements rust-lang/types-team#79. This PR consolidates `ty::Projection` and `ty::Opaque` into a single `ty::Alias`, with an `AliasKind` and `AliasTy` type (renamed from `ty::ProjectionTy`, which is the inner data of `ty::Projection`) defined as so: ``` enum AliasKind { Projection, Opaque, } struct AliasTy<'tcx> { def_id: DefId, substs: SubstsRef<'tcx>, } ``` Since we don't have access to `TyCtxt` in type flags computation, and because repeatedly calling `DefKind` on the def-id is expensive, these two types are distinguished with `ty::AliasKind`, conveniently glob-imported into `ty::{Projection, Opaque}`. For example: ```diff match ty.kind() { - ty::Opaque(..) => + ty::Alias(ty::Opaque, ..) => {} _ => {} } ``` This PR also consolidates match arms that treated `ty::Opaque` and `ty::Projection` identically. r? `@ghost`
2 parents 21ee03e + 99417d5 commit 918d0ac

File tree

115 files changed

+632
-674
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

115 files changed

+632
-674
lines changed

compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -697,8 +697,8 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
697697
.map_bound(|p| p.predicates),
698698
None,
699699
),
700-
ty::Opaque(did, substs) => {
701-
find_fn_kind_from_did(tcx.bound_explicit_item_bounds(*did), Some(*substs))
700+
ty::Alias(ty::Opaque, ty::AliasTy { def_id, substs }) => {
701+
find_fn_kind_from_did(tcx.bound_explicit_item_bounds(*def_id), Some(*substs))
702702
}
703703
ty::Closure(_, substs) => match substs.as_closure().kind() {
704704
ty::ClosureKind::Fn => Some(hir::Mutability::Not),

compiler/rustc_borrowck/src/diagnostics/region_errors.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
504504
let ErrorConstraintInfo { outlived_fr, span, .. } = errci;
505505

506506
let mut output_ty = self.regioncx.universal_regions().unnormalized_output_ty;
507-
if let ty::Opaque(def_id, _) = *output_ty.kind() {
507+
if let ty::Alias(ty::Opaque, ty::AliasTy { def_id, substs: _ }) = *output_ty.kind() {
508508
output_ty = self.infcx.tcx.type_of(def_id)
509509
};
510510

compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ fn push_debuginfo_type_name<'tcx>(
235235
let projection_bounds: SmallVec<[_; 4]> = trait_data
236236
.projection_bounds()
237237
.map(|bound| {
238-
let ExistentialProjection { item_def_id, term, .. } =
238+
let ExistentialProjection { def_id: item_def_id, term, .. } =
239239
tcx.erase_late_bound_regions(bound);
240240
// FIXME(associated_const_equality): allow for consts here
241241
(item_def_id, term.ty().unwrap())
@@ -411,9 +411,8 @@ fn push_debuginfo_type_name<'tcx>(
411411
ty::Error(_)
412412
| ty::Infer(_)
413413
| ty::Placeholder(..)
414-
| ty::Projection(..)
414+
| ty::Alias(..)
415415
| ty::Bound(..)
416-
| ty::Opaque(..)
417416
| ty::GeneratorWitness(..) => {
418417
bug!(
419418
"debuginfo: Trying to create type name for \

compiler/rustc_const_eval/src/const_eval/valtrees.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -142,12 +142,11 @@ pub(crate) fn const_to_valtree_inner<'tcx>(
142142
| ty::Foreign(..)
143143
| ty::Infer(ty::FreshIntTy(_))
144144
| ty::Infer(ty::FreshFloatTy(_))
145-
| ty::Projection(..)
145+
// FIXME(oli-obk): we could look behind opaque types
146+
| ty::Alias(..)
146147
| ty::Param(_)
147148
| ty::Bound(..)
148149
| ty::Placeholder(..)
149-
// FIXME(oli-obk): we could look behind opaque types
150-
| ty::Opaque(..)
151150
| ty::Infer(_)
152151
// FIXME(oli-obk): we can probably encode closures just like structs
153152
| ty::Closure(..)
@@ -307,11 +306,10 @@ pub fn valtree_to_const_value<'tcx>(
307306
| ty::Foreign(..)
308307
| ty::Infer(ty::FreshIntTy(_))
309308
| ty::Infer(ty::FreshFloatTy(_))
310-
| ty::Projection(..)
309+
| ty::Alias(..)
311310
| ty::Param(_)
312311
| ty::Bound(..)
313312
| ty::Placeholder(..)
314-
| ty::Opaque(..)
315313
| ty::Infer(_)
316314
| ty::Closure(..)
317315
| ty::Generator(..)

compiler/rustc_const_eval/src/interpret/intrinsics.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,9 @@ pub(crate) fn eval_nullary_intrinsic<'tcx>(
8282
ty::Adt(ref adt, _) => {
8383
ConstValue::from_machine_usize(adt.variants().len() as u64, &tcx)
8484
}
85-
ty::Projection(_)
86-
| ty::Opaque(_, _)
87-
| ty::Param(_)
88-
| ty::Placeholder(_)
89-
| ty::Infer(_) => throw_inval!(TooGeneric),
85+
ty::Alias(..) | ty::Param(_) | ty::Placeholder(_) | ty::Infer(_) => {
86+
throw_inval!(TooGeneric)
87+
}
9088
ty::Bound(_, _) => bug!("bound ty during ctfe"),
9189
ty::Bool
9290
| ty::Char

compiler/rustc_const_eval/src/interpret/validity.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -601,8 +601,7 @@ impl<'rt, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> ValidityVisitor<'rt, 'mir, '
601601
| ty::Placeholder(..)
602602
| ty::Bound(..)
603603
| ty::Param(..)
604-
| ty::Opaque(..)
605-
| ty::Projection(..)
604+
| ty::Alias(..)
606605
| ty::GeneratorWitness(..) => bug!("Encountered invalid type {:?}", ty),
607606
}
608607
}

compiler/rustc_const_eval/src/transform/validate.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
241241
};
242242

243243
let kind = match parent_ty.ty.kind() {
244-
&ty::Opaque(def_id, substs) => {
244+
&ty::Alias(ty::Opaque, ty::AliasTy { def_id, substs }) => {
245245
self.tcx.bound_type_of(def_id).subst(self.tcx, substs).kind()
246246
}
247247
kind => kind,
@@ -652,7 +652,7 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
652652
self.fail(location, "`SetDiscriminant`is not allowed until deaggregation");
653653
}
654654
let pty = place.ty(&self.body.local_decls, self.tcx).ty.kind();
655-
if !matches!(pty, ty::Adt(..) | ty::Generator(..) | ty::Opaque(..)) {
655+
if !matches!(pty, ty::Adt(..) | ty::Generator(..) | ty::Alias(ty::Opaque, ..)) {
656656
self.fail(
657657
location,
658658
format!(

compiler/rustc_const_eval/src/util/type_name.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,7 @@ impl<'tcx> Printer<'tcx> for AbsolutePathPrinter<'tcx> {
5858
// Types with identity (print the module path).
5959
ty::Adt(ty::AdtDef(Interned(&ty::AdtDefData { did: def_id, .. }, _)), substs)
6060
| ty::FnDef(def_id, substs)
61-
| ty::Opaque(def_id, substs)
62-
| ty::Projection(ty::ProjectionTy { item_def_id: def_id, substs })
61+
| ty::Alias(_, ty::AliasTy { def_id, substs })
6362
| ty::Closure(def_id, substs)
6463
| ty::Generator(def_id, substs, _) => self.print_def_path(def_id, substs),
6564
ty::Foreign(def_id) => self.print_def_path(def_id, &[]),

compiler/rustc_hir_analysis/src/astconv/mod.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -1146,10 +1146,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
11461146

11471147
debug!(?substs_trait_ref_and_assoc_item);
11481148

1149-
ty::ProjectionTy {
1150-
item_def_id: assoc_item.def_id,
1151-
substs: substs_trait_ref_and_assoc_item,
1152-
}
1149+
ty::AliasTy { def_id: assoc_item.def_id, substs: substs_trait_ref_and_assoc_item }
11531150
});
11541151

11551152
if !speculative {
@@ -1195,7 +1192,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
11951192
// the "projection predicate" for:
11961193
//
11971194
// `<T as Iterator>::Item = u32`
1198-
let assoc_item_def_id = projection_ty.skip_binder().item_def_id;
1195+
let assoc_item_def_id = projection_ty.skip_binder().def_id;
11991196
let def_kind = tcx.def_kind(assoc_item_def_id);
12001197
match (def_kind, term.unpack()) {
12011198
(hir::def::DefKind::AssocTy, ty::TermKind::Ty(_))
@@ -1244,7 +1241,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
12441241
//
12451242
// Calling `skip_binder` is okay, because `add_bounds` expects the `param_ty`
12461243
// parameter to have a skipped binder.
1247-
let param_ty = tcx.mk_ty(ty::Projection(projection_ty.skip_binder()));
1244+
let param_ty = tcx.mk_ty(ty::Alias(ty::Projection, projection_ty.skip_binder()));
12481245
self.add_bounds(param_ty, ast_bounds.iter(), bounds, candidate.bound_vars());
12491246
}
12501247
}

compiler/rustc_hir_analysis/src/check/check.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1440,7 +1440,7 @@ fn opaque_type_cycle_error(tcx: TyCtxt<'_>, def_id: LocalDefId, span: Span) -> E
14401440
impl<'tcx> ty::visit::TypeVisitor<'tcx> for OpaqueTypeCollector {
14411441
fn visit_ty(&mut self, t: Ty<'tcx>) -> ControlFlow<Self::BreakTy> {
14421442
match *t.kind() {
1443-
ty::Opaque(def, _) => {
1443+
ty::Alias(ty::Opaque, ty::AliasTy { def_id: def, substs: _ }) => {
14441444
self.0.push(def);
14451445
ControlFlow::CONTINUE
14461446
}

compiler/rustc_hir_analysis/src/check/compare_method.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -571,10 +571,10 @@ impl<'tcx> TypeFolder<'tcx> for ImplTraitInTraitCollector<'_, 'tcx> {
571571
}
572572

573573
fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> {
574-
if let ty::Projection(proj) = ty.kind()
575-
&& self.tcx().def_kind(proj.item_def_id) == DefKind::ImplTraitPlaceholder
574+
if let ty::Alias(ty::Projection, proj) = ty.kind()
575+
&& self.tcx().def_kind(proj.def_id) == DefKind::ImplTraitPlaceholder
576576
{
577-
if let Some((ty, _)) = self.types.get(&proj.item_def_id) {
577+
if let Some((ty, _)) = self.types.get(&proj.def_id) {
578578
return *ty;
579579
}
580580
//FIXME(RPITIT): Deny nested RPITIT in substs too
@@ -586,9 +586,9 @@ impl<'tcx> TypeFolder<'tcx> for ImplTraitInTraitCollector<'_, 'tcx> {
586586
span: self.span,
587587
kind: TypeVariableOriginKind::MiscVariable,
588588
});
589-
self.types.insert(proj.item_def_id, (infer_ty, proj.substs));
589+
self.types.insert(proj.def_id, (infer_ty, proj.substs));
590590
// Recurse into bounds
591-
for (pred, pred_span) in self.tcx().bound_explicit_item_bounds(proj.item_def_id).subst_iter_copied(self.tcx(), proj.substs) {
591+
for (pred, pred_span) in self.tcx().bound_explicit_item_bounds(proj.def_id).subst_iter_copied(self.tcx(), proj.substs) {
592592
let pred = pred.fold_with(self);
593593
let pred = self.ocx.normalize(
594594
&ObligationCause::misc(self.span, self.body_id),
@@ -601,7 +601,7 @@ impl<'tcx> TypeFolder<'tcx> for ImplTraitInTraitCollector<'_, 'tcx> {
601601
ObligationCause::new(
602602
self.span,
603603
self.body_id,
604-
ObligationCauseCode::BindingObligation(proj.item_def_id, pred_span),
604+
ObligationCauseCode::BindingObligation(proj.def_id, pred_span),
605605
),
606606
self.param_env,
607607
pred,
@@ -1734,8 +1734,8 @@ pub fn check_type_bounds<'tcx>(
17341734
let normalize_param_env = {
17351735
let mut predicates = param_env.caller_bounds().iter().collect::<Vec<_>>();
17361736
match impl_ty_value.kind() {
1737-
ty::Projection(proj)
1738-
if proj.item_def_id == trait_ty.def_id && proj.substs == rebased_substs =>
1737+
ty::Alias(ty::Projection, proj)
1738+
if proj.def_id == trait_ty.def_id && proj.substs == rebased_substs =>
17391739
{
17401740
// Don't include this predicate if the projected type is
17411741
// exactly the same as the projection. This can occur in
@@ -1746,8 +1746,8 @@ pub fn check_type_bounds<'tcx>(
17461746
_ => predicates.push(
17471747
ty::Binder::bind_with_vars(
17481748
ty::ProjectionPredicate {
1749-
projection_ty: ty::ProjectionTy {
1750-
item_def_id: trait_ty.def_id,
1749+
projection_ty: ty::AliasTy {
1750+
def_id: trait_ty.def_id,
17511751
substs: rebased_substs,
17521752
},
17531753
term: impl_ty_value.into(),

compiler/rustc_hir_analysis/src/check/mod.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -352,11 +352,7 @@ fn bounds_from_generic_predicates<'tcx>(
352352
// insert the associated types where they correspond, but for now let's be "lazy" and
353353
// propose this instead of the following valid resugaring:
354354
// `T: Trait, Trait::Assoc = K` → `T: Trait<Assoc = K>`
355-
where_clauses.push(format!(
356-
"{} = {}",
357-
tcx.def_path_str(p.projection_ty.item_def_id),
358-
p.term,
359-
));
355+
where_clauses.push(format!("{} = {}", tcx.def_path_str(p.projection_ty.def_id), p.term));
360356
}
361357
let where_clauses = if where_clauses.is_empty() {
362358
String::new()

compiler/rustc_hir_analysis/src/check/wfcheck.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -759,7 +759,7 @@ impl<'tcx> TypeVisitor<'tcx> for GATSubstCollector<'tcx> {
759759

760760
fn visit_ty(&mut self, t: Ty<'tcx>) -> ControlFlow<Self::BreakTy> {
761761
match t.kind() {
762-
ty::Projection(p) if p.item_def_id == self.gat => {
762+
ty::Alias(ty::Projection, p) if p.def_id == self.gat => {
763763
for (idx, subst) in p.substs.iter().enumerate() {
764764
match subst.unpack() {
765765
GenericArgKind::Lifetime(lt) if !lt.is_late_bound() => {
@@ -1592,12 +1592,12 @@ fn check_return_position_impl_trait_in_trait_bounds<'tcx>(
15921592
{
15931593
for arg in fn_output.walk() {
15941594
if let ty::GenericArgKind::Type(ty) = arg.unpack()
1595-
&& let ty::Projection(proj) = ty.kind()
1596-
&& tcx.def_kind(proj.item_def_id) == DefKind::ImplTraitPlaceholder
1597-
&& tcx.impl_trait_in_trait_parent(proj.item_def_id) == fn_def_id.to_def_id()
1595+
&& let ty::Alias(ty::Projection, proj) = ty.kind()
1596+
&& tcx.def_kind(proj.def_id) == DefKind::ImplTraitPlaceholder
1597+
&& tcx.impl_trait_in_trait_parent(proj.def_id) == fn_def_id.to_def_id()
15981598
{
1599-
let span = tcx.def_span(proj.item_def_id);
1600-
let bounds = wfcx.tcx().explicit_item_bounds(proj.item_def_id);
1599+
let span = tcx.def_span(proj.def_id);
1600+
let bounds = wfcx.tcx().explicit_item_bounds(proj.def_id);
16011601
let wf_obligations = bounds.iter().flat_map(|&(bound, bound_span)| {
16021602
let bound = ty::EarlyBinder(bound).subst(tcx, proj.substs);
16031603
let normalized_bound = wfcx.normalize(span, None, bound);

compiler/rustc_hir_analysis/src/coherence/inherent_impls.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ impl<'tcx> InherentCollect<'tcx> {
223223
| ty::Tuple(..) => {
224224
self.check_primitive_impl(item.owner_id.def_id, self_ty, items, ty.span)
225225
}
226-
ty::Projection(..) | ty::Opaque(..) | ty::Param(_) => {
226+
ty::Alias(..) | ty::Param(_) => {
227227
let mut err = struct_span_err!(
228228
self.tcx.sess,
229229
ty.span,

compiler/rustc_hir_analysis/src/collect/lifetimes.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1749,7 +1749,7 @@ fn is_late_bound_map(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Option<&FxIndexSet<
17491749
ty::Param(param_ty) => {
17501750
self.arg_is_constrained[param_ty.index as usize] = true;
17511751
}
1752-
ty::Projection(_) => return ControlFlow::Continue(()),
1752+
ty::Alias(ty::Projection, _) => return ControlFlow::Continue(()),
17531753
_ => (),
17541754
}
17551755
t.super_visit_with(self)

compiler/rustc_hir_analysis/src/collect/predicates_of.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -408,9 +408,9 @@ pub(super) fn explicit_predicates_of<'tcx>(
408408
// identity substs of the trait.
409409
// * It must be an associated type for this trait (*not* a
410410
// supertrait).
411-
if let ty::Projection(projection) = ty.kind() {
411+
if let ty::Alias(ty::Projection, projection) = ty.kind() {
412412
projection.substs == trait_identity_substs
413-
&& tcx.associated_item(projection.item_def_id).container_id(tcx) == def_id
413+
&& tcx.associated_item(projection.def_id).container_id(tcx) == def_id
414414
} else {
415415
false
416416
}

compiler/rustc_hir_analysis/src/collect/type_of.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ pub(super) fn opt_const_param_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Option<
5252
// Using the ItemCtxt convert the HIR for the unresolved assoc type into a
5353
// ty which is a fully resolved projection.
5454
// For the code example above, this would mean converting Self::Assoc<3>
55-
// into a ty::Projection(<Self as Foo>::Assoc<3>)
55+
// into a ty::Alias(ty::Projection, <Self as Foo>::Assoc<3>)
5656
let item_hir_id = tcx
5757
.hir()
5858
.parent_iter(hir_id)
@@ -68,8 +68,8 @@ pub(super) fn opt_const_param_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Option<
6868
// the def_id that this query was called with. We filter to only type and const args here
6969
// as a precaution for if it's ever allowed to elide lifetimes in GAT's. It currently isn't
7070
// but it can't hurt to be safe ^^
71-
if let ty::Projection(projection) = ty.kind() {
72-
let generics = tcx.generics_of(projection.item_def_id);
71+
if let ty::Alias(ty::Projection, projection) = ty.kind() {
72+
let generics = tcx.generics_of(projection.def_id);
7373

7474
let arg_index = segment
7575
.args
@@ -666,7 +666,7 @@ fn find_opaque_ty_constraints_for_tait(tcx: TyCtxt<'_>, def_id: LocalDefId) -> T
666666

667667
let hir_id = tcx.hir().local_def_id_to_hir_id(def_id);
668668
let scope = tcx.hir().get_defining_scope(hir_id);
669-
let mut locator = ConstraintLocator { def_id: def_id, tcx, found: None, typeck_types: vec![] };
669+
let mut locator = ConstraintLocator { def_id, tcx, found: None, typeck_types: vec![] };
670670

671671
debug!(?scope);
672672

@@ -803,7 +803,7 @@ fn find_opaque_ty_constraints_for_rpit(
803803
if let Some(concrete) = concrete {
804804
let scope = tcx.hir().local_def_id_to_hir_id(owner_def_id);
805805
debug!(?scope);
806-
let mut locator = ConstraintChecker { def_id: def_id, tcx, found: concrete };
806+
let mut locator = ConstraintChecker { def_id, tcx, found: concrete };
807807

808808
match tcx.hir().get(scope) {
809809
Node::Item(it) => intravisit::walk_item(&mut locator, it),

compiler/rustc_hir_analysis/src/constrained_generic_params.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ struct ParameterCollector {
5959
impl<'tcx> TypeVisitor<'tcx> for ParameterCollector {
6060
fn visit_ty(&mut self, t: Ty<'tcx>) -> ControlFlow<Self::BreakTy> {
6161
match *t.kind() {
62-
ty::Projection(..) if !self.include_nonconstraining => {
62+
ty::Alias(ty::Projection, ..) if !self.include_nonconstraining => {
6363
// projections are not injective
6464
return ControlFlow::CONTINUE;
6565
}

compiler/rustc_hir_analysis/src/outlives/implicit_infer.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -196,13 +196,13 @@ fn insert_required_predicates_to_be_wf<'tcx>(
196196
}
197197
}
198198

199-
ty::Projection(obj) => {
199+
ty::Alias(ty::Projection, obj) => {
200200
// This corresponds to `<T as Foo<'a>>::Bar`. In this case, we should use the
201201
// explicit predicates as well.
202202
debug!("Projection");
203203
check_explicit_predicates(
204204
tcx,
205-
tcx.parent(obj.item_def_id),
205+
tcx.parent(obj.def_id),
206206
obj.substs,
207207
required_predicates,
208208
explicit_map,

compiler/rustc_hir_analysis/src/outlives/utils.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ pub(crate) fn insert_outlives_predicate<'tcx>(
9090
// ```
9191
//
9292
// Here we want to add an explicit `where <T as Iterator>::Item: 'a`.
93-
let ty: Ty<'tcx> = tcx.mk_projection(proj_ty.item_def_id, proj_ty.substs);
93+
let ty: Ty<'tcx> = tcx.mk_projection(proj_ty.def_id, proj_ty.substs);
9494
required_predicates
9595
.entry(ty::OutlivesPredicate(ty.into(), outlived_region))
9696
.or_insert(span);

compiler/rustc_hir_analysis/src/variance/constraints.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -249,14 +249,10 @@ impl<'a, 'tcx> ConstraintContext<'a, 'tcx> {
249249
self.add_constraints_from_substs(current, def.did(), substs, variance);
250250
}
251251

252-
ty::Projection(ref data) => {
252+
ty::Alias(_, ref data) => {
253253
self.add_constraints_from_invariant_substs(current, data.substs, variance);
254254
}
255255

256-
ty::Opaque(_, substs) => {
257-
self.add_constraints_from_invariant_substs(current, substs, variance);
258-
}
259-
260256
ty::Dynamic(data, r, _) => {
261257
// The type `Foo<T+'a>` is contravariant w/r/t `'a`:
262258
let contra = self.contravariant(variance);

0 commit comments

Comments
 (0)