about summary refs log tree commit diff
path: root/library
diff options
context:
space:
mode:
authorStuart Cook <Zalathar@users.noreply.github.com>2025-09-17 14:56:48 +1000
committerGitHub <noreply@github.com>2025-09-17 14:56:48 +1000
commit6473a0f02d6549dc25d8f98b3d06f80fa453fe49 (patch)
treeebddd166d5e5281032378486af5dfcd609f09665 /library
parent577f18ffe23c2c01d98f557c1a12830eadcb7abe (diff)
parentde73af9ec47552dcade86e4ebc4edb8a68fddd2e (diff)
downloadrust-6473a0f02d6549dc25d8f98b3d06f80fa453fe49.tar.gz
rust-6473a0f02d6549dc25d8f98b3d06f80fa453fe49.zip
Rollup merge of #146564 - cjgillot:mir-nolen, r=scottmcm
Remove Rvalue::Len again.

Now that we have `RawPtrKind::FakeForPtrMetadata`, we can reimplement `Rvalue::Len` using `PtrMetadata(&raw const (fake) place)`.

r? ``@scottmcm``
Diffstat (limited to 'library')
-rw-r--r--library/core/src/intrinsics/mir.rs11
1 files changed, 9 insertions, 2 deletions
diff --git a/library/core/src/intrinsics/mir.rs b/library/core/src/intrinsics/mir.rs
index 55dcf7cd47e..a800ef1cb93 100644
--- a/library/core/src/intrinsics/mir.rs
+++ b/library/core/src/intrinsics/mir.rs
@@ -233,7 +233,8 @@
 //!
 //!  - Operands implicitly convert to `Use` rvalues.
 //!  - `&`, `&mut`, `addr_of!`, and `addr_of_mut!` all work to create their associated rvalue.
-//!  - [`Discriminant`], [`Len`], and [`CopyForDeref`] have associated functions.
+//!  - [`CopyForDeref`], [`CastTransmute`], [`CastPtrToPtr`], [`CastUnsize`], and [`Discriminant`]
+//!    have associated functions.
 //!  - Unary and binary operations use their normal Rust syntax - `a * b`, `!c`, etc.
 //!  - The binary operation `Offset` can be created via [`Offset`].
 //!  - Checked binary operations are represented by wrapping the associated binop in [`Checked`].
@@ -401,7 +402,6 @@ define!("mir_storage_dead", fn StorageDead<T>(local: T));
 define!("mir_assume", fn Assume(operand: bool));
 define!("mir_deinit", fn Deinit<T>(place: T));
 define!("mir_checked", fn Checked<T>(binop: T) -> (T, bool));
-define!("mir_len", fn Len<T>(place: T) -> usize);
 define!(
     "mir_ptr_metadata",
     fn PtrMetadata<P: ?Sized>(place: *const P) -> <P as ::core::ptr::Pointee>::Metadata
@@ -492,6 +492,13 @@ define!(
     fn CastPtrToPtr<T, U>(operand: T) -> U
 );
 define!(
+    "mir_cast_unsize",
+    /// Emits a `CastKind::PointerCoercion(Unsize)` cast.
+    ///
+    /// This allows bypassing normal validation to generate strange casts.
+    fn CastUnsize<T, U>(operand: T) -> U
+);
+define!(
     "mir_make_place",
     #[doc(hidden)]
     fn __internal_make_place<T>(place: T) -> *mut T