From de16ed35a326041f619de882dfcead1d02623328 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Fri, 13 Dec 2024 16:19:34 +0100 Subject: [PATCH] Correctly handle comments in attributes in doctests source code --- src/librustdoc/doctest/make.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/librustdoc/doctest/make.rs b/src/librustdoc/doctest/make.rs index 3ae60938749e..f484c98a0d30 100644 --- a/src/librustdoc/doctest/make.rs +++ b/src/librustdoc/doctest/make.rs @@ -520,6 +520,8 @@ fn handle_attr(mod_attr_pending: &mut String, source_info: &mut SourceInfo, edit mod_attr_pending.clear(); } else if mod_attr_pending.ends_with('\\') { mod_attr_pending.push('n'); + } else { + mod_attr_pending.push_str("\n"); } }