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::ConstArgHasType(..)
| ty::ClauseKind::WellFormed(_)
| ty::ClauseKind::ConstEvaluatable(_)
| ty::ClauseKind::TypeWellFormedFromEnv(_) => {
| ty::ClauseKind::ConstEvaluatable(_) => {
bug!()
}
}

View File

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

View File

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

View File

@ -685,7 +685,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
// inference variable.
| ty::PredicateKind::ClosureKind(..)
| 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::ConstArgHasType(_, _)
| ty::ClauseKind::WellFormed(_)
| ty::ClauseKind::ConstEvaluatable(_)
| ty::ClauseKind::TypeWellFormedFromEnv(_) => None,
| ty::ClauseKind::ConstEvaluatable(_) => None,
}
});

View File

@ -31,8 +31,7 @@ pub fn explicit_outlives_bounds<'tcx>(
| ty::ClauseKind::Projection(_)
| ty::ClauseKind::ConstArgHasType(_, _)
| ty::ClauseKind::WellFormed(_)
| ty::ClauseKind::ConstEvaluatable(_)
| ty::ClauseKind::TypeWellFormedFromEnv(_) => None,
| ty::ClauseKind::ConstEvaluatable(_) => 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::AliasRelate(..) => {
// No

View File

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

View File

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

View File

@ -554,8 +554,7 @@ impl<'tcx> Predicate<'tcx> {
| PredicateKind::Coerce(_)
| PredicateKind::Clause(ClauseKind::ConstEvaluatable(_))
| PredicateKind::ConstEquate(_, _)
| PredicateKind::Ambiguous
| PredicateKind::Clause(ClauseKind::TypeWellFormedFromEnv(_)) => true,
| PredicateKind::Ambiguous => true,
}
}
}
@ -661,11 +660,6 @@ pub enum ClauseKind<'tcx> {
/// Constant initializer must evaluate successfully.
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)]
@ -1424,8 +1418,7 @@ impl<'tcx> Predicate<'tcx> {
| PredicateKind::Clause(ClauseKind::TypeOutlives(..))
| PredicateKind::Clause(ClauseKind::ConstEvaluatable(..))
| PredicateKind::ConstEquate(..)
| PredicateKind::Ambiguous
| PredicateKind::Clause(ClauseKind::TypeWellFormedFromEnv(..)) => None,
| PredicateKind::Ambiguous => None,
}
}
@ -1445,8 +1438,7 @@ impl<'tcx> Predicate<'tcx> {
| PredicateKind::Clause(ClauseKind::TypeOutlives(..))
| PredicateKind::Clause(ClauseKind::ConstEvaluatable(..))
| PredicateKind::ConstEquate(..)
| PredicateKind::Ambiguous
| PredicateKind::Clause(ClauseKind::TypeWellFormedFromEnv(..)) => None,
| PredicateKind::Ambiguous => None,
}
}
@ -1466,8 +1458,7 @@ impl<'tcx> Predicate<'tcx> {
| PredicateKind::ClosureKind(..)
| PredicateKind::Clause(ClauseKind::ConstEvaluatable(..))
| PredicateKind::ConstEquate(..)
| PredicateKind::Ambiguous
| PredicateKind::Clause(ClauseKind::TypeWellFormedFromEnv(..)) => None,
| PredicateKind::Ambiguous => None,
}
}

View File

@ -2888,9 +2888,6 @@ define_print_and_forward_display! {
ty::ClauseKind::ConstEvaluatable(ct) => {
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) => {
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::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(_, _) => {
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
.compute_alias_relate_goal(Goal {
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
| ty::PredicateKind::Clause(ty::ClauseKind::ConstEvaluatable(..))
| ty::PredicateKind::Coerce(..) => {}
ty::PredicateKind::Clause(ty::ClauseKind::TypeWellFormedFromEnv(..)) => {
bug!("predicate should only exist in the environment: {bound_predicate:?}")
}
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::Clause(ty::ClauseKind::TypeWellFormedFromEnv(..)) => {
span_bug!(
span,
"TypeWellFormedFromEnv predicate should only exist in the environment"
)
}
ty::PredicateKind::AliasRelate(..) => span_bug!(
span,
"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)]))
}
ty::PredicateKind::Ambiguous => ProcessResult::Unchanged,
ty::PredicateKind::Clause(ty::ClauseKind::TypeWellFormedFromEnv(..)) => {
bug!("TypeWellFormedFromEnv is only used for Chalk")
}
ty::PredicateKind::AliasRelate(..) => {
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::Clause(ty::ClauseKind::TypeWellFormedFromEnv(..)) => {
bug!("TypeWellFormedFromEnv is only used for Chalk")
}
ty::PredicateKind::AliasRelate(..) => {
bug!("AliasRelate is only used for new solver")
}

View File

@ -311,7 +311,7 @@ fn predicate_references_self<'tcx>(
| ty::ClauseKind::RegionOutlives(..)
// FIXME(generic_const_exprs): this can mention `Self`
| 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::ConstArgHasType(_, _)
| ty::ClauseKind::WellFormed(_)
| ty::ClauseKind::ConstEvaluatable(_)
| ty::ClauseKind::TypeWellFormedFromEnv(_) => false,
| ty::ClauseKind::ConstEvaluatable(_) => false,
})
}

View File

@ -134,7 +134,7 @@ pub fn compute_implied_outlives_bounds_inner<'tcx>(
| ty::PredicateKind::ConstEquate(..)
| ty::PredicateKind::Ambiguous
| ty::PredicateKind::AliasRelate(..)
| ty::PredicateKind::Clause(ty::ClauseKind::TypeWellFormedFromEnv(..)) => {}
=> {}
// We need to search through *all* WellFormed predicates
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(..) => {
bug!("AliasRelate is only used for new solver")
}

View File

@ -184,8 +184,7 @@ pub fn predicate_obligations<'tcx>(
| ty::PredicateKind::Coerce(..)
| ty::PredicateKind::ConstEquate(..)
| ty::PredicateKind::Ambiguous
| ty::PredicateKind::AliasRelate(..)
| ty::PredicateKind::Clause(ty::ClauseKind::TypeWellFormedFromEnv(..)) => {
| ty::PredicateKind::AliasRelate(..) => {
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::ConstArgHasType(_, _)
| ty::ClauseKind::WellFormed(_)
| ty::ClauseKind::ConstEvaluatable(_)
| ty::ClauseKind::TypeWellFormedFromEnv(_) => None,
| ty::ClauseKind::ConstEvaluatable(_) => None,
}
})
.collect()

View File

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

View File

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