Rollup merge of #77984 - Aaron1011:fix/macro-mod-weird-parent, r=petrochenkov
Compute proper module parent during resolution Fixes #75982 The direct parent of a module may not be a module (e.g. `const _: () = { #[path = "foo.rs"] mod foo; };`). To find the parent of a module for purposes of resolution, we need to walk up the tree until we hit a module or a crate root.
This commit is contained in:
commit
569d29d55c
5 changed files with 73 additions and 7 deletions
|
@ -8,6 +8,7 @@ use rustc_ast as ast;
|
|||
use rustc_ast::expand::allocator::AllocatorKind;
|
||||
use rustc_data_structures::svh::Svh;
|
||||
use rustc_data_structures::sync::{self, MetadataRef};
|
||||
use rustc_hir::def::DefKind;
|
||||
use rustc_hir::def_id::{CrateNum, DefId, LOCAL_CRATE};
|
||||
use rustc_hir::definitions::{DefKey, DefPath, DefPathHash};
|
||||
use rustc_macros::HashStable;
|
||||
|
@ -185,6 +186,7 @@ pub trait CrateStore {
|
|||
|
||||
// resolve
|
||||
fn def_key(&self, def: DefId) -> DefKey;
|
||||
fn def_kind(&self, def: DefId) -> DefKind;
|
||||
fn def_path(&self, def: DefId) -> DefPath;
|
||||
fn def_path_hash(&self, def: DefId) -> DefPathHash;
|
||||
fn all_def_path_hashes_and_def_ids(&self, cnum: CrateNum) -> Vec<(DefPathHash, DefId)>;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue