Update item_children

This commit is contained in:
John Kåre Alsaker 2018-11-30 22:32:16 +01:00
parent 529aed81de
commit b1398a0de6
3 changed files with 4 additions and 4 deletions

View File

@ -784,7 +784,7 @@ rustc_queries! {
eval_always
desc { "fetching what a crate is named" }
}
query item_children(_: DefId) -> Lrc<Vec<Export<hir::HirId>>> {}
query item_children(_: DefId) -> &'tcx [Export<hir::HirId>] {}
query extern_mod_stmt_cnum(_: DefId) -> Option<CrateNum> {}
query get_lib_features(_: CrateNum) -> Lrc<LibFeatures> {

View File

@ -223,9 +223,9 @@ provide! { <'tcx> tcx, def_id, other, cdata,
}
crate_name => { cdata.name }
item_children => {
let mut result = vec![];
let mut result = SmallVec::<[_; 8]>::new();
cdata.each_child_of_item(def_id.index, |child| result.push(child), tcx.sess);
Lrc::new(result)
tcx.arena.alloc_slice(&result)
}
defined_lib_features => { Lrc::new(cdata.get_lib_features()) }
defined_lang_items => { Lrc::new(cdata.get_lang_items()) }

View File

@ -4434,7 +4434,7 @@ pub fn path_to_def(tcx: TyCtxt<'_, '_, '_>, path: &[Symbol]) -> Option<DefId> {
loop {
let segment = path_it.next()?;
for item in mem::replace(&mut items, Lrc::new(vec![])).iter() {
for item in mem::replace(&mut items, &[]).iter() {
if item.ident.name == *segment {
if path_it.peek().is_none() {
return match item.res {