rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
98.56k stars 12.74k forks source link

Well-formedness analysis pass on trait impl paniced #126997

Closed Dampfwalze closed 4 months ago

Dampfwalze commented 4 months ago

This happend out off the blue. After I did cargo clean, everything was fine again. This is probably because of a cache corruption then. But I am happy if this helps you guys anyways!

Code

Since this happend on a pretty big project of mine and I can't reproduce it, I sadly can't share a working reproduction example. But essentially, at the point of interrest, I am implementing a trait, which looks like this:

pub trait NodeTask: Send + Sync + 'static {
    type InputId: From<InputId> + Into<InputId>;
    type PipelineNode: PipelineNode;

    fn sync_node(&mut self, _node: &Self::PipelineNode) {}

    fn connect(&mut self, input_id: Self::InputId, input: &mut ConnectionHandle);

    fn disconnect(&mut self, input_id: Self::InputId);

    fn invalidate(&mut self) {}

    fn run(&mut self) -> impl Future<Output = ()> + Send;
}

On a struct similar to this:

struct Task {
    m_scan_out: TaskOutput<requests::Scan>,
    offset_in: TaskInput<requests::VectorData>,
}
// Every field is Send + Sync

Meta

rustc --version --verbose:

rustc 1.78.0 (9b00956e5 2024-04-29)
binary: rustc
commit-hash: 9b00956e56009bab2aa15d7bff10916599e3d6d6
commit-date: 2024-04-29
host: x86_64-pc-windows-msvc
release: 1.78.0
LLVM version: 18.1.2

Error output

Backtrace

``` thread 'rustc' panicked at compiler\rustc_middle\src\dep_graph\dep_node.rs:198:17: Failed to extract DefId: def_kind dd40d9ca4515edd3-4751067c9257c2f7 stack backtrace: 0: 0x7ffb343733ca - std::backtrace_rs::backtrace::dbghelp64::trace at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library\std\src\..\..\backtrace\src\backtrace\dbghelp64.rs:99 1: 0x7ffb343733ca - std::backtrace_rs::backtrace::trace_unsynchronized at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library\std\src\..\..\backtrace\src\backtrace\mod.rs:66 2: 0x7ffb343733ca - std::sys_common::backtrace::_print_fmt at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library\std\src\sys_common\backtrace.rs:68 3: 0x7ffb343733ca - std::sys_common::backtrace::_print::impl$0::fmt at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library\std\src\sys_common\backtrace.rs:44 4: 0x7ffb343a634b - core::fmt::rt::Argument::fmt at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library\core\src\fmt\rt.rs:142 5: 0x7ffb343a634b - core::fmt::write at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library\core\src\fmt\mod.rs:1153 6: 0x7ffb34369ac1 - std::io::Write::write_fmt at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library\std\src\io\mod.rs:1843 7: 0x7ffb343731b6 - std::sys_common::backtrace::print at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library\std\src\sys_common\backtrace.rs:34 8: 0x7ffb3437661f - std::panicking::default_hook::closure$1 at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library\std\src\panicking.rs:272 9: 0x7ffb343762b7 - std::panicking::default_hook at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library\std\src\panicking.rs:292 10: 0x7ffafdb9a021 - __longjmp_internal 11: 0x7ffb34376c4c - alloc::boxed::impl$49::call at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library\alloc\src\boxed.rs:2034 12: 0x7ffb34376c4c - std::panicking::rust_panic_with_hook at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library\std\src\panicking.rs:783 13: 0x7ffb34376ad9 - std::panicking::begin_panic_handler::closure$0 at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library\std\src\panicking.rs:657 14: 0x7ffb34373cd9 - std::sys_common::backtrace::__rust_end_short_backtrace at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library\std\src\sys_common\backtrace.rs:171 15: 0x7ffb34376796 - std::panicking::begin_panic_handler at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library\std\src\panicking.rs:645 16: 0x7ffb343ccec7 - core::panicking::panic_fmt at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library\core\src\panicking.rs:72 17: 0x7ffafed409a1 - ::encode_def_index 18: 0x7ffafdadef5b - ::extract_def_id 19: 0x7ffafe5e181a - ::fmt 20: 0x7ffafd3bd05a - ::terminator_effect 21: 0x7ffafd3bcfcd - ::terminator_effect 22: 0x7ffafd3bcfcd - ::terminator_effect 23: 0x7ffafd3bcfcd - ::terminator_effect 24: 0x7ffafd3bcfcd - ::terminator_effect 25: 0x7ffafd3bcfcd - ::terminator_effect 26: 0x7ffafd3eec35 - ::terminator_effect 27: 0x7ffafd4d9972 - rustc_query_impl[35a1e4ec0f2bf1cb]::plumbing::query_key_hash_verify_all 28: 0x7ffafd5cb22b - ::process_obligation 29: 0x7ffafd53253c - ::check_fn 30: 0x7ffafd56a79e - ::select_all_or_error 31: 0x7ffafdf08b26 - rustc_hir_analysis[9c8c83e03407cb17]::check::compare_impl_item::collect_return_position_impl_trait_in_trait_tys 32: 0x7ffafe61d4ab - ::depth_limit_error 33: 0x7ffafd3dfafd - ::terminator_effect 34: 0x7ffafc53c097 - ::find_discr 35: 0x7ffafe5e15cf - ::fmt 36: 0x7ffafd3bd05a - ::terminator_effect 37: 0x7ffafd3e023b - ::terminator_effect 38: 0x7ffafd4ca1d6 - rustc_query_impl[35a1e4ec0f2bf1cb]::plumbing::query_key_hash_verify_all 39: 0x7ffafde7ea36 - ::method_exists 40: 0x7ffafcb1087d - rustc_hir_analysis[9c8c83e03407cb17]::check::wfcheck::check_well_formed 41: 0x7ffafd4c80aa - rustc_query_impl[35a1e4ec0f2bf1cb]::plumbing::query_key_hash_verify_all 42: 0x7ffafd4240ff - ::terminator_effect 43: 0x7ffafc5127f6 - ::find_discr 44: 0x7ffafd3bd05a - ::terminator_effect 45: 0x7ffafd3bcd2b - ::terminator_effect 46: 0x7ffafc4ae9ea - ::find_discr 47: 0x7ffafc551d5b - rustc_query_impl[35a1e4ec0f2bf1cb]::query_system 48: 0x7ffafcb62c57 - rustc_hir_analysis[9c8c83e03407cb17]::check_crate 49: 0x7ffafc8ce0eb - ::pre_expansion_lint 50: 0x7ffafc53f2ca - ::find_discr 51: 0x7ffafc4b5692 - ::find_discr 52: 0x7ffafc547bf3 - rustc_query_impl[35a1e4ec0f2bf1cb]::query_system 53: 0x7ffaf9944256 - _Nan_C 54: 0x7ffaf9941777 - _Nan_C 55: 0x7ffaf99492b0 - _Nan_C 56: 0x7ffb34387d3c - std::sys::pal::windows::thread::impl$0::new::thread_start at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library\std\src\sys\pal\windows\thread.rs:54 57: 0x7ffbebb4257d - BaseThreadInitThunk 58: 0x7ffbedb6af28 - RtlUserThreadStart error: 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.78.0 (9b00956e5 2024-04-29) running on x86_64-pc-windows-msvc note: compiler flags: --crate-type bin -C embed-bitcode=no -C debuginfo=2 -C incremental=[REDACTED] note: some of the compiler flags provided by cargo are hidden query stack during panic: #0 [evaluate_obligation] evaluating trait selection obligation `pipeline::nodes::process_raw_m_scan::Task: core::marker::Send` #1 [collect_return_position_impl_trait_in_trait_tys] comparing an impl and trait method signature, inferring any hidden `impl Trait` types in the process #2 [type_of] computing type of `pipeline::nodes::process_raw_m_scan::::{synthetic#0}` #3 [check_well_formed] checking that `pipeline::nodes::process_raw_m_scan::` is well-formed #4 [analysis] running analysis passes on this crate end of query stack there was a panic while trying to force a dep node try_mark_green dep node stack: #0 type_of(thread 'rustc' panicked at compiler\rustc_middle\src\dep_graph\dep_node.rs:198:17: Failed to extract DefId: type_of dd40d9ca4515edd3-4751067c9257c2f7 stack backtrace: 0: 0x7ffb343733ca - std::backtrace_rs::backtrace::dbghelp64::trace at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library\std\src\..\..\backtrace\src\backtrace\dbghelp64.rs:99 1: 0x7ffb343733ca - std::backtrace_rs::backtrace::trace_unsynchronized at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library\std\src\..\..\backtrace\src\backtrace\mod.rs:66 2: 0x7ffb343733ca - std::sys_common::backtrace::_print_fmt at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library\std\src\sys_common\backtrace.rs:68 3: 0x7ffb343733ca - std::sys_common::backtrace::_print::impl$0::fmt at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library\std\src\sys_common\backtrace.rs:44 4: 0x7ffb343a634b - core::fmt::rt::Argument::fmt at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library\core\src\fmt\rt.rs:142 5: 0x7ffb343a634b - core::fmt::write at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library\core\src\fmt\mod.rs:1153 6: 0x7ffb34369ac1 - std::io::Write::write_fmt at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library\std\src\io\mod.rs:1843 7: 0x7ffb343731b6 - std::sys_common::backtrace::print at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library\std\src\sys_common\backtrace.rs:34 8: 0x7ffb3437661f - std::panicking::default_hook::closure$1 at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library\std\src\panicking.rs:272 9: 0x7ffb343762b7 - std::panicking::default_hook at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library\std\src\panicking.rs:292 10: 0x7ffafdb9a021 - __longjmp_internal 11: 0x7ffb34376c4c - alloc::boxed::impl$49::call at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library\alloc\src\boxed.rs:2034 12: 0x7ffb34376c4c - std::panicking::rust_panic_with_hook at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library\std\src\panicking.rs:783 13: 0x7ffb34376ad9 - std::panicking::begin_panic_handler::closure$0 at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library\std\src\panicking.rs:657 14: 0x7ffb34373cd9 - std::sys_common::backtrace::__rust_end_short_backtrace at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library\std\src\sys_common\backtrace.rs:171 15: 0x7ffb34376796 - std::panicking::begin_panic_handler at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library\std\src\panicking.rs:645 16: 0x7ffb343ccec7 - core::panicking::panic_fmt at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library\core\src\panicking.rs:72 17: 0x7ffafed409a1 - ::encode_def_index 18: 0x7ffafdadef5b - ::extract_def_id 19: 0x7ffafdcd6f85 - rustc_interface[c379e6340dfc8ff4]::callbacks::dep_node_debug 20: 0x7ffafed91059 - ::fmt 21: 0x7ffb343a634b - core::fmt::rt::Argument::fmt at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library\core\src\fmt\rt.rs:142 22: 0x7ffb343a634b - core::fmt::write at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library\core\src\fmt\mod.rs:1153 23: 0x7ffb34367939 - std::io::Write::write_fmt at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library\std\src\io\mod.rs:1843 24: 0x7ffb34367939 - std::io::stdio::impl$26::write_fmt at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library\std\src\io\stdio.rs:1008 25: 0x7ffb343682e6 - std::io::stdio::_eprint at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library\std\src\io\stdio.rs:1175 26: 0x7ffafe577268 - ::fmt 27: 0x7ffafd3be0af - ::terminator_effect 28: 0x7ffafd3bcfcd - ::terminator_effect 29: 0x7ffafd3bcfcd - ::terminator_effect 30: 0x7ffafd3bcfcd - ::terminator_effect 31: 0x7ffafd3bcfcd - ::terminator_effect 32: 0x7ffafd3bcfcd - ::terminator_effect 33: 0x7ffafd3eec35 - ::terminator_effect 34: 0x7ffafd4d9972 - rustc_query_impl[35a1e4ec0f2bf1cb]::plumbing::query_key_hash_verify_all 35: 0x7ffafd5cb22b - ::process_obligation 36: 0x7ffafd53253c - ::check_fn 37: 0x7ffafd56a79e - ::select_all_or_error 38: 0x7ffafdf08b26 - rustc_hir_analysis[9c8c83e03407cb17]::check::compare_impl_item::collect_return_position_impl_trait_in_trait_tys 39: 0x7ffafe61d4ab - ::depth_limit_error 40: 0x7ffafd3dfafd - ::terminator_effect 41: 0x7ffafc53c097 - ::find_discr 42: 0x7ffafe5e15cf - ::fmt 43: 0x7ffafd3bd05a - ::terminator_effect 44: 0x7ffafd3e023b - ::terminator_effect 45: 0x7ffafd4ca1d6 - rustc_query_impl[35a1e4ec0f2bf1cb]::plumbing::query_key_hash_verify_all 46: 0x7ffafde7ea36 - ::method_exists 47: 0x7ffafcb1087d - rustc_hir_analysis[9c8c83e03407cb17]::check::wfcheck::check_well_formed 48: 0x7ffafd4c80aa - rustc_query_impl[35a1e4ec0f2bf1cb]::plumbing::query_key_hash_verify_all 49: 0x7ffafd4240ff - ::terminator_effect 50: 0x7ffafc5127f6 - ::find_discr 51: 0x7ffafd3bd05a - ::terminator_effect 52: 0x7ffafd3bcd2b - ::terminator_effect 53: 0x7ffafc4ae9ea - ::find_discr 54: 0x7ffafc551d5b - rustc_query_impl[35a1e4ec0f2bf1cb]::query_system 55: 0x7ffafcb62c57 - rustc_hir_analysis[9c8c83e03407cb17]::check_crate 56: 0x7ffafc8ce0eb - ::pre_expansion_lint 57: 0x7ffafc53f2ca - ::find_discr 58: 0x7ffafc4b5692 - ::find_discr 59: 0x7ffafc547bf3 - rustc_query_impl[35a1e4ec0f2bf1cb]::query_system 60: 0x7ffaf9944256 - _Nan_C 61: 0x7ffaf9941777 - _Nan_C 62: 0x7ffaf99492b0 - _Nan_C 63: 0x7ffb34387d3c - std::sys::pal::windows::thread::impl$0::new::thread_start at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library\std\src\sys\pal\windows\thread.rs:54 64: 0x7ffbebb4257d - BaseThreadInitThunk 65: 0x7ffbedb6af28 - RtlUserThreadStart error: 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.78.0 (9b00956e5 2024-04-29) running on x86_64-pc-windows-msvc note: compiler flags: --crate-type bin -C embed-bitcode=no -C debuginfo=2 -C incremental=[REDACTED] note: some of the compiler flags provided by cargo are hidden query stack during panic: #0 [evaluate_obligation] evaluating trait selection obligation `pipeline::nodes::process_raw_m_scan::Task: core::marker::Send` #1 [collect_return_position_impl_trait_in_trait_tys] comparing an impl and trait method signature, inferring any hidden `impl Trait` types in the process #2 [type_of] computing type of `pipeline::nodes::process_raw_m_scan::::{synthetic#0}` #3 [check_well_formed] checking that `pipeline::nodes::process_raw_m_scan::` is well-formed #4 [analysis] running analysis passes on this crate end of query stack there was a panic while trying to force a dep node try_mark_green dep node stack: #0 type_of(test_gui_rust_2[dd40]::pipeline::nodes::process_raw_m_scan::{impl#1}::{synthetic#0}) end of try_mark_green dep node stack there was a panic while trying to force a dep node try_mark_green dep node stack: #0 check_mod_type_wf(test_gui_rust_2[dd40]::pipeline::nodes::process_raw_m_scan) end of try_mark_green dep node stack error: could not compile `test_gui_rust_2` (bin "test_gui_rust_2") ```

lqd commented 4 months ago

Looks like #125945 which may have been fixed by #126409 already

pacak commented 4 months ago

Failed to extract DefId - this specific panic is no longer possible after https://github.com/rust-lang/rust/pull/126409

Noratrieb commented 4 months ago

in that case, closing.