s/Clause/ClauseKind
This commit is contained in:
parent
f28ec85530
commit
b2c7ce8908
11 changed files with 37 additions and 37 deletions
|
|
@ -73,7 +73,7 @@ fn fn_eagerness(cx: &LateContext<'_>, fn_id: DefId, name: Symbol, have_one_arg:
|
|||
.flat_map(|v| v.fields.iter())
|
||||
.any(|x| matches!(cx.tcx.type_of(x.did).subst_identity().peel_refs().kind(), ty::Param(_)))
|
||||
&& all_predicates_of(cx.tcx, fn_id).all(|(pred, _)| match pred.kind().skip_binder() {
|
||||
PredicateKind::Clause(ty::Clause::Trait(pred)) => cx.tcx.trait_def(pred.trait_ref.def_id).is_marker,
|
||||
PredicateKind::Clause(ty::ClauseKind::Trait(pred)) => cx.tcx.trait_def(pred.trait_ref.def_id).is_marker,
|
||||
_ => true,
|
||||
})
|
||||
&& subs.types().all(|x| matches!(x.peel_refs().kind(), ty::Param(_)))
|
||||
|
|
|
|||
|
|
@ -27,14 +27,14 @@ pub fn is_min_const_fn<'tcx>(tcx: TyCtxt<'tcx>, body: &Body<'tcx>, msrv: &Msrv)
|
|||
for (predicate, _) in predicates.predicates {
|
||||
match predicate.kind().skip_binder() {
|
||||
ty::PredicateKind::Clause(
|
||||
ty::Clause::RegionOutlives(_)
|
||||
| ty::Clause::TypeOutlives(_)
|
||||
| ty::Clause::Projection(_)
|
||||
| ty::Clause::Trait(..)
|
||||
| ty::Clause::ConstArgHasType(..),
|
||||
ty::ClauseKind::RegionOutlives(_)
|
||||
| ty::ClauseKind::TypeOutlives(_)
|
||||
| ty::ClauseKind::Projection(_)
|
||||
| ty::ClauseKind::Trait(..)
|
||||
| ty::ClauseKind::ConstArgHasType(..),
|
||||
)
|
||||
| ty::PredicateKind::Clause(ty::Clause::WellFormed(_))
|
||||
| ty::PredicateKind::Clause(ty::Clause::ConstEvaluatable(..))
|
||||
| ty::PredicateKind::Clause(ty::ClauseKind::WellFormed(_))
|
||||
| ty::PredicateKind::Clause(ty::ClauseKind::ConstEvaluatable(..))
|
||||
| ty::PredicateKind::ConstEquate(..)
|
||||
| ty::PredicateKind::TypeWellFormedFromEnv(..) => continue,
|
||||
ty::PredicateKind::AliasRelate(..) => panic!("alias relate predicate on function: {predicate:#?}"),
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ pub fn contains_ty_adt_constructor_opaque<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'
|
|||
match predicate.kind().skip_binder() {
|
||||
// For `impl Trait<U>`, it will register a predicate of `T: Trait<U>`, so we go through
|
||||
// and check substitutions to find `U`.
|
||||
ty::PredicateKind::Clause(ty::Clause::Trait(trait_predicate)) => {
|
||||
ty::PredicateKind::Clause(ty::ClauseKind::Trait(trait_predicate)) => {
|
||||
if trait_predicate
|
||||
.trait_ref
|
||||
.substs
|
||||
|
|
@ -107,7 +107,7 @@ pub fn contains_ty_adt_constructor_opaque<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'
|
|||
},
|
||||
// For `impl Trait<Assoc=U>`, it will register a predicate of `<T as Trait>::Assoc = U`,
|
||||
// so we check the term for `U`.
|
||||
ty::PredicateKind::Clause(ty::Clause::Projection(projection_predicate)) => {
|
||||
ty::PredicateKind::Clause(ty::ClauseKind::Projection(projection_predicate)) => {
|
||||
if let ty::TermKind::Ty(ty) = projection_predicate.term.unpack() {
|
||||
if contains_ty_adt_constructor_opaque_inner(cx, ty, needle, seen) {
|
||||
return true;
|
||||
|
|
@ -268,7 +268,7 @@ pub fn is_must_use_ty<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>) -> bool {
|
|||
ty::Tuple(substs) => substs.iter().any(|ty| is_must_use_ty(cx, ty)),
|
||||
ty::Alias(ty::Opaque, ty::AliasTy { def_id, .. }) => {
|
||||
for (predicate, _) in cx.tcx.explicit_item_bounds(def_id).skip_binder() {
|
||||
if let ty::PredicateKind::Clause(ty::Clause::Trait(trait_predicate)) = predicate.kind().skip_binder() {
|
||||
if let ty::PredicateKind::Clause(ty::ClauseKind::Trait(trait_predicate)) = predicate.kind().skip_binder() {
|
||||
if cx.tcx.has_attr(trait_predicate.trait_ref.def_id, sym::must_use) {
|
||||
return true;
|
||||
}
|
||||
|
|
@ -707,7 +707,7 @@ fn sig_from_bounds<'tcx>(
|
|||
|
||||
for pred in predicates {
|
||||
match pred.kind().skip_binder() {
|
||||
PredicateKind::Clause(ty::Clause::Trait(p))
|
||||
PredicateKind::Clause(ty::ClauseKind::Trait(p))
|
||||
if (lang_items.fn_trait() == Some(p.def_id())
|
||||
|| lang_items.fn_mut_trait() == Some(p.def_id())
|
||||
|| lang_items.fn_once_trait() == Some(p.def_id()))
|
||||
|
|
@ -720,7 +720,7 @@ fn sig_from_bounds<'tcx>(
|
|||
}
|
||||
inputs = Some(i);
|
||||
},
|
||||
PredicateKind::Clause(ty::Clause::Projection(p))
|
||||
PredicateKind::Clause(ty::ClauseKind::Projection(p))
|
||||
if Some(p.projection_ty.def_id) == lang_items.fn_once_output() && p.projection_ty.self_ty() == ty =>
|
||||
{
|
||||
if output.is_some() {
|
||||
|
|
@ -747,7 +747,7 @@ fn sig_for_projection<'tcx>(cx: &LateContext<'tcx>, ty: AliasTy<'tcx>) -> Option
|
|||
.subst_iter_copied(cx.tcx, ty.substs)
|
||||
{
|
||||
match pred.kind().skip_binder() {
|
||||
PredicateKind::Clause(ty::Clause::Trait(p))
|
||||
PredicateKind::Clause(ty::ClauseKind::Trait(p))
|
||||
if (lang_items.fn_trait() == Some(p.def_id())
|
||||
|| lang_items.fn_mut_trait() == Some(p.def_id())
|
||||
|| lang_items.fn_once_trait() == Some(p.def_id())) =>
|
||||
|
|
@ -760,7 +760,7 @@ fn sig_for_projection<'tcx>(cx: &LateContext<'tcx>, ty: AliasTy<'tcx>) -> Option
|
|||
}
|
||||
inputs = Some(i);
|
||||
},
|
||||
PredicateKind::Clause(ty::Clause::Projection(p))
|
||||
PredicateKind::Clause(ty::ClauseKind::Projection(p))
|
||||
if Some(p.projection_ty.def_id) == lang_items.fn_once_output() =>
|
||||
{
|
||||
if output.is_some() {
|
||||
|
|
@ -950,7 +950,7 @@ pub fn ty_is_fn_once_param<'tcx>(tcx: TyCtxt<'_>, ty: Ty<'tcx>, predicates: &'tc
|
|||
predicates
|
||||
.iter()
|
||||
.try_fold(false, |found, p| {
|
||||
if let PredicateKind::Clause(ty::Clause::Trait(p)) = p.kind().skip_binder()
|
||||
if let PredicateKind::Clause(ty::ClauseKind::Trait(p)) = p.kind().skip_binder()
|
||||
&& let ty::Param(self_ty) = p.trait_ref.self_ty().kind()
|
||||
&& ty.index == self_ty.index
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue