File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -91,7 +91,17 @@ impl<'a> Cursor<'a> {
91
91
// It was tried making optimized version of this for eg. line comments, but
92
92
// LLVM can inline all of this and compile it down to fast iteration over bytes.
93
93
while predicate ( self . first ( ) ) && !self . is_eof ( ) {
94
- self . bump ( ) ;
94
+ #[ cfg( debug_assertions) ]
95
+ {
96
+ self . bump ( ) ;
97
+ }
98
+
99
+ #[ cfg( not( debug_assertions) ) ]
100
+ {
101
+ // SAFETY: we checked it's not EOF therefore there must be
102
+ // at least 1 char present.
103
+ unsafe { self . chars . advance_by ( 1 ) . unwrap_unchecked ( ) } ;
104
+ }
95
105
}
96
106
}
97
107
}
Original file line number Diff line number Diff line change 18
18
//! lexeme types.
19
19
//!
20
20
//! [`rustc_parse::lexer`]: ../rustc_parse/lexer/index.html
21
+ #![ feature( iter_advance_by) ]
21
22
#![ deny( rustc:: untranslatable_diagnostic) ]
22
23
#![ deny( rustc:: diagnostic_outside_of_impl) ]
23
24
// We want to be able to build this crate with a stable compiler, so no
You can’t perform that action at this time.
0 commit comments