est31 / cargo-udeps

Find unused dependencies in Cargo.toml
Other
1.76k stars 46 forks source link

Sometimes compiler panics! #110

Closed omid closed 2 years ago

omid commented 2 years ago

Sometimes I face this long error message:

thread 'rustc' panicked at 'failed to lookup `SourceFile` in new context', compiler/rustc_query_impl/src/on_disk_cache.rs:500:22
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

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.59.0-nightly (83b15bfe1 2021-12-28) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z binary-dep-depinfo -Z save-analysis -C embed-bitcode=no -C debug-assertions=off -C overflow-checks=on -C incremental

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

query stack during panic:
#0 [typeck] type-checking `some::where::something`
#1 [analysis] running analysis passes on this crate
end of query stack
est31 commented 2 years ago

Thanks! Can you provide a setting where, from a non-existant target directory, one can reproduce the issue?

omid commented 2 years ago

Hell @est31, I don't know how to debug it. I don't know how I can have a non-existent target directory. Should I run it with RUST_BACKTRACE=1?

est31 commented 2 years ago

Non existent target directory means that you delete it before you run it, so that others can reproduce the issue (incremental bugs depend on the target directory for example).

omid commented 2 years ago

yep, no errors after removing the target.

omid commented 2 years ago

Sorry, I don't know how udeps works. Does this test mean it's not a udeps issue?

est31 commented 2 years ago

It is likely a bug in the rust compiler when invoking the save-analysis backend. Maybe it's even a dupe of https://github.com/rust-lang/rust/issues/92355 . As it doesn't seem like a bug in udeps, I'm closing this issue.