diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2024-12-13 16:19:34 +0100 |
|---|---|---|
| committer | Josh Stone <jistone@redhat.com> | 2025-01-02 14:28:32 -0800 |
| commit | 31236a39f86ad8128323afd0cead010227444c2a (patch) | |
| tree | 6db42c8f6f03dc9dd176da46180c2642cc3a5fc6 | |
| parent | bee5d0996b4c5f4f62ed7a68f0aff6fc745540f7 (diff) | |
| download | rust-31236a39f86ad8128323afd0cead010227444c2a.tar.gz rust-31236a39f86ad8128323afd0cead010227444c2a.zip | |
Correctly handle comments in attributes in doctests source code
(cherry picked from commit de16ed35a326041f619de882dfcead1d02623328)
| -rw-r--r-- | src/librustdoc/doctest/make.rs | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/librustdoc/doctest/make.rs b/src/librustdoc/doctest/make.rs index 3ae60938749..f484c98a0d3 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"); } } |
