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