mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-30 06:43:20 +03:00
Rollup merge of #95804 - GuillaumeGomez:empty-doc-comment-with-backline, r=notriddle
rustdoc: Fix empty doc comment with backline ICE Fixes #95800. r? ```@notriddle```
This commit is contained in:
@@ -52,7 +52,10 @@ fn get_horizontal_trim<'a>(lines: &'a [&str], kind: CommentKind) -> Option<Strin
|
||||
// when we try to compute the "horizontal trim".
|
||||
let lines = if kind == CommentKind::Block {
|
||||
// Whatever happens, we skip the first line.
|
||||
let mut i = if lines[0].trim_start().starts_with('*') { 0 } else { 1 };
|
||||
let mut i = lines
|
||||
.get(0)
|
||||
.map(|l| if l.trim_start().starts_with('*') { 0 } else { 1 })
|
||||
.unwrap_or(0);
|
||||
let mut j = lines.len();
|
||||
|
||||
while i < j && lines[i].trim().is_empty() {
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
// Ensure that empty doc comments don't panic.
|
||||
|
||||
/*!
|
||||
*/
|
||||
|
||||
///
|
||||
///
|
||||
pub struct Foo;
|
||||
|
||||
#[doc = "
|
||||
"]
|
||||
pub mod Mod {
|
||||
//!
|
||||
//!
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
pub mod Another {
|
||||
#![doc = "
|
||||
"]
|
||||
}
|
||||
Reference in New Issue
Block a user