rust-analyzer icon indicating copy to clipboard operation
rust-analyzer copied to clipboard

Unresolved import only in lib.rs, but not main.rs - circular dev dependency failure

Open jkelleyrtp opened this issue 3 years ago • 4 comments

I'm trying to import a crate from the same workspace and the import fails in the lib.rs file but not the main.rs file. I can't seem to fix the issue, IE cargo clean doesn't fix it, and the issue persists between restarts.

My Cargo.toml:

[package]
name = "dioxus-hooks"
version = "0.0.0"
edition = "2018"

[dependencies]
dioxus-core = { path = "../core"}

And the issues side-by-side

Screen Shot 2021-07-11 at 6 31 22 PM

Any idea on how the bust the cache to get RA working again?

jkelleyrtp avatar Jul 11 '21 22:07 jkelleyrtp

Ah, I use this crate is a dev-dependency in my "core" crate - when I remove this RA is happy again. I guess there's an issue with circular dependencies through dev-dependencies.

jkelleyrtp avatar Jul 11 '21 22:07 jkelleyrtp

You should try to update the rustc to the latest version. I had the same problem before, but after I upgrade the rustc and it fixed.

sbzi1020 avatar Sep 12 '21 22:09 sbzi1020

This still happens for me, on rust version 1.61.0-nightly (10913c000 2022-03-03) and rust-analyzer vscode extension version: 9d473a0b9 2022-03-04 nightly.

Edgeworth avatar Mar 04 '22 10:03 Edgeworth

still happens at rust-analyzer version: 1.65.0-nightly (015a824 2022-08-22)

I guess this affects wide range of projects, wish it be fixed some time.

jiangying000 avatar Sep 14 '22 16:09 jiangying000

Closing in favor of https://github.com/rust-lang/rust-analyzer/issues/14167

Veykril avatar Feb 16 '23 09:02 Veykril