Skip to content

Commit 0b62529

Browse files
committed
Wrong clause was caught
1 parent 8c21272 commit 0b62529

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

library/core/src/alloc/layout.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,10 @@ impl Layout {
434434
/// On arithmetic overflow, returns `LayoutError`.
435435
#[unstable(feature = "alloc_layout_extra", issue = "55724")]
436436
#[inline]
437-
#[ensures(|result| result.is_err() || result.as_ref().unwrap().size() == n * self.size())]
437+
// the below multiplication might be too costly to prove at this time
438+
// #[ensures(|result| result.is_err() || result.as_ref().unwrap().size() == n * self.size())]
439+
// use the weaker statement below for now
440+
#[ensures(|result| result.is_err() || n == 0 || result.as_ref().unwrap().size() >= self.size())]
438441
#[ensures(|result| result.is_err() || result.as_ref().unwrap().align() == self.align())]
439442
pub fn repeat_packed(&self, n: usize) -> Result<Self, LayoutError> {
440443
let size = self.size().checked_mul(n).ok_or(LayoutError)?;
@@ -450,9 +453,6 @@ impl Layout {
450453
/// On arithmetic overflow, returns `LayoutError`.
451454
#[unstable(feature = "alloc_layout_extra", issue = "55724")]
452455
#[inline]
453-
// the below is wrong but was written in a previous commit; keeping it for now to confirm that
454-
// this is caught
455-
#[ensures(|result| result.is_err() || result.as_ref().unwrap().size() <= next.size())]
456456
#[ensures(|result| result.is_err() || result.as_ref().unwrap().size() == self.size() + next.size())]
457457
#[ensures(|result| result.is_err() || result.as_ref().unwrap().align() == self.align())]
458458
pub fn extend_packed(&self, next: Self) -> Result<Self, LayoutError> {

0 commit comments

Comments
 (0)