Skip to content

Unsafe binders unsupported in debug info #139462

Open
@ds84182

Description

@ds84182

Code

(I hit this on Rust Playground, so I can't attach the ICE txt file. Works fine in release mode.)

https://play.rust-lang.org/?version=nightly&mode=debug&edition=2024&gist=4f0a92174d7eca28addc51f8b4612742

#![feature(unsafe_binders)]
use std::unsafe_binder::wrap_binder;
fn main() {
    let foo = 0;
    let foo: unsafe<'a> &'a u32 = unsafe { wrap_binder!(&foo) };
}

Meta

rustc --version --verbose:

1.88.0-nightly (2025-04-06 2fa8b11f0933dae9b4e5)

Error output

error: internal compiler error: compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs:462:14: debuginfo: unexpected type in type_di_node(): Binder { value: &'^0 u32, bound_vars: [Region(BrAnon)] }
Backtrace

thread 'rustc' panicked at compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs:462:14:
Box<dyn Any>
stack backtrace:
   0:     0x7a54b46955e3 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h54e65d53802d6f14
   1:     0x7a54b4e06111 - core::fmt::write::h2ab2627ac6040071
   2:     0x7a54b61ec651 - std::io::Write::write_fmt::h7c79906be33e14fb
   3:     0x7a54b4695442 - std::sys::backtrace::BacktraceLock::print::h277faba49a014a7d
   4:     0x7a54b4698f2a - std::panicking::default_hook::{{closure}}::hd2f15c305ca8b86e
   5:     0x7a54b4698aaf - std::panicking::default_hook::h057d80f2dca97b6e
   6:     0x7a54b36f1a73 - std[d02962fe56d99dcc]::panicking::update_hook::<alloc[4b3f7a816ac45d68]::boxed::Box<rustc_driver_impl[8b13fa2b174f7f62]::install_ice_hook::{closure#1}>>::{closure#0}
   7:     0x7a54b46997a3 - std::panicking::rust_panic_with_hook::h928afe7ce4f23dbb
   8:     0x7a54b3730131 - std[d02962fe56d99dcc]::panicking::begin_panic::<rustc_errors[736ca0fcc4929ac3]::ExplicitBug>::{closure#0}
   9:     0x7a54b37241a6 - std[d02962fe56d99dcc]::sys::backtrace::__rust_end_short_backtrace::<std[d02962fe56d99dcc]::panicking::begin_panic<rustc_errors[736ca0fcc4929ac3]::ExplicitBug>::{closure#0}, !>
  10:     0x7a54b3720b9b - std[d02962fe56d99dcc]::panicking::begin_panic::<rustc_errors[736ca0fcc4929ac3]::ExplicitBug>
  11:     0x7a54b3739981 - <rustc_errors[736ca0fcc4929ac3]::diagnostic::BugAbort as rustc_errors[736ca0fcc4929ac3]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  12:     0x7a54b3d8f7da - rustc_middle[63a048d087a3442e]::util::bug::opt_span_bug_fmt::<rustc_span[51c212edee1a24cc]::span_encoding::Span>::{closure#0}
  13:     0x7a54b3d6962a - rustc_middle[63a048d087a3442e]::ty::context::tls::with_opt::<rustc_middle[63a048d087a3442e]::util::bug::opt_span_bug_fmt<rustc_span[51c212edee1a24cc]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  14:     0x7a54b3d6949b - rustc_middle[63a048d087a3442e]::ty::context::tls::with_context_opt::<rustc_middle[63a048d087a3442e]::ty::context::tls::with_opt<rustc_middle[63a048d087a3442e]::util::bug::opt_span_bug_fmt<rustc_span[51c212edee1a24cc]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  15:     0x7a54b1f50dc0 - rustc_middle[63a048d087a3442e]::util::bug::bug_fmt
  16:     0x7a54b55444a1 - rustc_codegen_llvm[ba3e838039641cce]::debuginfo::metadata::type_di_node
  17:     0x7a54b5542212 - <rustc_codegen_llvm[ba3e838039641cce]::context::GenericCx<rustc_codegen_llvm[ba3e838039641cce]::context::FullCx> as rustc_codegen_ssa[98c2f8fc06024765]::traits::debuginfo::DebugInfoCodegenMethods>::create_dbg_var
  18:     0x7a54b5eaf586 - rustc_codegen_ssa[98c2f8fc06024765]::mir::codegen_mir::<rustc_codegen_llvm[ba3e838039641cce]::builder::GenericBuilder<rustc_codegen_llvm[ba3e838039641cce]::context::FullCx>>
  19:     0x7a54b5eaa08f - rustc_codegen_llvm[ba3e838039641cce]::base::compile_codegen_unit::module_codegen
  20:     0x7a54b5fcde56 - <rustc_codegen_llvm[ba3e838039641cce]::LlvmCodegenBackend as rustc_codegen_ssa[98c2f8fc06024765]::traits::backend::ExtraBackendMethods>::compile_codegen_unit
  21:     0x7a54b5fca117 - <rustc_codegen_llvm[ba3e838039641cce]::LlvmCodegenBackend as rustc_codegen_ssa[98c2f8fc06024765]::traits::backend::CodegenBackend>::codegen_crate
  22:     0x7a54b5c6eb9d - <rustc_interface[8d837187d32f3597]::queries::Linker>::codegen_and_build_linker
  23:     0x7a54b61164ac - rustc_interface[8d837187d32f3597]::passes::create_and_enter_global_ctxt::<core[d62cfdcf594127e5]::option::Option<rustc_interface[8d837187d32f3597]::queries::Linker>, rustc_driver_impl[8b13fa2b174f7f62]::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
  24:     0x7a54b5f841b9 - rustc_interface[8d837187d32f3597]::interface::run_compiler::<(), rustc_driver_impl[8b13fa2b174f7f62]::run_compiler::{closure#0}>::{closure#1}
  25:     0x7a54b5d7d005 - std[d02962fe56d99dcc]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[8d837187d32f3597]::util::run_in_thread_with_globals<rustc_interface[8d837187d32f3597]::util::run_in_thread_pool_with_globals<rustc_interface[8d837187d32f3597]::interface::run_compiler<(), rustc_driver_impl[8b13fa2b174f7f62]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  26:     0x7a54b5d7d8eb - <<std[d02962fe56d99dcc]::thread::Builder>::spawn_unchecked_<rustc_interface[8d837187d32f3597]::util::run_in_thread_with_globals<rustc_interface[8d837187d32f3597]::util::run_in_thread_pool_with_globals<rustc_interface[8d837187d32f3597]::interface::run_compiler<(), rustc_driver_impl[8b13fa2b174f7f62]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[d62cfdcf594127e5]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  27:     0x7a54b5d7ecf7 - std::sys::pal::unix::thread::Thread::new::thread_start::hf081d5b83a5b7148
  28:     0x7a54b7583a94 - <unknown>
  29:     0x7a54b7610a34 - clone
  30:                0x0 - <unknown>

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-debuginfoArea: Debugging information in compiled programs (DWARF, PDB, etc.)C-bugCategory: This is a bug.F-unsafe_binders`#![feature(unsafe_binders)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️S-bug-has-testStatus: This bug is tracked inside the repo by a `known-bug` test.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions