rustdoc: avoid ParamEnv with infer vars

ParamEnv's with inference variabels are invalid.
This commit is contained in:
Ali MJ Al-Nasrawy 2023-12-13 19:12:24 +00:00
parent e452c94912
commit aa36c35296
2 changed files with 2 additions and 3 deletions

View File

@ -14,7 +14,6 @@ pub(crate) struct BlanketImplFinder<'a, 'tcx> {
impl<'a, 'tcx> BlanketImplFinder<'a, 'tcx> { impl<'a, 'tcx> BlanketImplFinder<'a, 'tcx> {
pub(crate) fn get_blanket_impls(&mut self, item_def_id: DefId) -> Vec<Item> { pub(crate) fn get_blanket_impls(&mut self, item_def_id: DefId) -> Vec<Item> {
let cx = &mut self.cx; let cx = &mut self.cx;
let param_env = cx.tcx.param_env(item_def_id);
let ty = cx.tcx.type_of(item_def_id); let ty = cx.tcx.type_of(item_def_id);
trace!("get_blanket_impls({ty:?})"); trace!("get_blanket_impls({ty:?})");
@ -40,7 +39,7 @@ pub(crate) fn get_blanket_impls(&mut self, item_def_id: DefId) -> Vec<Item> {
let infcx = cx.tcx.infer_ctxt().build(); let infcx = cx.tcx.infer_ctxt().build();
let args = infcx.fresh_args_for_item(DUMMY_SP, item_def_id); let args = infcx.fresh_args_for_item(DUMMY_SP, item_def_id);
let impl_ty = ty.instantiate(infcx.tcx, args); let impl_ty = ty.instantiate(infcx.tcx, args);
let param_env = EarlyBinder::bind(param_env).instantiate(infcx.tcx, args); let param_env = ty::ParamEnv::empty();
let impl_args = infcx.fresh_args_for_item(DUMMY_SP, impl_def_id); let impl_args = infcx.fresh_args_for_item(DUMMY_SP, impl_def_id);
let impl_trait_ref = trait_ref.instantiate(infcx.tcx, impl_args); let impl_trait_ref = trait_ref.instantiate(infcx.tcx, impl_args);

View File

@ -26,7 +26,7 @@
use rustc_middle::ty::fold::TypeFolder; use rustc_middle::ty::fold::TypeFolder;
use rustc_middle::ty::GenericArgsRef; use rustc_middle::ty::GenericArgsRef;
use rustc_middle::ty::TypeVisitableExt; use rustc_middle::ty::TypeVisitableExt;
use rustc_middle::ty::{self, AdtKind, EarlyBinder, Ty, TyCtxt}; use rustc_middle::ty::{self, AdtKind, Ty, TyCtxt};
use rustc_middle::{bug, span_bug}; use rustc_middle::{bug, span_bug};
use rustc_span::hygiene::{AstPass, MacroKind}; use rustc_span::hygiene::{AstPass, MacroKind};
use rustc_span::symbol::{kw, sym, Ident, Symbol}; use rustc_span::symbol::{kw, sym, Ident, Symbol};