@@ -40,15 +40,12 @@ use rustc_hir::{
40
40
use rustc_infer:: infer:: TyCtxtInferExt ;
41
41
use rustc_lint:: { LateContext , Level , Lint , LintContext } ;
42
42
use rustc_middle:: hir:: map:: Map ;
43
- use rustc_middle:: traits;
44
43
use rustc_middle:: ty:: { self , layout:: IntegerExt , subst:: GenericArg , Binder , Ty , TyCtxt , TypeFoldable } ;
45
44
use rustc_span:: hygiene:: { ExpnKind , MacroKind } ;
46
45
use rustc_span:: source_map:: original_sp;
47
46
use rustc_span:: symbol:: { self , kw, Symbol } ;
48
47
use rustc_span:: { BytePos , Pos , Span , DUMMY_SP } ;
49
48
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 ;
52
49
use rustc_trait_selection:: traits:: query:: normalize:: AtExt ;
53
50
use smallvec:: SmallVec ;
54
51
@@ -326,19 +323,8 @@ pub fn implements_trait<'a, 'tcx>(
326
323
trait_id : DefId ,
327
324
ty_params : & [ GenericArg < ' tcx > ] ,
328
325
) -> 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 ) )
342
328
}
343
329
344
330
/// Gets the `hir::TraitRef` of the trait the given method is implemented for.
0 commit comments