Closed as not planned
Description
I found an issue with cargo 1.79.0-nightly (d438c80c4 2024-03-19) and format_code_in_doc_comments = true
with raw string literals:
/// # Examples
///
/// ```
/// use std::io::Write;
///
/// # fn main() -> testresult::TestResult {
/// let source = r#"```sh
/// echo x
/// ```"#;
/// let mut sink = Vec::new();
///
/// tangler::extract(source.as_bytes(), &mut sink, &["sh"])?;
///
/// assert_eq!(&b"echo x\n\n"[..], &sink[..]);
/// # Ok(()) }
/// ```
(Original source at https://github.com/wiktor-k/tangler/blob/main/src/lib.rs#L24-L26 . The tool works with markdown documents, that's why the doc comment uses raw strings).
It shows:
$ cargo +nightly fmt --all -- --check
error[E0748]: unterminated raw string
--> <stdin>:5:18
|
5 | let source = r#"```sh
| ^ unterminated raw string
|
= note: this raw string should be terminated with `"#`
but cargo test
(nightly and stable) and cargo doc
are OK with this fragment of code.
I'm not sure if I should report it as a separate ticket or just appending it here is OK...?
Originally posted by @wiktor-k in #3348 (comment)