Skip to content

Commit 331c547

Browse files
authored
Rollup merge of rust-lang#110556 - kylematsuda:earlybinder-explicit-item-bounds, r=compiler-errors
Switch to `EarlyBinder` for `explicit_item_bounds` Part of the work to finish rust-lang#105779. This PR adds `EarlyBinder` to the return type of the `explicit_item_bounds` query and removes `bound_explicit_item_bounds`. r? `@compiler-errors` (hope it's okay to request you, since you reviewed rust-lang#110299 and rust-lang#110498 😃)
2 parents 5514d9f + 55d8146 commit 331c547

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

clippy_lints/src/future_not_send.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use rustc_hir::intravisit::FnKind;
44
use rustc_hir::{Body, FnDecl};
55
use rustc_infer::infer::TyCtxtInferExt;
66
use rustc_lint::{LateContext, LateLintPass};
7-
use rustc_middle::ty::{self, AliasTy, Clause, EarlyBinder, PredicateKind};
7+
use rustc_middle::ty::{self, AliasTy, Clause, PredicateKind};
88
use rustc_session::{declare_lint_pass, declare_tool_lint};
99
use rustc_span::def_id::LocalDefId;
1010
use rustc_span::{sym, Span};
@@ -66,8 +66,7 @@ impl<'tcx> LateLintPass<'tcx> for FutureNotSend {
6666
if let ty::Alias(ty::Opaque, AliasTy { def_id, substs, .. }) = *ret_ty.kind() {
6767
let preds = cx.tcx.explicit_item_bounds(def_id);
6868
let mut is_future = false;
69-
for &(p, _span) in preds {
70-
let p = EarlyBinder(p).subst(cx.tcx, substs);
69+
for (p, _span) in preds.subst_iter_copied(cx.tcx, substs) {
7170
if let Some(trait_pred) = p.to_opt_poly_trait_pred() {
7271
if Some(trait_pred.skip_binder().trait_ref.def_id) == cx.tcx.lang_items().future_trait() {
7372
is_future = true;

clippy_utils/src/ty.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ pub fn contains_ty_adt_constructor_opaque<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'
9090
return false;
9191
}
9292

93-
for &(predicate, _span) in cx.tcx.explicit_item_bounds(def_id) {
93+
for (predicate, _span) in cx.tcx.explicit_item_bounds(def_id).subst_identity_iter_copied() {
9494
match predicate.kind().skip_binder() {
9595
// For `impl Trait<U>`, it will register a predicate of `T: Trait<U>`, so we go through
9696
// and check substituions to find `U`.
@@ -267,7 +267,7 @@ pub fn is_must_use_ty<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>) -> bool {
267267
},
268268
ty::Tuple(substs) => substs.iter().any(|ty| is_must_use_ty(cx, ty)),
269269
ty::Alias(ty::Opaque, ty::AliasTy { def_id, .. }) => {
270-
for (predicate, _) in cx.tcx.explicit_item_bounds(*def_id) {
270+
for (predicate, _) in cx.tcx.explicit_item_bounds(def_id).skip_binder() {
271271
if let ty::PredicateKind::Clause(ty::Clause::Trait(trait_predicate)) = predicate.kind().skip_binder() {
272272
if cx.tcx.has_attr(trait_predicate.trait_ref.def_id, sym::must_use) {
273273
return true;
@@ -743,7 +743,7 @@ fn sig_for_projection<'tcx>(cx: &LateContext<'tcx>, ty: AliasTy<'tcx>) -> Option
743743

744744
for (pred, _) in cx
745745
.tcx
746-
.bound_explicit_item_bounds(ty.def_id)
746+
.explicit_item_bounds(ty.def_id)
747747
.subst_iter_copied(cx.tcx, ty.substs)
748748
{
749749
match pred.kind().skip_binder() {

0 commit comments

Comments
 (0)