Skip to content

ICE: cannot convert to a region vid #73375

Closed
@DutchGhost

Description

@DutchGhost

Code

fn bug<'a>() {
    [(); (|_: &'a u8| (), 0).1];
}

Meta

rustc --version --verbose:

rustc 1.44.0 (49cae5576 2020-06-01)
rustc 1.45.0-beta.3359 (b7dc83a3f 2020-06-03)
rustc 1.46.0-nightly (4fb54ed48 2020-06-14)

Error output

error: internal compiler error: src/librustc_mir/borrow_check/universal_regions.rs:750: cannot convert `ReFree(DefId(0:3 ~ playground[5d24]::bug[0]), BrNamed(DefId(0:4 ~ playground[5d24]::bug[0]::'a[0]), 'a))` to a region vid
Backtrace

thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:904:9
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/libunwind.rs:86
   1: backtrace::backtrace::trace_unsynchronized
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print_fmt
             at src/libstd/sys_common/backtrace.rs:78
   3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
             at src/libstd/sys_common/backtrace.rs:59
   4: core::fmt::write
             at src/libcore/fmt/mod.rs:1069
   5: std::io::Write::write_fmt
             at src/libstd/io/mod.rs:1504
   6: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:62
   7: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:49
   8: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:198
   9: std::panicking::default_hook
             at src/libstd/panicking.rs:218
  10: rustc_driver::report_ice
  11: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:515
  12: std::panicking::begin_panic
  13: rustc_errors::HandlerInner::bug
  14: rustc_errors::Handler::bug
  15: rustc_middle::util::bug::opt_span_bug_fmt::{{closure}}
  16: rustc_middle::ty::context::tls::with_opt::{{closure}}
  17: rustc_middle::ty::context::tls::with_opt
  18: rustc_middle::util::bug::opt_span_bug_fmt
  19: rustc_middle::util::bug::bug_fmt
  20: rustc_mir::borrow_check::universal_regions::UniversalRegionIndices::to_region_vid::{{closure}}
  21: rustc_mir::borrow_check::universal_regions::UniversalRegionIndices::to_region_vid
  22: <rustc_mir::borrow_check::type_check::relate_tys::NllTypeRelatingDelegate as rustc_infer::infer::nll_relate::TypeRelatingDelegate>::push_outlives
  23: <rustc_infer::infer::nll_relate::TypeRelating<D> as rustc_middle::ty::relate::TypeRelation>::regions
  24: rustc_middle::ty::relate::super_relate_tys
  25: rustc_infer::infer::combine::<impl rustc_infer::infer::InferCtxt>::super_combine_tys
  26: <rustc_infer::infer::nll_relate::TypeRelating<D> as rustc_middle::ty::relate::TypeRelation>::tys
  27: rustc_mir::borrow_check::type_check::relate_tys::relate_types
  28: rustc_mir::borrow_check::type_check::input_output::<impl rustc_mir::borrow_check::type_check::TypeChecker>::equate_normalized_input_or_output
  29: rustc_mir::borrow_check::type_check::type_check
  30: rustc_mir::borrow_check::nll::compute_regions
  31: rustc_mir::borrow_check::do_mir_borrowck
  32: rustc_middle::ty::context::GlobalCtxt::enter_local
  33: rustc_mir::borrow_check::mir_borrowck
  34: 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
  35: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  36: rustc_query_system::query::plumbing::get_query
  37: rustc_mir::borrow_check::type_check::TypeChecker::check_rvalue
  38: rustc_mir::borrow_check::type_check::TypeChecker::typeck_mir
  39: rustc_mir::borrow_check::type_check::type_check
  40: rustc_mir::borrow_check::nll::compute_regions
  41: rustc_mir::borrow_check::do_mir_borrowck
  42: rustc_middle::ty::context::GlobalCtxt::enter_local
  43: rustc_mir::borrow_check::mir_borrowck
  44: 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
  45: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  46: rustc_query_system::query::plumbing::get_query
  47: rustc_query_system::query::plumbing::ensure_query
  48: rustc_mir::transform::optimized_mir
  49: 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
  50: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  51: rustc_query_system::query::plumbing::get_query
  52: rustc_mir::interpret::eval_context::InterpCx<M>::load_mir
  53: rustc_mir::const_eval::eval_queries::const_eval_raw_provider
  54: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::const_eval_raw>::compute
  55: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  56: rustc_query_system::query::plumbing::get_query
  57: rustc_mir::const_eval::eval_queries::const_eval_validated_provider
  58: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::const_eval_validated>::compute
  59: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  60: rustc_query_system::query::plumbing::get_query
  61: rustc_middle::mir::interpret::queries::<impl rustc_middle::ty::context::TyCtxt>::const_eval_resolve
  62: rustc_infer::infer::InferCtxt::const_eval_resolve
  63: rustc_data_structures::obligation_forest::ObligationForest<O>::process_obligations
  64: <rustc_trait_selection::traits::fulfill::FulfillmentContext as rustc_infer::traits::engine::TraitEngine>::select_where_possible
  65: rustc_typeck::check::FnCtxt::resolve_vars_with_obligations
  66: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind
  67: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs
  68: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind
  69: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs
  70: rustc_typeck::check::FnCtxt::check_stmt
  71: rustc_typeck::check::FnCtxt::check_block_with_expected
  72: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind
  73: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs
  74: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_return_expr
  75: rustc_typeck::check::check_fn
  76: rustc_infer::infer::InferCtxtBuilder::enter
  77: rustc_typeck::check::typeck_tables_of
  78: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::typeck_tables_of>::compute
  79: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  80: rustc_query_system::query::plumbing::get_query
  81: rustc_query_system::query::plumbing::ensure_query
  82: rustc_typeck::check::typeck_item_bodies
  83: 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
  84: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  85: rustc_query_system::query::plumbing::get_query
  86: rustc_typeck::check_crate
  87: rustc_interface::passes::analysis
  88: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::analysis>::compute
  89: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  90: rustc_query_system::query::plumbing::get_query
  91: rustc_middle::ty::context::tls::enter_global
  92: rustc_interface::interface::run_compiler_in_existing_thread_pool
  93: scoped_tls::ScopedKey<T>::set
  94: rustc_ast::attr::with_globals
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/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.44.0 (49cae5576 2020-06-01) running on x86_64-unknown-linux-gnu

note: compiler flags: -C codegen-units=1 -C debuginfo=2 --crate-type lib

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

query stack during panic:
#0 [mir_borrowck] borrow-checking `bug::{{constant}}#0::{{closure}}#0`
#1 [mir_borrowck] borrow-checking `bug::{{constant}}#0`
#2 [optimized_mir] processing `bug::{{constant}}#0`
#3 [const_eval_raw] const-evaluating `bug::{{constant}}#0`
#4 [const_eval_validated] const-evaluating + checking `bug::{{constant}}#0`
#5 [typeck_tables_of] type-checking `bug`
#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`.

Metadata

Metadata

Assignees

Labels

A-borrow-checkerArea: The borrow checkerA-closuresArea: Closures (`|…| { … }`)C-bugCategory: This is a bug.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.glacierICE tracked in rust-lang/glacier.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions