From 50a49e7b3f769bcbc862603b97646b670e22706f Mon Sep 17 00:00:00 2001 From: shulaoda <165626830+shulaoda@users.noreply.github.com> Date: Sat, 11 Oct 2025 04:19:36 +0800 Subject: [PATCH] Fix idempotency issue with raw strings --- src/comment.rs | 1 - tests/source/issue-6161.rs | 8 ++++++++ tests/target/issue-6161.rs | 8 ++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 tests/source/issue-6161.rs create mode 100644 tests/target/issue-6161.rs diff --git a/src/comment.rs b/src/comment.rs index 709031dda44..226fa95722c 100644 --- a/src/comment.rs +++ b/src/comment.rs @@ -1360,7 +1360,6 @@ where match chr { '"' => { if sharps == 0 { - char_kind = FullCodeCharKind::Normal; CharClassesStatus::Normal } else if is_raw_string_suffix(&mut self.base, sharps) { CharClassesStatus::RawStringSuffix(sharps) diff --git a/tests/source/issue-6161.rs b/tests/source/issue-6161.rs new file mode 100644 index 00000000000..7bf46dd11d4 --- /dev/null +++ b/tests/source/issue-6161.rs @@ -0,0 +1,8 @@ +fn f() { +my_macro! { + m => + "a": r"bb + ccc +", +}; +} diff --git a/tests/target/issue-6161.rs b/tests/target/issue-6161.rs new file mode 100644 index 00000000000..2ba75c73871 --- /dev/null +++ b/tests/target/issue-6161.rs @@ -0,0 +1,8 @@ +fn f() { + my_macro! { + m => + "a": r"bb + ccc +", + }; +}