Skip to content

Commit 61adaf8

Browse files
Combine projection and opaque into alias
1 parent c13bd83 commit 61adaf8

File tree

104 files changed

+387
-381
lines changed

Some content is hidden

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

104 files changed

+387
-381
lines changed

compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
697697
.map_bound(|p| p.predicates),
698698
None,
699699
),
700-
ty::Opaque(ty::AliasTy { def_id, substs }) => {
700+
ty::Alias(ty::Opaque, ty::AliasTy { def_id, substs }) => {
701701
find_fn_kind_from_did(tcx.bound_explicit_item_bounds(*def_id), Some(*substs))
702702
}
703703
ty::Closure(_, substs) => match substs.as_closure().kind() {

compiler/rustc_borrowck/src/diagnostics/region_errors.rs

Lines changed: 1 addition & 1 deletion
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(ty::AliasTy { def_id, substs: _ }) = *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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -411,9 +411,9 @@ fn push_debuginfo_type_name<'tcx>(
411411
ty::Error(_)
412412
| ty::Infer(_)
413413
| ty::Placeholder(..)
414-
| ty::Projection(..)
414+
| ty::Alias(ty::Projection, ..)
415415
| ty::Bound(..)
416-
| ty::Opaque(..)
416+
| ty::Alias(ty::Opaque, ..)
417417
| ty::GeneratorWitness(..) => {
418418
bug!(
419419
"debuginfo: Trying to create type name for \

compiler/rustc_const_eval/src/const_eval/valtrees.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,12 +142,12 @@ 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+
| ty::Alias(ty::Projection, ..)
146146
| ty::Param(_)
147147
| ty::Bound(..)
148148
| ty::Placeholder(..)
149149
// FIXME(oli-obk): we could look behind opaque types
150-
| ty::Opaque(..)
150+
| ty::Alias(ty::Opaque, ..)
151151
| ty::Infer(_)
152152
// FIXME(oli-obk): we can probably encode closures just like structs
153153
| ty::Closure(..)
@@ -307,11 +307,11 @@ pub fn valtree_to_const_value<'tcx>(
307307
| ty::Foreign(..)
308308
| ty::Infer(ty::FreshIntTy(_))
309309
| ty::Infer(ty::FreshFloatTy(_))
310-
| ty::Projection(..)
310+
| ty::Alias(ty::Projection, ..)
311311
| ty::Param(_)
312312
| ty::Bound(..)
313313
| ty::Placeholder(..)
314-
| ty::Opaque(..)
314+
| ty::Alias(ty::Opaque, ..)
315315
| ty::Infer(_)
316316
| ty::Closure(..)
317317
| ty::Generator(..)

compiler/rustc_const_eval/src/interpret/intrinsics.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ 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(ty::AliasTy { def_id: _, substs: _ })
85+
ty::Alias(ty::Projection, _)
86+
| ty::Alias(ty::Opaque, ty::AliasTy { def_id: _, substs: _ })
8787
| ty::Param(_)
8888
| ty::Placeholder(_)
8989
| ty::Infer(_) => throw_inval!(TooGeneric),

compiler/rustc_const_eval/src/interpret/validity.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -601,8 +601,8 @@ 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(ty::Opaque, ..)
605+
| ty::Alias(ty::Projection, ..)
606606
| ty::GeneratorWitness(..) => bug!("Encountered invalid type {:?}", ty),
607607
}
608608
}

compiler/rustc_const_eval/src/transform/validate.rs

Lines changed: 2 additions & 2 deletions
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(ty::AliasTy { 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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ 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(ty::AliasTy { def_id, substs })
62-
| ty::Projection(ty::AliasTy { def_id, substs })
61+
| ty::Alias(ty::Opaque, ty::AliasTy { def_id, substs })
62+
| ty::Alias(ty::Projection, ty::AliasTy { def_id, substs })
6363
| ty::Closure(def_id, substs)
6464
| ty::Generator(def_id, substs, _) => self.print_def_path(def_id, substs),
6565
ty::Foreign(def_id) => self.print_def_path(def_id, &[]),

compiler/rustc_hir_analysis/src/astconv/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1241,7 +1241,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
12411241
//
12421242
// Calling `skip_binder` is okay, because `add_bounds` expects the `param_ty`
12431243
// parameter to have a skipped binder.
1244-
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()));
12451245
self.add_bounds(param_ty, ast_bounds.iter(), bounds, candidate.bound_vars());
12461246
}
12471247
}

compiler/rustc_hir_analysis/src/check/check.rs

Lines changed: 1 addition & 1 deletion
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(ty::AliasTy { def_id: def, substs: _ }) => {
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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ 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()
574+
if let ty::Alias(ty::Projection, proj) = ty.kind()
575575
&& self.tcx().def_kind(proj.def_id) == DefKind::ImplTraitPlaceholder
576576
{
577577
if let Some((ty, _)) = self.types.get(&proj.def_id) {
@@ -1734,7 +1734,7 @@ 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)
1737+
ty::Alias(ty::Projection, proj)
17381738
if proj.def_id == trait_ty.def_id && proj.substs == rebased_substs =>
17391739
{
17401740
// Don't include this predicate if the projected type is

compiler/rustc_hir_analysis/src/check/wfcheck.rs

Lines changed: 2 additions & 2 deletions
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.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,7 +1592,7 @@ 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()
1595+
&& let ty::Alias(ty::Projection, proj) = ty.kind()
15961596
&& tcx.def_kind(proj.def_id) == DefKind::ImplTraitPlaceholder
15971597
&& tcx.impl_trait_in_trait_parent(proj.def_id) == fn_def_id.to_def_id()
15981598
{

compiler/rustc_hir_analysis/src/coherence/inherent_impls.rs

Lines changed: 1 addition & 1 deletion
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::Projection, ..) | ty::Alias(ty::Opaque, ..) | ty::Param(_) => {
227227
let mut err = struct_span_err!(
228228
self.tcx.sess,
229229
ty.span,

compiler/rustc_hir_analysis/src/collect/lifetimes.rs

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ pub(super) fn explicit_predicates_of<'tcx>(
411411
// substs are the same as the trait's.
412412
// * It must be an associated type for this trait (*not* a
413413
// supertrait).
414-
if let ty::Projection(projection) = ty.kind() {
414+
if let ty::Alias(ty::Projection, projection) = ty.kind() {
415415
projection.substs == trait_identity_substs
416416
&& tcx.associated_item(projection.def_id).container_id(tcx) == def_id
417417
} else {

compiler/rustc_hir_analysis/src/collect/type_of.rs

Lines changed: 2 additions & 2 deletions
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,7 +68,7 @@ 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() {
71+
if let ty::Alias(ty::Projection, projection) = ty.kind() {
7272
let generics = tcx.generics_of(projection.def_id);
7373

7474
let arg_index = segment

compiler/rustc_hir_analysis/src/constrained_generic_params.rs

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ 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");

compiler/rustc_hir_analysis/src/variance/constraints.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,11 +249,11 @@ 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(ty::Projection, ref data) => {
253253
self.add_constraints_from_invariant_substs(current, data.substs, variance);
254254
}
255255

256-
ty::Opaque(ty::AliasTy { def_id: _, substs }) => {
256+
ty::Alias(ty::Opaque, ty::AliasTy { def_id: _, substs }) => {
257257
self.add_constraints_from_invariant_substs(current, substs, variance);
258258
}
259259

compiler/rustc_hir_analysis/src/variance/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@ fn variance_of_opaque(tcx: TyCtxt<'_>, item_def_id: LocalDefId) -> &[ty::Varianc
112112
fn visit_ty(&mut self, t: Ty<'tcx>) -> ControlFlow<Self::BreakTy> {
113113
// FIXME(alias): merge these
114114
match t.kind() {
115-
ty::Opaque(ty::AliasTy { def_id, substs }) => self.visit_opaque(*def_id, substs),
116-
ty::Projection(proj)
115+
ty::Alias(ty::Opaque, ty::AliasTy { def_id, substs }) => self.visit_opaque(*def_id, substs),
116+
ty::Alias(ty::Projection, proj)
117117
if self.tcx.def_kind(proj.def_id) == DefKind::ImplTraitPlaceholder =>
118118
{
119119
self.visit_opaque(proj.def_id, proj.substs)

compiler/rustc_hir_typeck/src/_match.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
212212
self.can_coerce(arm_ty, ret_ty)
213213
&& prior_arm.map_or(true, |(_, ty, _)| self.can_coerce(ty, ret_ty))
214214
// The match arms need to unify for the case of `impl Trait`.
215-
&& !matches!(ret_ty.kind(), ty::Opaque(..))
215+
&& !matches!(ret_ty.kind(), ty::Alias(ty::Opaque, ..))
216216
}
217217
_ => false,
218218
};
@@ -518,7 +518,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
518518

519519
let substs = sig.output().walk().find_map(|arg| {
520520
if let ty::GenericArgKind::Type(ty) = arg.unpack()
521-
&& let ty::Opaque(ty::AliasTy { def_id, substs }) = *ty.kind()
521+
&& let ty::Alias(ty::Opaque, ty::AliasTy { def_id, substs }) = *ty.kind()
522522
&& def_id == rpit_def_id
523523
{
524524
Some(substs)

compiler/rustc_hir_typeck/src/cast.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
118118
// Pointers to foreign types are thin, despite being unsized
119119
ty::Foreign(..) => Some(PointerKind::Thin),
120120
// We should really try to normalize here.
121-
ty::Projection(pi) => Some(PointerKind::OfProjection(pi)),
122-
ty::Opaque(ty::AliasTy { def_id, substs }) => {
121+
ty::Alias(ty::Projection, pi) => Some(PointerKind::OfProjection(pi)),
122+
ty::Alias(ty::Opaque, ty::AliasTy { def_id, substs }) => {
123123
Some(PointerKind::OfOpaque(def_id, substs))
124124
}
125125
ty::Param(p) => Some(PointerKind::OfParam(p)),

compiler/rustc_hir_typeck/src/closure.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
167167
expected_ty: Ty<'tcx>,
168168
) -> (Option<ExpectedSig<'tcx>>, Option<ty::ClosureKind>) {
169169
match *expected_ty.kind() {
170-
ty::Opaque(ty::AliasTy { def_id, substs }) => self.deduce_signature_from_predicates(
171-
self.tcx.bound_explicit_item_bounds(def_id).subst_iter_copied(self.tcx, substs),
172-
),
170+
ty::Alias(ty::Opaque, ty::AliasTy { def_id, substs }) => self
171+
.deduce_signature_from_predicates(
172+
self.tcx.bound_explicit_item_bounds(def_id).subst_iter_copied(self.tcx, substs),
173+
),
173174
ty::Dynamic(ref object_type, ..) => {
174175
let sig = object_type.projection_bounds().find_map(|pb| {
175176
let pb = pb.with_self_ty(self.tcx, self.tcx.types.trait_object_dummy_self);
@@ -677,13 +678,13 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
677678
get_future_output(obligation.predicate, obligation.cause.span)
678679
})?
679680
}
680-
ty::Opaque(ty::AliasTy { def_id, substs }) => self
681+
ty::Alias(ty::Opaque, ty::AliasTy { def_id, substs }) => self
681682
.tcx
682683
.bound_explicit_item_bounds(def_id)
683684
.subst_iter_copied(self.tcx, substs)
684685
.find_map(|(p, s)| get_future_output(p, s))?,
685686
ty::Error(_) => return None,
686-
ty::Projection(proj)
687+
ty::Alias(ty::Projection, proj)
687688
if self.tcx.def_kind(proj.def_id) == DefKind::ImplTraitPlaceholder =>
688689
{
689690
self.tcx

compiler/rustc_hir_typeck/src/coercion.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1805,7 +1805,7 @@ impl<'tcx, 'exprs, E: AsCoercionSite> CoerceMany<'tcx, 'exprs, E> {
18051805
{
18061806
let ty = <dyn AstConv<'_>>::ast_ty_to_ty(fcx, ty);
18071807
// Get the `impl Trait`'s `DefId`.
1808-
if let ty::Opaque(ty::AliasTy { def_id, substs: _ }) = ty.kind()
1808+
if let ty::Alias(ty::Opaque, ty::AliasTy { def_id, substs: _ }) = ty.kind()
18091809
// Get the `impl Trait`'s `Item` so that we can get its trait bounds and
18101810
// get the `Trait`'s `DefId`.
18111811
&& let hir::ItemKind::OpaqueTy(hir::OpaqueTy { bounds, .. }) =

compiler/rustc_hir_typeck/src/expr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2391,7 +2391,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
23912391
ty::Param(param_ty) => {
23922392
self.point_at_param_definition(&mut err, param_ty);
23932393
}
2394-
ty::Opaque(ty::AliasTy { def_id: _, substs: _ }) => {
2394+
ty::Alias(ty::Opaque, ty::AliasTy { def_id: _, substs: _ }) => {
23952395
self.suggest_await_on_field_access(&mut err, ident, base, base_ty.peel_refs());
23962396
}
23972397
_ => {}

compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -716,7 +716,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
716716
if formal_ret.has_infer_types() {
717717
for ty in ret_ty.walk() {
718718
if let ty::subst::GenericArgKind::Type(ty) = ty.unpack()
719-
&& let ty::Opaque(ty::AliasTy { def_id, substs: _ }) = *ty.kind()
719+
&& let ty::Alias(ty::Opaque, ty::AliasTy { def_id, substs: _ }) = *ty.kind()
720720
&& let Some(def_id) = def_id.as_local()
721721
&& self.opaque_type_origin(def_id, DUMMY_SP).is_some() {
722722
return None;

compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2124,7 +2124,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
21242124
}
21252125
}
21262126
}
2127-
ty::Opaque(ty::AliasTy { def_id: new_def_id, substs: _ })
2127+
ty::Alias(ty::Opaque, ty::AliasTy { def_id: new_def_id, substs: _ })
21282128
| ty::Closure(new_def_id, _)
21292129
| ty::FnDef(new_def_id, _) => {
21302130
def_id = new_def_id;
@@ -2217,7 +2217,7 @@ fn find_param_in_ty<'tcx>(ty: Ty<'tcx>, param_to_point_at: ty::GenericArg<'tcx>)
22172217
if arg == param_to_point_at {
22182218
return true;
22192219
} else if let ty::GenericArgKind::Type(ty) = arg.unpack()
2220-
&& let ty::Projection(..) = ty.kind()
2220+
&& let ty::Alias(ty::Projection, ..) = ty.kind()
22212221
{
22222222
// This logic may seem a bit strange, but typically when
22232223
// we have a projection type in a function signature, the

compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
174174
let fn_sig = substs.as_closure().sig();
175175
Some((DefIdOrName::DefId(def_id), fn_sig.output(), fn_sig.inputs().map_bound(|inputs| &inputs[1..])))
176176
}
177-
ty::Opaque(ty::AliasTy { def_id, substs }) => {
177+
ty::Alias(ty::Opaque, ty::AliasTy { def_id, substs }) => {
178178
self.tcx.bound_item_bounds(def_id).subst(self.tcx, substs).iter().find_map(|pred| {
179179
if let ty::PredicateKind::Clause(ty::Clause::Projection(proj)) = pred.kind().skip_binder()
180180
&& Some(proj.projection_ty.def_id) == self.tcx.lang_items().fn_once_output()

compiler/rustc_hir_typeck/src/generator_interior/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ fn check_must_not_suspend_ty<'tcx>(
563563
}
564564
ty::Adt(def, _) => check_must_not_suspend_def(fcx.tcx, def.did(), hir_id, data),
565565
// FIXME: support adding the attribute to TAITs
566-
ty::Opaque(ty::AliasTy { def_id: def, substs: _ }) => {
566+
ty::Alias(ty::Opaque, ty::AliasTy { def_id: def, substs: _ }) => {
567567
let mut has_emitted = false;
568568
for &(predicate, _) in fcx.tcx.explicit_item_bounds(def) {
569569
// We only look at the `DefId`, so it is safe to skip the binder here.

0 commit comments

Comments
 (0)