diff options
| author | Rémy Rakic <remy.rakic+github@gmail.com> | 2025-01-18 22:08:38 +0000 |
|---|---|---|
| committer | Josh Stone <jistone@redhat.com> | 2025-02-06 09:53:26 -0800 |
| commit | 7302b302d08e3d884d75a688a5a38c53be78bd87 (patch) | |
| tree | c4aff59683135db350d8d6ef1c5b5f98eeedc91a /compiler/rustc_middle/src/mir/syntax.rs | |
| parent | 13c3f9b9498013837782b46120085ea19ca75518 (diff) | |
| download | rust-7302b302d08e3d884d75a688a5a38c53be78bd87.tar.gz rust-7302b302d08e3d884d75a688a5a38c53be78bd87.zip | |
Revert "Auto merge of #134330 - scottmcm:no-more-rvalue-len, r=matthewjasper"
This reverts commit e108481f74ff123ad98a63bd107a18d13035b275, reversing changes made to 303e8bd768526a5812bb1776e798e829ddb7d3ca. (cherry picked from commit ca1c17c88d1f625763859396ba7a50f36ac45cc0)
Diffstat (limited to 'compiler/rustc_middle/src/mir/syntax.rs')
| -rw-r--r-- | compiler/rustc_middle/src/mir/syntax.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/compiler/rustc_middle/src/mir/syntax.rs b/compiler/rustc_middle/src/mir/syntax.rs index bbbaffc5a35..0c17a2e0fe5 100644 --- a/compiler/rustc_middle/src/mir/syntax.rs +++ b/compiler/rustc_middle/src/mir/syntax.rs @@ -1351,6 +1351,16 @@ pub enum Rvalue<'tcx> { /// model. RawPtr(Mutability, Place<'tcx>), + /// Yields the length of the place, as a `usize`. + /// + /// 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`. /// /// This allows for casts from/to a variety of types. |
