-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bounds-check with PtrMetadata instead of Len in MIR
- Loading branch information
Showing
100 changed files
with
1,431 additions
and
1,665 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 4 additions & 4 deletions
8
src/tools/miri/tests/fail/both_borrows/buggy_as_mut_slice.stack.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
tests/mir-opt/building/index_array_and_slice.index_array.built.after.mir
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// MIR for `index_array` after built | ||
|
||
fn index_array(_1: &[i32; 7], _2: usize) -> &i32 { | ||
debug array => _1; | ||
debug index => _2; | ||
let mut _0: &i32; | ||
let _3: &i32; | ||
let _4: usize; | ||
let mut _5: bool; | ||
|
||
bb0: { | ||
StorageLive(_3); | ||
StorageLive(_4); | ||
_4 = copy _2; | ||
FakeRead(ForIndex, (*_1)); | ||
_5 = Lt(copy _4, const 7_usize); | ||
assert(move _5, "index out of bounds: the length is {} but the index is {}", const 7_usize, copy _4) -> [success: bb1, unwind: bb2]; | ||
} | ||
|
||
bb1: { | ||
_3 = &(*_1)[_4]; | ||
_0 = &(*_3); | ||
StorageDead(_4); | ||
StorageDead(_3); | ||
return; | ||
} | ||
|
||
bb2 (cleanup): { | ||
resume; | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
tests/mir-opt/building/index_array_and_slice.index_const_generic_array.built.after.mir
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// MIR for `index_const_generic_array` after built | ||
|
||
fn index_const_generic_array(_1: &[i32; N], _2: usize) -> &i32 { | ||
debug array => _1; | ||
debug index => _2; | ||
let mut _0: &i32; | ||
let _3: &i32; | ||
let _4: usize; | ||
let mut _5: bool; | ||
|
||
bb0: { | ||
StorageLive(_3); | ||
StorageLive(_4); | ||
_4 = copy _2; | ||
FakeRead(ForIndex, (*_1)); | ||
_5 = Lt(copy _4, const N); | ||
assert(move _5, "index out of bounds: the length is {} but the index is {}", const N, copy _4) -> [success: bb1, unwind: bb2]; | ||
} | ||
|
||
bb1: { | ||
_3 = &(*_1)[_4]; | ||
_0 = &(*_3); | ||
StorageDead(_4); | ||
StorageDead(_3); | ||
return; | ||
} | ||
|
||
bb2 (cleanup): { | ||
resume; | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
tests/mir-opt/building/index_array_and_slice.index_custom.built.after.mir
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// MIR for `index_custom` after built | ||
|
||
fn index_custom(_1: &WithSliceTail, _2: usize) -> &i32 { | ||
debug custom => _1; | ||
debug index => _2; | ||
let mut _0: &i32; | ||
let _3: &i32; | ||
let _4: usize; | ||
let mut _5: *const [i32]; | ||
let mut _6: usize; | ||
let mut _7: bool; | ||
|
||
bb0: { | ||
StorageLive(_3); | ||
StorageLive(_4); | ||
_4 = copy _2; | ||
_5 = &raw const ((*_1).1: [i32]); | ||
_6 = PtrMetadata(move _5); | ||
_7 = Lt(copy _4, copy _6); | ||
assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, copy _4) -> [success: bb1, unwind: bb2]; | ||
} | ||
|
||
bb1: { | ||
_3 = &((*_1).1: [i32])[_4]; | ||
_0 = &(*_3); | ||
StorageDead(_4); | ||
StorageDead(_3); | ||
return; | ||
} | ||
|
||
bb2 (cleanup): { | ||
resume; | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
tests/mir-opt/building/index_array_and_slice.index_mut_slice.built.after.mir
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// MIR for `index_mut_slice` after built | ||
|
||
fn index_mut_slice(_1: &mut [i32], _2: usize) -> &i32 { | ||
debug slice => _1; | ||
debug index => _2; | ||
let mut _0: &i32; | ||
let _3: &i32; | ||
let _4: usize; | ||
let mut _5: *const [i32]; | ||
let mut _6: usize; | ||
let mut _7: bool; | ||
|
||
bb0: { | ||
StorageLive(_3); | ||
StorageLive(_4); | ||
_4 = copy _2; | ||
_5 = &raw const (*_1); | ||
_6 = PtrMetadata(move _5); | ||
_7 = Lt(copy _4, copy _6); | ||
assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, copy _4) -> [success: bb1, unwind: bb2]; | ||
} | ||
|
||
bb1: { | ||
_3 = &(*_1)[_4]; | ||
_0 = &(*_3); | ||
StorageDead(_4); | ||
StorageDead(_3); | ||
return; | ||
} | ||
|
||
bb2 (cleanup): { | ||
resume; | ||
} | ||
} |
Oops, something went wrong.