Skip to content

Commit e331419

Browse files
committed
Avoid multiplication
1 parent 0b62529 commit e331419

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

library/core/src/alloc/layout.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,10 @@ impl Layout {
343343
#[inline]
344344
#[ensures(|result| result.is_err() || n == 0 || result.as_ref().unwrap().1 % n == 0)]
345345
#[ensures(|result| result.is_err() || n == 0 || result.as_ref().unwrap().0.size() >= self.size())]
346-
#[ensures(|result| result.is_err() || result.as_ref().unwrap().0.size() == n * result.as_ref().unwrap().1)]
346+
// the below multiplication might be too costly to prove at this time
347+
// #[ensures(|result| result.is_err() || result.as_ref().unwrap().0.size() == n * result.as_ref().unwrap().1)]
348+
// use the weaker statement below for now
349+
#[ensures(|result| result.is_err() || n == 0 || result.as_ref().unwrap().0.size() >= result.as_ref().unwrap().1)]
347350
pub fn repeat(&self, n: usize) -> Result<(Self, usize), LayoutError> {
348351
// This cannot overflow. Quoting from the invariant of Layout:
349352
// > `size`, when rounded up to the nearest multiple of `align`,

0 commit comments

Comments
 (0)