]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_resolve/macros.rs
Auto merge of #50851 - eddyb:the-only-constant, r=nikomatsakis
[rust.git] / src / librustc_resolve / macros.rs
index 57d7b1fac4803501234581c70a0064a9fc2631ab..38a7d9e41ac7652b339cc4eaa8993f7794e97429 100644 (file)
@@ -45,9 +45,6 @@
 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,
@@ -60,7 +57,6 @@ pub fn root(graph_root: Module<'a>) -> Self {
         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),
         }
@@ -124,7 +120,6 @@ fn get_module_scope(&mut self, id: ast::NodeId) -> Mark {
         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),
         }));
@@ -715,13 +710,12 @@ fn collect_def_ids(&mut self,
                        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),
@@ -732,11 +726,6 @@ fn collect_def_ids(&mut self,
         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)
         });
     }