Quote the quoted comment

This commit is contained in:
Edwin Cheng 2019-05-04 19:34:02 +08:00
parent 048f12d9f0
commit 036141663b
2 changed files with 2 additions and 2 deletions

View file

@ -135,7 +135,7 @@ fn doc_comment_text(comment: &ast::Comment) -> SmolStr {
// Quote the string // Quote the string
// Note that `tt::Literal` expect an escaped string // Note that `tt::Literal` expect an escaped string
let text = format!("\"{}\"", text.escape_default()); let text = format!("{:?}", text.escape_default().to_string());
text.into() text.into()
} }

View file

@ -888,7 +888,7 @@ fn test_meta_doc_comments() {
MultiLines Doc MultiLines Doc
*/ */
}"#, }"#,
"# [doc = \" Single Line Doc 1\"] # [doc = \" \\n MultiLines Doc\\n \"] fn bar () {}", "# [doc = \" Single Line Doc 1\"] # [doc = \" \\\\n MultiLines Doc\\\\n \"] fn bar () {}",
); );
} }