about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorEduard-Mihai Burtescu <edy.burt@gmail.com>2020-11-05 19:28:17 +0200
committerEduard-Mihai Burtescu <eddyb@lyken.rs>2022-06-13 08:00:58 +0000
commit521218ce88e12ed2960f619545cf22404cee8d1e (patch)
tree1b3601c47d27dfd4e108c2fd7e23fccc2d965c83 /compiler
parent0763c7be93b4cd8f3540077ed430ef8b8e8265c3 (diff)
downloadrust-521218ce88e12ed2960f619545cf22404cee8d1e.tar.gz
rust-521218ce88e12ed2960f619545cf22404cee8d1e.zip
rustc_parse: work around instruction-counting non-determinism.
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_parse/src/lexer/mod.rs20
1 files changed, 9 insertions, 11 deletions
diff --git a/compiler/rustc_parse/src/lexer/mod.rs b/compiler/rustc_parse/src/lexer/mod.rs
index e9701ec2d7f..f3b11e9b604 100644
--- a/compiler/rustc_parse/src/lexer/mod.rs
+++ b/compiler/rustc_parse/src/lexer/mod.rs
@@ -335,17 +335,15 @@ impl<'a> StringReader<'a> {
         comment_kind: CommentKind,
         doc_style: DocStyle,
     ) -> TokenKind {
-        if content.contains('\r') {
-            for (idx, _) in content.char_indices().filter(|&(_, c)| c == '\r') {
-                self.err_span_(
-                    content_start + BytePos(idx as u32),
-                    content_start + BytePos(idx as u32 + 1),
-                    match comment_kind {
-                        CommentKind::Line => "bare CR not allowed in doc-comment",
-                        CommentKind::Block => "bare CR not allowed in block doc-comment",
-                    },
-                );
-            }
+        for (idx, _) in content.match_indices('\r') {
+            self.err_span_(
+                content_start + BytePos(idx as u32),
+                content_start + BytePos(idx as u32 + 1),
+                match comment_kind {
+                    CommentKind::Line => "bare CR not allowed in doc-comment",
+                    CommentKind::Block => "bare CR not allowed in block doc-comment",
+                },
+            );
         }
 
         let attr_style = match doc_style {