diff --git a/crates/proc-macro-srv/src/tests/mod.rs b/crates/proc-macro-srv/src/tests/mod.rs index 1277106d71d..07222907f08 100644 --- a/crates/proc-macro-srv/src/tests/mod.rs +++ b/crates/proc-macro-srv/src/tests/mod.rs @@ -60,10 +60,10 @@ fn test_fn_like_macro_clone_ident_subtree() { fn test_fn_like_macro_clone_raw_ident() { assert_expand( "fn_like_clone_tokens", - "r#\"ident\"#", - expect![[r##" + "r#async", + expect![[r#" SUBTREE $ - LITERAL r#"ident"# 4294967295"##]], + IDENT async 4294967295"#]], ); } diff --git a/crates/proc-macro-test/imp/src/lib.rs b/crates/proc-macro-test/imp/src/lib.rs index 7760774a3fc..feeacdb6407 100644 --- a/crates/proc-macro-test/imp/src/lib.rs +++ b/crates/proc-macro-test/imp/src/lib.rs @@ -90,7 +90,14 @@ fn clone_tree(t: TokenTree) -> TokenTree { new.set_span(orig.span()); TokenTree::Group(new) } - TokenTree::Ident(orig) => TokenTree::Ident(Ident::new(&orig.to_string(), orig.span())), + TokenTree::Ident(orig) => { + let s = orig.to_string(); + if let Some(rest) = s.strip_prefix("r#") { + TokenTree::Ident(Ident::new_raw(rest, orig.span())) + } else { + TokenTree::Ident(Ident::new(&s, orig.span())) + } + } TokenTree::Punct(orig) => { let mut new = Punct::new(orig.as_char(), orig.spacing()); new.set_span(orig.span());