transmutability: high memory unsage for types containing references
Open
Nobody has claimed this yet.
C-bug
F-transmutability
I-compilemem
T-compiler
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
I am running out of memory when trying to compile the following code:
#![feature(transmutability)]
use std::mem::{Assume, TransmuteFrom};
pub fn is_maybe_transmutable<Src, Dst>()
where
Dst: TransmuteFrom<Src, { Assume::SAFETY }>
{}
pub union U {
pub a: &'static u8,
pub b: &'static u16,
pub c: &'static u32,
pub d: &'static u64,
}
fn main() {
is_maybe_transmutable::<[U; 10], [U; 10]>();
}
Meta
rustc --version --verbose:
rustc 1.88.0-nightly (4824c2bb7 2025-05-02)
binary: rustc
commit-hash: 4824c2bb7445cb2478aab0190c268c939d77a0f6
commit-date: 2025-05-02
host: x86_64-unknown-linux-gnu
release: 1.88.0-nightly
LLVM version: 20.1.2
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by compiling the issue's standalone Rust reproducer with the nightly version shown and observe its memory use. Trace the transmutability evaluation for [U; 10] and reference-containing union fields; done means the example no longer exhausts memory and the behavior is covered by a regression test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100