Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rust analyzer reports cyclic dependencies in Bevy #10256

Closed
torsteingrindvik opened this issue Oct 25, 2023 · 1 comment · Fixed by #11523
Closed

Rust analyzer reports cyclic dependencies in Bevy #10256

torsteingrindvik opened this issue Oct 25, 2023 · 1 comment · Fixed by #11523
Labels
A-Meta About the project itself C-Bug An unexpected or incorrect behavior S-Needs-Investigation This issue requires detective work to figure out what's going wrong

Comments

@torsteingrindvik
Copy link
Contributor

Bevy version

Hash: 4d286d0
(main on Oct 20th)

What you did

  • Open vscode
  • go to the Rust Analyzer Language Server tab in the terminal
  • Press the clear output button
  • Run rust-analyzer: Restart server from the ctrl+shift+P command dropdown

The following is produced:

image

What went wrong

What I was expecting

No issues in server logs.

What actually happened

The image above, with reported cyclic deps.

Additional information

Formatted for readability:

[ERROR project_model::workspace] cyclic deps:
                        bevy_internal(Idx::<CrateData>(255)) -> bevy_gilrs(Idx::<CrateData>(250))
    alternative path:   bevy_gilrs(Idx::<CrateData>(250)) -> bevy_input(Idx::<CrateData>(254)) -> bevy(Idx::<CrateData>(41)) -> bevy_internal(Idx::<CrateData>(255))

[ERROR project_model::workspace] cyclic deps:
                        bevy_internal(Idx::<CrateData>(255)) -> bevy_input(Idx::<CrateData>(254))
    alternative path:   bevy_input(Idx::<CrateData>(254)) -> bevy(Idx::<CrateData>(41)) -> bevy_internal(Idx::<CrateData>(255))

[ERROR project_model::workspace] cyclic deps:
                        bevy_ui(Idx::<CrateData>(278)) -> bevy_input(Idx::<CrateData>(254))
    alternative path:   bevy_input(Idx::<CrateData>(254)) -> bevy(Idx::<CrateData>(41)) -> bevy_internal(Idx::<CrateData>(255)) -> bevy_ui(Idx::<CrateData>(278))

[ERROR project_model::workspace] cyclic deps:
                        bevy_window(Idx::<CrateData>(281)) -> bevy_input(Idx::<CrateData>(254))
    alternative path:   bevy_input(Idx::<CrateData>(254)) -> bevy(Idx::<CrateData>(41)) -> bevy_internal(Idx::<CrateData>(255)) -> bevy_animation(Idx::<CrateData>(233)) -> bevy_render(Idx::<CrateData>(268)) -> bevy_window(Idx::<CrateData>(281))

[ERROR project_model::workspace] cyclic deps:
                        bevy_winit(Idx::<CrateData>(282)) -> bevy_input(Idx::<CrateData>(254))
    alternative path:   bevy_input(Idx::<CrateData>(254)) -> bevy(Idx::<CrateData>(41)) -> bevy_internal(Idx::<CrateData>(255)) -> bevy_winit(Idx::<CrateData>(282))

[ERROR project_model::workspace] cyclic deps:
                        bevy_internal(Idx::<CrateData>(255)) -> bevy_gilrs(Idx::<CrateData>(250))
    alternative path:   bevy_gilrs(Idx::<CrateData>(250)) -> bevy_input(Idx::<CrateData>(254)) -> bevy(Idx::<CrateData>(41)) -> bevy_internal(Idx::<CrateData>(255))

[ERROR project_model::workspace] cyclic deps:
                        bevy_internal(Idx::<CrateData>(255)) -> bevy_input(Idx::<CrateData>(254))
    alternative path:   bevy_input(Idx::<CrateData>(254)) -> bevy(Idx::<CrateData>(41)) -> bevy_internal(Idx::<CrateData>(255))

[ERROR project_model::workspace] cyclic deps:
                        bevy_ui(Idx::<CrateData>(278)) -> bevy_input(Idx::<CrateData>(254))
    alternative path:   bevy_input(Idx::<CrateData>(254)) -> bevy(Idx::<CrateData>(41)) -> bevy_internal(Idx::<CrateData>(255)) -> bevy_ui(Idx::<CrateData>(278))

[ERROR project_model::workspace] cyclic deps:
                        bevy_window(Idx::<CrateData>(281)) -> bevy_input(Idx::<CrateData>(254))
    alternative path:   bevy_input(Idx::<CrateData>(254)) -> bevy(Idx::<CrateData>(41)) -> bevy_internal(Idx::<CrateData>(255)) -> bevy_animation(Idx::<CrateData>(233)) -> bevy_render(Idx::<CrateData>(268)) -> bevy_window(Idx::<CrateData>(281))

[ERROR project_model::workspace] cyclic deps:
                        bevy_winit(Idx::<CrateData>(282)) -> bevy_input(Idx::<CrateData>(254))
    alternative path:   bevy_input(Idx::<CrateData>(254)) -> bevy(Idx::<CrateData>(41)) -> bevy_internal(Idx::<CrateData>(255)) -> bevy_winit(Idx::<CrateData>(282))

As a final note, I'm not sure this is a problem in Bevy or a false positive in rust analyzer.

@torsteingrindvik torsteingrindvik added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Oct 25, 2023
@alice-i-cecile alice-i-cecile added A-Meta About the project itself S-Needs-Investigation This issue requires detective work to figure out what's going wrong and removed S-Needs-Triage This issue needs to be labelled labels Oct 26, 2023
@SecretPocketCat
Copy link
Contributor

I think it might be rust-lang/rust-analyzer#14167 .

github-merge-queue bot pushed a commit that referenced this issue Jan 25, 2024
# Objective

Rust analyzer kept complaining about a cyclic dependency due to
`bevy_input` having a dev-dependency on `bevy`.

`bevy_input` was also missing `bevy_reflect`'s "smol_str" feature which
it needs to compile on its own.

Fixes #10256

## Solution

Remove the dev-dependency on `bevy` from `bevy_input` since it was only
used to reduce imports for 1 test and 3 doc examples by 1 line each, as
`bevy_input` already has dependencies on everything needed for those
tests and doctests to work.

Add `bevy_reflect`'s "smol_str" feature to `bevy_input`'s dependency
list as it needs it to actually compile.
tjamaan pushed a commit to tjamaan/bevy that referenced this issue Feb 6, 2024
# Objective

Rust analyzer kept complaining about a cyclic dependency due to
`bevy_input` having a dev-dependency on `bevy`.

`bevy_input` was also missing `bevy_reflect`'s "smol_str" feature which
it needs to compile on its own.

Fixes bevyengine#10256

## Solution

Remove the dev-dependency on `bevy` from `bevy_input` since it was only
used to reduce imports for 1 test and 3 doc examples by 1 line each, as
`bevy_input` already has dependencies on everything needed for those
tests and doctests to work.

Add `bevy_reflect`'s "smol_str" feature to `bevy_input`'s dependency
list as it needs it to actually compile.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Meta About the project itself C-Bug An unexpected or incorrect behavior S-Needs-Investigation This issue requires detective work to figure out what's going wrong
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants