Closed imlazyeye closed 2 years ago
Some additional testing: the issue does occur on nightly (rustc 1.62.0-nightly
), but does not occur on rustc 1.59.0
.
In this zulip thread, I've bisected this to nightly-2021-09-19
( 9dd4ce80fb01d1ff5cb5002f08b7b3847b59e664...aa8f2d432b23575929a48f87b8746f41ba723318) which is 1.57.
The reason it does not occur on stable 1.59 is that incremental compilation was disabled for that release. It'll still ICE with RUSTC_FORCE_INCREMENTAL=1 cargo check
(but back then the ICE had a different message).
I've been having some difficulty minimizing this ICE (though I've been able to reproduce it locally). I'd appreciate it someone would be able to take a shot a minimizing this.
@Aaron1011
pub struct Stmt {
pub stmt_type: StmtKind,
pub stmt_tag: Option<LintTag>,
}
pub struct LintTag;
pub enum StmtKind {
If(If),
Block(&'static str),
Return(Return),
}
pub struct If {
pub condition: Function,
}
pub struct Return {
pub value: Function,
}
pub struct Function {
pub parameters: Box<Stmt>,
}
pub fn start_late_pass(stmt_receiver: Box<Stmt>) {
spawn(async { stmt_receiver });
}
pub fn spawn<T>(_: T)
where
T: Send,
{
}
Steps: cargo check
, then rename the stmt_tag
field, now cargo check
will ICE.
In the project linked below, changing a specific field to have a different name will ice the compiler.
cargo check
passes, butcargo 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: Insrc/parse/gml/stmt.rs
, the fieldtag
onStmt
.Meta
rustc --version --verbose
:Error output
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 -::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 - as rustc_middle[48a4de8117124789]::dep_graph::dep_node::DepNodeExt>::extract_def_id::{closure#0}
12: 0x10bccd070 - ::def_path_hash_to_def_id
13: 0x10bd2bad0 - 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 - ::try_force_from_dep_node
16: 0x10b2bc174 - >::try_mark_previous_green::
17: 0x10b2bc144 - >::try_mark_previous_green::
18: 0x10b2bc144 - >::try_mark_previous_green::
19: 0x10b2bc144 - >::try_mark_previous_green::
20: 0x10b2bc144 - >::try_mark_previous_green::
21: 0x10b2bc144 - >::try_mark_previous_green::
22: 0x10b2bc144 - >::try_mark_previous_green::
23: 0x10b08c82c - rustc_query_system[91d58cadb6adb151]::query::plumbing::try_load_from_disk_and_cache_in_memory::>, core[e180da0f2c78f25f]::result::Result>
24: 0x10b0f0ab4 - rustc_query_system[91d58cadb6adb151]::query::plumbing::get_query::
25: 0x10b158498 - ::evaluate_obligation
26: 0x10ba4ca78 - ::evaluate_obligation
27: 0x10ba4cbbc - ::evaluate_obligation_no_overflow
28: 0x10bac1134 - ::process_trait_obligation
29: 0x10babcfa4 - ::progress_changed_obligations
30: 0x10bad9388 - >::process_obligations::>
31: 0x10babc8ec - ::select_where_possible
32: 0x10a6d08a0 - ::resolve_generator_interiors
33: 0x10a7d307c - ::enter::<&rustc_middle[48a4de8117124789]::ty::context::TypeckResults, ::enter::{closure#1}, &rustc_middle[48a4de8117124789]::ty::context::TypeckResults>::{closure#0}>
34: 0x10a789188 - rustc_typeck[761806a90de36c46]::check::typeck
35: 0x10b25a320 - >::with_task::
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::{closure#3}>
37: 0x10b04e6bc - rustc_query_system[91d58cadb6adb151]::query::plumbing::try_execute_query::>
38: 0x10b13e648 - rustc_query_system[91d58cadb6adb151]::query::plumbing::force_query::
39: 0x10b1a3564 - rustc_query_impl[9309ed91bf96ef41]::query_callbacks::typeck::force_from_dep_node
40: 0x10bcb6538 - ::try_force_from_dep_node
41: 0x10b2bc174 - >::try_mark_previous_green::
42: 0x10b0d3288 - rustc_query_system[91d58cadb6adb151]::query::plumbing::ensure_must_run::
43: 0x10b11c8c8 - rustc_query_system[91d58cadb6adb151]::query::plumbing::get_query::
44: 0x10a81cc58 - ::par_body_owners::
45: 0x10a78ccf4 - rustc_typeck[761806a90de36c46]::check::typeck_item_bodies
46: 0x10b28cfec - >::with_task::
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::{closure#3}>
48: 0x10b086520 - rustc_query_system[91d58cadb6adb151]::query::plumbing::try_execute_query::>
49: 0x10b0f0004 - rustc_query_system[91d58cadb6adb151]::query::plumbing::get_query::
50: 0x10a79d514 - ::time::<(), rustc_typeck[761806a90de36c46]::check_crate::{closure#7}>
51: 0x10a77e7e0 - rustc_typeck[761806a90de36c46]::check_crate
52: 0x1083a2010 - rustc_interface[2280aded15839b11]::passes::analysis
53: 0x10b283df0 - >::with_task::>
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>::{closure#3}>
55: 0x10b07d464 - rustc_query_system[91d58cadb6adb151]::query::plumbing::try_execute_query::>>
56: 0x10b11cdc4 - rustc_query_system[91d58cadb6adb151]::query::plumbing::get_query::
57: 0x1082afd38 - ::enter::>
58: 0x10826344c - rustc_interface[2280aded15839b11]::interface::create_compiler_and_run::, rustc_driver[3e35567b0507961a]::run_compiler::{closure#1}>
59: 0x10824acb0 - std[8541ff70ccfedbb0]::sys_common::backtrace::__rust_begin_short_backtrace::, 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 - <::spawn_unchecked_, 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
```