aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/mbe/src/syntax_bridge.rs2
-rw-r--r--crates/mbe/src/tests.rs23
2 files changed, 24 insertions, 1 deletions
diff --git a/crates/mbe/src/syntax_bridge.rs b/crates/mbe/src/syntax_bridge.rs
index 5a91781fc..aacae1026 100644
--- a/crates/mbe/src/syntax_bridge.rs
+++ b/crates/mbe/src/syntax_bridge.rs
@@ -213,7 +213,7 @@ fn doc_comment_text(comment: &ast::Comment) -> SmolStr {
213 213
214 // Quote the string 214 // Quote the string
215 // Note that `tt::Literal` expect an escaped string 215 // Note that `tt::Literal` expect an escaped string
216 let text = format!("{:?}", text.escape_default().to_string()); 216 let text = format!("{:?}", text.escape_debug().to_string());
217 text.into() 217 text.into()
218} 218}
219 219
diff --git a/crates/mbe/src/tests.rs b/crates/mbe/src/tests.rs
index 1c467facd..f1eadcd1e 100644
--- a/crates/mbe/src/tests.rs
+++ b/crates/mbe/src/tests.rs
@@ -970,6 +970,29 @@ fn test_meta_doc_comments() {
970} 970}
971 971
972#[test] 972#[test]
973fn test_meta_doc_comments_non_latin() {
974 parse_macro(
975 r#"
976 macro_rules! foo {
977 ($(#[$ i:meta])+) => (
978 $(#[$ i])+
979 fn bar() {}
980 )
981 }
982"#,
983 ).
984 assert_expand_items(
985 r#"foo! {
986 /// 錦瑟無端五十弦,一弦一柱思華年。
987 /**
988 莊生曉夢迷蝴蝶,望帝春心託杜鵑。
989 */
990 }"#,
991 "# [doc = \" 錦瑟無端五十弦,一弦一柱思華年。\"] # [doc = \"\\\\n 莊生曉夢迷蝴蝶,望帝春心託杜鵑。\\\\n \"] fn bar () {}",
992 );
993}
994
995#[test]
973fn test_tt_block() { 996fn test_tt_block() {
974 parse_macro( 997 parse_macro(
975 r#" 998 r#"