s/Clause/ClauseKind
This commit is contained in:
parent
f28ec85530
commit
b2c7ce8908
11 changed files with 37 additions and 37 deletions
|
|
@ -26,7 +26,7 @@ use rustc_lint::{LateContext, LateLintPass};
|
|||
use rustc_middle::mir::{Rvalue, StatementKind};
|
||||
use rustc_middle::ty::adjustment::{Adjust, Adjustment, AutoBorrow, AutoBorrowMutability};
|
||||
use rustc_middle::ty::{
|
||||
self, Binder, BoundVariableKind, Clause, EarlyBinder, FnSig, GenericArgKind, List, ParamEnv, ParamTy,
|
||||
self, Binder, BoundVariableKind, ClauseKind, EarlyBinder, FnSig, GenericArgKind, List, ParamEnv, ParamTy,
|
||||
PredicateKind, ProjectionPredicate, Ty, TyCtxt, TypeVisitableExt, TypeckResults,
|
||||
};
|
||||
use rustc_session::{declare_tool_lint, impl_lint_pass};
|
||||
|
|
@ -1133,7 +1133,7 @@ fn needless_borrow_impl_arg_position<'tcx>(
|
|||
let projection_predicates = predicates
|
||||
.iter()
|
||||
.filter_map(|predicate| {
|
||||
if let PredicateKind::Clause(Clause::Projection(projection_predicate)) = predicate.kind().skip_binder() {
|
||||
if let PredicateKind::Clause(ClauseKind::Projection(projection_predicate)) = predicate.kind().skip_binder() {
|
||||
Some(projection_predicate)
|
||||
} else {
|
||||
None
|
||||
|
|
@ -1147,7 +1147,7 @@ fn needless_borrow_impl_arg_position<'tcx>(
|
|||
if predicates
|
||||
.iter()
|
||||
.filter_map(|predicate| {
|
||||
if let PredicateKind::Clause(Clause::Trait(trait_predicate)) = predicate.kind().skip_binder()
|
||||
if let PredicateKind::Clause(ClauseKind::Trait(trait_predicate)) = predicate.kind().skip_binder()
|
||||
&& trait_predicate.trait_ref.self_ty() == param_ty.to_ty(cx.tcx)
|
||||
{
|
||||
Some(trait_predicate.trait_ref.def_id)
|
||||
|
|
@ -1209,7 +1209,7 @@ fn needless_borrow_impl_arg_position<'tcx>(
|
|||
}
|
||||
|
||||
predicates.iter().all(|predicate| {
|
||||
if let PredicateKind::Clause(Clause::Trait(trait_predicate)) = predicate.kind().skip_binder()
|
||||
if let PredicateKind::Clause(ClauseKind::Trait(trait_predicate)) = predicate.kind().skip_binder()
|
||||
&& cx.tcx.is_diagnostic_item(sym::IntoIterator, trait_predicate.trait_ref.def_id)
|
||||
&& let ty::Param(param_ty) = trait_predicate.self_ty().kind()
|
||||
&& let GenericArgKind::Type(ty) = substs_with_referent_ty[param_ty.index as usize].unpack()
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ use rustc_lint::{LateContext, LateLintPass};
|
|||
use rustc_middle::hir::nested_filter;
|
||||
use rustc_middle::traits::Reveal;
|
||||
use rustc_middle::ty::{
|
||||
self, Binder, BoundConstness, Clause, GenericArgKind, GenericParamDefKind, ImplPolarity, ParamEnv, PredicateKind,
|
||||
self, Binder, BoundConstness, ClauseKind, GenericArgKind, GenericParamDefKind, ImplPolarity, ParamEnv, PredicateKind,
|
||||
TraitPredicate, Ty, TyCtxt,
|
||||
};
|
||||
use rustc_session::{declare_lint_pass, declare_tool_lint};
|
||||
|
|
@ -503,7 +503,7 @@ fn param_env_for_derived_eq(tcx: TyCtxt<'_>, did: DefId, eq_trait_id: DefId) ->
|
|||
|
||||
let ty_predicates = tcx.predicates_of(did).predicates;
|
||||
for (p, _) in ty_predicates {
|
||||
if let PredicateKind::Clause(Clause::Trait(p)) = p.kind().skip_binder()
|
||||
if let PredicateKind::Clause(ClauseKind::Trait(p)) = p.kind().skip_binder()
|
||||
&& p.trait_ref.def_id == eq_trait_id
|
||||
&& let ty::Param(self_ty) = p.trait_ref.self_ty().kind()
|
||||
&& p.constness == BoundConstness::NotConst
|
||||
|
|
@ -516,7 +516,7 @@ fn param_env_for_derived_eq(tcx: TyCtxt<'_>, did: DefId, eq_trait_id: DefId) ->
|
|||
ParamEnv::new(
|
||||
tcx.mk_predicates_from_iter(ty_predicates.iter().map(|&(p, _)| p).chain(
|
||||
params.iter().filter(|&&(_, needs_eq)| needs_eq).map(|&(param, _)| {
|
||||
tcx.mk_predicate(Binder::dummy(PredicateKind::Clause(Clause::Trait(TraitPredicate {
|
||||
tcx.mk_predicate(Binder::dummy(PredicateKind::Clause(ClauseKind::Trait(TraitPredicate {
|
||||
trait_ref: ty::TraitRef::new(tcx, eq_trait_id, [tcx.mk_param_from_def(param)]),
|
||||
constness: BoundConstness::NotConst,
|
||||
polarity: ImplPolarity::Positive,
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use rustc_hir::intravisit::FnKind;
|
|||
use rustc_hir::{Body, FnDecl};
|
||||
use rustc_infer::infer::TyCtxtInferExt;
|
||||
use rustc_lint::{LateContext, LateLintPass};
|
||||
use rustc_middle::ty::{self, AliasTy, Clause, PredicateKind};
|
||||
use rustc_middle::ty::{self, AliasTy, ClauseKind, PredicateKind};
|
||||
use rustc_session::{declare_lint_pass, declare_tool_lint};
|
||||
use rustc_span::def_id::LocalDefId;
|
||||
use rustc_span::{sym, Span};
|
||||
|
|
@ -93,7 +93,7 @@ impl<'tcx> LateLintPass<'tcx> for FutureNotSend {
|
|||
infcx
|
||||
.err_ctxt()
|
||||
.maybe_note_obligation_cause_for_async_await(db, &obligation);
|
||||
if let PredicateKind::Clause(Clause::Trait(trait_pred)) =
|
||||
if let PredicateKind::Clause(ClauseKind::Trait(trait_pred)) =
|
||||
obligation.predicate.kind().skip_binder()
|
||||
{
|
||||
db.note(format!(
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ use rustc_hir::{
|
|||
};
|
||||
use rustc_lint::LateContext;
|
||||
use rustc_middle::hir::nested_filter;
|
||||
use rustc_middle::ty::{self, AssocKind, Clause, EarlyBinder, GenericArg, GenericArgKind, PredicateKind, Ty};
|
||||
use rustc_middle::ty::{self, AssocKind, ClauseKind, EarlyBinder, GenericArg, GenericArgKind, PredicateKind, Ty};
|
||||
use rustc_span::symbol::Ident;
|
||||
use rustc_span::{sym, Span, Symbol};
|
||||
|
||||
|
|
@ -175,7 +175,7 @@ fn check_collect_into_intoiterator<'tcx>(
|
|||
.caller_bounds()
|
||||
.into_iter()
|
||||
.filter_map(|p| {
|
||||
if let PredicateKind::Clause(Clause::Trait(t)) = p.kind().skip_binder()
|
||||
if let PredicateKind::Clause(ClauseKind::Trait(t)) = p.kind().skip_binder()
|
||||
&& cx.tcx.is_diagnostic_item(sym::IntoIterator,t.trait_ref.def_id) {
|
||||
Some(t.self_ty())
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ use rustc_lint::LateContext;
|
|||
use rustc_middle::mir::Mutability;
|
||||
use rustc_middle::ty::adjustment::{Adjust, Adjustment, OverloadedDeref};
|
||||
use rustc_middle::ty::subst::{GenericArg, GenericArgKind, SubstsRef};
|
||||
use rustc_middle::ty::{self, Clause, EarlyBinder, ParamTy, PredicateKind, ProjectionPredicate, TraitPredicate, Ty};
|
||||
use rustc_middle::ty::{self, ClauseKind, EarlyBinder, ParamTy, PredicateKind, ProjectionPredicate, TraitPredicate, Ty};
|
||||
use rustc_span::{sym, Symbol};
|
||||
use rustc_trait_selection::traits::{query::evaluate_obligation::InferCtxtExt as _, Obligation, ObligationCause};
|
||||
|
||||
|
|
@ -345,12 +345,12 @@ fn get_input_traits_and_projections<'tcx>(
|
|||
let mut projection_predicates = Vec::new();
|
||||
for predicate in cx.tcx.param_env(callee_def_id).caller_bounds() {
|
||||
match predicate.kind().skip_binder() {
|
||||
PredicateKind::Clause(Clause::Trait(trait_predicate)) => {
|
||||
PredicateKind::Clause(ClauseKind::Trait(trait_predicate)) => {
|
||||
if trait_predicate.trait_ref.self_ty() == input {
|
||||
trait_predicates.push(trait_predicate);
|
||||
}
|
||||
},
|
||||
PredicateKind::Clause(Clause::Projection(projection_predicate)) => {
|
||||
PredicateKind::Clause(ClauseKind::Projection(projection_predicate)) => {
|
||||
if projection_predicate.projection_ty.self_ty() == input {
|
||||
projection_predicates.push(projection_predicate);
|
||||
}
|
||||
|
|
@ -407,7 +407,7 @@ fn can_change_type<'a>(cx: &LateContext<'a>, mut expr: &'a Expr<'a>, mut ty: Ty<
|
|||
|
||||
let mut trait_predicates = cx.tcx.param_env(callee_def_id)
|
||||
.caller_bounds().iter().filter(|predicate| {
|
||||
if let PredicateKind::Clause(Clause::Trait(trait_predicate))
|
||||
if let PredicateKind::Clause(ClauseKind::Trait(trait_predicate))
|
||||
= predicate.kind().skip_binder()
|
||||
&& trait_predicate.trait_ref.self_ty() == *param_ty
|
||||
{
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ impl<'tcx> LateLintPass<'tcx> for NeedlessPassByValue {
|
|||
.filter_map(|pred| {
|
||||
// Note that we do not want to deal with qualified predicates here.
|
||||
match pred.kind().no_bound_vars() {
|
||||
Some(ty::PredicateKind::Clause(ty::Clause::Trait(pred))) if pred.def_id() != sized_trait => {
|
||||
Some(ty::PredicateKind::Clause(ty::ClauseKind::Trait(pred))) if pred.def_id() != sized_trait => {
|
||||
Some(pred)
|
||||
},
|
||||
_ => None,
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ use rustc_infer::infer::TyCtxtInferExt;
|
|||
use rustc_infer::traits::{Obligation, ObligationCause};
|
||||
use rustc_lint::{LateContext, LateLintPass};
|
||||
use rustc_middle::hir::nested_filter;
|
||||
use rustc_middle::ty::{self, Binder, Clause, ExistentialPredicate, List, PredicateKind, Ty};
|
||||
use rustc_middle::ty::{self, Binder, ClauseKind, ExistentialPredicate, List, PredicateKind, Ty};
|
||||
use rustc_session::{declare_lint_pass, declare_tool_lint};
|
||||
use rustc_span::source_map::Span;
|
||||
use rustc_span::sym;
|
||||
|
|
@ -697,7 +697,7 @@ fn matches_preds<'tcx>(
|
|||
ObligationCause::dummy(),
|
||||
cx.param_env,
|
||||
cx.tcx
|
||||
.mk_predicate(Binder::dummy(PredicateKind::Clause(Clause::Projection(
|
||||
.mk_predicate(Binder::dummy(PredicateKind::Clause(ClauseKind::Projection(
|
||||
p.with_self_ty(cx.tcx, ty),
|
||||
)))),
|
||||
)),
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use rustc_hir::def_id::DefId;
|
|||
use rustc_hir::{Closure, Expr, ExprKind, StmtKind};
|
||||
use rustc_lint::{LateContext, LateLintPass};
|
||||
use rustc_middle::ty;
|
||||
use rustc_middle::ty::{Clause, GenericPredicates, PredicateKind, ProjectionPredicate, TraitPredicate};
|
||||
use rustc_middle::ty::{ClauseKind, GenericPredicates, PredicateKind, ProjectionPredicate, TraitPredicate};
|
||||
use rustc_session::{declare_lint_pass, declare_tool_lint};
|
||||
use rustc_span::{sym, BytePos, Span};
|
||||
|
||||
|
|
@ -45,7 +45,7 @@ fn get_trait_predicates_for_trait_id<'tcx>(
|
|||
let mut preds = Vec::new();
|
||||
for (pred, _) in generics.predicates {
|
||||
if_chain! {
|
||||
if let PredicateKind::Clause(Clause::Trait(poly_trait_pred)) = pred.kind().skip_binder();
|
||||
if let PredicateKind::Clause(ClauseKind::Trait(poly_trait_pred)) = pred.kind().skip_binder();
|
||||
let trait_pred = cx.tcx.erase_late_bound_regions(pred.kind().rebind(poly_trait_pred));
|
||||
if let Some(trait_def_id) = trait_id;
|
||||
if trait_def_id == trait_pred.trait_ref.def_id;
|
||||
|
|
@ -63,7 +63,7 @@ fn get_projection_pred<'tcx>(
|
|||
trait_pred: TraitPredicate<'tcx>,
|
||||
) -> Option<ProjectionPredicate<'tcx>> {
|
||||
generics.predicates.iter().find_map(|(proj_pred, _)| {
|
||||
if let ty::PredicateKind::Clause(Clause::Projection(pred)) = proj_pred.kind().skip_binder() {
|
||||
if let ty::PredicateKind::Clause(ClauseKind::Projection(pred)) = proj_pred.kind().skip_binder() {
|
||||
let projection_pred = cx.tcx.erase_late_bound_regions(proj_pred.kind().rebind(pred));
|
||||
if projection_pred.projection_ty.substs == trait_pred.trait_ref.substs {
|
||||
return Some(projection_pred);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue