Skip to content

Commit c13bd83

Browse files
squash OpaqueTy and ProjectionTy into AliasTy
1 parent 5c6afb8 commit c13bd83

File tree

66 files changed

+182
-197
lines changed

Some content is hidden

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

66 files changed

+182
-197
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::OpaqueTy { def_id, substs }) => {
700+
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::OpaqueTy { def_id, substs: _ }) = *output_ty.kind() {
507+
if let ty::Opaque(ty::AliasTy { def_id, substs: _ }) = *output_ty.kind() {
508508
output_ty = self.infcx.tcx.type_of(def_id)
509509
};
510510

compiler/rustc_const_eval/src/interpret/intrinsics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ pub(crate) fn eval_nullary_intrinsic<'tcx>(
8383
ConstValue::from_machine_usize(adt.variants().len() as u64, &tcx)
8484
}
8585
ty::Projection(_)
86-
| ty::Opaque(ty::OpaqueTy { def_id: _, substs: _ })
86+
| ty::Opaque(ty::AliasTy { def_id: _, substs: _ })
8787
| ty::Param(_)
8888
| ty::Placeholder(_)
8989
| ty::Infer(_) => throw_inval!(TooGeneric),

compiler/rustc_const_eval/src/transform/validate.rs

Lines changed: 1 addition & 1 deletion
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::OpaqueTy { def_id, substs }) => {
244+
&ty::Opaque(ty::AliasTy { def_id, substs }) => {
245245
self.tcx.bound_type_of(def_id).subst(self.tcx, substs).kind()
246246
}
247247
kind => kind,

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::OpaqueTy { def_id, substs })
62-
| ty::Projection(ty::ProjectionTy { def_id, substs })
61+
| ty::Opaque(ty::AliasTy { def_id, substs })
62+
| 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
@@ -1146,7 +1146,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
11461146

11471147
debug!(?substs_trait_ref_and_assoc_item);
11481148

1149-
ty::ProjectionTy { def_id: assoc_item.def_id, substs: substs_trait_ref_and_assoc_item }
1149+
ty::AliasTy { def_id: assoc_item.def_id, substs: substs_trait_ref_and_assoc_item }
11501150
});
11511151

11521152
if !speculative {

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::OpaqueTy { def_id: def, substs: _ }) => {
1443+
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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1746,7 +1746,7 @@ pub fn check_type_bounds<'tcx>(
17461746
_ => predicates.push(
17471747
ty::Binder::bind_with_vars(
17481748
ty::ProjectionPredicate {
1749-
projection_ty: ty::ProjectionTy {
1749+
projection_ty: ty::AliasTy {
17501750
def_id: trait_ty.def_id,
17511751
substs: rebased_substs,
17521752
},

compiler/rustc_hir_analysis/src/variance/constraints.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ impl<'a, 'tcx> ConstraintContext<'a, 'tcx> {
253253
self.add_constraints_from_invariant_substs(current, data.substs, variance);
254254
}
255255

256-
ty::Opaque(ty::OpaqueTy { def_id: _, substs }) => {
256+
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: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,9 @@ fn variance_of_opaque(tcx: TyCtxt<'_>, item_def_id: LocalDefId) -> &[ty::Varianc
110110

111111
#[instrument(level = "trace", skip(self), ret)]
112112
fn visit_ty(&mut self, t: Ty<'tcx>) -> ControlFlow<Self::BreakTy> {
113-
// FIXME(alias): merge these
114-
match t.kind() {
115-
ty::Opaque(ty::OpaqueTy { def_id, substs }) => self.visit_opaque(*def_id, substs),
113+
// FIXME(alias): merge these
114+
match t.kind() {
115+
ty::Opaque(ty::AliasTy { def_id, substs }) => self.visit_opaque(*def_id, substs),
116116
ty::Projection(proj)
117117
if self.tcx.def_kind(proj.def_id) == DefKind::ImplTraitPlaceholder =>
118118
{
@@ -168,7 +168,7 @@ fn variance_of_opaque(tcx: TyCtxt<'_>, item_def_id: LocalDefId) -> &[ty::Varianc
168168
}
169169
}
170170
ty::PredicateKind::Clause(ty::Clause::Projection(ty::ProjectionPredicate {
171-
projection_ty: ty::ProjectionTy { substs, def_id: _ },
171+
projection_ty: ty::AliasTy { substs, def_id: _ },
172172
term,
173173
})) => {
174174
for subst in &substs[1..] {

0 commit comments

Comments
 (0)