Skip to content

Commit 92521d1

Browse files
committed
Make it clear about content_end
1 parent 535c726 commit 92521d1

File tree

1 file changed

+10
-10
lines changed
  • compiler/rustc_parse/src/lexer

1 file changed

+10
-10
lines changed

compiler/rustc_parse/src/lexer/mod.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -172,17 +172,17 @@ impl<'a> StringReader<'a> {
172172
)
173173
.emit();
174174
FatalError.raise();
175+
} else {
176+
// Skip non-doc comments
177+
let doc_style = doc_style?;
178+
179+
// Opening delimiter of the length 3 and closing delimiter of the length 2
180+
// are not included into the symbol.
181+
let content_start = start + BytePos(3);
182+
let content_end = self.pos - BytePos(2);
183+
let content = self.str_from_to(content_start, content_end);
184+
self.cook_doc_comment(content_start, content, CommentKind::Block, doc_style)
175185
}
176-
177-
// Skip non-doc comments
178-
let doc_style = doc_style?;
179-
180-
// Opening delimiter of the length 3 and closing delimiter of the length 2
181-
// are not included into the symbol.
182-
let content_start = start + BytePos(3);
183-
let content_end = self.pos - BytePos(if terminated { 2 } else { 0 });
184-
let content = self.str_from_to(content_start, content_end);
185-
self.cook_doc_comment(content_start, content, CommentKind::Block, doc_style)
186186
}
187187
rustc_lexer::TokenKind::Whitespace => return None,
188188
rustc_lexer::TokenKind::Ident | rustc_lexer::TokenKind::RawIdent => {

0 commit comments

Comments
 (0)