Skip to content

Commit

Permalink
Mark StreamDeserializer's error codepaths as cold
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Apr 4, 2020
1 parent f77c84d commit 0fb6147
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,7 @@ where
const should_early_return_if_failed: bool = true;

#[inline]
#[cold]
fn set_failed(&mut self, failed: &mut bool) {
*failed = true;
}
Expand Down Expand Up @@ -613,6 +614,7 @@ impl<'a> Read<'a> for SliceRead<'a> {
const should_early_return_if_failed: bool = false;

#[inline]
#[cold]
fn set_failed(&mut self, _failed: &mut bool) {
self.slice = &self.slice[..self.index];
}
Expand Down Expand Up @@ -711,6 +713,7 @@ impl<'a> Read<'a> for StrRead<'a> {
const should_early_return_if_failed: bool = false;

#[inline]
#[cold]
fn set_failed(&mut self, failed: &mut bool) {
self.delegate.set_failed(failed);
}
Expand Down

0 comments on commit 0fb6147

Please sign in to comment.