Skip to content

ICE: cannot convert ReErased to a region vid #81857

Closed
@ZhangZhuoSJTU

Description

@ZhangZhuoSJTU

It seems like a duplicate of #78174. But it is, on the other hand, an invalid statements instead of a nightly-only feature (inline_const). So I open this issue.

I will try to understand whether it is indeed a duplicate. But it would be very appreciated if someone can figure it out, so that we do not bother so much. Thanks!

Code

#[c=""]

fn e()->i {{""]const{""

md5: fef99e2b36eeaaa4fe32447f7ff03c9c

Meta

It is on nightly, beta, and stable versions.

rustc --version --verbose:

rustc 1.52.0-nightly (a73c2e555 2021-02-06)
binary: rustc
commit-hash: a73c2e555c26ef0c8b98c91c97a7d24b7017267f
commit-date: 2021-02-06
host: x86_64-unknown-linux-gnu
release: 1.52.0-nightly
LLVM version: 11.0.1

rustc 1.50.0-beta.8 (1cd030396 2021-01-20)
binary: rustc
commit-hash: 1cd0303963629f317a08e7e52162ccca7232ae7f
commit-date: 2021-01-20
host: x86_64-unknown-linux-gnu
release: 1.50.0-beta.8

rustc 1.49.0 (e1884a8e3 2020-12-29)
binary: rustc
commit-hash: e1884a8e3c3e813aada8254edfa120e85bf5ffca
commit-date: 2020-12-29
host: x86_64-unknown-linux-gnu
release: 1.49.0

Error output

The output is from nightly.

➜  playground rustc poc.rs
error: this file contains an unclosed delimiter
 --> poc.rs:3:25
  |
3 | fn e()->i {{""]const{""
  |           -         -   ^
  |           |         |
  |           |         unclosed delimiter
  |           unclosed delimiter

error: mismatched closing delimiter: `]`
 --> poc.rs:3:15
  |
3 | fn e()->i {{""]const{""
  |            -  ^ mismatched closing delimiter
  |            |
  |            unclosed delimiter

error: cannot find attribute `c` in this scope
 --> poc.rs:1:3
  |
1 | #[c=""]
  |   ^

error[E0412]: cannot find type `i` in this scope
 --> poc.rs:3:9
  |
3 | fn e()->i {{""]const{""
  |         ^ help: a builtin type with a similar name exists: `i8`

error[E0658]: inline-const is experimental
 --> poc.rs:3:16
  |
3 | fn e()->i {{""]const{""
  |                ^^^^^
  |
  = note: see issue #76001 <https://github.com/rust-lang/rust/issues/76001> for more information
  = help: add `#![feature(inline_const)]` to the crate attributes to enable

warning: unnecessary braces around block return value
 --> poc.rs:3:12
  |
3 | fn e()->i {{""]const{""
  |            ^^^^ help: remove these braces
  |
  = note: `#[warn(unused_braces)]` on by default

error[E0308]: mismatched types
 --> poc.rs:3:13
  |
3 | fn e()->i {{""]const{""
  |             ^^ expected `()`, found `&str`

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>', /rustc/a73c2e555c26ef0c8b98c91c97a7d24b7017267f/library/std/src/panic.rs:59:5
note: run with `RUST_BACKTRACE=1` environment variable to display a 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.52.0-nightly (a73c2e555 2021-02-06) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [mir_borrowck] borrow-checking `e::{constant#0}`
#1 [mir_drops_elaborated_and_const_checked] elaborating drops for `e::{constant#0}`
end of query stack
error: aborting due to 7 previous errors; 1 warning emitted

Some errors have detailed explanations: E0308, E0412, E0658.
For more information about an error, try `rustc --explain E0308`.
Backtrace

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-borrow-checkerArea: The borrow checkerA-lifetimesArea: Lifetimes / regionsC-bugCategory: This is a bug.F-inline_constInline constants (aka: const blocks, const expressions, anonymous constants)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