Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/test-fixture/src/lib.rs')
-rw-r--r--crates/test-fixture/src/lib.rs42
1 files changed, 41 insertions, 1 deletions
diff --git a/crates/test-fixture/src/lib.rs b/crates/test-fixture/src/lib.rs
index b40b7757c6..0e72d79687 100644
--- a/crates/test-fixture/src/lib.rs
+++ b/crates/test-fixture/src/lib.rs
@@ -376,7 +376,7 @@ impl ChangeFixture {
}
}
-fn default_test_proc_macros() -> [(String, ProcMacro); 7] {
+fn default_test_proc_macros() -> [(String, ProcMacro); 8] {
[
(
r#"
@@ -483,6 +483,21 @@ pub fn issue_18840(_attr: TokenStream, _item: TokenStream) -> TokenStream {
disabled: false,
},
),
+ (
+ r#"
+#[proc_macro]
+pub fn issue_17479(input: TokenStream) -> TokenStream {
+ input
+}
+"#
+ .into(),
+ ProcMacro {
+ name: Symbol::intern("issue_17479"),
+ kind: ProcMacroKind::Bang,
+ expander: sync::Arc::new(Issue17479ProcMacroExpander),
+ disabled: false,
+ },
+ ),
]
}
@@ -761,3 +776,28 @@ impl ProcMacroExpander for ShortenProcMacroExpander {
}
}
}
+
+// Reads ident type within string quotes, for issue #17479.
+#[derive(Debug)]
+struct Issue17479ProcMacroExpander;
+impl ProcMacroExpander for Issue17479ProcMacroExpander {
+ fn expand(
+ &self,
+ subtree: &TopSubtree,
+ _: Option<&TopSubtree>,
+ _: &Env,
+ _: Span,
+ _: Span,
+ _: Span,
+ _: Option<String>,
+ ) -> Result<TopSubtree, ProcMacroExpansionError> {
+ let TokenTree::Leaf(Leaf::Literal(lit)) = &subtree.0[1] else {
+ return Err(ProcMacroExpansionError::Panic("incorrect Input".into()));
+ };
+ let symbol = &lit.symbol;
+ let span = lit.span;
+ Ok(quote! { span =>
+ #symbol()
+ })
+ }
+}