diff options
| author | Dylan DPC <dylan.dpc@gmail.com> | 2020-05-16 02:37:21 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-05-16 02:37:21 +0200 |
| commit | b0490cc80d1a0747f2a91d1200ed31b8c77d45bc (patch) | |
| tree | a34163ce4b9b22fd80c50f5f70d454665bcae2ea | |
| parent | d13d8987b070e04c05a6e138c5a0feee596bc4aa (diff) | |
| parent | 0a86335cd428fe87f95af68aa402b08284c1123a (diff) | |
| download | rust-b0490cc80d1a0747f2a91d1200ed31b8c77d45bc.tar.gz rust-b0490cc80d1a0747f2a91d1200ed31b8c77d45bc.zip | |
Rollup merge of #71948 - csmoe:issue-61076, r=oli-obk
Suggest to await future before ? operator Closes https://github.com/rust-lang/rust/issues/71811 cc #61076
| -rw-r--r-- | clippy_lints/src/utils/mod.rs | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/clippy_lints/src/utils/mod.rs b/clippy_lints/src/utils/mod.rs index 3b8ef18bfab..438a9f42ccd 100644 --- a/clippy_lints/src/utils/mod.rs +++ b/clippy_lints/src/utils/mod.rs @@ -40,15 +40,12 @@ use rustc_hir::{ use rustc_infer::infer::TyCtxtInferExt; use rustc_lint::{LateContext, Level, Lint, LintContext}; use rustc_middle::hir::map::Map; -use rustc_middle::traits; use rustc_middle::ty::{self, layout::IntegerExt, subst::GenericArg, Binder, Ty, TyCtxt, TypeFoldable}; use rustc_span::hygiene::{ExpnKind, MacroKind}; use rustc_span::source_map::original_sp; use rustc_span::symbol::{self, kw, Symbol}; use rustc_span::{BytePos, Pos, Span, DUMMY_SP}; use rustc_target::abi::Integer; -use rustc_trait_selection::traits::predicate_for_trait_def; -use rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt; use rustc_trait_selection::traits::query::normalize::AtExt; use smallvec::SmallVec; @@ -326,19 +323,8 @@ pub fn implements_trait<'a, 'tcx>( trait_id: DefId, ty_params: &[GenericArg<'tcx>], ) -> bool { - let ty = cx.tcx.erase_regions(&ty); - let obligation = predicate_for_trait_def( - cx.tcx, - cx.param_env, - traits::ObligationCause::dummy(), - trait_id, - 0, - ty, - ty_params, - ); - cx.tcx - .infer_ctxt() - .enter(|infcx| infcx.predicate_must_hold_modulo_regions(&obligation)) + let ty_params = cx.tcx.mk_substs(ty_params.iter()); + cx.tcx.type_implements_trait((trait_id, ty, ty_params, cx.param_env)) } /// Gets the `hir::TraitRef` of the trait the given method is implemented for. |
