Combine identical alias arms
This commit is contained in:
parent
61adaf8187
commit
96cb18e864
29 changed files with 69 additions and 120 deletions
|
@ -411,9 +411,8 @@ fn push_debuginfo_type_name<'tcx>(
|
|||
ty::Error(_)
|
||||
| ty::Infer(_)
|
||||
| ty::Placeholder(..)
|
||||
| ty::Alias(ty::Projection, ..)
|
||||
| ty::Alias(..)
|
||||
| ty::Bound(..)
|
||||
| ty::Alias(ty::Opaque, ..)
|
||||
| ty::GeneratorWitness(..) => {
|
||||
bug!(
|
||||
"debuginfo: Trying to create type name for \
|
||||
|
|
|
@ -142,12 +142,11 @@ pub(crate) fn const_to_valtree_inner<'tcx>(
|
|||
| ty::Foreign(..)
|
||||
| ty::Infer(ty::FreshIntTy(_))
|
||||
| ty::Infer(ty::FreshFloatTy(_))
|
||||
| ty::Alias(ty::Projection, ..)
|
||||
// FIXME(oli-obk): we could look behind opaque types
|
||||
| ty::Alias(..)
|
||||
| ty::Param(_)
|
||||
| ty::Bound(..)
|
||||
| ty::Placeholder(..)
|
||||
// FIXME(oli-obk): we could look behind opaque types
|
||||
| ty::Alias(ty::Opaque, ..)
|
||||
| ty::Infer(_)
|
||||
// FIXME(oli-obk): we can probably encode closures just like structs
|
||||
| ty::Closure(..)
|
||||
|
@ -307,11 +306,10 @@ pub fn valtree_to_const_value<'tcx>(
|
|||
| ty::Foreign(..)
|
||||
| ty::Infer(ty::FreshIntTy(_))
|
||||
| ty::Infer(ty::FreshFloatTy(_))
|
||||
| ty::Alias(ty::Projection, ..)
|
||||
| ty::Alias(..)
|
||||
| ty::Param(_)
|
||||
| ty::Bound(..)
|
||||
| ty::Placeholder(..)
|
||||
| ty::Alias(ty::Opaque, ..)
|
||||
| ty::Infer(_)
|
||||
| ty::Closure(..)
|
||||
| ty::Generator(..)
|
||||
|
|
|
@ -82,11 +82,9 @@ pub(crate) fn eval_nullary_intrinsic<'tcx>(
|
|||
ty::Adt(ref adt, _) => {
|
||||
ConstValue::from_machine_usize(adt.variants().len() as u64, &tcx)
|
||||
}
|
||||
ty::Alias(ty::Projection, _)
|
||||
| ty::Alias(ty::Opaque, ty::AliasTy { def_id: _, substs: _ })
|
||||
| ty::Param(_)
|
||||
| ty::Placeholder(_)
|
||||
| ty::Infer(_) => throw_inval!(TooGeneric),
|
||||
ty::Alias(..) | ty::Param(_) | ty::Placeholder(_) | ty::Infer(_) => {
|
||||
throw_inval!(TooGeneric)
|
||||
}
|
||||
ty::Bound(_, _) => bug!("bound ty during ctfe"),
|
||||
ty::Bool
|
||||
| ty::Char
|
||||
|
|
|
@ -601,8 +601,7 @@ impl<'rt, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> ValidityVisitor<'rt, 'mir, '
|
|||
| ty::Placeholder(..)
|
||||
| ty::Bound(..)
|
||||
| ty::Param(..)
|
||||
| ty::Alias(ty::Opaque, ..)
|
||||
| ty::Alias(ty::Projection, ..)
|
||||
| ty::Alias(..)
|
||||
| ty::GeneratorWitness(..) => bug!("Encountered invalid type {:?}", ty),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,8 +58,7 @@ impl<'tcx> Printer<'tcx> for AbsolutePathPrinter<'tcx> {
|
|||
// Types with identity (print the module path).
|
||||
ty::Adt(ty::AdtDef(Interned(&ty::AdtDefData { did: def_id, .. }, _)), substs)
|
||||
| ty::FnDef(def_id, substs)
|
||||
| ty::Alias(ty::Opaque, ty::AliasTy { def_id, substs })
|
||||
| ty::Alias(ty::Projection, ty::AliasTy { def_id, substs })
|
||||
| ty::Alias(_, ty::AliasTy { def_id, substs })
|
||||
| ty::Closure(def_id, substs)
|
||||
| ty::Generator(def_id, substs, _) => self.print_def_path(def_id, substs),
|
||||
ty::Foreign(def_id) => self.print_def_path(def_id, &[]),
|
||||
|
|
|
@ -223,7 +223,7 @@ impl<'tcx> InherentCollect<'tcx> {
|
|||
| ty::Tuple(..) => {
|
||||
self.check_primitive_impl(item.owner_id.def_id, self_ty, items, ty.span)
|
||||
}
|
||||
ty::Alias(ty::Projection, ..) | ty::Alias(ty::Opaque, ..) | ty::Param(_) => {
|
||||
ty::Alias(..) | ty::Param(_) => {
|
||||
let mut err = struct_span_err!(
|
||||
self.tcx.sess,
|
||||
ty.span,
|
||||
|
|
|
@ -249,14 +249,10 @@ impl<'a, 'tcx> ConstraintContext<'a, 'tcx> {
|
|||
self.add_constraints_from_substs(current, def.did(), substs, variance);
|
||||
}
|
||||
|
||||
ty::Alias(ty::Projection, ref data) => {
|
||||
ty::Alias(_, ref data) => {
|
||||
self.add_constraints_from_invariant_substs(current, data.substs, variance);
|
||||
}
|
||||
|
||||
ty::Alias(ty::Opaque, ty::AliasTy { def_id: _, substs }) => {
|
||||
self.add_constraints_from_invariant_substs(current, substs, variance);
|
||||
}
|
||||
|
||||
ty::Dynamic(data, r, _) => {
|
||||
// The type `Foo<T+'a>` is contravariant w/r/t `'a`:
|
||||
let contra = self.contravariant(variance);
|
||||
|
|
|
@ -453,10 +453,9 @@ impl<'cx, 'tcx> TypeFolder<'tcx> for Canonicalizer<'cx, 'tcx> {
|
|||
| ty::Dynamic(..)
|
||||
| ty::Never
|
||||
| ty::Tuple(..)
|
||||
| ty::Alias(ty::Projection, ..)
|
||||
| ty::Alias(..)
|
||||
| ty::Foreign(..)
|
||||
| ty::Param(..)
|
||||
| ty::Alias(ty::Opaque, ..) => {
|
||||
| ty::Param(..) => {
|
||||
if t.flags().intersects(self.needs_canonical_flags) {
|
||||
t.super_fold_with(self)
|
||||
} else {
|
||||
|
|
|
@ -589,8 +589,8 @@ impl<'tcx> InferCtxt<'tcx> {
|
|||
hidden_ty
|
||||
}
|
||||
// FIXME(RPITIT): This can go away when we move to associated types
|
||||
ty::Alias(ty::Projection, proj)
|
||||
if def_id.to_def_id() == proj.def_id && substs == proj.substs =>
|
||||
ty::Alias(ty::Projection, ty::AliasTy { def_id: def_id2, substs: substs2 })
|
||||
if def_id.to_def_id() == def_id2 && substs == substs2 =>
|
||||
{
|
||||
hidden_ty
|
||||
}
|
||||
|
|
|
@ -349,7 +349,7 @@ impl<'tcx> SizeSkeleton<'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
ty::Alias(ty::Projection, _) | ty::Alias(ty::Opaque, ..) => {
|
||||
ty::Alias(..) => {
|
||||
let normalized = tcx.normalize_erasing_regions(param_env, ty);
|
||||
if ty == normalized {
|
||||
Err(err)
|
||||
|
@ -757,10 +757,9 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
ty::Alias(ty::Projection, _)
|
||||
ty::Alias(..)
|
||||
| ty::Bound(..)
|
||||
| ty::Placeholder(..)
|
||||
| ty::Alias(ty::Opaque, ..)
|
||||
| ty::Param(_)
|
||||
| ty::Infer(_)
|
||||
| ty::Error(_) => bug!("TyAndLayout::field: unexpected type `{}`", this.ty),
|
||||
|
|
|
@ -275,10 +275,9 @@ fn characteristic_def_id_of_type_cached<'a>(
|
|||
| ty::Uint(_)
|
||||
| ty::Str
|
||||
| ty::FnPtr(_)
|
||||
| ty::Alias(ty::Projection, _)
|
||||
| ty::Alias(..)
|
||||
| ty::Placeholder(..)
|
||||
| ty::Param(_)
|
||||
| ty::Alias(ty::Opaque, ..)
|
||||
| ty::Infer(_)
|
||||
| ty::Bound(..)
|
||||
| ty::Error(_)
|
||||
|
|
|
@ -651,12 +651,7 @@ impl<'tcx> TypeSuperFoldable<'tcx> for Ty<'tcx> {
|
|||
}
|
||||
ty::GeneratorWitness(types) => ty::GeneratorWitness(types.try_fold_with(folder)?),
|
||||
ty::Closure(did, substs) => ty::Closure(did, substs.try_fold_with(folder)?),
|
||||
ty::Alias(ty::Projection, data) => {
|
||||
ty::Alias(ty::Projection, data.try_fold_with(folder)?)
|
||||
}
|
||||
ty::Alias(ty::Opaque, ty::AliasTy { def_id, substs }) => {
|
||||
ty::Alias(ty::Opaque, ty::AliasTy { def_id, substs: substs.try_fold_with(folder)? })
|
||||
}
|
||||
ty::Alias(kind, data) => ty::Alias(kind, data.try_fold_with(folder)?),
|
||||
|
||||
ty::Bool
|
||||
| ty::Char
|
||||
|
@ -701,10 +696,7 @@ impl<'tcx> TypeSuperVisitable<'tcx> for Ty<'tcx> {
|
|||
ty::Generator(_did, ref substs, _) => substs.visit_with(visitor),
|
||||
ty::GeneratorWitness(ref types) => types.visit_with(visitor),
|
||||
ty::Closure(_did, ref substs) => substs.visit_with(visitor),
|
||||
ty::Alias(ty::Projection, ref data) => data.visit_with(visitor),
|
||||
ty::Alias(ty::Opaque, ty::AliasTy { def_id: _, ref substs }) => {
|
||||
substs.visit_with(visitor)
|
||||
}
|
||||
ty::Alias(_, ref data) => data.visit_with(visitor),
|
||||
|
||||
ty::Bool
|
||||
| ty::Char
|
||||
|
|
|
@ -2047,10 +2047,7 @@ impl<'tcx> Ty<'tcx> {
|
|||
ty::Adt(adt, _) if adt.is_enum() => adt.repr().discr_type().to_ty(tcx),
|
||||
ty::Generator(_, substs, _) => substs.as_generator().discr_ty(tcx),
|
||||
|
||||
ty::Param(_)
|
||||
| ty::Alias(ty::Projection, _)
|
||||
| ty::Alias(ty::Opaque, ..)
|
||||
| ty::Infer(ty::TyVar(_)) => {
|
||||
ty::Param(_) | ty::Alias(..) | ty::Infer(ty::TyVar(_)) => {
|
||||
let assoc_items = tcx.associated_item_def_ids(
|
||||
tcx.require_lang_item(hir::LangItem::DiscriminantKind, None),
|
||||
);
|
||||
|
@ -2130,7 +2127,7 @@ impl<'tcx> Ty<'tcx> {
|
|||
|
||||
// type parameters only have unit metadata if they're sized, so return true
|
||||
// to make sure we double check this during confirmation
|
||||
ty::Param(_) | ty::Alias(ty::Projection, _) | ty::Alias(ty::Opaque, ..) => (tcx.types.unit, true),
|
||||
ty::Param(_) | ty::Alias(..) => (tcx.types.unit, true),
|
||||
|
||||
ty::Infer(ty::TyVar(_))
|
||||
| ty::Bound(..)
|
||||
|
@ -2206,7 +2203,7 @@ impl<'tcx> Ty<'tcx> {
|
|||
|
||||
ty::Adt(def, _substs) => def.sized_constraint(tcx).0.is_empty(),
|
||||
|
||||
ty::Alias(ty::Projection, _) | ty::Param(_) | ty::Alias(ty::Opaque, ..) => false,
|
||||
ty::Alias(..) | ty::Param(_) => false,
|
||||
|
||||
ty::Infer(ty::TyVar(_)) => false,
|
||||
|
||||
|
@ -2262,9 +2259,12 @@ impl<'tcx> Ty<'tcx> {
|
|||
ty::Generator(..) | ty::GeneratorWitness(..) => false,
|
||||
|
||||
// Might be, but not "trivial" so just giving the safe answer.
|
||||
ty::Adt(..) | ty::Closure(..) | ty::Alias(ty::Opaque, ..) => false,
|
||||
ty::Adt(..) | ty::Closure(..) => false,
|
||||
|
||||
ty::Alias(ty::Projection, ..) | ty::Param(..) | ty::Infer(..) | ty::Error(..) => false,
|
||||
// Needs normalization or revealing to determine, so no is the safe answer.
|
||||
ty::Alias(..) => false,
|
||||
|
||||
ty::Param(..) | ty::Infer(..) | ty::Error(..) => false,
|
||||
|
||||
ty::Bound(..) | ty::Placeholder(..) => {
|
||||
bug!("`is_trivially_pure_clone_copy` applied to unexpected type: {:?}", self);
|
||||
|
|
|
@ -259,7 +259,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||
|
||||
ty::Tuple(_) => break,
|
||||
|
||||
ty::Alias(ty::Projection, _) | ty::Alias(ty::Opaque, ..) => {
|
||||
ty::Alias(..) => {
|
||||
let normalized = normalize(ty);
|
||||
if ty == normalized {
|
||||
return ty;
|
||||
|
@ -332,8 +332,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||
break;
|
||||
}
|
||||
}
|
||||
(ty::Alias(ty::Projection, _) | ty::Alias(ty::Opaque, ..), _)
|
||||
| (_, ty::Alias(ty::Projection, _) | ty::Alias(ty::Opaque, ..)) => {
|
||||
(ty::Alias(..), _) | (_, ty::Alias(..)) => {
|
||||
// If either side is a projection, attempt to
|
||||
// progress via normalization. (Should be safe to
|
||||
// apply to both sides as normalization is
|
||||
|
@ -938,10 +937,9 @@ impl<'tcx> Ty<'tcx> {
|
|||
| ty::Generator(..)
|
||||
| ty::GeneratorWitness(_)
|
||||
| ty::Infer(_)
|
||||
| ty::Alias(ty::Opaque, ..)
|
||||
| ty::Alias(..)
|
||||
| ty::Param(_)
|
||||
| ty::Placeholder(_)
|
||||
| ty::Alias(ty::Projection, _) => false,
|
||||
| ty::Placeholder(_) => false,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -978,10 +976,9 @@ impl<'tcx> Ty<'tcx> {
|
|||
| ty::Generator(..)
|
||||
| ty::GeneratorWitness(_)
|
||||
| ty::Infer(_)
|
||||
| ty::Alias(ty::Opaque, ..)
|
||||
| ty::Alias(..)
|
||||
| ty::Param(_)
|
||||
| ty::Placeholder(_)
|
||||
| ty::Alias(ty::Projection, _) => false,
|
||||
| ty::Placeholder(_) => false,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1101,12 +1098,9 @@ impl<'tcx> Ty<'tcx> {
|
|||
//
|
||||
// FIXME(ecstaticmorse): Maybe we should `bug` here? This should probably only be
|
||||
// called for known, fully-monomorphized types.
|
||||
ty::Alias(ty::Projection, _)
|
||||
| ty::Alias(ty::Opaque, ..)
|
||||
| ty::Param(_)
|
||||
| ty::Bound(..)
|
||||
| ty::Placeholder(_)
|
||||
| ty::Infer(_) => false,
|
||||
ty::Alias(..) | ty::Param(_) | ty::Bound(..) | ty::Placeholder(_) | ty::Infer(_) => {
|
||||
false
|
||||
}
|
||||
|
||||
ty::Foreign(_) | ty::GeneratorWitness(..) | ty::Error(_) => false,
|
||||
}
|
||||
|
@ -1237,11 +1231,10 @@ pub fn needs_drop_components<'tcx>(
|
|||
|
||||
// These require checking for `Copy` bounds or `Adt` destructors.
|
||||
ty::Adt(..)
|
||||
| ty::Alias(ty::Projection, ..)
|
||||
| ty::Alias(..)
|
||||
| ty::Param(_)
|
||||
| ty::Bound(..)
|
||||
| ty::Placeholder(..)
|
||||
| ty::Alias(ty::Opaque, ..)
|
||||
| ty::Infer(_)
|
||||
| ty::Closure(..)
|
||||
| ty::Generator(..) => Ok(smallvec![ty]),
|
||||
|
@ -1265,13 +1258,12 @@ pub fn is_trivially_const_drop<'tcx>(ty: Ty<'tcx>) -> bool {
|
|||
| ty::Never
|
||||
| ty::Foreign(_) => true,
|
||||
|
||||
ty::Alias(ty::Opaque, ..)
|
||||
ty::Alias(..)
|
||||
| ty::Dynamic(..)
|
||||
| ty::Error(_)
|
||||
| ty::Bound(..)
|
||||
| ty::Param(_)
|
||||
| ty::Placeholder(_)
|
||||
| ty::Alias(ty::Projection, _)
|
||||
| ty::Infer(_) => false,
|
||||
|
||||
// Not trivial because they have components, and instead of looking inside,
|
||||
|
|
|
@ -654,7 +654,7 @@ impl<'tcx> TypeVisitor<'tcx> for LateBoundRegionsCollector {
|
|||
// ignore the inputs to a projection, as they may not appear
|
||||
// in the normalized form
|
||||
if self.just_constrained {
|
||||
if let ty::Alias(ty::Projection, ..) | ty::Alias(ty::Opaque, ..) = t.kind() {
|
||||
if let ty::Alias(..) = t.kind() {
|
||||
return ControlFlow::CONTINUE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -165,7 +165,7 @@ fn push_inner<'tcx>(stack: &mut TypeWalkerStack<'tcx>, parent: GenericArg<'tcx>)
|
|||
stack.push(ty.into());
|
||||
stack.push(lt.into());
|
||||
}
|
||||
ty::Alias(ty::Projection, data) => {
|
||||
ty::Alias(_, data) => {
|
||||
stack.extend(data.substs.iter().rev());
|
||||
}
|
||||
ty::Dynamic(obj, lt, _) => {
|
||||
|
@ -188,7 +188,6 @@ fn push_inner<'tcx>(stack: &mut TypeWalkerStack<'tcx>, parent: GenericArg<'tcx>)
|
|||
}));
|
||||
}
|
||||
ty::Adt(_, substs)
|
||||
| ty::Alias(ty::Opaque, ty::AliasTy { def_id: _, substs })
|
||||
| ty::Closure(_, substs)
|
||||
| ty::Generator(_, substs, _)
|
||||
| ty::FnDef(_, substs) => {
|
||||
|
|
|
@ -216,8 +216,7 @@ impl<'tcx> Printer<'tcx> for &mut SymbolPrinter<'tcx> {
|
|||
match *ty.kind() {
|
||||
// Print all nominal types as paths (unlike `pretty_print_type`).
|
||||
ty::FnDef(def_id, substs)
|
||||
| ty::Alias(ty::Opaque, ty::AliasTy { def_id, substs })
|
||||
| ty::Alias(ty::Projection, ty::AliasTy { def_id, substs })
|
||||
| ty::Alias(_, ty::AliasTy { def_id, substs })
|
||||
| ty::Closure(def_id, substs)
|
||||
| ty::Generator(def_id, substs, _) => self.print_def_path(def_id, substs),
|
||||
|
||||
|
|
|
@ -646,10 +646,9 @@ fn encode_ty<'tcx>(
|
|||
| ty::Error(..)
|
||||
| ty::GeneratorWitness(..)
|
||||
| ty::Infer(..)
|
||||
| ty::Alias(ty::Opaque, ..)
|
||||
| ty::Alias(..)
|
||||
| ty::Param(..)
|
||||
| ty::Placeholder(..)
|
||||
| ty::Alias(ty::Projection, ..) => {
|
||||
| ty::Placeholder(..) => {
|
||||
bug!("encode_ty: unexpected `{:?}`", ty.kind());
|
||||
}
|
||||
};
|
||||
|
@ -799,10 +798,9 @@ fn transform_ty<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>, options: TransformTyOptio
|
|||
| ty::Error(..)
|
||||
| ty::GeneratorWitness(..)
|
||||
| ty::Infer(..)
|
||||
| ty::Alias(ty::Opaque, ..)
|
||||
| ty::Alias(..)
|
||||
| ty::Param(..)
|
||||
| ty::Placeholder(..)
|
||||
| ty::Alias(ty::Projection, ..) => {
|
||||
| ty::Placeholder(..) => {
|
||||
bug!("transform_ty: unexpected `{:?}`", ty.kind());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -439,8 +439,7 @@ impl<'tcx> Printer<'tcx> for &mut SymbolMangler<'tcx> {
|
|||
// Mangle all nominal types as paths.
|
||||
ty::Adt(ty::AdtDef(Interned(&ty::AdtDefData { did: def_id, .. }, _)), substs)
|
||||
| ty::FnDef(def_id, substs)
|
||||
| ty::Alias(ty::Opaque, ty::AliasTy { def_id, substs })
|
||||
| ty::Alias(ty::Projection, ty::AliasTy { def_id, substs })
|
||||
| ty::Alias(_, ty::AliasTy { def_id, substs })
|
||||
| ty::Closure(def_id, substs)
|
||||
| ty::Generator(def_id, substs, _) => {
|
||||
self = self.print_def_path(def_id, substs)?;
|
||||
|
|
|
@ -1620,8 +1620,7 @@ fn assemble_candidates_from_impls<'cx, 'tcx>(
|
|||
// type parameters, opaques, and unnormalized projections have pointer
|
||||
// metadata if they're known (e.g. by the param_env) to be sized
|
||||
ty::Param(_)
|
||||
| ty::Alias(ty::Projection, ..)
|
||||
| ty::Alias(ty::Opaque, ..)
|
||||
| ty::Alias(..)
|
||||
| ty::Bound(..)
|
||||
| ty::Placeholder(..)
|
||||
| ty::Infer(..)
|
||||
|
@ -1675,7 +1674,7 @@ fn assemble_candidates_from_impls<'cx, 'tcx>(
|
|||
|
||||
// type parameters, opaques, and unnormalized projections have pointer
|
||||
// metadata if they're known (e.g. by the param_env) to be sized
|
||||
ty::Param(_) | ty::Alias(ty::Projection, ..) | ty::Alias(ty::Opaque, ..)
|
||||
ty::Param(_) | ty::Alias(..)
|
||||
if selcx.infcx.predicate_must_hold_modulo_regions(
|
||||
&obligation.with(
|
||||
selcx.tcx(),
|
||||
|
@ -1691,8 +1690,7 @@ fn assemble_candidates_from_impls<'cx, 'tcx>(
|
|||
|
||||
// FIXME(compiler-errors): are Bound and Placeholder types ever known sized?
|
||||
ty::Param(_)
|
||||
| ty::Alias(ty::Projection, ..)
|
||||
| ty::Alias(ty::Opaque, ..)
|
||||
| ty::Alias(..)
|
||||
| ty::Bound(..)
|
||||
| ty::Placeholder(..)
|
||||
| ty::Infer(..)
|
||||
|
|
|
@ -62,9 +62,8 @@ pub fn trivial_dropck_outlives<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> bool {
|
|||
|
||||
// The following *might* require a destructor: needs deeper inspection.
|
||||
ty::Dynamic(..)
|
||||
| ty::Alias(ty::Projection, ..)
|
||||
| ty::Alias(..)
|
||||
| ty::Param(_)
|
||||
| ty::Alias(ty::Opaque, ..)
|
||||
| ty::Placeholder(..)
|
||||
| ty::Infer(_)
|
||||
| ty::Bound(..)
|
||||
|
|
|
@ -138,7 +138,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
// Before we go into the whole placeholder thing, just
|
||||
// quickly check if the self-type is a projection at all.
|
||||
match obligation.predicate.skip_binder().trait_ref.self_ty().kind() {
|
||||
ty::Alias(ty::Projection, _) | ty::Alias(ty::Opaque, ..) => {}
|
||||
ty::Alias(..) => {}
|
||||
ty::Infer(ty::TyVar(_)) => {
|
||||
span_bug!(
|
||||
obligation.cause.span,
|
||||
|
@ -734,13 +734,12 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
|
||||
let self_ty = self.infcx.shallow_resolve(obligation.self_ty());
|
||||
match self_ty.skip_binder().kind() {
|
||||
ty::Alias(ty::Opaque, ..)
|
||||
ty::Alias(..)
|
||||
| ty::Dynamic(..)
|
||||
| ty::Error(_)
|
||||
| ty::Bound(..)
|
||||
| ty::Param(_)
|
||||
| ty::Placeholder(_)
|
||||
| ty::Alias(ty::Projection, _) => {
|
||||
| ty::Placeholder(_) => {
|
||||
// We don't know if these are `~const Destruct`, at least
|
||||
// not structurally... so don't push a candidate.
|
||||
}
|
||||
|
@ -826,8 +825,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
| ty::Generator(_, _, _)
|
||||
| ty::GeneratorWitness(_)
|
||||
| ty::Never
|
||||
| ty::Alias(ty::Projection, _)
|
||||
| ty::Alias(ty::Opaque, ty::AliasTy { def_id: _, substs: _ })
|
||||
| ty::Alias(..)
|
||||
| ty::Param(_)
|
||||
| ty::Bound(_, _)
|
||||
| ty::Error(_)
|
||||
|
|
|
@ -155,8 +155,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
let placeholder_self_ty = placeholder_trait_predicate.self_ty();
|
||||
let placeholder_trait_predicate = ty::Binder::dummy(placeholder_trait_predicate);
|
||||
let (def_id, substs) = match *placeholder_self_ty.kind() {
|
||||
ty::Alias(ty::Projection, proj) => (proj.def_id, proj.substs),
|
||||
ty::Alias(ty::Opaque, ty::AliasTy { def_id, substs }) => (def_id, substs),
|
||||
ty::Alias(_, ty::AliasTy { def_id, substs }) => (def_id, substs),
|
||||
_ => bug!("projection candidate for unexpected type: {:?}", placeholder_self_ty),
|
||||
};
|
||||
|
||||
|
|
|
@ -1595,8 +1595,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
|
||||
let tcx = self.infcx.tcx;
|
||||
let (def_id, substs) = match *placeholder_trait_predicate.trait_ref.self_ty().kind() {
|
||||
ty::Alias(ty::Projection, ref data) => (data.def_id, data.substs),
|
||||
ty::Alias(ty::Opaque, ty::AliasTy { def_id, substs }) => (def_id, substs),
|
||||
ty::Alias(_, ty::AliasTy { def_id, substs }) => (def_id, substs),
|
||||
_ => {
|
||||
span_bug!(
|
||||
obligation.cause.span,
|
||||
|
@ -2067,7 +2066,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
}))
|
||||
}
|
||||
|
||||
ty::Alias(ty::Projection, _) | ty::Param(_) | ty::Alias(ty::Opaque, ..) => None,
|
||||
ty::Alias(..) | ty::Param(_) => None,
|
||||
ty::Infer(ty::TyVar(_)) => Ambiguous,
|
||||
|
||||
ty::Placeholder(..)
|
||||
|
@ -2167,10 +2166,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
ty::Adt(..)
|
||||
| ty::Alias(ty::Projection, ..)
|
||||
| ty::Param(..)
|
||||
| ty::Alias(ty::Opaque, ..) => {
|
||||
ty::Adt(..) | ty::Alias(..) | ty::Param(..) => {
|
||||
// Fallback to whatever user-defined impls exist in this case.
|
||||
None
|
||||
}
|
||||
|
|
|
@ -95,10 +95,7 @@ impl<'tcx> TypeVisitor<'tcx> for Search<'tcx> {
|
|||
ty::Foreign(_) => {
|
||||
return ControlFlow::Break(ty);
|
||||
}
|
||||
ty::Alias(ty::Opaque, ..) => {
|
||||
return ControlFlow::Break(ty);
|
||||
}
|
||||
ty::Alias(ty::Projection, ..) => {
|
||||
ty::Alias(..) => {
|
||||
return ControlFlow::Break(ty);
|
||||
}
|
||||
ty::Closure(..) => {
|
||||
|
|
|
@ -112,7 +112,7 @@ fn dropck_outlives<'tcx>(
|
|||
|
||||
// A projection that we couldn't resolve - it
|
||||
// might have a destructor.
|
||||
ty::Alias(ty::Projection, ..) | ty::Alias(ty::Opaque, ..) => {
|
||||
ty::Alias(..) => {
|
||||
result.kinds.push(ty.into());
|
||||
}
|
||||
|
||||
|
@ -268,7 +268,7 @@ fn dtorck_constraint_for_ty<'tcx>(
|
|||
}
|
||||
|
||||
// Types that can't be resolved. Pass them forward.
|
||||
ty::Alias(ty::Projection, ..) | ty::Alias(ty::Opaque, ..) | ty::Param(..) => {
|
||||
ty::Alias(..) | ty::Param(..) => {
|
||||
constraints.dtorck_types.push(ty);
|
||||
}
|
||||
|
||||
|
|
|
@ -444,7 +444,7 @@ fn layout_of_uncached<'tcx>(
|
|||
}
|
||||
|
||||
// Types with no meaningful known layout.
|
||||
ty::Alias(ty::Projection, _) | ty::Alias(ty::Opaque, ..) => {
|
||||
ty::Alias(..) => {
|
||||
// NOTE(eddyb) `layout_of` query should've normalized these away,
|
||||
// if that was possible, so there's no reason to try again here.
|
||||
return Err(LayoutError::Unknown(ty));
|
||||
|
|
|
@ -152,10 +152,7 @@ where
|
|||
queue_type(self, required);
|
||||
}
|
||||
}
|
||||
ty::Array(..)
|
||||
| ty::Alias(ty::Opaque, ..)
|
||||
| ty::Alias(ty::Projection, ..)
|
||||
| ty::Param(_) => {
|
||||
ty::Array(..) | ty::Alias(..) | ty::Param(_) => {
|
||||
if ty == component {
|
||||
// Return the type to the caller: they may be able
|
||||
// to normalize further than we can.
|
||||
|
|
|
@ -636,11 +636,11 @@ where
|
|||
18 => Never,
|
||||
19 => Tuple(Decodable::decode(d)),
|
||||
20 => Alias(Decodable::decode(d), Decodable::decode(d)),
|
||||
22 => Param(Decodable::decode(d)),
|
||||
23 => Bound(Decodable::decode(d), Decodable::decode(d)),
|
||||
24 => Placeholder(Decodable::decode(d)),
|
||||
25 => Infer(Decodable::decode(d)),
|
||||
26 => Error(Decodable::decode(d)),
|
||||
21 => Param(Decodable::decode(d)),
|
||||
22 => Bound(Decodable::decode(d), Decodable::decode(d)),
|
||||
23 => Placeholder(Decodable::decode(d)),
|
||||
24 => Infer(Decodable::decode(d)),
|
||||
25 => Error(Decodable::decode(d)),
|
||||
_ => panic!(
|
||||
"{}",
|
||||
format!(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue