1
Fork 0

fast_reject: remove StripReferences

This commit is contained in:
lcnr 2022-01-25 12:50:00 +01:00
parent 165142e993
commit 0efc6c02cb
7 changed files with 20 additions and 68 deletions

View file

@ -9,7 +9,7 @@ use rustc_hir::def_id::{DefId, LocalDefId};
use rustc_hir::lang_items::LangItem;
use rustc_hir::{ExprKind, Node, QPath};
use rustc_infer::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind};
use rustc_middle::ty::fast_reject::{simplify_type, SimplifyParams, StripReferences};
use rustc_middle::ty::fast_reject::{simplify_type, SimplifyParams};
use rustc_middle::ty::print::with_crate_prefix;
use rustc_middle::ty::{self, DefIdTree, ToPredicate, Ty, TyCtxt, TypeFoldable};
use rustc_span::lev_distance;
@ -1748,8 +1748,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
// FIXME: Even though negative bounds are not implemented, we could maybe handle
// cases where a positive bound implies a negative impl.
(candidates, Vec::new())
} else if let Some(simp_rcvr_ty) =
simplify_type(self.tcx, rcvr_ty, SimplifyParams::Yes, StripReferences::No)
} else if let Some(simp_rcvr_ty) = simplify_type(self.tcx, rcvr_ty, SimplifyParams::Yes)
{
let mut potential_candidates = Vec::new();
let mut explicitly_negative = Vec::new();
@ -1763,12 +1762,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
})
.any(|imp_did| {
let imp = self.tcx.impl_trait_ref(imp_did).unwrap();
let imp_simp = simplify_type(
self.tcx,
imp.self_ty(),
SimplifyParams::Yes,
StripReferences::No,
);
let imp_simp =
simplify_type(self.tcx, imp.self_ty(), SimplifyParams::Yes);
imp_simp.map_or(false, |s| s == simp_rcvr_ty)
})
{