about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/mir
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2024-10-05 12:19:14 +0200
committerRalf Jung <post@ralfj.de>2024-10-05 12:19:14 +0200
commitf0ddc7b472a6ea84f2224364e2b71c688b7b285e (patch)
tree1a14bd8a4bebb0bc9526ab6284a580c9a4403c4d /compiler/rustc_middle/src/mir
parent5a4ee43c387110736440cecc375cb5aedc441dbc (diff)
downloadrust-f0ddc7b472a6ea84f2224364e2b71c688b7b285e.tar.gz
rust-f0ddc7b472a6ea84f2224364e2b71c688b7b285e.zip
clarify semantics of ConstantIndex MIR projection
Diffstat (limited to 'compiler/rustc_middle/src/mir')
-rw-r--r--compiler/rustc_middle/src/mir/syntax.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/compiler/rustc_middle/src/mir/syntax.rs b/compiler/rustc_middle/src/mir/syntax.rs
index ae75f2d4187..1722a7a1f35 100644
--- a/compiler/rustc_middle/src/mir/syntax.rs
+++ b/compiler/rustc_middle/src/mir/syntax.rs
@@ -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.