File tree Expand file tree Collapse file tree 1 file changed +9
-14
lines changed
compiler/rustc_serialize/src Expand file tree Collapse file tree 1 file changed +9
-14
lines changed Original file line number Diff line number Diff line change @@ -504,19 +504,6 @@ impl<'a> MemDecoder<'a> {
504504 panic ! ( "MemDecoder exhausted" )
505505 }
506506
507- #[ inline]
508- fn read_byte ( & mut self ) -> u8 {
509- if self . current == self . end {
510- Self :: decoder_exhausted ( ) ;
511- }
512- // SAFETY: This type guarantees current <= end, and we just checked current == end.
513- unsafe {
514- let byte = * self . current ;
515- self . current = self . current . add ( 1 ) ;
516- byte
517- }
518- }
519-
520507 #[ inline]
521508 fn read_array < const N : usize > ( & mut self ) -> [ u8 ; N ] {
522509 self . read_raw_bytes ( N ) . try_into ( ) . unwrap ( )
@@ -586,7 +573,15 @@ impl<'a> Decoder for MemDecoder<'a> {
586573
587574 #[ inline]
588575 fn read_u8 ( & mut self ) -> u8 {
589- self . read_byte ( )
576+ if self . current == self . end {
577+ Self :: decoder_exhausted ( ) ;
578+ }
579+ // SAFETY: This type guarantees current <= end, and we just checked current == end.
580+ unsafe {
581+ let byte = * self . current ;
582+ self . current = self . current . add ( 1 ) ;
583+ byte
584+ }
590585 }
591586
592587 #[ inline]
You can’t perform that action at this time.
0 commit comments