Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

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
}

0 commit comments

Comments
 (0)