]> git.lizzy.rs Git - rust.git/blobdiff - crates/hir_def/src/lib.rs
Map attribute input tokens correctly
[rust.git] / crates / hir_def / src / lib.rs
index bb174aec810ce4cb4bf17ed3fa399c04da20a227..3c9cf0e38dca8b254ce43bcd081d0dce04ef6ce7 100644 (file)
@@ -115,18 +115,6 @@ pub fn containing_module(&self, db: &dyn db::DefDatabase) -> Option<ModuleId> {
     pub fn containing_block(&self) -> Option<BlockId> {
         self.block
     }
-
-    /// Returns `true` if this module represents a block expression.
-    ///
-    /// Returns `false` if this module is a submodule *inside* a block expression
-    /// (eg. `m` in `{ mod m {} }`).
-    pub fn is_block_root(&self, db: &dyn db::DefDatabase) -> bool {
-        if self.block.is_none() {
-            return false;
-        }
-
-        self.def_map(db)[self.local_id].parent.is_none()
-    }
 }
 
 /// An ID of a module, **local** to a specific crate
@@ -798,13 +786,13 @@ fn attr_macro_as_call_id(
         .ok_or_else(|| UnresolvedMacro { path: item_attr.path.clone() })?;
     let mut arg = match &macro_attr.input {
         Some(input) => match &**input {
-            attr::AttrInput::Literal(_) => tt::Subtree::default(),
+            attr::AttrInput::Literal(_) => Default::default(),
             attr::AttrInput::TokenTree(tt) => tt.clone(),
         },
-        None => tt::Subtree::default(),
+        None => Default::default(),
     };
     // The parentheses are always disposed here.
-    arg.delimiter = None;
+    arg.tree.delimiter = None;
 
     let res = def.as_lazy_macro(
         db.upcast(),