Skip to content

Commit d47b3de

Browse files
authored
Rollup merge of rust-lang#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``
2 parents f1fbb46 + 4756811 commit d47b3de

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

core/src/intrinsics/mir.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,8 @@
233233
//!
234234
//! - Operands implicitly convert to `Use` rvalues.
235235
//! - `&`, `&mut`, `addr_of!`, and `addr_of_mut!` all work to create their associated rvalue.
236-
//! - [`Discriminant`], [`Len`], and [`CopyForDeref`] have associated functions.
236+
//! - [`CopyForDeref`], [`CastTransmute`], [`CastPtrToPtr`], [`CastUnsize`], and [`Discriminant`]
237+
//! have associated functions.
237238
//! - Unary and binary operations use their normal Rust syntax - `a * b`, `!c`, etc.
238239
//! - The binary operation `Offset` can be created via [`Offset`].
239240
//! - 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));
401402
define!("mir_assume", fn Assume(operand: bool));
402403
define!("mir_deinit", fn Deinit<T>(place: T));
403404
define!("mir_checked", fn Checked<T>(binop: T) -> (T, bool));
404-
define!("mir_len", fn Len<T>(place: T) -> usize);
405405
define!(
406406
"mir_ptr_metadata",
407407
fn PtrMetadata<P: ?Sized>(place: *const P) -> <P as ::core::ptr::Pointee>::Metadata
@@ -491,6 +491,13 @@ define!(
491491
/// This allows bypassing normal validation to generate strange casts.
492492
fn CastPtrToPtr<T, U>(operand: T) -> U
493493
);
494+
define!(
495+
"mir_cast_unsize",
496+
/// Emits a `CastKind::PointerCoercion(Unsize)` cast.
497+
///
498+
/// This allows bypassing normal validation to generate strange casts.
499+
fn CastUnsize<T, U>(operand: T) -> U
500+
);
494501
define!(
495502
"mir_make_place",
496503
#[doc(hidden)]

0 commit comments

Comments
 (0)