Closed as not planned
Description
It's very hard to precisely summarize the keywords, feel sorry if I missed a duplicated case when checking previous issues.
Code
In lib.rs
pub struct Foo<F> {
pub f: F,
}
// these also works: private `f` field, `pub Foo<F>(F);`
impl<F> Foo<F> {
pub async fn foo() {}
}
In main.rs
use foo::Foo; // package named `foo`
fn main() {
Foo(());
}
Run cargo check
or cargo build
, it looks like compiler allocate memory in infinite loop/recursion and eventually get killed.
Either the following does not trigger...:
- Replace
use foo::Foo
withmod foo { /* lib.rs content */ }
- Replace
Foo(())
withFoo { f: () }
with a privatef
field - All other variants that passes compilation. (the two cases above reports correct error)
...and after do either of them once, revert the code, rerun
error[E0391]: cycle detected when getting the resolver for lowering
|
= note: ...which requires normalizing `foo::Foo<F>::foo::{opaque#0}`...
= note: ...which requires looking up limits...
= note: ...which requires getting the crate HIR...
= note: ...which again requires getting the resolver for lowering, completing the cycle
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
For more information about this error, try `rustc --explain E0391`.
cargo clean
and rerun, the issue is back.
Meta
rustc --version --verbose
:
rustc 1.76.0 (07dca489a 2024-02-04)
binary: rustc
commit-hash: 07dca489ac2d933c78d3c5158e3f43beefeb02ce
commit-date: 2024-02-04
host: x86_64-unknown-linux-gnu
release: 1.76.0
LLVM version: 17.0.6