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

Compile error when checking bevy_ui #7874

Closed
TimJentzsch opened this issue Mar 2, 2023 · 4 comments
Closed

Compile error when checking bevy_ui #7874

TimJentzsch opened this issue Mar 2, 2023 · 4 comments
Labels
A-UI Graphical user interfaces, styles, layouts, and widgets C-Bug An unexpected or incorrect behavior
Milestone

Comments

@TimJentzsch
Copy link
Contributor

Bevy version

main (9153bd0e)

[Optional] Relevant system information

  • cargo 1.67.1 (8ecd4f20a 2023-01-10)
  • Linux (Pop!_OS)

What you did

Run cargo check -p bevy_ui

What went wrong

I got compile errors:

warning: unused variable: `to_watch`
   --> crates/bevy_asset/src/io/file_asset_io.rs:127:9
    |
127 |         to_watch: &Path,
    |         ^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_to_watch`
    |
    = note: `#[warn(unused_variables)]` on by default

warning: unused variable: `to_reload`
   --> crates/bevy_asset/src/io/file_asset_io.rs:128:9
    |
128 |         to_reload: Option<PathBuf>,
    |         ^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_to_reload`

warning: `bevy_asset` (lib) generated 2 warnings
    Checking bevy_ui v0.9.0 (/home/tim/Documents/bevyengine/bevy/crates/bevy_ui)
error[E0432]: unresolved import `bevy_text`
  --> crates/bevy_ui/src/accessibility.rs:15:5
   |
15 | use bevy_text::Text;
   |     ^^^^^^^^^ use of undeclared crate or module `bevy_text`
   |
help: there is a crate or module with a similar name
   |
15 | use bevy_ecs::Text;
   |     ~~~~~~~~

error[E0277]: the trait bound `for<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i> fn(bevy_ecs::system::Commands<'a, 'b>, bevy_ecs::system::Query<'c, 'd, (bevy_ecs::entity::Entity, &'e bevy_hierarchy::Children, std::option::Option<&'f mut AccessibilityNode>), Changed<button::Button>>, bevy_ecs::system::Query<'g, 'h, &'i [type error], [type error]>) {button_changed}: IntoSystem<(), (), _>` is not satisfied
   --> crates/bevy_ui/src/accessibility.rs:153:25
    |
153 |             .add_system(button_changed)
    |              ---------- ^^^^^^^^^^^^^^ the trait `IntoSystem<(), (), _>` is not implemented for fn item `for<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i> fn(bevy_ecs::system::Commands<'a, 'b>, bevy_ecs::system::Query<'c, 'd, (bevy_ecs::entity::Entity, &'e bevy_hierarchy::Children, std::option::Option<&'f mut AccessibilityNode>), Changed<button::Button>>, bevy_ecs::system::Query<'g, 'h, &'i [type error], [type error]>) {button_changed}`
    |              |
    |              required by a bound introduced by this call
    |
    = help: the trait `bevy_app::IntoSystemAppConfig<()>` is implemented for `SystemAppConfig`
    = note: required for `for<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i> fn(bevy_ecs::system::Commands<'a, 'b>, ..., ...) {button_changed}` to implement `bevy_ecs::schedule::IntoSystemConfig<_>`
    = note: the full type name has been written to '/home/tim/Documents/bevyengine/bevy/target/debug/deps/bevy_ui-b1f535ab30b1ca08.long-type-17902658850639122308.txt'
    = note: required for `for<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i> fn(bevy_ecs::system::Commands<'a, 'b>, ..., ...) {button_changed}` to implement `bevy_app::IntoSystemAppConfig<_>`
    = note: the full type name has been written to '/home/tim/Documents/bevyengine/bevy/target/debug/deps/bevy_ui-b1f535ab30b1ca08.long-type-17902658850639122308.txt'
note: required by a bound in `bevy_app::App::add_system`
   --> /home/tim/Documents/bevyengine/bevy/crates/bevy_app/src/app.rs:384:50
    |
384 |     pub fn add_system<M>(&mut self, system: impl IntoSystemAppConfig<M>) -> &mut Self {
    |                                                  ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `bevy_app::App::add_system`

error[E0277]: the trait bound `for<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i> fn(bevy_ecs::system::Commands<'a, 'b>, bevy_ecs::system::Query<'c, 'd, (bevy_ecs::entity::Entity, &'e bevy_hierarchy::Children, std::option::Option<&'f mut AccessibilityNode>), (Changed<ui_node::UiImage>, bevy_ecs::query::Without<button::Button>)>, bevy_ecs::system::Query<'g, 'h, &'i [type error], [type error]>) {image_changed}: IntoSystem<(), (), _>` is not satisfied
   --> crates/bevy_ui/src/accessibility.rs:154:25
    |
154 |             .add_system(image_changed)
    |              ---------- ^^^^^^^^^^^^^ the trait `IntoSystem<(), (), _>` is not implemented for fn item `for<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i> fn(bevy_ecs::system::Commands<'a, 'b>, bevy_ecs::system::Query<'c, 'd, (bevy_ecs::entity::Entity, &'e bevy_hierarchy::Children, std::option::Option<&'f mut AccessibilityNode>), (Changed<ui_node::UiImage>, bevy_ecs::query::Without<button::Button>)>, bevy_ecs::system::Query<'g, 'h, &'i [type error], [type error]>) {image_changed}`
    |              |
    |              required by a bound introduced by this call
    |
    = help: the trait `bevy_app::IntoSystemAppConfig<()>` is implemented for `SystemAppConfig`
    = note: required for `for<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i> fn(bevy_ecs::system::Commands<'a, 'b>, ..., ...) {image_changed}` to implement `bevy_ecs::schedule::IntoSystemConfig<_>`
    = note: the full type name has been written to '/home/tim/Documents/bevyengine/bevy/target/debug/deps/bevy_ui-b1f535ab30b1ca08.long-type-10771950962674446127.txt'
    = note: required for `for<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i> fn(bevy_ecs::system::Commands<'a, 'b>, ..., ...) {image_changed}` to implement `bevy_app::IntoSystemAppConfig<_>`
    = note: the full type name has been written to '/home/tim/Documents/bevyengine/bevy/target/debug/deps/bevy_ui-b1f535ab30b1ca08.long-type-10771950962674446127.txt'
note: required by a bound in `bevy_app::App::add_system`
   --> /home/tim/Documents/bevyengine/bevy/crates/bevy_app/src/app.rs:384:50
    |
384 |     pub fn add_system<M>(&mut self, system: impl IntoSystemAppConfig<M>) -> &mut Self {
    |                                                  ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `bevy_app::App::add_system`

error[E0277]: the trait bound `for<'a, 'b, 'c, 'd, 'e, 'f> fn(bevy_ecs::system::Commands<'a, 'b>, bevy_ecs::system::Query<'c, 'd, (bevy_ecs::entity::Entity, &'e [type error], std::option::Option<&'f mut AccessibilityNode>), Changed<widget::label::Label>>) {label_changed}: IntoSystem<(), (), _>` is not satisfied
   --> crates/bevy_ui/src/accessibility.rs:155:25
    |
155 |             .add_system(label_changed);
    |              ---------- ^^^^^^^^^^^^^ the trait `IntoSystem<(), (), _>` is not implemented for fn item `for<'a, 'b, 'c, 'd, 'e, 'f> fn(bevy_ecs::system::Commands<'a, 'b>, bevy_ecs::system::Query<'c, 'd, (bevy_ecs::entity::Entity, &'e [type error], std::option::Option<&'f mut AccessibilityNode>), Changed<widget::label::Label>>) {label_changed}`
    |              |
    |              required by a bound introduced by this call
    |
    = help: the trait `bevy_app::IntoSystemAppConfig<()>` is implemented for `SystemAppConfig`
    = note: required for `for<'a, 'b, 'c, 'd, 'e, 'f> fn(bevy_ecs::system::Commands<'a, 'b>, ...) {label_changed}` to implement `bevy_ecs::schedule::IntoSystemConfig<_>`
    = note: the full type name has been written to '/home/tim/Documents/bevyengine/bevy/target/debug/deps/bevy_ui-b1f535ab30b1ca08.long-type-4260758417611086486.txt'
    = note: required for `for<'a, 'b, 'c, 'd, 'e, 'f> fn(bevy_ecs::system::Commands<'a, 'b>, ...) {label_changed}` to implement `bevy_app::IntoSystemAppConfig<_>`
    = note: the full type name has been written to '/home/tim/Documents/bevyengine/bevy/target/debug/deps/bevy_ui-b1f535ab30b1ca08.long-type-4260758417611086486.txt'
note: required by a bound in `bevy_app::App::add_system`
   --> /home/tim/Documents/bevyengine/bevy/crates/bevy_app/src/app.rs:384:50
    |
384 |     pub fn add_system<M>(&mut self, system: impl IntoSystemAppConfig<M>) -> &mut Self {
    |                                                  ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `bevy_app::App::add_system`

Some errors have detailed explanations: E0277, E0432.
For more information about an error, try `rustc --explain E0277`.
error: could not compile `bevy_ui` due to 4 previous errors

Additional information

I ran into this issue while porting leafwing-input-manager to 0.10.

When I run cargo check on bevy I don't get any errors, same thing when I use the feature flags that we use on leafwing-input-manager.

@TimJentzsch TimJentzsch added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Mar 2, 2023
@alice-i-cecile alice-i-cecile added A-UI Graphical user interfaces, styles, layouts, and widgets and removed S-Needs-Triage This issue needs to be labelled labels Mar 2, 2023
@JMS55
Copy link
Contributor

JMS55 commented Mar 2, 2023

I've had the same issue with the rendering crates recently.

@TimJentzsch
Copy link
Contributor Author

TimJentzsch commented Mar 2, 2023

Most errors seem to be in crates/bevy_ui/src/accessibility.rs. I noticed that it imports bevy_text::Text, but bevy_text is an optional dependency.
Could that be the cause of this issue?

@alice-i-cecile
Copy link
Member

Ah yep, I bet that's it.

@alice-i-cecile alice-i-cecile added this to the 0.10 milestone Mar 2, 2023
@alice-i-cecile
Copy link
Member

The imports will either need to be feature flagged or the depedency will have to be mandatory.

@bors bors bot closed this as completed in 73c1ab1 Mar 2, 2023
Shfty pushed a commit to shfty-rust/bevy that referenced this issue Mar 19, 2023
# Objective

- Fixes bevyengine#7874.
- The `bevy_text` dependency is optional for `bevy_ui`, but the `accessibility` module depended on it.

## Solution

- Guard the `accessibility` module behind the `bevy_text` feature and only add the plugin when it's enabled.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-UI Graphical user interfaces, styles, layouts, and widgets C-Bug An unexpected or incorrect behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants