Skip to content

ICE: "cannot convert ReErased to a region vid" after adding unused variable #104247

Description

@l4l

Code

I didn't yet come up with a minimal example. So far for reproduction elfo crate is needed (which is quite big bruh). Here's the repo with the code: https://github.com/l4l/ice-bwck-unused-todo

Meta

Tried on stable 1.64.0, 1.65.0 and nightly 1.66.0 (470e518 2022-09-27).

Error output

compiler/rustc_borrowck/src/universal_regions.rs:810:36: cannot convert `ReErased` to a region vid
Shortened backtrace

  20:     0x7f01cd89aea3 - rustc_middle[b6cf56a787d1e2a1]::util::bug::bug_fmt
  21:     0x7f01cdc58c49 - <rustc_borrowck[9bf94ea6123d60bb]::type_check::constraint_conversion::ConstraintConversion>::convert_all
  22:     0x7f01cdc29a8a - <rustc_borrowck[9bf94ea6123d60bb]::type_check::TypeChecker>::normalize_and_prove_instantiated_predicates
  23:     0x7f01cdc26156 - <rustc_borrowck[9bf94ea6123d60bb]::type_check::TypeVerifier as rustc_middle[b6cf56a787d1e2a1]::mir::visit::Visitor>::visit_constant
  24:     0x7f01cdc10769 - <rustc_borrowck[9bf94ea6123d60bb]::type_check::TypeVerifier as rustc_middle[b6cf56a787d1e2a1]::mir::visit::Visitor>::visit_body
  25:     0x7f01cdbb5c32 - rustc_borrowck[9bf94ea6123d60bb]::type_check::type_check
  26:     0x7f01cdb922ce - rustc_borrowck[9bf94ea6123d60bb]::nll::compute_regions
  27:     0x7f01cdb7cdaf - rustc_borrowck[9bf94ea6123d60bb]::do_mir_borrowck
  28:     0x7f01ce82794d - rustc_borrowck[9bf94ea6123d60bb]::mir_borrowck
  29:     0x7f01ce826e60 - <rustc_borrowck[9bf94ea6123d60bb]::provide::{closure#0} as core[6fcc70bcc91a5bf5]::ops::function::FnOnce<(rustc_middle[b6cf56a787d1e2a1]::ty::context::TyCtxt, rustc_span[721a57c036170ce]::def_id::LocalDefId)>>::call_once
  30:     0x7f01ce13a39f - <rustc_query_system[8caf4755e287670e]::dep_graph::graph::DepGraph<rustc_middle[b6cf56a787d1e2a1]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[b6cf56a787d1e2a1]::ty::context::TyCtxt, rustc_span[721a57c036170ce]::def_id::LocalDefId, &rustc_middle[b6cf56a787d1e2a1]::mir::query::BorrowCheckResult>
  31:     0x7f01ce13967d - rustc_query_system[8caf4755e287670e]::query::plumbing::try_execute_query::<rustc_query_impl[232efbc2900411f9]::plumbing::QueryCtxt, rustc_query_system[8caf4755e287670e]::query::caches::DefaultCache<rustc_span[721a57c036170ce]::def_id::LocalDefId, &rustc_middle[b6cf56a787d1e2a1]::mir::query::BorrowCheckResult>>
  32:     0x7f01ced4356a - <rustc_query_impl[232efbc2900411f9]::Queries as rustc_middle[b6cf56a787d1e2a1]::ty::query::QueryEngine>::mir_borrowck
  33:     0x7f01ce8304d3 - rustc_data_structures[49e7163a34b889d1]::sync::par_for_each_in::<&[rustc_span[721a57c036170ce]::def_id::LocalDefId], <rustc_middle[b6cf56a787d1e2a1]::hir::map::Map>::par_body_owners<rustc_interface[f934826ba4c12dd9]::passes::analysis::{closure#2}::{closure#0}>::{closure#0}>
  34:     0x7f01ce82fc8b - <rustc_middle[b6cf56a787d1e2a1]::hir::map::Map>::par_body_owners::<rustc_interface[f934826ba4c12dd9]::passes::analysis::{closure#2}::{closure#0}>
  35:     0x7f01ce82fb63 - <rustc_session[98f7faf1d37bb5fb]::session::Session>::time::<(), rustc_interface[f934826ba4c12dd9]::passes::analysis::{closure#2}>
  36:     0x7f01ce82f955 - rustc_interface[f934826ba4c12dd9]::passes::analysis
  37:     0x7f01cebea2bc - <rustc_query_system[8caf4755e287670e]::dep_graph::graph::DepGraph<rustc_middle[b6cf56a787d1e2a1]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[b6cf56a787d1e2a1]::ty::context::TyCtxt, (), core[6fcc70bcc91a5bf5]::result::Result<(), rustc_errors[5fcb1a1f56a762e6]::ErrorGuaranteed>>
  38:     0x7f01cebe9aab - rustc_query_system[8caf4755e287670e]::query::plumbing::try_execute_query::<rustc_query_impl[232efbc2900411f9]::plumbing::QueryCtxt, rustc_query_system[8caf4755e287670e]::query::caches::DefaultCache<(), core[6fcc70bcc91a5bf5]::result::Result<(), rustc_errors[5fcb1a1f56a762e6]::ErrorGuaranteed>>>
  39:     0x7f01cebe95fe - rustc_query_system[8caf4755e287670e]::query::plumbing::get_query::<rustc_query_impl[232efbc2900411f9]::queries::analysis, rustc_query_impl[232efbc2900411f9]::plumbing::QueryCtxt>
  40:     0x7f01ce5c3d87 - <rustc_interface[f934826ba4c12dd9]::passes::QueryContext>::enter::<rustc_driver[4568cc0a685fd94d]::run_compiler::{closure#1}::{closure#2}::{closure#3}, core[6fcc70bcc91a5bf5]::result::Result<(), rustc_errors[5fcb1a1f56a762e6]::ErrorGuaranteed>>
  41:     0x7f01ce5bc97f - <rustc_interface[f934826ba4c12dd9]::interface::Compiler>::enter::<rustc_driver[4568cc0a685fd94d]::run_compiler::{closure#1}::{closure#2}, core[6fcc70bcc91a5bf5]::result::Result<core[6fcc70bcc91a5bf5]::option::Option<rustc_interface[f934826ba4c12dd9]::queries::Linker>, rustc_errors[5fcb1a1f56a762e6]::ErrorGuaranteed>>
  42:     0x7f01ce5b186a - rustc_span[721a57c036170ce]::with_source_map::<core[6fcc70bcc91a5bf5]::result::Result<(), rustc_errors[5fcb1a1f56a762e6]::ErrorGuaranteed>, rustc_interface[f934826ba4c12dd9]::interface::create_compiler_and_run<core[6fcc70bcc91a5bf5]::result::Result<(), rustc_errors[5fcb1a1f56a762e6]::ErrorGuaranteed>, rustc_driver[4568cc0a685fd94d]::run_compiler::{closure#1}>::{closure#1}>
  43:     0x7f01ce5b11a2 - <scoped_tls[80743de900a7f844]::ScopedKey<rustc_span[721a57c036170ce]::SessionGlobals>>::set::<rustc_interface[f934826ba4c12dd9]::interface::run_compiler<core[6fcc70bcc91a5bf5]::result::Result<(), rustc_errors[5fcb1a1f56a762e6]::ErrorGuaranteed>, rustc_driver[4568cc0a685fd94d]::run_compiler::{closure#1}>::{closure#0}, core[6fcc70bcc91a5bf5]::result::Result<(), rustc_errors[5fcb1a1f56a762e6]::ErrorGuaranteed>>
  44:     0x7f01ce5af5cf - std[306a94a967d8f5ee]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[f934826ba4c12dd9]::util::run_in_thread_pool_with_globals<rustc_interface[f934826ba4c12dd9]::interface::run_compiler<core[6fcc70bcc91a5bf5]::result::Result<(), rustc_errors[5fcb1a1f56a762e6]::ErrorGuaranteed>, rustc_driver[4568cc0a685fd94d]::run_compiler::{closure#1}>::{closure#0}, core[6fcc70bcc91a5bf5]::result::Result<(), rustc_errors[5fcb1a1f56a762e6]::ErrorGuaranteed>>::{closure#0}, core[6fcc70bcc91a5bf5]::result::Result<(), rustc_errors[5fcb1a1f56a762e6]::ErrorGuaranteed>>

Triggered this after adding let x: <ty> = todo(), if literal is set instead there's no ICE.

Looks similar to #96304 or #78174 but this one doesn't require nightly features.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    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.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions