Rollup merge of #131285 - RalfJung:mir-projection-sem, r=cjgillot
clarify semantics of ConstantIndex MIR projection
This documents what Miri does:
c4ce8c114b/compiler/rustc_const_eval/src/interpret/projection.rs (L272-L275)
I am not sure what exactly the purpose of this `min_length` field is, TBH... but this seems like the most obvious meaning it could have?
This commit is contained in:
commit
c45f902723
2 changed files with 8 additions and 4 deletions
|
@ -1135,8 +1135,10 @@ pub enum ProjectionElem<V, T> {
|
|||
ConstantIndex {
|
||||
/// index or -index (in Python terms), depending on from_end
|
||||
offset: u64,
|
||||
/// The thing being indexed must be at least this long. For arrays this
|
||||
/// is always the exact length.
|
||||
/// The thing being indexed must be at least this long -- otherwise, the
|
||||
/// projection is UB.
|
||||
///
|
||||
/// For arrays this is always the exact length.
|
||||
min_length: u64,
|
||||
/// Counting backwards from end? This is always false when indexing an
|
||||
/// array.
|
||||
|
|
|
@ -768,8 +768,10 @@ pub enum ProjectionElem {
|
|||
ConstantIndex {
|
||||
/// index or -index (in Python terms), depending on from_end
|
||||
offset: u64,
|
||||
/// The thing being indexed must be at least this long. For arrays this
|
||||
/// is always the exact length.
|
||||
/// The thing being indexed must be at least this long -- otherwise, the
|
||||
/// projection is UB.
|
||||
///
|
||||
/// For arrays this is always the exact length.
|
||||
min_length: u64,
|
||||
/// Counting backwards from end? This is always false when indexing an
|
||||
/// array.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue