Skip to content

-Znext-solver=globally breaks TransmuteFrom<&T> #161251

Closed

Description

@funsafemath

I tried this code:

#![feature(transmutability)]

use std::mem::TransmuteFrom;

fn main() {
    let bytes: &[u8; 4] = unsafe { TransmuteFrom::<&i32>::transmute(&1i32) };
}

I expected to see this happen: code compiles (it does with -Znext-solver=coherence)

Instead, this happened: code doesn't compile

Meta

rustc --version --verbose:

rustc 1.100.0-nightly (67854e511 2026-08-15)
binary: rustc
commit-hash: 67854e511de21d881bb16426996cd4259d44aa2e
commit-date: 2026-08-15
host: x86_64-unknown-linux-gnu
release: 1.100.0-nightly
LLVM version: 23.1.0
Backtrace

error[E0277]: `&i32` cannot be safely transmuted into `&[u8; 4]`
  |
6 |     let bytes: &[u8; 4] = unsafe { TransmuteFrom::<&i32>::transmute(&1i32) };
  |                                    -------------------------------- ^^^^^ the nightly-only, unstable trait `TransmuteFrom<&i32, Assume { alignment: false, lifetimes: false, safety: false, validity: false }>` is not implemented for `&[u8; 4]`
  |                                    |
  |                                    required by a bound introduced by this call

For more information about this error, try `rustc --explain E0277`.

Activity

  1. added
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Aug 17, 2026
  2. added
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    WG-trait-system-refactorThe Rustc Trait System Refactor Initiative (-Znext-solver)
    on Aug 17, 2026
  3. ShoyuVanilla commented on Aug 31, 2026

    @ShoyuVanilla
    Member

    Responsible lines:

    // FIXME(transmutability): This really should be returning nested goals for `Answer::If*`
    match rustc_transmute::TransmuteTypeEnv::new(self.0.tcx).is_transmutable(src, dst, assume) {
    rustc_transmute::Answer::Yes => Ok(Certainty::Yes),
    rustc_transmute::Answer::No(_) | rustc_transmute::Answer::If(_) => Err(NoSolution),
    }

  4. added 3 commits that reference this issue on Oct 12, 2026
    1fdb48f
    f121039
    cee2a0d
  5. removed
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Oct 12, 2026
  6. added a commit that references this issue on Oct 12, 2026
    e0ea861
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.F-transmutability`#![feature(transmutability)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.WG-trait-system-refactorThe Rustc Trait System Refactor Initiative (-Znext-solver)

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions