Skip to content

ICE: "cannot convert ReErased to a region vid" for let const { "foo" } = "foo" #78174

Closed

Description

Code

About as minimal of an example as it gets :)

#![allow(incomplete_features)]
#![feature(inline_const)]
fn main() {
    let const { "foo" } = "foo";
}

playground

Meta

Version

On the playground, so I don't think I can access the rest, but:

rustc 1.49.0-nightly (b1496c6e6 2020-10-18) running on x86_64-unknown-linux-gnu

This is a nightly-only feature, so I can't test on stable or beta :)

Error output

error: internal compiler error: compiler/rustc_mir/src/borrow_check/universal_regions.rs:768:36: cannot convert `ReErased` to a region vid

thread 'rustc' panicked at 'Box<Any>', compiler/rustc_errors/src/lib.rs:945:9
Backtrace

stack backtrace:
   0: std::panicking::begin_panic
   1: rustc_errors::HandlerInner::bug
   2: rustc_errors::Handler::bug
   3: rustc_middle::util::bug::opt_span_bug_fmt::{{closure}}
   4: rustc_middle::ty::context::tls::with_opt::{{closure}}
   5: rustc_middle::ty::context::tls::with_opt
   6: rustc_middle::util::bug::opt_span_bug_fmt
   7: rustc_middle::util::bug::bug_fmt
   8: rustc_mir::borrow_check::universal_regions::UniversalRegionIndices::to_region_vid::{{closure}}
   9: rustc_mir::borrow_check::universal_regions::UniversalRegionIndices::to_region_vid
  10: rustc_mir::borrow_check::universal_regions::UniversalRegionIndices::fold_to_region_vids::{{closure}}
  11: rustc_middle::ty::structural_impls::<impl rustc_middle::ty::fold::TypeFoldable for &rustc_middle::ty::TyS>::super_fold_with
  12: rustc_mir::borrow_check::universal_regions::UniversalRegions::new
  13: rustc_mir::borrow_check::nll::replace_regions_in_mir
  14: rustc_mir::borrow_check::do_mir_borrowck
  15: rustc_infer::infer::InferCtxtBuilder::enter
  16: rustc_mir::borrow_check::mir_borrowck
  17: core::ops::function::FnOnce::call_once
  18: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::mir_borrowck>::compute
  19: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  20: rustc_data_structures::stack::ensure_sufficient_stack
  21: rustc_query_system::query::plumbing::get_query_impl
  22: rustc_query_system::query::plumbing::ensure_query_impl
  23: rustc_mir::transform::mir_drops_elaborated_and_const_checked
  24: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::mir_drops_elaborated_and_const_checked>::compute
  25: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  26: rustc_middle::ty::query::plumbing::<impl rustc_query_system::query::QueryContext for rustc_middle::ty::context::TyCtxt>::start_query::{{closure}}::{{closure}}::{{closure}}
  27: rustc_query_system::query::plumbing::get_query_impl
  28: rustc_mir::transform::optimized_mir
  29: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::optimized_mir>::compute
  30: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  31: rustc_data_structures::stack::ensure_sufficient_stack
  32: rustc_query_system::query::plumbing::get_query_impl
  33: rustc_mir::interpret::eval_context::InterpCx<M>::load_mir
  34: rustc_mir::const_eval::eval_queries::eval_to_allocation_raw_provider
  35: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::eval_to_allocation_raw>::compute
  36: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  37: rustc_data_structures::stack::ensure_sufficient_stack
  38: rustc_query_system::query::plumbing::get_query_impl
  39: rustc_mir::const_eval::eval_queries::eval_to_const_value_raw_provider
  40: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::eval_to_const_value_raw>::compute
  41: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  42: rustc_data_structures::stack::ensure_sufficient_stack
  43: rustc_query_system::query::plumbing::get_query_impl
  44: rustc_middle::mir::interpret::queries::<impl rustc_middle::ty::context::TyCtxt>::const_eval_global_id
  45: rustc_middle::mir::interpret::queries::<impl rustc_middle::ty::context::TyCtxt>::const_eval_resolve
  46: rustc_infer::infer::InferCtxt::const_eval_resolve
  47: rustc_trait_selection::traits::const_evaluatable::is_const_evaluatable
  48: rustc_trait_selection::traits::fulfill::FulfillProcessor::progress_changed_obligations
  49: rustc_data_structures::obligation_forest::ObligationForest<O>::process_obligations
  50: <rustc_trait_selection::traits::fulfill::FulfillmentContext as rustc_infer::traits::engine::TraitEngine>::select_where_possible
  51: rustc_typeck::check::fn_ctxt::_impl::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::select_obligations_where_possible
  52: rustc_infer::infer::InferCtxtBuilder::enter
  53: rustc_typeck::check::typeck
  54: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::typeck>::compute
  55: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  56: rustc_data_structures::stack::ensure_sufficient_stack
  57: rustc_query_system::query::plumbing::get_query_impl
  58: rustc_query_system::query::plumbing::ensure_query_impl
  59: rustc_typeck::check::typeck_item_bodies
  60: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::typeck_item_bodies>::compute
  61: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  62: rustc_data_structures::stack::ensure_sufficient_stack
  63: rustc_query_system::query::plumbing::get_query_impl
  64: rustc_typeck::check_crate
  65: rustc_interface::passes::analysis
  66: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::analysis>::compute
  67: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  68: rustc_data_structures::stack::ensure_sufficient_stack
  69: rustc_query_system::query::plumbing::get_query_impl
  70: rustc_interface::passes::QueryContext::enter
  71: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  72: rustc_span::with_source_map
  73: scoped_tls::ScopedKey<T>::set
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

note: 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

note: rustc 1.49.0-nightly (b1496c6e6 2020-10-18) running on x86_64-unknown-linux-gnu

note: compiler flags: -C embed-bitcode=no -C codegen-units=1 -C debuginfo=2 --crate-type bin

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [mir_borrowck] borrow-checking `main::{constant#0}`
#1 [mir_drops_elaborated_and_const_checked] elaborating drops for `main::{constant#0}`
#2 [optimized_mir] optimizing MIR for `main::{constant#0}`
#3 [eval_to_allocation_raw] const-evaluating + checking `main::{constant#0}`
#4 [eval_to_const_value_raw] simplifying constant for the type system `main::{constant#0}`
#5 [typeck] type-checking `main`
#6 [typeck_item_bodies] type-checking all item bodies
#7 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to previous error

error: could not compile `playground`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

A-borrow-checkerArea: The borrow checkerArea: The borrow checkerA-lifetimesArea: Lifetimes / regionsArea: Lifetimes / regionsC-bugCategory: This is a bug.Category: This is a bug.F-inline_constInline constants (aka: const blocks, const expressions, anonymous constants)Inline constants (aka: const blocks, const expressions, anonymous constants)I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.glacierICE tracked in rust-lang/glacier.ICE tracked in rust-lang/glacier.requires-nightlyThis issue requires a nightly compiler in some way.This issue requires a nightly compiler in some way.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions