Skip to content

Commit 44783f1

Browse files
committed
Revert "rustc_parse: work around instruction-counting non-determinism."
This reverts commit 521218c.
1 parent 521218c commit 44783f1

File tree

1 file changed

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

1 file changed

+11
-9
lines changed

compiler/rustc_parse/src/lexer/mod.rs

+11-9
Original file line numberDiff line numberDiff line change
@@ -335,15 +335,17 @@ impl<'a> StringReader<'a> {
335335
comment_kind: CommentKind,
336336
doc_style: DocStyle,
337337
) -> TokenKind {
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-
);
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+
}
347349
}
348350

349351
let attr_style = match doc_style {

0 commit comments

Comments
 (0)