Combine identical alias arms
This commit is contained in:
parent
61adaf8187
commit
96cb18e864
29 changed files with 69 additions and 120 deletions
|
@ -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(..) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue