rustc_metadata: Rename item_children(_untracked) to module_children(_untracked)

And `each_child_of_item` to `for_each_module_child`
This commit is contained in:
Vadim Petrochenkov 2021-12-23 16:12:34 +08:00
parent 1288b80aff
commit c8ea0420cb
5 changed files with 6 additions and 6 deletions

View File

@ -96,7 +96,7 @@ fn check_item(&mut self, cx: &LateContext<'_>, item: &hir::Item<'_>) {
if let Res::Def(DefKind::Mod, id) = path.res;
if !id.is_local();
then {
for kid in cx.tcx.item_children(id).iter() {
for kid in cx.tcx.module_children(id).iter() {
if let Res::Def(DefKind::Macro(_mac_type), mac_id) = kid.res {
let span = mac_attr.span;
let def_path = cx.tcx.def_path_str(mac_id);

View File

@ -924,7 +924,7 @@ pub fn check_path(cx: &LateContext<'_>, path: &[&str]) -> bool {
let lang_item_path = cx.get_def_path(*item_def_id);
if path_syms.starts_with(&lang_item_path) {
if let [item] = &path_syms[lang_item_path.len()..] {
for child in cx.tcx.item_children(*item_def_id) {
for child in cx.tcx.module_children(*item_def_id) {
if child.ident.name == *item {
return true;
}
@ -984,7 +984,7 @@ fn check_crate(&mut self, cx: &LateContext<'_>) {
for &module in &[&paths::KW_MODULE, &paths::SYM_MODULE] {
if let Some(def_id) = path_to_res(cx, module).opt_def_id() {
for item in cx.tcx.item_children(def_id).iter() {
for item in cx.tcx.module_children(def_id).iter() {
if_chain! {
if let Res::Def(DefKind::Const, item_def_id) = item.res;
let ty = cx.tcx.type_of(item_def_id);

View File

@ -525,7 +525,7 @@ macro_rules! try_res {
fn item_child_by_name<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId, name: &str) -> Option<Res> {
match tcx.def_kind(def_id) {
DefKind::Mod | DefKind::Enum | DefKind::Trait => tcx
.item_children(def_id)
.module_children(def_id)
.iter()
.find(|item| item.ident.name.as_str() == name)
.map(|child| child.res.expect_non_local()),

View File

@ -40,7 +40,7 @@ mod a {
}
}
// issue #7015, ICE due to calling `item_children` with local `DefId`
// issue #7015, ICE due to calling `module_children` with local `DefId`
#[macro_use]
use a as b;

View File

@ -40,7 +40,7 @@ fn test() {
}
}
// issue #7015, ICE due to calling `item_children` with local `DefId`
// issue #7015, ICE due to calling `module_children` with local `DefId`
#[macro_use]
use a as b;