Skip to content

Commit b0490cc

Browse files
authored
Rollup merge of rust-lang#71948 - csmoe:issue-61076, r=oli-obk
Suggest to await future before ? operator Closes rust-lang#71811 cc rust-lang#61076
2 parents d13d898 + 0a86335 commit b0490cc

File tree

1 file changed

+2
-16
lines changed

1 file changed

+2
-16
lines changed

clippy_lints/src/utils/mod.rs

+2-16
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,12 @@ use rustc_hir::{
4040
use rustc_infer::infer::TyCtxtInferExt;
4141
use rustc_lint::{LateContext, Level, Lint, LintContext};
4242
use rustc_middle::hir::map::Map;
43-
use rustc_middle::traits;
4443
use rustc_middle::ty::{self, layout::IntegerExt, subst::GenericArg, Binder, Ty, TyCtxt, TypeFoldable};
4544
use rustc_span::hygiene::{ExpnKind, MacroKind};
4645
use rustc_span::source_map::original_sp;
4746
use rustc_span::symbol::{self, kw, Symbol};
4847
use rustc_span::{BytePos, Pos, Span, DUMMY_SP};
4948
use rustc_target::abi::Integer;
50-
use rustc_trait_selection::traits::predicate_for_trait_def;
51-
use rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt;
5249
use rustc_trait_selection::traits::query::normalize::AtExt;
5350
use smallvec::SmallVec;
5451

@@ -326,19 +323,8 @@ pub fn implements_trait<'a, 'tcx>(
326323
trait_id: DefId,
327324
ty_params: &[GenericArg<'tcx>],
328325
) -> bool {
329-
let ty = cx.tcx.erase_regions(&ty);
330-
let obligation = predicate_for_trait_def(
331-
cx.tcx,
332-
cx.param_env,
333-
traits::ObligationCause::dummy(),
334-
trait_id,
335-
0,
336-
ty,
337-
ty_params,
338-
);
339-
cx.tcx
340-
.infer_ctxt()
341-
.enter(|infcx| infcx.predicate_must_hold_modulo_regions(&obligation))
326+
let ty_params = cx.tcx.mk_substs(ty_params.iter());
327+
cx.tcx.type_implements_trait((trait_id, ty, ty_params, cx.param_env))
342328
}
343329

344330
/// Gets the `hir::TraitRef` of the trait the given method is implemented for.

0 commit comments

Comments
 (0)