Skip to content

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

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
l4l opened this issue Nov 10, 2022 · 6 comments
Closed

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

l4l opened this issue Nov 10, 2022 · 6 comments
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@l4l
Copy link
Contributor

l4l commented Nov 10, 2022

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.

@l4l l4l added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 10, 2022
@albertlarsan68
Copy link
Member

I can't reproduce with rustc 1.66.0-beta.1 on x86_64-pc-windows-msvc.

@compiler-errors
Copy link
Member

@l4l, this is a pretty old nightly version -- can you update your compiler and see if it still reproduces the issue?

@albertlarsan68
Copy link
Member

However, it reproduces with rustc 1.65.0

@l4l
Copy link
Contributor Author

l4l commented Nov 10, 2022

Hmm, wonder when it was resolved. I've found no recent relevant issues.

No longer reproduces with 1.67.0-nightly (9286a1beb 2022-11-04), sorry for misreporting.

@l4l l4l closed this as completed Nov 10, 2022
@albertlarsan68
Copy link
Member

The fix was deployed in nightly-2022-10-29, currently continuing the bisection for the exact merge

@albertlarsan68
Copy link
Member

It seems like #103629 is the merge that fixed it.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants