pub struct InvocationData<'a> {
pub module: Cell<Module<'a>>,
pub def_index: DefIndex,
- // True if this expansion is in a `const_expr` position, for example `[u32; m!()]`.
- // c.f. `DefCollector::visit_const_expr`.
- pub const_expr: bool,
// The scope in which the invocation path is resolved.
pub legacy_scope: Cell<LegacyScope<'a>>,
// The smallest scope that includes this invocation's expansion,
InvocationData {
module: Cell::new(graph_root),
def_index: CRATE_DEF_INDEX,
- const_expr: false,
legacy_scope: Cell::new(LegacyScope::Empty),
expansion: Cell::new(LegacyScope::Empty),
}
self.invocations.insert(mark, self.arenas.alloc_invocation_data(InvocationData {
module: Cell::new(module),
def_index: module.def_id().unwrap().index,
- const_expr: false,
legacy_scope: Cell::new(LegacyScope::Empty),
expansion: Cell::new(LegacyScope::Empty),
}));
invocation: &'a InvocationData<'a>,
expansion: &Expansion) {
let Resolver { ref mut invocations, arenas, graph_root, .. } = *self;
- let InvocationData { def_index, const_expr, .. } = *invocation;
+ let InvocationData { def_index, .. } = *invocation;
let visit_macro_invoc = &mut |invoc: map::MacroInvocationData| {
invocations.entry(invoc.mark).or_insert_with(|| {
arenas.alloc_invocation_data(InvocationData {
def_index: invoc.def_index,
- const_expr: invoc.const_expr,
module: Cell::new(graph_root),
expansion: Cell::new(LegacyScope::Empty),
legacy_scope: Cell::new(LegacyScope::Empty),
let mut def_collector = DefCollector::new(&mut self.definitions, mark);
def_collector.visit_macro_invoc = Some(visit_macro_invoc);
def_collector.with_parent(def_index, |def_collector| {
- if const_expr {
- if let Expansion::Expr(ref expr) = *expansion {
- def_collector.visit_const_expr(expr);
- }
- }
expansion.visit_with(def_collector)
});
}