Skip to content

ICE: cannot convert to a region vid #135649

Closed
@matthiaskrgr

Description

@matthiaskrgr

snippet:

struct A<'a> {
    x: Vec<A> = Vec::new(),
}

Version information

rustc 1.86.0-nightly (bcd0683e5 2025-01-17)
binary: rustc
commit-hash: bcd0683e5dce1945b5d940714742e7502883bb5c
commit-date: 2025-01-17
host: x86_64-unknown-linux-gnu
release: 1.86.0-nightly
LLVM version: 19.1.7

Possibly related line of code:

// errors are being emitted and 2) it leaves the happy path unaffected.
self.fr_static
} else {
*self
.indices
.get(&r)
.unwrap_or_else(|| bug!("cannot convert `{:?}` to a region vid", r))
}
}
/// Replaces all free regions in `value` with region vids, as
/// returned by `to_region_vid`.
fn fold_to_region_vids<T>(&self, tcx: TyCtxt<'tcx>, value: T) -> T

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc

Program output

error[E0106]: missing lifetime specifier
 --> /tmp/icemaker_global_tempdir.65vzQ3rSPMlN/rustc_testrunner_tmpdir_reporting.9LgfFhJdaXkA/mvce.rs:2:12
  |
2 |     x: Vec<A> = Vec::new(),
  |            ^ expected named lifetime parameter
  |
help: consider using the `'a` lifetime
  |
2 |     x: Vec<A<'a>> = Vec::new(),
  |             ++++

error[E0658]: default values on fields are experimental
 --> /tmp/icemaker_global_tempdir.65vzQ3rSPMlN/rustc_testrunner_tmpdir_reporting.9LgfFhJdaXkA/mvce.rs:2:14
  |
2 |     x: Vec<A> = Vec::new(),
  |              ^^^^^^^^^^^^^
  |
  = note: see issue #132162 <https://github.com/rust-lang/rust/issues/132162> for more information
  = help: add `#![feature(default_field_values)]` to the crate attributes to enable
  = note: this compiler was built on 2025-01-17; consider upgrading it if it is out of date

error[E0601]: `main` function not found in crate `mvce`
 --> /tmp/icemaker_global_tempdir.65vzQ3rSPMlN/rustc_testrunner_tmpdir_reporting.9LgfFhJdaXkA/mvce.rs:3:2
  |
3 | }
  |  ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.65vzQ3rSPMlN/rustc_testrunner_tmpdir_reporting.9LgfFhJdaXkA/mvce.rs`

error[E0392]: lifetime parameter `'a` is never used
 --> /tmp/icemaker_global_tempdir.65vzQ3rSPMlN/rustc_testrunner_tmpdir_reporting.9LgfFhJdaXkA/mvce.rs:1:10
  |
1 | struct A<'a> {
  |          ^^ unused lifetime parameter
  |
  = help: consider removing `'a`, referring to it in a field, or using a marker such as `PhantomData`

error: internal compiler error: compiler/rustc_borrowck/src/universal_regions.rs:888:36: cannot convert `'a/#0` to a region vid


thread 'rustc' panicked at compiler/rustc_borrowck/src/universal_regions.rs:888:36:
Box<dyn Any>
stack backtrace:
   0:     0x730ea98f502a - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h4fb5b0de48364101
   1:     0x730eaa012d66 - core::fmt::write::h6eb54c31028066ca
   2:     0x730eaafa43d1 - std::io::Write::write_fmt::hd9e9dfb2c5e220cc
   3:     0x730ea98f4e82 - std::sys::backtrace::BacktraceLock::print::ha2ddb07494fe7b3b
   4:     0x730ea98f7302 - std::panicking::default_hook::{{closure}}::h4eed2bdbab3e3d9c
   5:     0x730ea98f718a - std::panicking::default_hook::h520b49f6397a0732
   6:     0x730ea8a58e1b - std[3244471bfd6eaa61]::panicking::update_hook::<alloc[8ba9d48c156baf43]::boxed::Box<rustc_driver_impl[df45097da6562dc6]::install_ice_hook::{closure#1}>>::{closure#0}
   7:     0x730ea98f7e43 - std::panicking::rust_panic_with_hook::ha20255168d758ad1
   8:     0x730ea8a94761 - std[3244471bfd6eaa61]::panicking::begin_panic::<rustc_errors[af9a6eaf1dbd0244]::ExplicitBug>::{closure#0}
   9:     0x730ea8a89666 - std[3244471bfd6eaa61]::sys::backtrace::__rust_end_short_backtrace::<std[3244471bfd6eaa61]::panicking::begin_panic<rustc_errors[af9a6eaf1dbd0244]::ExplicitBug>::{closure#0}, !>
  10:     0x730ea8a89423 - std[3244471bfd6eaa61]::panicking::begin_panic::<rustc_errors[af9a6eaf1dbd0244]::ExplicitBug>
  11:     0x730ea8a9e691 - <rustc_errors[af9a6eaf1dbd0244]::diagnostic::BugAbort as rustc_errors[af9a6eaf1dbd0244]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  12:     0x730ea907bc53 - rustc_middle[352907c3633efb2c]::util::bug::opt_span_bug_fmt::<rustc_span[2bc6ccfbd90abceb]::span_encoding::Span>::{closure#0}
  13:     0x730ea90615da - rustc_middle[352907c3633efb2c]::ty::context::tls::with_opt::<rustc_middle[352907c3633efb2c]::util::bug::opt_span_bug_fmt<rustc_span[2bc6ccfbd90abceb]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  14:     0x730ea906146b - rustc_middle[352907c3633efb2c]::ty::context::tls::with_context_opt::<rustc_middle[352907c3633efb2c]::ty::context::tls::with_opt<rustc_middle[352907c3633efb2c]::util::bug::opt_span_bug_fmt<rustc_span[2bc6ccfbd90abceb]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  15:     0x730ea6f596b0 - rustc_middle[352907c3633efb2c]::util::bug::bug_fmt
  16:     0x730eab54beb3 - <rustc_borrowck[55cebfbcecacd79c]::universal_regions::UniversalRegionIndices>::to_region_vid.cold
  17:     0x730eaa060745 - <rustc_middle[352907c3633efb2c]::ty::Ty as rustc_type_ir[ba8c709077c11182]::fold::TypeSuperFoldable<rustc_middle[352907c3633efb2c]::ty::context::TyCtxt>>::try_super_fold_with::<rustc_type_ir[ba8c709077c11182]::fold::RegionFolder<rustc_middle[352907c3633efb2c]::ty::context::TyCtxt>>
  18:     0x730eaa05f068 - <rustc_middle[352907c3633efb2c]::ty::Ty as rustc_type_ir[ba8c709077c11182]::fold::TypeSuperFoldable<rustc_middle[352907c3633efb2c]::ty::context::TyCtxt>>::try_super_fold_with::<rustc_type_ir[ba8c709077c11182]::fold::RegionFolder<rustc_middle[352907c3633efb2c]::ty::context::TyCtxt>>
  19:     0x730eab0c21f6 - rustc_borrowck[55cebfbcecacd79c]::do_mir_borrowck
  20:     0x730eab0bfbef - rustc_query_impl[43ade5033af9534a]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[43ade5033af9534a]::query_impl::mir_borrowck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[352907c3633efb2c]::query::erase::Erased<[u8; 8usize]>>
  21:     0x730eaa33c04e - rustc_query_system[eb70713c06242342]::query::plumbing::try_execute_query::<rustc_query_impl[43ade5033af9534a]::DynamicConfig<rustc_data_structures[dc2c66faf0aa2c5f]::vec_cache::VecCache<rustc_span[2bc6ccfbd90abceb]::def_id::LocalDefId, rustc_middle[352907c3633efb2c]::query::erase::Erased<[u8; 8usize]>, rustc_query_system[eb70713c06242342]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[43ade5033af9534a]::plumbing::QueryCtxt, false>
  22:     0x730eaa33bb53 - rustc_query_impl[43ade5033af9534a]::query_impl::mir_borrowck::get_query_non_incr::__rust_end_short_backtrace
  23:     0x730eaa3309f0 - rustc_interface[508537c9f518ed83]::passes::run_required_analyses
  24:     0x730eaaf9fade - rustc_interface[508537c9f518ed83]::passes::analysis
  25:     0x730eaaf9faaf - rustc_query_impl[43ade5033af9534a]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[43ade5033af9534a]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[352907c3633efb2c]::query::erase::Erased<[u8; 0usize]>>
  26:     0x730eaaf5a9d5 - rustc_query_system[eb70713c06242342]::query::plumbing::try_execute_query::<rustc_query_impl[43ade5033af9534a]::DynamicConfig<rustc_query_system[eb70713c06242342]::query::caches::SingleCache<rustc_middle[352907c3633efb2c]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[43ade5033af9534a]::plumbing::QueryCtxt, false>
  27:     0x730eaaf5a70e - rustc_query_impl[43ade5033af9534a]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  28:     0x730eab0391e9 - rustc_interface[508537c9f518ed83]::passes::create_and_enter_global_ctxt::<core[24a92a8ec63ee5f4]::option::Option<rustc_interface[508537c9f518ed83]::queries::Linker>, rustc_driver_impl[df45097da6562dc6]::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
  29:     0x730eab02c416 - rustc_interface[508537c9f518ed83]::interface::run_compiler::<(), rustc_driver_impl[df45097da6562dc6]::run_compiler::{closure#0}>::{closure#1}
  30:     0x730eaae73a07 - std[3244471bfd6eaa61]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[508537c9f518ed83]::util::run_in_thread_with_globals<rustc_interface[508537c9f518ed83]::util::run_in_thread_pool_with_globals<rustc_interface[508537c9f518ed83]::interface::run_compiler<(), rustc_driver_impl[df45097da6562dc6]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  31:     0x730eaae736d9 - <<std[3244471bfd6eaa61]::thread::Builder>::spawn_unchecked_<rustc_interface[508537c9f518ed83]::util::run_in_thread_with_globals<rustc_interface[508537c9f518ed83]::util::run_in_thread_pool_with_globals<rustc_interface[508537c9f518ed83]::interface::run_compiler<(), rustc_driver_impl[df45097da6562dc6]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[24a92a8ec63ee5f4]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  32:     0x730eaae72e6f - std::sys::pal::unix::thread::Thread::new::thread_start::h5d259864ca2af1e4
  33:     0x730ea52a339d - <unknown>
  34:     0x730ea532849c - <unknown>
  35:                0x0 - <unknown>

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

note: please make sure that you have updated to the latest nightly

note: please attach the file at `/tmp/im2/rustc-ice-2025-01-17T19_45_25-2933219.txt` to your bug report

query stack during panic:
#0 [mir_borrowck] borrow-checking `A::x::{constant#0}`
#1 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 5 previous errors

Some errors have detailed explanations: E0106, E0392, E0601, E0658.
For more information about an error, try `rustc --explain E0106`.

Metadata

Metadata

Assignees

Labels

C-bugCategory: This is a bug.F-default_field_values`#![feature(default_field_values)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️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