about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJonas Schievink <jonasschievink@gmail.com>2021-05-12 00:57:41 +0200
committerJonas Schievink <jonasschievink@gmail.com>2021-05-12 00:57:41 +0200
commitc868414dcd50bbfe433cc93f8319d41e6742542c (patch)
tree852aceb23512b159e24316f58ef32c2f09ed8eb7
parentc6e2ba43bbfef80d4ecabbc9edd5be9d058f6db9 (diff)
downloadrust-c868414dcd50bbfe433cc93f8319d41e6742542c.tar.gz
rust-c868414dcd50bbfe433cc93f8319d41e6742542c.zip
Revert "Strip delimiter from fn-like proc macro input"
This reverts commit bda68e23328ca62a71da348a13c4d13cc8f991f3.
-rw-r--r--crates/hir_expand/src/input.rs31
-rw-r--r--crates/hir_expand/src/lib.rs4
2 files changed, 2 insertions, 33 deletions
diff --git a/crates/hir_expand/src/input.rs b/crates/hir_expand/src/input.rs
index 860aa049ba0..112216859cf 100644
--- a/crates/hir_expand/src/input.rs
+++ b/crates/hir_expand/src/input.rs
@@ -1,9 +1,8 @@
 //! Macro input conditioning.
 
-use parser::SyntaxKind;
 use syntax::{
     ast::{self, AttrsOwner},
-    AstNode, SyntaxElement, SyntaxNode,
+    AstNode, SyntaxNode,
 };
 
 use crate::{
@@ -20,33 +19,7 @@ pub(crate) fn process_macro_input(
     let loc: MacroCallLoc = db.lookup_intern_macro(id);
 
     match loc.kind {
-        MacroCallKind::FnLike { .. } => {
-            if !loc.def.is_proc_macro() {
-                // MBE macros expect the parentheses as part of their input.
-                return node;
-            }
-
-            // The input includes the `(` + `)` delimiter tokens, so remove them before passing this
-            // to the macro.
-            let node = node.clone_for_update();
-            if let Some(SyntaxElement::Token(tkn)) = node.first_child_or_token() {
-                if matches!(
-                    tkn.kind(),
-                    SyntaxKind::L_BRACK | SyntaxKind::L_PAREN | SyntaxKind::L_CURLY
-                ) {
-                    tkn.detach();
-                }
-            }
-            if let Some(SyntaxElement::Token(tkn)) = node.last_child_or_token() {
-                if matches!(
-                    tkn.kind(),
-                    SyntaxKind::R_BRACK | SyntaxKind::R_PAREN | SyntaxKind::R_CURLY
-                ) {
-                    tkn.detach();
-                }
-            }
-            node
-        }
+        MacroCallKind::FnLike { .. } => node,
         MacroCallKind::Derive { derive_attr_index, .. } => {
             let item = match ast::Item::cast(node.clone()) {
                 Some(item) => item,
diff --git a/crates/hir_expand/src/lib.rs b/crates/hir_expand/src/lib.rs
index 88cb16ca4d1..5df11856e90 100644
--- a/crates/hir_expand/src/lib.rs
+++ b/crates/hir_expand/src/lib.rs
@@ -272,10 +272,6 @@ impl MacroDefId {
         };
         Either::Left(*id)
     }
-
-    pub fn is_proc_macro(&self) -> bool {
-        matches!(self.kind, MacroDefKind::ProcMacro(..))
-    }
 }
 
 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]