Skip to content

Panic after changing field name on cached builds #96319

Closed
@imlazyeye

Description

@imlazyeye

In the project linked below, changing a specific field to have a different name will ice the compiler. cargo check passes, but cargo run / cargo build will fail.

If you run cargo clean the issue will go away. However, if you then change the field name again, the ice returns. This feels to me like an issue with incremental complication?

Repo: https://github.com/imlazyeye/duck
Branch: rust-ice
Location: In src/parse/gml/stmt.rs, the field tag on Stmt.

Meta

rustc --version --verbose:

❯ rustc --version --verbose
rustc 1.60.0 (7737e0b5c 2022-04-04)
binary: rustc
commit-hash: 7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c
commit-date: 2022-04-04
host: aarch64-apple-darwin
release: 1.60.0
LLVM version: 14.0.0

Error output

thread 'rustc' panicked at 'Failed to extract DefId: local_def_id_to_hir_id bc0d0a5ef7cff5bc-6d59dfaffc699752', compiler/rustc_middle/src/dep_graph/dep_node.rs:270:17
Backtrace

❯ cargo run
   Compiling duck v0.1.0 (/Users/gabe/Documents/repos/duck)
warning: unused import: `duck_bug`
 --> src/solve/solver.rs:3:17
  |
3 |     adt, array, duck_bug, duck_error,
  |                 ^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

thread 'rustc' panicked at 'Failed to extract DefId: local_def_id_to_hir_id bc0d0a5ef7cff5bc-6d59dfaffc699752', compiler/rustc_middle/src/dep_graph/dep_node.rs:270:17
stack backtrace:
   0:        0x100ee3118 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h10cf06316d33e2a9
   1:        0x100f2f808 - core::fmt::write::h1faf18c959c3a8df
   2:        0x100ed5104 - std::io::Write::write_fmt::h86ab231360bc97d2
   3:        0x100ee6e44 - std::panicking::default_hook::{{closure}}::h36e628ffaf3cd44f
   4:        0x100ee6abc - std::panicking::default_hook::h3ee1564a7544e58f
   5:        0x1082bc5c4 - rustc_driver[3e35567b0507961a]::DEFAULT_HOOK::{closure#0}::{closure#0}
   6:        0x100ee7634 - std::panicking::rust_panic_with_hook::h191339fbd2fe2360
   7:        0x100ee7388 - std::panicking::begin_panic_handler::{{closure}}::h91c230befd9929e3
   8:        0x100ee3600 - std::sys_common::backtrace::__rust_end_short_backtrace::haaaeebb1d37476b3
   9:        0x100ee70c4 - _rust_begin_unwind
  10:        0x100f5d7fc - core::panicking::panic_fmt::h4fe1013b011ef602
  11:        0x10bd2bb5c - <rustc_query_system[91d58cadb6adb151]::dep_graph::dep_node::DepNode<rustc_middle[48a4de8117124789]::dep_graph::dep_node::DepKind> as rustc_middle[48a4de8117124789]::dep_graph::dep_node::DepNodeExt>::extract_def_id::{closure#0}
  12:        0x10bccd070 - <rustc_middle[48a4de8117124789]::ty::context::TyCtxt>::def_path_hash_to_def_id
  13:        0x10bd2bad0 - <rustc_query_system[91d58cadb6adb151]::dep_graph::dep_node::DepNode<rustc_middle[48a4de8117124789]::dep_graph::dep_node::DepKind> as rustc_middle[48a4de8117124789]::dep_graph::dep_node::DepNodeExt>::extract_def_id
  14:        0x10b19d5d8 - rustc_query_impl[9309ed91bf96ef41]::query_callbacks::local_def_id_to_hir_id::force_from_dep_node
  15:        0x10bcb6538 - <rustc_middle[48a4de8117124789]::ty::context::TyCtxt as rustc_query_system[91d58cadb6adb151]::dep_graph::DepContext>::try_force_from_dep_node
  16:        0x10b2bc174 - <rustc_query_system[91d58cadb6adb151]::dep_graph::graph::DepGraph<rustc_middle[48a4de8117124789]::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl[9309ed91bf96ef41]::plumbing::QueryCtxt>
  17:        0x10b2bc144 - <rustc_query_system[91d58cadb6adb151]::dep_graph::graph::DepGraph<rustc_middle[48a4de8117124789]::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl[9309ed91bf96ef41]::plumbing::QueryCtxt>
  18:        0x10b2bc144 - <rustc_query_system[91d58cadb6adb151]::dep_graph::graph::DepGraph<rustc_middle[48a4de8117124789]::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl[9309ed91bf96ef41]::plumbing::QueryCtxt>
  19:        0x10b2bc144 - <rustc_query_system[91d58cadb6adb151]::dep_graph::graph::DepGraph<rustc_middle[48a4de8117124789]::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl[9309ed91bf96ef41]::plumbing::QueryCtxt>
  20:        0x10b2bc144 - <rustc_query_system[91d58cadb6adb151]::dep_graph::graph::DepGraph<rustc_middle[48a4de8117124789]::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl[9309ed91bf96ef41]::plumbing::QueryCtxt>
  21:        0x10b2bc144 - <rustc_query_system[91d58cadb6adb151]::dep_graph::graph::DepGraph<rustc_middle[48a4de8117124789]::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl[9309ed91bf96ef41]::plumbing::QueryCtxt>
  22:        0x10b2bc144 - <rustc_query_system[91d58cadb6adb151]::dep_graph::graph::DepGraph<rustc_middle[48a4de8117124789]::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl[9309ed91bf96ef41]::plumbing::QueryCtxt>
  23:        0x10b08c82c - rustc_query_system[91d58cadb6adb151]::query::plumbing::try_load_from_disk_and_cache_in_memory::<rustc_query_impl[9309ed91bf96ef41]::plumbing::QueryCtxt, rustc_middle[48a4de8117124789]::infer::canonical::Canonical<rustc_middle[48a4de8117124789]::ty::ParamEnvAnd<rustc_middle[48a4de8117124789]::ty::Predicate>>, core[e180da0f2c78f25f]::result::Result<rustc_middle[48a4de8117124789]::traits::select::EvaluationResult, rustc_middle[48a4de8117124789]::traits::select::OverflowError>>
  24:        0x10b0f0ab4 - rustc_query_system[91d58cadb6adb151]::query::plumbing::get_query::<rustc_query_impl[9309ed91bf96ef41]::queries::evaluate_obligation, rustc_query_impl[9309ed91bf96ef41]::plumbing::QueryCtxt>
  25:        0x10b158498 - <rustc_query_impl[9309ed91bf96ef41]::Queries as rustc_middle[48a4de8117124789]::ty::query::QueryEngine>::evaluate_obligation
  26:        0x10ba4ca78 - <rustc_infer[85aec4995fa1aeb4]::infer::InferCtxt as rustc_trait_selection[95de940f5ebd95bc]::traits::query::evaluate_obligation::InferCtxtExt>::evaluate_obligation
  27:        0x10ba4cbbc - <rustc_infer[85aec4995fa1aeb4]::infer::InferCtxt as rustc_trait_selection[95de940f5ebd95bc]::traits::query::evaluate_obligation::InferCtxtExt>::evaluate_obligation_no_overflow
  28:        0x10bac1134 - <rustc_trait_selection[95de940f5ebd95bc]::traits::fulfill::FulfillProcessor>::process_trait_obligation
  29:        0x10babcfa4 - <rustc_trait_selection[95de940f5ebd95bc]::traits::fulfill::FulfillProcessor>::progress_changed_obligations
  30:        0x10bad9388 - <rustc_data_structures[6a7bec35f5e261c6]::obligation_forest::ObligationForest<rustc_trait_selection[95de940f5ebd95bc]::traits::fulfill::PendingPredicateObligation>>::process_obligations::<rustc_trait_selection[95de940f5ebd95bc]::traits::fulfill::FulfillProcessor, rustc_data_structures[6a7bec35f5e261c6]::obligation_forest::Outcome<rustc_trait_selection[95de940f5ebd95bc]::traits::fulfill::PendingPredicateObligation, rustc_infer[85aec4995fa1aeb4]::traits::FulfillmentErrorCode>>
  31:        0x10babc8ec - <rustc_trait_selection[95de940f5ebd95bc]::traits::fulfill::FulfillmentContext as rustc_infer[85aec4995fa1aeb4]::traits::engine::TraitEngine>::select_where_possible
  32:        0x10a6d08a0 - <rustc_typeck[761806a90de36c46]::check::fn_ctxt::FnCtxt>::resolve_generator_interiors
  33:        0x10a7d307c - <rustc_infer[85aec4995fa1aeb4]::infer::InferCtxtBuilder>::enter::<&rustc_middle[48a4de8117124789]::ty::context::TypeckResults, <rustc_typeck[761806a90de36c46]::check::inherited::InheritedBuilder>::enter<rustc_typeck[761806a90de36c46]::check::typeck_with_fallback<rustc_typeck[761806a90de36c46]::check::typeck::{closure#0}>::{closure#1}, &rustc_middle[48a4de8117124789]::ty::context::TypeckResults>::{closure#0}>
  34:        0x10a789188 - rustc_typeck[761806a90de36c46]::check::typeck
  35:        0x10b25a320 - <rustc_query_system[91d58cadb6adb151]::dep_graph::graph::DepGraph<rustc_middle[48a4de8117124789]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[48a4de8117124789]::ty::context::TyCtxt, rustc_span[dd8cd730fd24a84e]::def_id::LocalDefId, &rustc_middle[48a4de8117124789]::ty::context::TypeckResults>
  36:        0x10b3ad8a0 - rustc_data_structures[6a7bec35f5e261c6]::stack::ensure_sufficient_stack::<(&rustc_middle[48a4de8117124789]::ty::context::TypeckResults, rustc_query_system[91d58cadb6adb151]::dep_graph::graph::DepNodeIndex), rustc_query_system[91d58cadb6adb151]::query::plumbing::execute_job<rustc_query_impl[9309ed91bf96ef41]::plumbing::QueryCtxt, rustc_span[dd8cd730fd24a84e]::def_id::LocalDefId, &rustc_middle[48a4de8117124789]::ty::context::TypeckResults>::{closure#3}>
  37:        0x10b04e6bc - rustc_query_system[91d58cadb6adb151]::query::plumbing::try_execute_query::<rustc_query_impl[9309ed91bf96ef41]::plumbing::QueryCtxt, rustc_query_system[91d58cadb6adb151]::query::caches::DefaultCache<rustc_span[dd8cd730fd24a84e]::def_id::LocalDefId, &rustc_middle[48a4de8117124789]::ty::context::TypeckResults>>
  38:        0x10b13e648 - rustc_query_system[91d58cadb6adb151]::query::plumbing::force_query::<rustc_query_impl[9309ed91bf96ef41]::queries::typeck, rustc_query_impl[9309ed91bf96ef41]::plumbing::QueryCtxt>
  39:        0x10b1a3564 - rustc_query_impl[9309ed91bf96ef41]::query_callbacks::typeck::force_from_dep_node
  40:        0x10bcb6538 - <rustc_middle[48a4de8117124789]::ty::context::TyCtxt as rustc_query_system[91d58cadb6adb151]::dep_graph::DepContext>::try_force_from_dep_node
  41:        0x10b2bc174 - <rustc_query_system[91d58cadb6adb151]::dep_graph::graph::DepGraph<rustc_middle[48a4de8117124789]::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl[9309ed91bf96ef41]::plumbing::QueryCtxt>
  42:        0x10b0d3288 - rustc_query_system[91d58cadb6adb151]::query::plumbing::ensure_must_run::<rustc_query_impl[9309ed91bf96ef41]::plumbing::QueryCtxt, rustc_span[dd8cd730fd24a84e]::def_id::LocalDefId, rustc_span[dd8cd730fd24a84e]::def_id::LocalDefId>
  43:        0x10b11c8c8 - rustc_query_system[91d58cadb6adb151]::query::plumbing::get_query::<rustc_query_impl[9309ed91bf96ef41]::queries::typeck, rustc_query_impl[9309ed91bf96ef41]::plumbing::QueryCtxt>
  44:        0x10a81cc58 - <rustc_middle[48a4de8117124789]::hir::map::Map>::par_body_owners::<rustc_typeck[761806a90de36c46]::check::typeck_item_bodies::{closure#0}>
  45:        0x10a78ccf4 - rustc_typeck[761806a90de36c46]::check::typeck_item_bodies
  46:        0x10b28cfec - <rustc_query_system[91d58cadb6adb151]::dep_graph::graph::DepGraph<rustc_middle[48a4de8117124789]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[48a4de8117124789]::ty::context::TyCtxt, (), ()>
  47:        0x10b3b2224 - rustc_data_structures[6a7bec35f5e261c6]::stack::ensure_sufficient_stack::<((), rustc_query_system[91d58cadb6adb151]::dep_graph::graph::DepNodeIndex), rustc_query_system[91d58cadb6adb151]::query::plumbing::execute_job<rustc_query_impl[9309ed91bf96ef41]::plumbing::QueryCtxt, (), ()>::{closure#3}>
  48:        0x10b086520 - rustc_query_system[91d58cadb6adb151]::query::plumbing::try_execute_query::<rustc_query_impl[9309ed91bf96ef41]::plumbing::QueryCtxt, rustc_query_system[91d58cadb6adb151]::query::caches::DefaultCache<(), ()>>
  49:        0x10b0f0004 - rustc_query_system[91d58cadb6adb151]::query::plumbing::get_query::<rustc_query_impl[9309ed91bf96ef41]::queries::typeck_item_bodies, rustc_query_impl[9309ed91bf96ef41]::plumbing::QueryCtxt>
  50:        0x10a79d514 - <rustc_session[d383daeae0c11292]::session::Session>::time::<(), rustc_typeck[761806a90de36c46]::check_crate::{closure#7}>
  51:        0x10a77e7e0 - rustc_typeck[761806a90de36c46]::check_crate
  52:        0x1083a2010 - rustc_interface[2280aded15839b11]::passes::analysis
  53:        0x10b283df0 - <rustc_query_system[91d58cadb6adb151]::dep_graph::graph::DepGraph<rustc_middle[48a4de8117124789]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[48a4de8117124789]::ty::context::TyCtxt, (), core[e180da0f2c78f25f]::result::Result<(), rustc_errors[677d6d214e1093d1]::ErrorReported>>
  54:        0x10b3a4a34 - rustc_data_structures[6a7bec35f5e261c6]::stack::ensure_sufficient_stack::<(core[e180da0f2c78f25f]::result::Result<(), rustc_errors[677d6d214e1093d1]::ErrorReported>, rustc_query_system[91d58cadb6adb151]::dep_graph::graph::DepNodeIndex), rustc_query_system[91d58cadb6adb151]::query::plumbing::execute_job<rustc_query_impl[9309ed91bf96ef41]::plumbing::QueryCtxt, (), core[e180da0f2c78f25f]::result::Result<(), rustc_errors[677d6d214e1093d1]::ErrorReported>>::{closure#3}>
  55:        0x10b07d464 - rustc_query_system[91d58cadb6adb151]::query::plumbing::try_execute_query::<rustc_query_impl[9309ed91bf96ef41]::plumbing::QueryCtxt, rustc_query_system[91d58cadb6adb151]::query::caches::DefaultCache<(), core[e180da0f2c78f25f]::result::Result<(), rustc_errors[677d6d214e1093d1]::ErrorReported>>>
  56:        0x10b11cdc4 - rustc_query_system[91d58cadb6adb151]::query::plumbing::get_query::<rustc_query_impl[9309ed91bf96ef41]::queries::analysis, rustc_query_impl[9309ed91bf96ef41]::plumbing::QueryCtxt>
  57:        0x1082afd38 - <rustc_interface[2280aded15839b11]::passes::QueryContext>::enter::<rustc_driver[3e35567b0507961a]::run_compiler::{closure#1}::{closure#2}::{closure#3}, core[e180da0f2c78f25f]::result::Result<(), rustc_errors[677d6d214e1093d1]::ErrorReported>>
  58:        0x10826344c - rustc_interface[2280aded15839b11]::interface::create_compiler_and_run::<core[e180da0f2c78f25f]::result::Result<(), rustc_errors[677d6d214e1093d1]::ErrorReported>, rustc_driver[3e35567b0507961a]::run_compiler::{closure#1}>
  59:        0x10824acb0 - std[8541ff70ccfedbb0]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[2280aded15839b11]::util::run_in_thread_pool_with_globals<rustc_interface[2280aded15839b11]::interface::run_compiler<core[e180da0f2c78f25f]::result::Result<(), rustc_errors[677d6d214e1093d1]::ErrorReported>, rustc_driver[3e35567b0507961a]::run_compiler::{closure#1}>::{closure#0}, core[e180da0f2c78f25f]::result::Result<(), rustc_errors[677d6d214e1093d1]::ErrorReported>>::{closure#0}, core[e180da0f2c78f25f]::result::Result<(), rustc_errors[677d6d214e1093d1]::ErrorReported>>
  60:        0x1082c4648 - <<std[8541ff70ccfedbb0]::thread::Builder>::spawn_unchecked_<rustc_interface[2280aded15839b11]::util::run_in_thread_pool_with_globals<rustc_interface[2280aded15839b11]::interface::run_compiler<core[e180da0f2c78f25f]::result::Result<(), rustc_errors[677d6d214e1093d1]::ErrorReported>, rustc_driver[3e35567b0507961a]::run_compiler::{closure#1}>::{closure#0}, core[e180da0f2c78f25f]::result::Result<(), rustc_errors[677d6d214e1093d1]::ErrorReported>>::{closure#0}, core[e180da0f2c78f25f]::result::Result<(), rustc_errors[677d6d214e1093d1]::ErrorReported>>::{closure#1} as core[e180da0f2c78f25f]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  61:        0x100ef2b70 - std::sys::unix::thread::Thread::new::thread_start::h8ccdabc567c5eee0
  62:        0x190e1d4ec - _pthread_from_mach_thread_np

error: internal compiler error: unexpected panic

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.60.0 (7737e0b5c 2022-04-04) running on aarch64-apple-darwin

note: compiler flags: --crate-type lib -C embed-bitcode=no -C split-debuginfo=unpacked -C debuginfo=2 -C incremental

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

query stack during panic:
#0 [evaluate_obligation] evaluating trait selection obligation `parse::gml::statements::r#return::Return: core::marker::Send`
#1 [typeck] type-checking `core::driver::start_parse`
#2 [typeck_item_bodies] type-checking all item bodies
#3 [analysis] running analysis passes on this crate
end of query stack
warning: `duck` (lib) generated 1 warning
error: could not compile `duck`; 1 warning emitted

Metadata

Metadata

Assignees

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