Remove impl_polarity query

This commit is contained in:
Oli Scherer 2024-02-11 07:11:48 +00:00
parent b43fbe63e7
commit 74c9dffac3
6 changed files with 5 additions and 13 deletions

View File

@ -79,7 +79,6 @@ pub fn provide(providers: &mut Providers) {
adt_def,
fn_sig,
impl_trait_header,
impl_polarity,
coroutine_kind,
coroutine_for_closure,
collect_mod_item_types,
@ -1394,11 +1393,6 @@ fn check_impl_constness(
}))
}
fn impl_polarity(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::ImplPolarity {
let item = tcx.hir().expect_item(def_id);
polarity_of_impl(tcx, def_id, item.expect_impl(), item.span)
}
fn polarity_of_impl(
tcx: TyCtxt<'_>,
def_id: LocalDefId,

View File

@ -234,7 +234,6 @@ fn into_args(self) -> (DefId, SimplifiedType) {
unused_generic_params => { cdata.root.tables.unused_generic_params.get(cdata, def_id.index) }
def_kind => { cdata.def_kind(def_id.index) }
impl_parent => { table }
impl_polarity => { table_direct }
defaultness => { table_direct }
constness => { table_direct }
coerce_unsized_info => {

View File

@ -1969,7 +1969,6 @@ fn encode_impls(&mut self) -> LazyArray<TraitImpls> {
let def_id = id.owner_id.to_def_id();
self.tables.defaultness.set_some(def_id.index, tcx.defaultness(def_id));
self.tables.impl_polarity.set_some(def_id.index, tcx.impl_polarity(def_id));
if of_trait && let Some(header) = tcx.impl_trait_header(def_id) {
record!(self.tables.impl_trait_header[def_id] <- header);

View File

@ -433,7 +433,6 @@ fn encode(&self, buf: &mut FileEncoder) -> LazyTables {
promoted_mir: Table<DefIndex, LazyValue<IndexVec<mir::Promoted, mir::Body<'static>>>>,
thir_abstract_const: Table<DefIndex, LazyValue<ty::EarlyBinder<ty::Const<'static>>>>,
impl_parent: Table<DefIndex, RawDefId>,
impl_polarity: Table<DefIndex, ty::ImplPolarity>,
constness: Table<DefIndex, hir::Constness>,
defaultness: Table<DefIndex, hir::Defaultness>,
// FIXME(eddyb) perhaps compute this on the fly if cheap enough?

View File

@ -853,10 +853,6 @@
cache_on_disk_if { impl_id.is_local() }
separate_provide_extern
}
query impl_polarity(impl_id: DefId) -> ty::ImplPolarity {
desc { |tcx| "computing implementation polarity of `{}`", tcx.def_path_str(impl_id) }
separate_provide_extern
}
query issue33140_self_ty(key: DefId) -> Option<ty::EarlyBinder<ty::Ty<'tcx>>> {
desc { |tcx| "computing Self type wrt issue #33140 `{}`", tcx.def_path_str(key) }

View File

@ -2317,6 +2317,11 @@ pub fn impl_trait_ref(
) -> Option<ty::EarlyBinder<ty::TraitRef<'tcx>>> {
Some(self.impl_trait_header(def_id)?.map_bound(|h| h.trait_ref))
}
pub fn impl_polarity(self, def_id: impl IntoQueryParam<DefId>) -> ty::ImplPolarity {
self.impl_trait_header(def_id)
.map_or(ty::ImplPolarity::Positive, |h| h.skip_binder().polarity)
}
}
/// Parameter attributes that can only be determined by examining the body of a function instead