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> {
9191 // It was tried making optimized version of this for eg. line comments, but
9292 // LLVM can inline all of this and compile it down to fast iteration over bytes.
9393 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+ }
95105 }
96106 }
97107}
Original file line number Diff line number Diff line change 1818//! lexeme types.
1919//!
2020//! [`rustc_parse::lexer`]: ../rustc_parse/lexer/index.html
21+ #![ feature( iter_advance_by) ]
2122#![ deny( rustc:: untranslatable_diagnostic) ]
2223#![ deny( rustc:: diagnostic_outside_of_impl) ]
2324// 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