Skip to content

Commit 96cb18e

Browse files
Combine identical alias arms
1 parent 61adaf8 commit 96cb18e

File tree

29 files changed

+69
-120
lines changed

29 files changed

+69
-120
lines changed

compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs

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

compiler/rustc_const_eval/src/const_eval/valtrees.rs

Lines changed: 3 additions & 5 deletions
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::Alias(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::Alias(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::Alias(ty::Projection, ..)
309+
| ty::Alias(..)
311310
| ty::Param(_)
312311
| ty::Bound(..)
313312
| ty::Placeholder(..)
314-
| ty::Alias(ty::Opaque, ..)
315313
| ty::Infer(_)
316314
| ty::Closure(..)
317315
| ty::Generator(..)

compiler/rustc_const_eval/src/interpret/intrinsics.rs

Lines changed: 3 additions & 5 deletions
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::Alias(ty::Projection, _)
86-
| ty::Alias(ty::Opaque, ty::AliasTy { def_id: _, substs: _ })
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

Lines changed: 1 addition & 2 deletions
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::Alias(ty::Opaque, ..)
605-
| ty::Alias(ty::Projection, ..)
604+
| ty::Alias(..)
606605
| ty::GeneratorWitness(..) => bug!("Encountered invalid type {:?}", ty),
607606
}
608607
}

compiler/rustc_const_eval/src/util/type_name.rs

Lines changed: 1 addition & 2 deletions
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::Alias(ty::Opaque, ty::AliasTy { def_id, substs })
62-
| ty::Alias(ty::Projection, ty::AliasTy { 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/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::Alias(ty::Projection, ..) | ty::Alias(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/variance/constraints.rs

Lines changed: 1 addition & 5 deletions
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::Alias(ty::Projection, ref data) => {
252+
ty::Alias(_, ref data) => {
253253
self.add_constraints_from_invariant_substs(current, data.substs, variance);
254254
}
255255

256-
ty::Alias(ty::Opaque, ty::AliasTy { def_id: _, 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);

compiler/rustc_infer/src/infer/canonical/canonicalizer.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -453,10 +453,9 @@ impl<'cx, 'tcx> TypeFolder<'tcx> for Canonicalizer<'cx, 'tcx> {
453453
| ty::Dynamic(..)
454454
| ty::Never
455455
| ty::Tuple(..)
456-
| ty::Alias(ty::Projection, ..)
456+
| ty::Alias(..)
457457
| ty::Foreign(..)
458-
| ty::Param(..)
459-
| ty::Alias(ty::Opaque, ..) => {
458+
| ty::Param(..) => {
460459
if t.flags().intersects(self.needs_canonical_flags) {
461460
t.super_fold_with(self)
462461
} else {

compiler/rustc_infer/src/infer/opaque_types.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -589,8 +589,8 @@ impl<'tcx> InferCtxt<'tcx> {
589589
hidden_ty
590590
}
591591
// FIXME(RPITIT): This can go away when we move to associated types
592-
ty::Alias(ty::Projection, proj)
593-
if def_id.to_def_id() == proj.def_id && substs == proj.substs =>
592+
ty::Alias(ty::Projection, ty::AliasTy { def_id: def_id2, substs: substs2 })
593+
if def_id.to_def_id() == def_id2 && substs == substs2 =>
594594
{
595595
hidden_ty
596596
}

compiler/rustc_middle/src/ty/layout.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ impl<'tcx> SizeSkeleton<'tcx> {
349349
}
350350
}
351351

352-
ty::Alias(ty::Projection, _) | ty::Alias(ty::Opaque, ..) => {
352+
ty::Alias(..) => {
353353
let normalized = tcx.normalize_erasing_regions(param_env, ty);
354354
if ty == normalized {
355355
Err(err)
@@ -757,10 +757,9 @@ where
757757
}
758758
}
759759

760-
ty::Alias(ty::Projection, _)
760+
ty::Alias(..)
761761
| ty::Bound(..)
762762
| ty::Placeholder(..)
763-
| ty::Alias(ty::Opaque, ..)
764763
| ty::Param(_)
765764
| ty::Infer(_)
766765
| ty::Error(_) => bug!("TyAndLayout::field: unexpected type `{}`", this.ty),

0 commit comments

Comments
 (0)