Skip to content

Commit 521218c

Browse files
committed
rustc_parse: work around instruction-counting non-determinism.
1 parent 0763c7b commit 521218c

File tree

1 file changed

+9
-11
lines changed
  • compiler/rustc_parse/src/lexer

1 file changed

+9
-11
lines changed

compiler/rustc_parse/src/lexer/mod.rs

+9-11
Original file line numberDiff line numberDiff line change
@@ -335,17 +335,15 @@ impl<'a> StringReader<'a> {
335335
comment_kind: CommentKind,
336336
doc_style: DocStyle,
337337
) -> TokenKind {
338-
if content.contains('\r') {
339-
for (idx, _) in content.char_indices().filter(|&(_, c)| c == '\r') {
340-
self.err_span_(
341-
content_start + BytePos(idx as u32),
342-
content_start + BytePos(idx as u32 + 1),
343-
match comment_kind {
344-
CommentKind::Line => "bare CR not allowed in doc-comment",
345-
CommentKind::Block => "bare CR not allowed in block doc-comment",
346-
},
347-
);
348-
}
338+
for (idx, _) in content.match_indices('\r') {
339+
self.err_span_(
340+
content_start + BytePos(idx as u32),
341+
content_start + BytePos(idx as u32 + 1),
342+
match comment_kind {
343+
CommentKind::Line => "bare CR not allowed in doc-comment",
344+
CommentKind::Block => "bare CR not allowed in block doc-comment",
345+
},
346+
);
349347
}
350348

351349
let attr_style = match doc_style {

0 commit comments

Comments
 (0)