about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-09-05 19:43:48 +0200
committerGitHub <noreply@github.com>2024-09-05 19:43:48 +0200
commit2efefe68b20f6f86c22c1b2020b605723a697257 (patch)
tree947bdc9dc0814ae922adf3db9715b05a76ea66ae
parent4a8135c6fa40d2cda4df06038ed0af177329cdb2 (diff)
parent98f74b4d047006aaa475b0252b61f0ca772372fb (diff)
Rollup merge of #129939 - RalfJung:rvalue-len, r=compiler-errors
explain why Rvalue::Len still exists

I just spent a bit of time trying to remove this until I realized why that's non-trivial. Let's document that for the next person. :)
-rw-r--r--compiler/rustc_middle/src/mir/syntax.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/compiler/rustc_middle/src/mir/syntax.rs b/compiler/rustc_middle/src/mir/syntax.rs
index 748ca047754..22a4b688c51 100644
--- a/compiler/rustc_middle/src/mir/syntax.rs
+++ b/compiler/rustc_middle/src/mir/syntax.rs
@@ -1307,6 +1307,9 @@ pub enum Rvalue<'tcx> {
     /// If the type of the place is an array, this is the array length. For slices (`[T]`, not
     /// `&[T]`) this accesses the place's metadata to determine the length. This rvalue is
     /// ill-formed for places of other types.
+    ///
+    /// This cannot be a `UnOp(PtrMetadata, _)` because that expects a value, and we only
+    /// have a place, and `UnOp(PtrMetadata, RawPtr(place))` is not a thing.
     Len(Place<'tcx>),
 
     /// Performs essentially all of the casts that can be performed via `as`.