rust-lang / rust

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

rustc doesn't finish stuck at rustc_trait_selection::traits::normalize::normalize_with_depth_to #132032

Open fabianmurariu opened 12 hours ago

fabianmurariu commented 12 hours ago

After a re factoring, moving some structs into different crates the build won't finish. Raphtory

These finish

cargo check -p raphtory-api
cargo check -p raphtory-memstorage

This doesn't

cargo check -p raphtory

I need some help to track down what causes this? I suspect our use of traits is the cause of this but I don't know how to find out which ones are causing this issue.

I expected to see this happen: cargo would finish compiling

Instead, this happened: cargo doesn't finish compiling

Meta

rustc --version --verbose:

rustc 1.82.0 (f6e511eec 2024-10-15)
binary: rustc
commit-hash: f6e511eec7342f59a25f7c0534f1dbea00d01b14
commit-date: 2024-10-15
host: x86_64-unknown-linux-gnu
release: 1.82.0
LLVM version: 19.1.1
The end of Rustc LOG where depth seems to degenerate

``` rustc_trait_selection::traits::normalize::normalize_with_depth_to depth=0, value=ImplHeader { impl_def_id: DefId(2:2820 ~ core[d898]::ptr::{impl#0}), impl_args: [?0t], self _ty: ?0t, trait_ref: Some(<_ as std::cmp::PartialEq>), predicates: [Binder { value: TraitPredicate(<_ as std::marker::Sized>, polarity:Positive), bound_vars: [] }, Binder { value: TraitPredicate(<_ as std::marker::FnPtr>, polarity:Positive), bound_vars: [] }] } rustc_trait_selection::traits::normalize::normalize_with_depth_to depth=0, value=ImplHeader { impl_def_id: DefId(0:5278 ~ raphtory[29e2]::db::graph::graph::{impl#1}), impl_ args: ['?0, ?1t], self_ty: raphtory_memstorage::db::graph::views::graph::Graph, trait_ref: Some(>), predicates: [Binder { value: TraitPredicate(<_ as std::marker::Sized>, polarity:Positive), bound_vars: [] }, Binder { value: TraitPredicate(<_ as db::api::view::graph:: GraphViewOps<'_>>, polarity:Positive), bound_vars: [] }, Binder { value: OutlivesPredicate(raphtory_memstorage::db::graph::views::graph::Graph, '?0), bound_vars: [] }] } rustc_trait_selection::traits::normalize::normalize_with_depth_to depth=1, value=<_ as db::api::view::graph::GraphViewOps<'_>> rustc_trait_selection::traits::normalize::normalize_with_depth_to depth=1, value=<_ as db::api::view::graph::GraphViewOps<'_>> rustc_trait_selection::traits::normalize::normalize_with_depth_to depth=1, value=Binder { value: TraitPredicate(<_ as std::marker::Sized>, polarity:Positive), bound_vars: [ ] } rustc_trait_selection::traits::normalize::normalize_with_depth_to depth=1, value=Binder { value: TraitPredicate(<_ as db::api::view::internal::BoxableGraphView>, polarity:P ositive), bound_vars: [] } rustc_trait_selection::traits::normalize::normalize_with_depth_to depth=1, value=Binder { value: TraitPredicate(<_ as std::clone::Clone>, polarity:Positive), bound_vars: [] } rustc_trait_selection::traits::normalize::normalize_with_depth_to depth=1, value=Binder { value: OutlivesPredicate(?2t, '?1), bound_vars: [] } rustc_trait_selection::traits::normalize::normalize_with_depth_to depth=1, value=Binder { value: OutlivesPredicate(?2t, '?1), bound_vars: [] } rustc_trait_selection::traits::normalize::normalize_with_depth_to depth=3, value=<_ as db::api::view::internal::BoxableGraphView> rustc_trait_selection::traits::normalize::normalize_with_depth_to depth=3, value=<_ as db::api::view::internal::BoxableGraphView> ... rustc_trait_selection::traits::normalize::normalize_with_depth_to depth=66, value=Binder { value: TraitPredicate(, polarity:Positive), bound_vars: [] } rustc_trait_selection::traits::normalize::normalize_with_depth_to depth=66, value=std::ptr::Unique rustc_trait_selection::traits::normalize::normalize_with_depth_to depth=66, value=alloc::raw_vec::Cap rustc_trait_selection::traits::normalize::normalize_with_depth_to depth=66, value=std::alloc::Global rustc_trait_selection::traits::normalize::normalize_with_depth_to depth=67, value= as std::marker::Sync> rustc_trait_selection::traits::normalize::normalize_with_depth_to depth=67, value= as std::marker::Sync> rustc_trait_selection::traits::normalize::normalize_with_depth_to depth=67, value=Binder { value: TraitPredicate(<_ as std::marker::Sync>, polarity:Positive), bound_vars: [] } rustc_trait_selection::traits::normalize::normalize_with_depth_to depth=68, value=Binder { value: TraitPredicate(, polarity:Positive), bound_vars: [] } rustc_trait_selection::traits::normalize::normalize_with_depth_to depth=67, value=Binder { value: TraitPredicate(, polarity:Positive), bound_vars: [] } rustc_trait_selection::traits::normalize::normalize_with_depth_to depth=67, value=usize rustc_trait_selection::traits::normalize::normalize_with_depth_to depth=68, value=Binder { value: TraitPredicate(, polarity:Positive), bound_vars: [] } rustc_trait_selection::traits::normalize::normalize_with_depth_to depth=67, value=Binder { value: TraitPredicate(, polarity:Positive), bound_vars: [] } rustc_trait_selection::traits::normalize::normalize_with_depth_to depth=66, value=Binder { value: TraitPredicate( as std::marker::Sync>, polarity:Positive), bound_vars: [] } ```

yingmanwumen commented 10 hours ago

Hi, I'm trying to reproduce it and the rustc doesn't stop as described. And I am curious about how the rustc log messages are enabled ^_^ Should I add some environment variables or just pass some arguments to cargo? @fabianmurariu

fmease commented 6 hours ago

Can repro.

fmease commented 6 hours ago

(Potentially fixed by the next-gen solver, though I can't check this without an MCVE as the next-gen solver hangs on rayon atm which is a dependency of Raphtory)

matthiaskrgr commented 5 hours ago

I can't repro on nightly rustc 1.84.0-nightly (439284741 2024-10-21)

I wonder if this was fixed by coherence stabilisation, can't really check myself right now because the servers will only give me 20 kb/s downloading the respective nightlies :/

fabianmurariu commented 5 hours ago

Hi, I'm trying to reproduce it and the rustc doesn't stop as described. And I am curious about how the rustc log messages are enabled ^_^ Should I add some environment variables or just pass some arguments to cargo? @fabianmurariu

I used RUSTC_LOG=debug

yingmanwumen commented 3 hours ago

I suspect our use of traits is the cause of this but I don't know how to find out which ones are causing this issue.

I've read the logs and found that the trait GraphViewOps was suspicious. Or more specifically, the trait BoxableGraphView might cause the dead loop. And the structure TimeIndexEntry in TCell is definitely related. But more details are still unclear for me :-) @fabianmurariu

lqd commented 3 hours ago

I wonder if this was fixed by coherence stabilisation

It looks like this doesn't hang on a0c2aba29aa9ea50a7c45c3391dd446f856bef7b (builds with errors in 4s) but does on its parent f79fae3069c449993eda6b16934da3b144cb8a66 (I didn't check logs to see if it actually hangs, just stopped it after 5 minutes or so).