Remove unused query
This commit is contained in:
parent
9c1a91628b
commit
d9797d23d5
2 changed files with 10 additions and 30 deletions
|
@ -1,5 +1,5 @@
|
||||||
use rustc_hir as hir;
|
use rustc_hir as hir;
|
||||||
use rustc_hir::def_id::{DefId, LocalDefId};
|
use rustc_hir::def_id::DefId;
|
||||||
use rustc_middle::hir::map::blocks::FnLikeNode;
|
use rustc_middle::hir::map::blocks::FnLikeNode;
|
||||||
use rustc_middle::ty::query::Providers;
|
use rustc_middle::ty::query::Providers;
|
||||||
use rustc_middle::ty::TyCtxt;
|
use rustc_middle::ty::TyCtxt;
|
||||||
|
@ -34,8 +34,14 @@ pub fn is_unstable_const_fn(tcx: TyCtxt<'_>, def_id: DefId) -> Option<Symbol> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_parent_const_impl_raw(tcx: TyCtxt<'_>, hir_id: hir::HirId) -> bool {
|
pub fn is_parent_const_impl_raw(tcx: TyCtxt<'_>, hir_id: hir::HirId) -> bool {
|
||||||
let parent_id = tcx.hir().get_parent_did(hir_id);
|
let parent_id = tcx.hir().get_parent_node(hir_id);
|
||||||
if !parent_id.is_top_level_module() { is_const_impl_raw(tcx, parent_id) } else { false }
|
matches!(
|
||||||
|
tcx.hir().get(parent_id),
|
||||||
|
hir::Node::Item(hir::Item {
|
||||||
|
kind: hir::ItemKind::Impl(hir::Impl { constness: hir::Constness::Const, .. }),
|
||||||
|
..
|
||||||
|
})
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Checks whether the function has a `const` modifier or, in case it is an intrinsic, whether
|
/// Checks whether the function has a `const` modifier or, in case it is an intrinsic, whether
|
||||||
|
@ -70,19 +76,6 @@ fn is_const_fn_raw(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Checks whether the given item is an `impl` that has a `const` modifier.
|
|
||||||
fn is_const_impl_raw(tcx: TyCtxt<'_>, def_id: LocalDefId) -> bool {
|
|
||||||
let hir_id = tcx.hir().local_def_id_to_hir_id(def_id);
|
|
||||||
let node = tcx.hir().get(hir_id);
|
|
||||||
matches!(
|
|
||||||
node,
|
|
||||||
hir::Node::Item(hir::Item {
|
|
||||||
kind: hir::ItemKind::Impl(hir::Impl { constness: hir::Constness::Const, .. }),
|
|
||||||
..
|
|
||||||
})
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn is_promotable_const_fn(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
|
fn is_promotable_const_fn(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
|
||||||
is_const_fn(tcx, def_id)
|
is_const_fn(tcx, def_id)
|
||||||
&& match tcx.lookup_const_stability(def_id) {
|
&& match tcx.lookup_const_stability(def_id) {
|
||||||
|
@ -103,10 +96,5 @@ fn is_promotable_const_fn(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn provide(providers: &mut Providers) {
|
pub fn provide(providers: &mut Providers) {
|
||||||
*providers = Providers {
|
*providers = Providers { is_const_fn_raw, is_promotable_const_fn, ..*providers };
|
||||||
is_const_fn_raw,
|
|
||||||
is_const_impl_raw: |tcx, def_id| is_const_impl_raw(tcx, def_id.expect_local()),
|
|
||||||
is_promotable_const_fn,
|
|
||||||
..*providers
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -544,14 +544,6 @@ rustc_queries! {
|
||||||
desc { |tcx| "checking if item is const fn: `{}`", tcx.def_path_str(key) }
|
desc { |tcx| "checking if item is const fn: `{}`", tcx.def_path_str(key) }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns `true` if this is a const `impl`. **Do not call this function manually.**
|
|
||||||
///
|
|
||||||
/// This query caches the base data for the `is_const_impl` helper function, which also
|
|
||||||
/// takes into account stability attributes (e.g., `#[rustc_const_unstable]`).
|
|
||||||
query is_const_impl_raw(key: DefId) -> bool {
|
|
||||||
desc { |tcx| "checking if item is const impl: `{}`", tcx.def_path_str(key) }
|
|
||||||
}
|
|
||||||
|
|
||||||
query asyncness(key: DefId) -> hir::IsAsync {
|
query asyncness(key: DefId) -> hir::IsAsync {
|
||||||
desc { |tcx| "checking if the function is async: `{}`", tcx.def_path_str(key) }
|
desc { |tcx| "checking if the function is async: `{}`", tcx.def_path_str(key) }
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue