Skip to content

Commit

Permalink
Auto merge of rust-lang#135709 - lqd:bring-back-len, r=compiler-errors
Browse files Browse the repository at this point in the history
Temporarily bring back `Rvalue::Len`

r? `@compiler-errors` as requested in rust-lang#135671 (comment)

> However, in the mean time, I'd rather we not crunch trying to find and more importantly validate the soundness of a solution 🤔

Agreed. To fix the IMO P-critical rust-lang#135671 for which we somehow didn't have test coverage, this PR temporarily reverts:
- rust-lang#133734
- its bugfix rust-lang#134371
- rust-lang#134330

cc `@scottmcm`

I added the few samples from that issue as a test, but we can add more in the future, in particular it seems `@steffahn` [will work on that](rust-lang#135671 (comment)).

Fixes rust-lang#135671. And if we want to land this, it should also be nominated for beta backport.
  • Loading branch information
bors authored and gitbot committed Mar 11, 2025
2 parents fe9afd2 + e5ee93d commit d6a1744
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion core/src/intrinsics/mir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@
//!
//! - Operands implicitly convert to `Use` rvalues.
//! - `&`, `&mut`, `addr_of!`, and `addr_of_mut!` all work to create their associated rvalue.
//! - [`Discriminant`] and [`CopyForDeref`] have associated functions.
//! - [`Discriminant`], [`Len`], and [`CopyForDeref`] 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`].
Expand Down Expand Up @@ -401,6 +401,7 @@ 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
Expand Down

0 comments on commit d6a1744

Please sign in to comment.