Bug 1398593 - stylo: mitigate performance impact of fallible allocation on stylist rebuilds. r=emilio.

This commit is contained in:
Julian Seward 2017-09-12 15:18:49 +02:00
parent 61fac2c10d
commit e7e03fac7b
2 changed files with 3 additions and 2 deletions

View file

@ -1002,6 +1002,7 @@ impl<K, V, S> HashMap<K, V, S>
self.try_entry(key).unwrap()
}
#[inline(always)]
pub fn try_entry(&mut self, key: K) -> Result<Entry<K, V>, FailedAllocationError> {
// Gotta resize now.
self.try_reserve(1)?;