rustdoc: Don't enter an infer_ctxt in get_blanket_impls for impls that aren't blanket impls

This commit is contained in:
Joshua Nelson 2021-03-07 11:51:43 -05:00
parent 66ec64ccf3
commit f8b15d85de

View File

@ -32,12 +32,8 @@ impl<'a, 'tcx> BlanketImplFinder<'a, 'tcx> {
trait_def_id, impl_def_id
);
let trait_ref = self.cx.tcx.impl_trait_ref(impl_def_id).unwrap();
let may_apply = self.cx.tcx.infer_ctxt().enter(|infcx| {
match trait_ref.self_ty().kind() {
ty::Param(_) => {}
_ => return false,
}
let is_param = matches!(trait_ref.self_ty().kind(), ty::Param(_));
let may_apply = is_param && self.cx.tcx.infer_ctxt().enter(|infcx| {
let substs = infcx.fresh_substs_for_item(DUMMY_SP, item_def_id);
let ty = ty.subst(infcx.tcx, substs);
let param_env = param_env.subst(infcx.tcx, substs);