about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthew Jasper <mjjasper1@gmail.com>2020-06-30 22:41:57 +0100
committerMatthew Jasper <mjjasper1@gmail.com>2020-10-06 11:19:30 +0100
commitadb7fc6283711c881186ca85bb9ac3bb8add099b (patch)
tree62c1064460d01fa04c535cbe388e9f94294986a1
parent22c5e0c34760b5d8f8a3c815f01ca2ed20d4ceeb (diff)
downloadrust-adb7fc6283711c881186ca85bb9ac3bb8add099b.tar.gz
rust-adb7fc6283711c881186ca85bb9ac3bb8add099b.zip
Fix tools
-rw-r--r--clippy_lints/src/future_not_send.rs15
-rw-r--r--clippy_lints/src/methods/mod.rs6
-rw-r--r--clippy_lints/src/utils/mod.rs5
3 files changed, 18 insertions, 8 deletions
diff --git a/clippy_lints/src/future_not_send.rs b/clippy_lints/src/future_not_send.rs
index 2ab257ca88e..d2a322e1223 100644
--- a/clippy_lints/src/future_not_send.rs
+++ b/clippy_lints/src/future_not_send.rs
@@ -3,6 +3,7 @@ use rustc_hir::intravisit::FnKind;
 use rustc_hir::{Body, FnDecl, HirId};
 use rustc_infer::infer::TyCtxtInferExt;
 use rustc_lint::{LateContext, LateLintPass};
+use rustc_middle::ty::subst::Subst;
 use rustc_middle::ty::{Opaque, PredicateAtom::Trait};
 use rustc_session::{declare_lint_pass, declare_tool_lint};
 use rustc_span::{sym, Span};
@@ -62,9 +63,10 @@ impl<'tcx> LateLintPass<'tcx> for FutureNotSend {
         }
         let ret_ty = utils::return_ty(cx, hir_id);
         if let Opaque(id, subst) = *ret_ty.kind() {
-            let preds = cx.tcx.predicates_of(id).instantiate(cx.tcx, subst);
+            let preds = cx.tcx.explicit_item_bounds(id);
             let mut is_future = false;
-            for p in preds.predicates {
+            for &(p, _span) in preds {
+                let p = p.subst(cx.tcx, subst);
                 if let Some(trait_ref) = p.to_opt_poly_trait_ref() {
                     if Some(trait_ref.def_id()) == cx.tcx.lang_items().future_trait() {
                         is_future = true;
@@ -90,8 +92,13 @@ impl<'tcx> LateLintPass<'tcx> for FutureNotSend {
                         |db| {
                             cx.tcx.infer_ctxt().enter(|infcx| {
                                 for FulfillmentError { obligation, .. } in send_errors {
-                                    infcx.maybe_note_obligation_cause_for_async_await(db, &obligation);
-                                    if let Trait(trait_pred, _) = obligation.predicate.skip_binders() {
+                                    infcx.maybe_note_obligation_cause_for_async_await(
+                                        db,
+                                        &obligation,
+                                    );
+                                    if let Trait(trait_pred, _) =
+                                        obligation.predicate.skip_binders()
+                                    {
                                         db.note(&format!(
                                             "`{}` doesn't implement `{}`",
                                             trait_pred.self_ty(),
diff --git a/clippy_lints/src/methods/mod.rs b/clippy_lints/src/methods/mod.rs
index dadd0f8ebb7..e0651f9ab5d 100644
--- a/clippy_lints/src/methods/mod.rs
+++ b/clippy_lints/src/methods/mod.rs
@@ -1667,8 +1667,10 @@ impl<'tcx> LateLintPass<'tcx> for Methods {
             // if return type is impl trait, check the associated types
             if let ty::Opaque(def_id, _) = *ret_ty.kind() {
                 // one of the associated types must be Self
-                for &(predicate, _span) in cx.tcx.predicates_of(def_id).predicates {
-                    if let ty::PredicateAtom::Projection(projection_predicate) = predicate.skip_binders() {
+                for &(predicate, _span) in cx.tcx.explicit_item_bounds(def_id) {
+                    if let ty::PredicateAtom::Projection(projection_predicate) =
+                        predicate.skip_binders()
+                    {
                         // walk the associated type and check for Self
                         if contains_ty(projection_predicate.ty, self_ty) {
                             return;
diff --git a/clippy_lints/src/utils/mod.rs b/clippy_lints/src/utils/mod.rs
index 96d9905027b..247effde19b 100644
--- a/clippy_lints/src/utils/mod.rs
+++ b/clippy_lints/src/utils/mod.rs
@@ -1285,9 +1285,10 @@ pub fn is_must_use_ty<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>) -> bool {
         },
         ty::Tuple(ref substs) => substs.types().any(|ty| is_must_use_ty(cx, ty)),
         ty::Opaque(ref def_id, _) => {
-            for (predicate, _) in cx.tcx.predicates_of(*def_id).predicates {
+            for (predicate, _) in cx.tcx.explicit_item_bounds(*def_id) {
                 if let ty::PredicateAtom::Trait(trait_predicate, _) = predicate.skip_binders() {
-                    if must_use_attr(&cx.tcx.get_attrs(trait_predicate.trait_ref.def_id)).is_some() {
+                    if must_use_attr(&cx.tcx.get_attrs(trait_predicate.trait_ref.def_id)).is_some()
+                    {
                         return true;
                     }
                 }