Skip to content

Commit

Permalink
fix: index out of bound on empty comment
Browse files Browse the repository at this point in the history
  • Loading branch information
csmoe authored Apr 19, 2022
1 parent e2661ba commit 5dd1684
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions compiler/rustc_ast/src/util/comments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ pub fn beautify_doc_string(data: Symbol, kind: CommentKind) -> Symbol {
}

fn get_horizontal_trim<'a>(lines: &'a [&str], kind: CommentKind) -> Option<String> {
if lines.is_empty() {
return None;
}

let mut i = usize::MAX;
let mut first = true;

Expand Down

0 comments on commit 5dd1684

Please sign in to comment.