1
Fork 0

remove TypeWellFormedFromEnv

This commit is contained in:
Michael Goulet 2023-07-03 15:27:41 +00:00
parent c6fcbaae0f
commit 0c73b41cd6
23 changed files with 18 additions and 73 deletions

View file

@ -983,8 +983,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
ty::ClauseKind::RegionOutlives(_) ty::ClauseKind::RegionOutlives(_)
| ty::ClauseKind::ConstArgHasType(..) | ty::ClauseKind::ConstArgHasType(..)
| ty::ClauseKind::WellFormed(_) | ty::ClauseKind::WellFormed(_)
| ty::ClauseKind::ConstEvaluatable(_) | ty::ClauseKind::ConstEvaluatable(_) => {
| ty::ClauseKind::TypeWellFormedFromEnv(_) => {
bug!() bug!()
} }
} }

View file

@ -551,7 +551,6 @@ fn trait_predicate_kind<'tcx>(
| ty::PredicateKind::ClosureKind(..) | ty::PredicateKind::ClosureKind(..)
| ty::PredicateKind::Clause(ty::ClauseKind::ConstEvaluatable(..)) | ty::PredicateKind::Clause(ty::ClauseKind::ConstEvaluatable(..))
| ty::PredicateKind::ConstEquate(..) | ty::PredicateKind::ConstEquate(..)
| ty::PredicateKind::Ambiguous | ty::PredicateKind::Ambiguous => None,
| ty::PredicateKind::Clause(ty::ClauseKind::TypeWellFormedFromEnv(..)) => None,
} }
} }

View file

@ -53,8 +53,7 @@ impl<'tcx> ExplicitPredicatesMap<'tcx> {
| ty::ClauseKind::Projection(_) | ty::ClauseKind::Projection(_)
| ty::ClauseKind::ConstArgHasType(_, _) | ty::ClauseKind::ConstArgHasType(_, _)
| ty::ClauseKind::WellFormed(_) | ty::ClauseKind::WellFormed(_)
| ty::ClauseKind::ConstEvaluatable(_) | ty::ClauseKind::ConstEvaluatable(_) => {}
| ty::ClauseKind::TypeWellFormedFromEnv(_) => {}
} }
} }

View file

@ -685,7 +685,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
// inference variable. // inference variable.
| ty::PredicateKind::ClosureKind(..) | ty::PredicateKind::ClosureKind(..)
| ty::PredicateKind::Ambiguous | ty::PredicateKind::Ambiguous
| ty::PredicateKind::Clause(ty::ClauseKind::TypeWellFormedFromEnv(..)) => None, => None,
}, },
) )
} }

View file

@ -847,8 +847,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
| ty::ClauseKind::Projection(_) | ty::ClauseKind::Projection(_)
| ty::ClauseKind::ConstArgHasType(_, _) | ty::ClauseKind::ConstArgHasType(_, _)
| ty::ClauseKind::WellFormed(_) | ty::ClauseKind::WellFormed(_)
| ty::ClauseKind::ConstEvaluatable(_) | ty::ClauseKind::ConstEvaluatable(_) => None,
| ty::ClauseKind::TypeWellFormedFromEnv(_) => None,
} }
}); });

View file

@ -31,8 +31,7 @@ pub fn explicit_outlives_bounds<'tcx>(
| ty::ClauseKind::Projection(_) | ty::ClauseKind::Projection(_)
| ty::ClauseKind::ConstArgHasType(_, _) | ty::ClauseKind::ConstArgHasType(_, _)
| ty::ClauseKind::WellFormed(_) | ty::ClauseKind::WellFormed(_)
| ty::ClauseKind::ConstEvaluatable(_) | ty::ClauseKind::ConstEvaluatable(_) => None,
| ty::ClauseKind::TypeWellFormedFromEnv(_) => None,
}) })
} }

View file

@ -370,9 +370,6 @@ impl<'tcx, O: Elaboratable<'tcx>> Elaborator<'tcx, O> {
}), }),
); );
} }
ty::PredicateKind::Clause(ty::ClauseKind::TypeWellFormedFromEnv(..)) => {
// Nothing to elaborate
}
ty::PredicateKind::Ambiguous => {} ty::PredicateKind::Ambiguous => {}
ty::PredicateKind::AliasRelate(..) => { ty::PredicateKind::AliasRelate(..) => {
// No // No

View file

@ -1606,8 +1606,7 @@ impl<'tcx> LateLintPass<'tcx> for TrivialConstraints {
// Ignore bounds that a user can't type // Ignore bounds that a user can't type
| ClauseKind::WellFormed(..) | ClauseKind::WellFormed(..)
// FIXME(generic_const_exprs): `ConstEvaluatable` can be written // FIXME(generic_const_exprs): `ConstEvaluatable` can be written
| ClauseKind::ConstEvaluatable(..) | ClauseKind::ConstEvaluatable(..) => continue,
| ClauseKind::TypeWellFormedFromEnv(_) => continue,
}; };
if predicate.is_global() { if predicate.is_global() {
cx.emit_spanned_lint( cx.emit_spanned_lint(

View file

@ -287,9 +287,6 @@ impl FlagComputation {
self.add_const(expected); self.add_const(expected);
self.add_const(found); self.add_const(found);
} }
ty::PredicateKind::Clause(ty::ClauseKind::TypeWellFormedFromEnv(ty)) => {
self.add_ty(ty);
}
ty::PredicateKind::Ambiguous => {} ty::PredicateKind::Ambiguous => {}
ty::PredicateKind::AliasRelate(t1, t2, _) => { ty::PredicateKind::AliasRelate(t1, t2, _) => {
self.add_term(t1); self.add_term(t1);

View file

@ -554,8 +554,7 @@ impl<'tcx> Predicate<'tcx> {
| PredicateKind::Coerce(_) | PredicateKind::Coerce(_)
| PredicateKind::Clause(ClauseKind::ConstEvaluatable(_)) | PredicateKind::Clause(ClauseKind::ConstEvaluatable(_))
| PredicateKind::ConstEquate(_, _) | PredicateKind::ConstEquate(_, _)
| PredicateKind::Ambiguous | PredicateKind::Ambiguous => true,
| PredicateKind::Clause(ClauseKind::TypeWellFormedFromEnv(_)) => true,
} }
} }
} }
@ -661,11 +660,6 @@ pub enum ClauseKind<'tcx> {
/// Constant initializer must evaluate successfully. /// Constant initializer must evaluate successfully.
ConstEvaluatable(ty::Const<'tcx>), ConstEvaluatable(ty::Const<'tcx>),
/// Represents a type found in the environment that we can use for implied bounds.
///
/// Only used for Chalk.
TypeWellFormedFromEnv(Ty<'tcx>),
} }
#[derive(Clone, Copy, PartialEq, Eq, Hash, TyEncodable, TyDecodable)] #[derive(Clone, Copy, PartialEq, Eq, Hash, TyEncodable, TyDecodable)]
@ -1424,8 +1418,7 @@ impl<'tcx> Predicate<'tcx> {
| PredicateKind::Clause(ClauseKind::TypeOutlives(..)) | PredicateKind::Clause(ClauseKind::TypeOutlives(..))
| PredicateKind::Clause(ClauseKind::ConstEvaluatable(..)) | PredicateKind::Clause(ClauseKind::ConstEvaluatable(..))
| PredicateKind::ConstEquate(..) | PredicateKind::ConstEquate(..)
| PredicateKind::Ambiguous | PredicateKind::Ambiguous => None,
| PredicateKind::Clause(ClauseKind::TypeWellFormedFromEnv(..)) => None,
} }
} }
@ -1445,8 +1438,7 @@ impl<'tcx> Predicate<'tcx> {
| PredicateKind::Clause(ClauseKind::TypeOutlives(..)) | PredicateKind::Clause(ClauseKind::TypeOutlives(..))
| PredicateKind::Clause(ClauseKind::ConstEvaluatable(..)) | PredicateKind::Clause(ClauseKind::ConstEvaluatable(..))
| PredicateKind::ConstEquate(..) | PredicateKind::ConstEquate(..)
| PredicateKind::Ambiguous | PredicateKind::Ambiguous => None,
| PredicateKind::Clause(ClauseKind::TypeWellFormedFromEnv(..)) => None,
} }
} }
@ -1466,8 +1458,7 @@ impl<'tcx> Predicate<'tcx> {
| PredicateKind::ClosureKind(..) | PredicateKind::ClosureKind(..)
| PredicateKind::Clause(ClauseKind::ConstEvaluatable(..)) | PredicateKind::Clause(ClauseKind::ConstEvaluatable(..))
| PredicateKind::ConstEquate(..) | PredicateKind::ConstEquate(..)
| PredicateKind::Ambiguous | PredicateKind::Ambiguous => None,
| PredicateKind::Clause(ClauseKind::TypeWellFormedFromEnv(..)) => None,
} }
} }

View file

@ -2888,9 +2888,6 @@ define_print_and_forward_display! {
ty::ClauseKind::ConstEvaluatable(ct) => { ty::ClauseKind::ConstEvaluatable(ct) => {
p!("the constant `", print(ct), "` can be evaluated") p!("the constant `", print(ct), "` can be evaluated")
} }
ty::ClauseKind::TypeWellFormedFromEnv(ty) => {
p!("the type `", print(ty), "` is found in the environment")
}
} }
} }

View file

@ -189,9 +189,6 @@ impl<'tcx> fmt::Debug for ty::ClauseKind<'tcx> {
ty::ClauseKind::ConstEvaluatable(ct) => { ty::ClauseKind::ConstEvaluatable(ct) => {
write!(f, "ConstEvaluatable({ct:?})") write!(f, "ConstEvaluatable({ct:?})")
} }
ty::ClauseKind::TypeWellFormedFromEnv(ty) => {
write!(f, "TypeWellFormedFromEnv({:?})", ty)
}
} }
} }
} }

View file

@ -174,7 +174,6 @@ where
} }
ty::ClauseKind::ConstEvaluatable(ct) => ct.visit_with(self), ty::ClauseKind::ConstEvaluatable(ct) => ct.visit_with(self),
ty::ClauseKind::WellFormed(arg) => arg.visit_with(self), ty::ClauseKind::WellFormed(arg) => arg.visit_with(self),
ty::ClauseKind::TypeWellFormedFromEnv(_) => bug!("unexpected clause: {clause}"),
} }
} }

View file

@ -435,9 +435,6 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
ty::PredicateKind::ConstEquate(_, _) => { ty::PredicateKind::ConstEquate(_, _) => {
bug!("ConstEquate should not be emitted when `-Ztrait-solver=next` is active") bug!("ConstEquate should not be emitted when `-Ztrait-solver=next` is active")
} }
ty::PredicateKind::Clause(ty::ClauseKind::TypeWellFormedFromEnv(..)) => {
bug!("TypeWellFormedFromEnv is only used for Chalk")
}
ty::PredicateKind::AliasRelate(lhs, rhs, direction) => self ty::PredicateKind::AliasRelate(lhs, rhs, direction) => self
.compute_alias_relate_goal(Goal { .compute_alias_relate_goal(Goal {
param_env, param_env,

View file

@ -836,9 +836,6 @@ impl<'tcx> AutoTraitFinder<'tcx> {
// FIXME(generic_const_exprs): you can absolutely add this as a where clauses // FIXME(generic_const_exprs): you can absolutely add this as a where clauses
| ty::PredicateKind::Clause(ty::ClauseKind::ConstEvaluatable(..)) | ty::PredicateKind::Clause(ty::ClauseKind::ConstEvaluatable(..))
| ty::PredicateKind::Coerce(..) => {} | ty::PredicateKind::Coerce(..) => {}
ty::PredicateKind::Clause(ty::ClauseKind::TypeWellFormedFromEnv(..)) => {
bug!("predicate should only exist in the environment: {bound_predicate:?}")
}
ty::PredicateKind::Ambiguous => return false, ty::PredicateKind::Ambiguous => return false,
}; };
} }

View file

@ -1094,13 +1094,6 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
ty::PredicateKind::Ambiguous => span_bug!(span, "ambiguous"), ty::PredicateKind::Ambiguous => span_bug!(span, "ambiguous"),
ty::PredicateKind::Clause(ty::ClauseKind::TypeWellFormedFromEnv(..)) => {
span_bug!(
span,
"TypeWellFormedFromEnv predicate should only exist in the environment"
)
}
ty::PredicateKind::AliasRelate(..) => span_bug!( ty::PredicateKind::AliasRelate(..) => span_bug!(
span, span,
"AliasRelate predicate should never be the predicate cause of a SelectionError" "AliasRelate predicate should never be the predicate cause of a SelectionError"

View file

@ -359,9 +359,6 @@ impl<'a, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'tcx> {
ProcessResult::Changed(mk_pending(vec![obligation.with(infcx.tcx, pred)])) ProcessResult::Changed(mk_pending(vec![obligation.with(infcx.tcx, pred)]))
} }
ty::PredicateKind::Ambiguous => ProcessResult::Unchanged, ty::PredicateKind::Ambiguous => ProcessResult::Unchanged,
ty::PredicateKind::Clause(ty::ClauseKind::TypeWellFormedFromEnv(..)) => {
bug!("TypeWellFormedFromEnv is only used for Chalk")
}
ty::PredicateKind::AliasRelate(..) => { ty::PredicateKind::AliasRelate(..) => {
bug!("AliasRelate is only used for new solver") bug!("AliasRelate is only used for new solver")
} }
@ -627,9 +624,6 @@ impl<'a, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'tcx> {
} }
} }
ty::PredicateKind::Ambiguous => ProcessResult::Unchanged, ty::PredicateKind::Ambiguous => ProcessResult::Unchanged,
ty::PredicateKind::Clause(ty::ClauseKind::TypeWellFormedFromEnv(..)) => {
bug!("TypeWellFormedFromEnv is only used for Chalk")
}
ty::PredicateKind::AliasRelate(..) => { ty::PredicateKind::AliasRelate(..) => {
bug!("AliasRelate is only used for new solver") bug!("AliasRelate is only used for new solver")
} }

View file

@ -311,7 +311,7 @@ fn predicate_references_self<'tcx>(
| ty::ClauseKind::RegionOutlives(..) | ty::ClauseKind::RegionOutlives(..)
// FIXME(generic_const_exprs): this can mention `Self` // FIXME(generic_const_exprs): this can mention `Self`
| ty::ClauseKind::ConstEvaluatable(..) | ty::ClauseKind::ConstEvaluatable(..)
| ty::ClauseKind::TypeWellFormedFromEnv(_) => None, => None,
} }
} }
@ -351,8 +351,7 @@ fn generics_require_sized_self(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
| ty::ClauseKind::Projection(_) | ty::ClauseKind::Projection(_)
| ty::ClauseKind::ConstArgHasType(_, _) | ty::ClauseKind::ConstArgHasType(_, _)
| ty::ClauseKind::WellFormed(_) | ty::ClauseKind::WellFormed(_)
| ty::ClauseKind::ConstEvaluatable(_) | ty::ClauseKind::ConstEvaluatable(_) => false,
| ty::ClauseKind::TypeWellFormedFromEnv(_) => false,
}) })
} }

View file

@ -134,7 +134,7 @@ pub fn compute_implied_outlives_bounds_inner<'tcx>(
| ty::PredicateKind::ConstEquate(..) | ty::PredicateKind::ConstEquate(..)
| ty::PredicateKind::Ambiguous | ty::PredicateKind::Ambiguous
| ty::PredicateKind::AliasRelate(..) | ty::PredicateKind::AliasRelate(..)
| ty::PredicateKind::Clause(ty::ClauseKind::TypeWellFormedFromEnv(..)) => {} => {}
// We need to search through *all* WellFormed predicates // We need to search through *all* WellFormed predicates
ty::PredicateKind::Clause(ty::ClauseKind::WellFormed(arg)) => { ty::PredicateKind::Clause(ty::ClauseKind::WellFormed(arg)) => {

View file

@ -972,9 +972,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
} }
} }
} }
ty::PredicateKind::Clause(ty::ClauseKind::TypeWellFormedFromEnv(..)) => {
bug!("TypeWellFormedFromEnv is only used for chalk")
}
ty::PredicateKind::AliasRelate(..) => { ty::PredicateKind::AliasRelate(..) => {
bug!("AliasRelate is only used for new solver") bug!("AliasRelate is only used for new solver")
} }

View file

@ -184,8 +184,7 @@ pub fn predicate_obligations<'tcx>(
| ty::PredicateKind::Coerce(..) | ty::PredicateKind::Coerce(..)
| ty::PredicateKind::ConstEquate(..) | ty::PredicateKind::ConstEquate(..)
| ty::PredicateKind::Ambiguous | ty::PredicateKind::Ambiguous
| ty::PredicateKind::AliasRelate(..) | ty::PredicateKind::AliasRelate(..) => {
| ty::PredicateKind::Clause(ty::ClauseKind::TypeWellFormedFromEnv(..)) => {
bug!("We should only wf check where clauses, unexpected predicate: {predicate:?}") bug!("We should only wf check where clauses, unexpected predicate: {predicate:?}")
} }
} }
@ -1005,8 +1004,7 @@ pub(crate) fn required_region_bounds<'tcx>(
| ty::ClauseKind::Projection(_) | ty::ClauseKind::Projection(_)
| ty::ClauseKind::ConstArgHasType(_, _) | ty::ClauseKind::ConstArgHasType(_, _)
| ty::ClauseKind::WellFormed(_) | ty::ClauseKind::WellFormed(_)
| ty::ClauseKind::ConstEvaluatable(_) | ty::ClauseKind::ConstEvaluatable(_) => None,
| ty::ClauseKind::TypeWellFormedFromEnv(_) => None,
} }
}) })
.collect() .collect()

View file

@ -69,7 +69,6 @@ fn not_outlives_predicate(p: ty::Predicate<'_>) -> bool {
| ty::PredicateKind::Coerce(..) | ty::PredicateKind::Coerce(..)
| ty::PredicateKind::Clause(ty::ClauseKind::ConstEvaluatable(..)) | ty::PredicateKind::Clause(ty::ClauseKind::ConstEvaluatable(..))
| ty::PredicateKind::ConstEquate(..) | ty::PredicateKind::ConstEquate(..)
| ty::PredicateKind::Ambiguous | ty::PredicateKind::Ambiguous => true,
| ty::PredicateKind::Clause(ty::ClauseKind::TypeWellFormedFromEnv(..)) => true,
} }
} }

View file

@ -342,8 +342,7 @@ pub(crate) fn clean_predicate<'tcx>(
// FIXME(generic_const_exprs): should this do something? // FIXME(generic_const_exprs): should this do something?
ty::ClauseKind::ConstEvaluatable(..) ty::ClauseKind::ConstEvaluatable(..)
| ty::ClauseKind::WellFormed(..) | ty::ClauseKind::WellFormed(..)
| ty::ClauseKind::ConstArgHasType(..) | ty::ClauseKind::ConstArgHasType(..) => None,
| ty::ClauseKind::TypeWellFormedFromEnv(..) => None,
} }
} }