rust-lang / rust-lang/rust

ICE due to name mangling not having been implemented yet for unsafe binders

Open
#154,367 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-name-mangling C-bug F-unsafe_binders I-ICE S-bug-has-test S-has-mcve T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

Code
#![feature(unsafe_binders)]
use std::mem::zeroed;
trait DoStuff {
    fn do_it();
}
struct MyImpl;
impl DoStuff for MyImpl {
    fn do_it() {
        let x0: unsafe<'a> &'a () = unsafe { zeroed() }; 
        let x1: i32 = 42;
    }
}
fn main() {
    MyImpl::do_it();
}
Meta

rustc --version --verbose:

rustc 1.96.0-nightly (b41f22de2 2026-03-08)
binary: rustc
commit-hash: b41f22de2a13a0babd28771e96feef4c309f54aa
commit-date: 2026-03-08
host: x86_64-unknown-linux-gnu
release: 1.96.0-nightly
LLVM version: 22.1.0
Backtrace

thread 'rustc' (2368628) panicked at /rustc-dev/b41f22de2a13a0babd28771e96feef4c309f54aa/compiler/rustc_symbol_mangling/src/v0.rs:582:37:
not yet implemented
stack backtrace:
   0:     0x7f96e3b8b54b - <<std[f377252fd1978e75]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[40ef8ddb62afa269]::fmt::Display>::fmt
   1:     0x7f96e424e288 - core[40ef8ddb62afa269]::fmt::write
   2:     0x7f96e3ba2556 - <std[f377252fd1978e75]::sys::stdio::unix::Stderr as std[f377252fd1978e75]::io::Write>::write_fmt
   3:     0x7f96e3b61638 - std[f377252fd1978e75]::panicking::default_hook::{closure#0}
   4:     0x7f96e3b7e9c3 - std[f377252fd1978e75]::panicking::default_hook
   5:     0x7f96e2b701bc - std[f377252fd1978e75]::panicking::update_hook::<alloc[7d80c8e5f2bc07aa]::boxed::Box<rustc_driver_impl[a7e284e8ff2767b6]::install_ice_hook::{closure#1}>>::{closure#0}
   6:     0x7f96e3b7eca2 - std[f377252fd1978e75]::panicking::panic_with_hook
   7:     0x7f96e3b6172a - std[f377252fd1978e75]::panicking::panic_handler::{closure#0}
   8:     0x7f96e3b58429 - std[f377252fd1978e75]::sys::backtrace::__rust_end_short_backtrace::<std[f377252fd1978e75]::panicking::panic_handler::{closure#0}, !>
   9:     0x7f96e3b6315d - __rustc[d65e30e194c7d9cd]::rust_begin_unwind
  10:     0x7f96e07270cc - core[40ef8ddb62afa269]::panicking::panic_fmt
  11:     0x7f96e02332b2 - core[40ef8ddb62afa269]::panicking::panic
  12:     0x7f96e4cfdde1 - <rustc_symbol_mangling[dce4c7cea9d9bfe9]::v0::V0SymbolMangler as rustc_middle[6d7cfdcb6c95edb7]::ty::print::Printer>::print_type
  13:     0x7f96e4cfeb36 - <rustc_symbol_mangling[dce4c7cea9d9bfe9]::v0::V0SymbolMangler as rustc_middle[6d7cfdcb6c95edb7]::ty::print::Printer>::print_def_path
  14:     0x7f96e4cfa25a - rustc_symbol_mangling[dce4c7cea9d9bfe9]::symbol_name_provider
  15:     0x7f96e4cf9631 - rustc_query_impl[5ff32ada1adb4c7a]::query_impl::symbol_name::invoke_provider_fn::__rust_begin_short_backtrace
  16:     0x7f96e4cf85d2 - rustc_query_impl[5ff32ada1adb4c7a]::execution::try_execute_query::<rustc_middle[6d7cfdcb6c95edb7]::query::caches::DefaultCache<rustc_middle[6d7cfdcb6c95edb7]::ty::instance::Instance, rustc_middle[6d7cfdcb6c95edb7]::query::erase::ErasedData<[u8; 16usize]>>, false>
  17:     0x7f96e4cf8240 - rustc_query_impl[5ff32ada1adb4c7a]::query_impl::symbol_name::execute_query_non_incr::__rust_end_short_backtrace
  18:     0x7f96e4cf7a4c - rustc_monomorphize[980ee425a9bb6f45]::partitioning::assert_symbols_are_distinct::<core[40ef8ddb62afa269]::slice::iter::Iter<rustc_middle[6d7cfdcb6c95edb7]::mir::mono::MonoItem>>
  19:     0x7f96e4ad0d0a - rustc_monomorphize[980ee425a9bb6f45]::partitioning::collect_and_partition_mono_items
  20:     0x7f96e4ad0516 - rustc_query_impl[5ff32ada1adb4c7a]::query_impl::collect_and_partition_mono_items::invoke_provider_fn::__rust_begin_short_backtrace
  21:     0x7f96e54b88a4 - rustc_query_impl[5ff32ada1adb4c7a]::execution::try_execute_query::<rustc_middle[6d7cfdcb6c95edb7]::query::caches::SingleCache<rustc_middle[6d7cfdcb6c95edb7]::query::erase::ErasedData<[u8; 24usize]>>, false>
  22:     0x7f96e54b863c - rustc_query_impl[5ff32ada1adb4c7a]::query_impl::collect_and_partition_mono_items::execute_query_non_incr::__rust_end_short_backtrace
  23:     0x7f96e55a3639 - rustc_codegen_ssa[1989ede88636deb3]::base::codegen_crate::<rustc_codegen_llvm[126abe350048c0c7]::LlvmCodegenBackend>
  24:     0x7f96e55a334d - <rustc_codegen_llvm[126abe350048c0c7]::LlvmCodegenBackend as rustc_codegen_ssa[1989ede88636deb3]::traits::backend::CodegenBackend>::codegen_crate
  25:     0x7f96e546dd7a - <rustc_interface[5f8c59f625471e6f]::queries::Linker>::codegen_and_build_linker
  26:     0x7f96e5468841 - rustc_interface[5f8c59f625471e6f]::interface::run_compiler::<(), rustc_driver_impl[a7e284e8ff2767b6]::run_compiler::{closure#0}>::{closure#1}
  27:     0x7f96e549ba7e - std[f377252fd1978e75]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[5f8c59f625471e6f]::util::run_in_thread_with_globals<rustc_interface[5f8c59f625471e6f]::util::run_in_thread_pool_with_globals<rustc_interface[5f8c59f625471e6f]::interface::run_compiler<(), rustc_driver_impl[a7e284e8ff2767b6]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  28:     0x7f96e549c320 - <std[f377252fd1978e75]::thread::lifecycle::spawn_unchecked<rustc_interface[5f8c59f625471e6f]::util::run_in_thread_with_globals<rustc_interface[5f8c59f625471e6f]::util::run_in_thread_pool_with_globals<rustc_interface[5f8c59f625471e6f]::interface::run_compiler<(), rustc_driver_impl[a7e284e8ff2767b6]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[40ef8ddb62afa269]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  29:     0x7f96e549d1ac - <std[f377252fd1978e75]::sys::thread::unix::Thread>::new::thread_start
  30:     0x7f96defd6609 - start_thread
                               at /build/glibc-B3wQXB/glibc-2.31/nptl/pthread_create.c:477:8
  31:     0x7f96deefb353 - clone
                               at /build/glibc-B3wQXB/glibc-2.31/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:95:0
  32:                0x0 - <unknown>

error: the compiler unexpectedly panicked. This is a bug

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

query stack during panic:
#0 [symbol_name] computing the symbol for `core::mem::zeroed::<unsafe<'a> &'a ()>`
#1 [collect_and_partition_mono_items] collect_and_partition_mono_items
end of query stack
warning: 1 warning emitted

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the ICE with the unsafe_binders example, then inspect compiler/rustc_symbol_mangling/src/v0.rs at the reported line 582 and the V0SymbolMangler::print_type path. Trace the symbol_name query for core::mem::zeroed::<unsafe<'a> &'a ()>; done means the example no longer panics during symbol generation.

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
Quiet
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.