Skip to content

Commit 1ce3522

Browse files
committed
Remove impl_polarity query
1 parent 53a4d8e commit 1ce3522

File tree

6 files changed

+5
-13
lines changed

6 files changed

+5
-13
lines changed

compiler/rustc_hir_analysis/src/collect.rs

-6
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ pub fn provide(providers: &mut Providers) {
7979
adt_def,
8080
fn_sig,
8181
impl_trait_header,
82-
impl_polarity,
8382
coroutine_kind,
8483
coroutine_for_closure,
8584
collect_mod_item_types,
@@ -1397,11 +1396,6 @@ fn check_impl_constness(
13971396
}))
13981397
}
13991398

1400-
fn impl_polarity(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::ImplPolarity {
1401-
let item = tcx.hir().expect_item(def_id);
1402-
polarity_of_impl_item(tcx, def_id, item.expect_impl(), item.span)
1403-
}
1404-
14051399
fn polarity_of_impl_item(
14061400
tcx: TyCtxt<'_>,
14071401
def_id: LocalDefId,

compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs

-1
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,6 @@ provide! { tcx, def_id, other, cdata,
234234
unused_generic_params => { cdata.root.tables.unused_generic_params.get(cdata, def_id.index) }
235235
def_kind => { cdata.def_kind(def_id.index) }
236236
impl_parent => { table }
237-
impl_polarity => { table_direct }
238237
defaultness => { table_direct }
239238
constness => { table_direct }
240239
coerce_unsized_info => {

compiler/rustc_metadata/src/rmeta/encoder.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1962,7 +1962,6 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
19621962
let def_id = id.owner_id.to_def_id();
19631963

19641964
self.tables.defaultness.set_some(def_id.index, tcx.defaultness(def_id));
1965-
self.tables.impl_polarity.set_some(def_id.index, tcx.impl_polarity(def_id));
19661965

19671966
if of_trait && let Some(header) = tcx.impl_trait_header(def_id) {
19681967
record!(self.tables.impl_trait_header[def_id] <- header);

compiler/rustc_metadata/src/rmeta/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,6 @@ define_tables! {
433433
promoted_mir: Table<DefIndex, LazyValue<IndexVec<mir::Promoted, mir::Body<'static>>>>,
434434
thir_abstract_const: Table<DefIndex, LazyValue<ty::EarlyBinder<ty::Const<'static>>>>,
435435
impl_parent: Table<DefIndex, RawDefId>,
436-
impl_polarity: Table<DefIndex, ty::ImplPolarity>,
437436
constness: Table<DefIndex, hir::Constness>,
438437
defaultness: Table<DefIndex, hir::Defaultness>,
439438
// FIXME(eddyb) perhaps compute this on the fly if cheap enough?

compiler/rustc_middle/src/query/mod.rs

-4
Original file line numberDiff line numberDiff line change
@@ -853,10 +853,6 @@ rustc_queries! {
853853
cache_on_disk_if { impl_id.is_local() }
854854
separate_provide_extern
855855
}
856-
query impl_polarity(impl_id: DefId) -> ty::ImplPolarity {
857-
desc { |tcx| "computing implementation polarity of `{}`", tcx.def_path_str(impl_id) }
858-
separate_provide_extern
859-
}
860856

861857
query issue33140_self_ty(key: DefId) -> Option<ty::EarlyBinder<ty::Ty<'tcx>>> {
862858
desc { |tcx| "computing Self type wrt issue #33140 `{}`", tcx.def_path_str(key) }

compiler/rustc_middle/src/ty/context.rs

+5
Original file line numberDiff line numberDiff line change
@@ -2317,6 +2317,11 @@ impl<'tcx> TyCtxt<'tcx> {
23172317
) -> Option<ty::EarlyBinder<ty::TraitRef<'tcx>>> {
23182318
Some(self.impl_trait_header(def_id)?.map_bound(|h| h.trait_ref))
23192319
}
2320+
2321+
pub fn impl_polarity(self, def_id: impl IntoQueryParam<DefId>) -> ty::ImplPolarity {
2322+
self.impl_trait_header(def_id)
2323+
.map_or(ty::ImplPolarity::Positive, |h| h.skip_binder().polarity)
2324+
}
23202325
}
23212326

23222327
/// Parameter attributes that can only be determined by examining the body of a function instead

0 commit comments

Comments
 (0)