1
Fork 0

Bounds-check with PtrMetadata instead of Len in MIR

This commit is contained in:
Scott McMurray 2024-12-01 20:14:04 -08:00
parent 490b2cc098
commit 612adbb6bf
100 changed files with 1431 additions and 1665 deletions

View file

@ -15,7 +15,7 @@ fn fun(_1: &[T]) -> &T {
StorageLive(_2);
StorageLive(_3);
_3 = const 0_usize;
_4 = Len((*_1));
_4 = PtrMetadata(copy _1);
_5 = Lt(copy _3, copy _4);
assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, copy _3) -> [success: bb1, unwind: bb2];
}