diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2021-11-08 15:15:24 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-11-08 15:15:24 +0100 |
| commit | d9fc7d10414a3b5fb172482911fc39ba2dd6bb37 (patch) | |
| tree | 6f3d2027183fd2b6e6a6a05f792d5bf76179eefa /compiler | |
| parent | 931881070a00e869ff52ddfbe243800d256261e8 (diff) | |
| parent | aa6f6f47cd7f83e3898b66e53ff30a414b0a0694 (diff) | |
| download | rust-d9fc7d10414a3b5fb172482911fc39ba2dd6bb37.tar.gz rust-d9fc7d10414a3b5fb172482911fc39ba2dd6bb37.zip | |
Rollup merge of #90657 - GuillaumeGomez:one-char-last-line-removed, r=jyn514
Fix bug with `#[doc]` string single-character last lines Fixes #90618. This is because `.iter().all(|c| c == '*')` returns `true` if there is no character checked. And in case the last line has only one character, it simply returns `true`, making the last line behind removed.
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_ast/src/util/comments.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_ast/src/util/comments.rs b/compiler/rustc_ast/src/util/comments.rs index 542a330a031..c40aec4b671 100644 --- a/compiler/rustc_ast/src/util/comments.rs +++ b/compiler/rustc_ast/src/util/comments.rs @@ -38,7 +38,7 @@ pub fn beautify_doc_string(data: Symbol) -> Symbol { i += 1; } // like the first, a last line of all stars should be omitted - if j > i && lines[j - 1].chars().skip(1).all(|c| c == '*') { + if j > i && !lines[j - 1].is_empty() && lines[j - 1].chars().all(|c| c == '*') { j -= 1; } |
