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

Migrate bevy to latest main #178

Merged
merged 3 commits into from
Feb 11, 2025
Merged

Conversation

villor
Copy link
Contributor

@villor villor commented Feb 10, 2025

  • Re-pin bevy to 232824c009c38ee26ad308f054bc12888f0020e9 d6725d3b1baa6a730fa6bfab1bb8f2a9e5f4716e
  • Update thiserror to 2.0
  • Migrate Entity-derefs
  • Migrate to weak_handle!
  • Migrate ConstructTuple bundle impl
  • Migrate PointerAction-matches with new Scroll-variant.

Caution

This won't compile because of some issues with the derive macros, yielding errors like:
use of undeclared crate or module bevy_reflect or use of undeclared crate or module bevy_ecs.

Possibly related to bevyengine/bevy#17330

The errors only seem to happen for crates/bevy_editor_cam.

Fixed in bevyengine/bevy@fb0e5c4

  • Compiles without errors
  • Tests pass
  • Editor and launcher runs

Also added temporary a workaround for the Linux issue regarding ashpd.

@raldone01
Copy link

raldone01 commented Feb 10, 2025

Ok I pulled your branch to track down the issue with bevy reflect/derive macros but can't build it:

error[E0432]: unresolved import `futures_util::AsyncReadExt`
   --> /home/main/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ashpd-0.10.2/src/desktop/secret.rs:26:5
    |
26  | use futures_util::AsyncReadExt;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^ no `AsyncReadExt` in the root
    |
note: found an item that was configured out
   --> /home/main/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/futures-util-0.3.31/src/lib.rs:320:47
    |
320 |     AsyncBufRead, AsyncBufReadExt, AsyncRead, AsyncReadExt, AsyncSeek, AsyncSeekExt, AsyncWrite,
    |                                               ^^^^^^^^^^^^
note: the item is gated behind the `io` feature
   --> /home/main/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/futures-util-0.3.31/src/lib.rs:316:7
    |
316 | #[cfg(feature = "io")]
    |       ^^^^^^^^^^^^^^

error[E0432]: unresolved import `futures_util::AsyncReadExt`
   --> /home/main/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ashpd-0.10.2/src/helpers.rs:4:5
    |
4   | use futures_util::AsyncReadExt;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^ no `AsyncReadExt` in the root
    |
note: found an item that was configured out
   --> /home/main/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/futures-util-0.3.31/src/lib.rs:320:47
    |
320 |     AsyncBufRead, AsyncBufReadExt, AsyncRead, AsyncReadExt, AsyncSeek, AsyncSeekExt, AsyncWrite,
    |                                               ^^^^^^^^^^^^
note: the item is gated behind the `io` feature
   --> /home/main/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/futures-util-0.3.31/src/lib.rs:316:7
    |
316 | #[cfg(feature = "io")]
    |       ^^^^^^^^^^^^^^

error[E0599]: no method named `read_to_string` found for struct `async_fs::File` in the current scope
    --> /home/main/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ashpd-0.10.2/src/helpers.rs:28:16
     |
28   |     match file.read_to_string(&mut buffer).await {
     |                ^^^^^^^^^^^^^^
     |
    ::: /home/main/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/futures-lite-2.6.0/src/io.rs:2059:8
     |
2059 |     fn read_to_string<'a>(&'a mut self, buf: &'a mut String) -> ReadToStringFuture<'a, Self>
     |        -------------- the method is available for `async_fs::File` here
     |
     = help: items from traits can only be used if the trait is in scope
help: trait `AsyncReadExt` which provides `read_to_string` is implemented but not in scope; perhaps you want to import it
     |
1    + use futures_lite::io::AsyncReadExt;
     |
help: there is a method `read_to_end` with a similar name
     |
28   |     match file.read_to_end(&mut buffer).await {
     |                ~~~~~~~~~~~

    Checking bevy_ecs v0.16.0-dev (/argon_bfs/user_main/argon_bfs_desktop/bevy_dev/bevy/crates/bevy_ecs)
    Checking bevy_math v0.16.0-dev (/argon_bfs/user_main/argon_bfs_desktop/bevy_dev/bevy/crates/bevy_math)
    Checking smithay-client-toolkit v0.19.2
error[E0599]: no method named `read_to_end` found for struct `async_net::unix::UnixStream` in the current scope
    --> /home/main/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ashpd-0.10.2/src/desktop/secret.rs:113:8
     |
113  |     x1.read_to_end(&mut buf).await?;
     |        ^^^^^^^^^^^ method not found in `UnixStream`
     |
    ::: /home/main/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/futures-lite-2.6.0/src/io.rs:2029:8
     |
2029 |     fn read_to_end<'a>(&'a mut self, buf: &'a mut Vec<u8>) -> ReadToEndFuture<'a, Self>
     |        ----------- the method is available for `async_net::unix::UnixStream` here
     |
     = help: items from traits can only be used if the trait is in scope
help: trait `AsyncReadExt` which provides `read_to_end` is implemented but not in scope; perhaps you want to import it
     |
21   + use futures_lite::io::AsyncReadExt;

ashpd seems to have some issues?

@raldone01
Copy link

Can you fix this issue with ashpd or provide me with a working Cargo.lock?

@villor
Copy link
Contributor Author

villor commented Feb 10, 2025

Can you fix this issue with ashpd or provide me with a working Cargo.lock?

I can't reproduce those errors, not familiar with ashpd but it seems to be Linux specific (I'm on Mac)
I'm getting the same error as the CI job

Attaching my Cargo.lock
Cargo.lock.zip

@raldone01
Copy link

raldone01 commented Feb 11, 2025

Ok. I fixed the ashpd issues on linux. It was caused by the rfd crate.

For some reason the io feature of futures-util is not being turned on when it's needed.

Maybe an issue should be opened on the rfd crate.

I had to add explicit dependencies to futures-util = { version = "0.3.31", features = ["io"] } for the creates that use the rfd crate.

I can now reproduce the bevy issue and I am working on a fix.

@raldone01
Copy link

raldone01 commented Feb 11, 2025

Ok. The issue is caused by bevy being in both dev-dependencies and normal dependencies. I have a plan to fix this.

Edit: You can follow the state of my investigation bevyengine/bevy#17780 (comment).

@villor
Copy link
Contributor Author

villor commented Feb 11, 2025

Ok. I fixed the ashpd issues on linux. It was caused by the rfd crate.
...

Nice find! It looks like ashpd needs to add a dependency on the futures_io/io feature. I guess in my case that is enabled from some other crate/dependency which avoids the error.

Opened an issue over at ashpd.

@raldone01
Copy link

raldone01 commented Feb 11, 2025

Can you verify that this pr works using bevyengine/bevy#17795?
Please comment if it works for you.

github-merge-queue bot pushed a commit to bevyengine/bevy that referenced this pull request Feb 11, 2025
… dependencies. (#17795)

This is a follow up fix for #17330 and fixes #17780.
There was a logic error in the ambiguity detection of
`cargo-manifest-proc-macros`.
`cargo-manifest-proc-macros` now has a test for this case to prevent the
issue in the future.

I also opted to hard fail if the `cargo-manifest-proc-macros` crate
fails. That way the error is more obvious and easier to fix and
diagnose.

## Testing

- The reproducer:
bevyengine/bevy_editor_prototypes#178 works for
me using these fixes.
@villor
Copy link
Contributor Author

villor commented Feb 11, 2025

Should be good to go now!

@raldone01 Thank you so much for the quick fix for the proc macros and the ashpd-investigation/workaround 🥳

@alice-i-cecile alice-i-cecile added this pull request to the merge queue Feb 11, 2025
Merged via the queue into bevyengine:main with commit f41e224 Feb 11, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants