@@ -41,7 +41,7 @@ use rustc_infer::infer::TyCtxtInferExt;
4141use rustc_lint:: { LateContext , Level , Lint , LintContext } ;
4242use rustc_middle:: hir:: map:: Map ;
4343use rustc_middle:: traits;
44- use rustc_middle:: ty:: { self , layout:: IntegerExt , subst:: GenericArg , Binder , Ty , TyCtxt , TypeFoldable } ;
44+ use rustc_middle:: ty:: { self , layout:: IntegerExt , subst:: GenericArg , Ty , TyCtxt , TypeFoldable } ;
4545use rustc_span:: hygiene:: { ExpnKind , MacroKind } ;
4646use rustc_span:: source_map:: original_sp;
4747use rustc_span:: symbol:: { self , kw, Symbol } ;
@@ -890,17 +890,8 @@ pub fn return_ty<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, fn_item: hir::HirId) -> T
890890}
891891
892892/// Checks if two types are the same.
893- ///
894- /// This discards any lifetime annotations, too.
895- //
896- // FIXME: this works correctly for lifetimes bounds (`for <'a> Foo<'a>` ==
897- // `for <'b> Foo<'b>`, but not for type parameters).
898- pub fn same_tys < ' a , ' tcx > ( cx : & LateContext < ' a , ' tcx > , a : Ty < ' tcx > , b : Ty < ' tcx > ) -> bool {
899- let a = cx. tcx . erase_late_bound_regions ( & Binder :: bind ( a) ) ;
900- let b = cx. tcx . erase_late_bound_regions ( & Binder :: bind ( b) ) ;
901- cx. tcx
902- . infer_ctxt ( )
903- . enter ( |infcx| infcx. can_eq ( cx. param_env , a, b) . is_ok ( ) )
893+ pub fn same_tys < ' tcx > ( a : Ty < ' tcx > , b : Ty < ' tcx > ) -> bool {
894+ ty:: TyS :: same_type ( a, b)
904895}
905896
906897/// Returns `true` if the given type is an `unsafe` function.
0 commit comments