rust-lang / rust-lang/rust

ICE cannot convert `'{erased}` to a region vid

Open
#148,961 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-bug F-generic_const_exprs I-ICE T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

Code
#![feature(generic_const_exprs)]
#![allow(incomplete_features)]
trait S {
    const N: usize;
}
trait C<'a> {
    type S: S;
}
struct M<T: S>([u8; T::N])
where
    [(); T::N]:;
impl<T: S> M<T>
where
    [(); T::N]:,
{
    fn new<'a, U>() -> Self
    where
        U: C<'a, S = T>,
    {
        Self([0; T::N])
    }
}
fn ice<'a, U: C<'a>>() -> M<U::S>
where
    [(); U::S::N]:,
{
    M::new::<U>()
}
Meta

rustc --version --verbose:

rustc 1.93.0-nightly (2286e5d22 2025-11-13)
binary: rustc
commit-hash: 2286e5d224b3413484cf4f398a9f078487e7b49d
commit-date: 2025-11-13
host: x86_64-unknown-linux-gnu
release: 1.93.0-nightly
LLVM version: 21.1.5
Error output
error: internal compiler error: compiler/rustc_borrowck/src/universal_regions.rs:930:36: cannot convert `'{erased}` to a region vid


thread 'rustc' (54087) panicked at compiler/rustc_borrowck/src/universal_regions.rs:930:36:
Box<dyn Any>
Backtrace

stack backtrace:
   0:     0x7d7e8cae6e8b - std::backtrace::Backtrace::create::h8901367d0d1a76ad
   1:     0x7d7e8cae6dd5 - std::backtrace::Backtrace::force_capture::h3a9eca701a89ac90
   2:     0x7d7e8bb2b5de - std[7d788b5188538e2b]::panicking::update_hook::<alloc[553cc5d856ecd863]::boxed::Box<rustc_driver_impl[c8ce05006c65ad3c]::install_ice_hook::{closure#1}>>::{closure#0}
   3:     0x7d7e8cae7d42 - std::panicking::panic_with_hook::hde79c55693a3b1eb
   4:     0x7d7e8bb656d1 - std[7d788b5188538e2b]::panicking::begin_panic::<rustc_errors[4de43e3d7fedae10]::ExplicitBug>::{closure#0}
   5:     0x7d7e8bb58146 - std[7d788b5188538e2b]::sys::backtrace::__rust_end_short_backtrace::<std[7d788b5188538e2b]::panicking::begin_panic<rustc_errors[4de43e3d7fedae10]::ExplicitBug>::{closure#0}, !>
   6:     0x7d7e8bb57d8a - std[7d788b5188538e2b]::panicking::begin_panic::<rustc_errors[4de43e3d7fedae10]::ExplicitBug>
   7:     0x7d7e8bb82d51 - <rustc_errors[4de43e3d7fedae10]::diagnostic::BugAbort as rustc_errors[4de43e3d7fedae10]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
   8:     0x7d7e8c0fb959 - rustc_middle[f50946c6ef20fb6c]::util::bug::opt_span_bug_fmt::<rustc_span[1e7f55c4812d8429]::span_encoding::Span>::{closure#0}
   9:     0x7d7e8c0fbc22 - rustc_middle[f50946c6ef20fb6c]::ty::context::tls::with_opt::<rustc_middle[f50946c6ef20fb6c]::util::bug::opt_span_bug_fmt<rustc_span[1e7f55c4812d8429]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  10:     0x7d7e8c0ec13b - rustc_middle[f50946c6ef20fb6c]::ty::context::tls::with_context_opt::<rustc_middle[f50946c6ef20fb6c]::ty::context::tls::with_opt<rustc_middle[f50946c6ef20fb6c]::util::bug::opt_span_bug_fmt<rustc_span[1e7f55c4812d8429]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  11:     0x7d7e8a594884 - rustc_middle[f50946c6ef20fb6c]::util::bug::bug_fmt
  12:     0x7d7e8d37418e - <rustc_borrowck[7701d710b21ce7f8]::type_check::constraint_conversion::ConstraintConversion>::convert_all
  13:     0x7d7e8db01d06 - <rustc_borrowck[7701d710b21ce7f8]::type_check::TypeChecker>::ascribe_user_type
  14:     0x7d7e8a7954ba - rustc_borrowck[7701d710b21ce7f8]::type_check::type_check
  15:     0x7d7e8e5807e6 - <rustc_borrowck[7701d710b21ce7f8]::root_cx::BorrowCheckRootCtxt>::do_mir_borrowck
  16:     0x7d7e8d3f93aa - rustc_borrowck[7701d710b21ce7f8]::mir_borrowck
  17:     0x7d7e8d3f9219 - rustc_query_impl[fc5c9cdf374917bb]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[fc5c9cdf374917bb]::query_impl::mir_borrowck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[f50946c6ef20fb6c]::query::erase::Erased<[u8; 8usize]>>
  18:     0x7d7e8d3d006c - rustc_query_system[1e75c00b3c64c9b1]::query::plumbing::try_execute_query::<rustc_query_impl[fc5c9cdf374917bb]::DynamicConfig<rustc_data_structures[e2276771c3e5c23]::vec_cache::VecCache<rustc_span[1e7f55c4812d8429]::def_id::LocalDefId, rustc_middle[f50946c6ef20fb6c]::query::erase::Erased<[u8; 8usize]>, rustc_query_system[1e75c00b3c64c9b1]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[fc5c9cdf374917bb]::plumbing::QueryCtxt, true>
  19:     0x7d7e8d3db612 - rustc_query_impl[fc5c9cdf374917bb]::query_impl::mir_borrowck::get_query_incr::__rust_end_short_backtrace
  20:     0x7d7e8d3f6937 - <rustc_middle[f50946c6ef20fb6c]::ty::context::TyCtxt>::par_hir_body_owners::<rustc_interface[91e485a584ad68a2]::passes::run_required_analyses::{closure#1}::{closure#0}>::{closure#0}
  21:     0x7d7e8d3f43a6 - rustc_interface[91e485a584ad68a2]::passes::analysis
  22:     0x7d7e8d3f3833 - rustc_query_impl[fc5c9cdf374917bb]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[fc5c9cdf374917bb]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[f50946c6ef20fb6c]::query::erase::Erased<[u8; 0usize]>>
  23:     0x7d7e8e3de330 - rustc_query_system[1e75c00b3c64c9b1]::query::plumbing::try_execute_query::<rustc_query_impl[fc5c9cdf374917bb]::DynamicConfig<rustc_query_system[1e75c00b3c64c9b1]::query::caches::SingleCache<rustc_middle[f50946c6ef20fb6c]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[fc5c9cdf374917bb]::plumbing::QueryCtxt, true>
  24:     0x7d7e8e3ddba3 - rustc_query_impl[fc5c9cdf374917bb]::query_impl::analysis::get_query_incr::__rust_end_short_backtrace
  25:     0x7d7e8e4d0dd0 - <rustc_interface[91e485a584ad68a2]::passes::create_and_enter_global_ctxt<core[3329aa63fa2cb4a1]::option::Option<rustc_interface[91e485a584ad68a2]::queries::Linker>, rustc_driver_impl[c8ce05006c65ad3c]::run_compiler::{closure#0}::{closure#2}>::{closure#2} as core[3329aa63fa2cb4a1]::ops::function::FnOnce<(&rustc_session[501a08cd526941ac]::session::Session, rustc_middle[f50946c6ef20fb6c]::ty::context::CurrentGcx, alloc[553cc5d856ecd863]::sync::Arc<rustc_data_structures[e2276771c3e5c23]::jobserver::Proxy>, &std[7d788b5188538e2b]::sync::once_lock::OnceLock<rustc_middle[f50946c6ef20fb6c]::ty::context::GlobalCtxt>, &rustc_data_structures[e2276771c3e5c23]::sync::worker_local::WorkerLocal<rustc_middle[f50946c6ef20fb6c]::arena::Arena>, &rustc_data_structures[e2276771c3e5c23]::sync::worker_local::WorkerLocal<rustc_hir[307765648b0e6fca]::Arena>, rustc_driver_impl[c8ce05006c65ad3c]::run_compiler::{closure#0}::{closure#2})>>::call_once::{shim:vtable#0}
  26:     0x7d7e8e2b87c5 - rustc_interface[91e485a584ad68a2]::interface::run_compiler::<(), rustc_driver_impl[c8ce05006c65ad3c]::run_compiler::{closure#0}>::{closure#1}
  27:     0x7d7e8e2d517a - std[7d788b5188538e2b]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[91e485a584ad68a2]::util::run_in_thread_with_globals<rustc_interface[91e485a584ad68a2]::util::run_in_thread_pool_with_globals<rustc_interface[91e485a584ad68a2]::interface::run_compiler<(), rustc_driver_impl[c8ce05006c65ad3c]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  28:     0x7d7e8e2d4e68 - <<std[7d788b5188538e2b]::thread::Builder>::spawn_unchecked_<rustc_interface[91e485a584ad68a2]::util::run_in_thread_with_globals<rustc_interface[91e485a584ad68a2]::util::run_in_thread_pool_with_globals<rustc_interface[91e485a584ad68a2]::interface::run_compiler<(), rustc_driver_impl[c8ce05006c65ad3c]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[3329aa63fa2cb4a1]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  29:     0x7d7e8e2dab6f - std::sys::thread::unix::Thread::new::thread_start::hbfa5f43fe6494715
  30:     0x7d7e87c9caa4 - start_thread
                               at ./nptl/pthread_create.c:447:8
  31:     0x7d7e87d29c6c - clone3
                               at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78:0
  32:                0x0 - <unknown>

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

Start with the reproducer in the issue and inspect compiler/rustc_borrowck/src/universal_regions.rs at line 930, following the constraint_conversion::ConstraintConversion::convert_all and TypeChecker::ascribe_user_type frames. Run the example with the reported nightly compiler; done means it no longer triggers this internal compiler error and instead produces a handled compiler result.

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
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.