bevyengine / bevyengine/bevy

derive(AppLabel) does not work when bevy_app is re-exported in other crate

Open
#4,321 1 comment 0 reactions 0 assignees View on GitHub
A-App C-Bug
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 16h
Merged PRs (30d)
171

Description

## Bevy version
0.6.0

## Operating system & version
MacOS & Windows 11

## What you did

I have a crate: ```my_bevy```. In ```Cargo.toml```, it uses ```bevy_app = "0.6.0"```, and then re-exports the crate
```Rust
pub mod app {
pub use bevy_app::*;
}
```

Then I have another crate ```my_render```, which uses ```my_bevy = { path = "../my_bevy" }```.
Inside ```my_render```, I have the following code:

```Rust
use my_bevy::app::AppLabel;

#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq, AppLabel)]
pub struct RenderApp;
```

It complains that ```bevy_app``` is not found:
```
error[E0433]: failed to resolve: use of undeclared crate or module `bevy_app`
--> crates/my-render/src/lib.rs:12:51
|
12 | #[derive(Debug, Clone, Copy, Hash, PartialEq, Eq, AppLabel)]
| ^^^^^^^^ use of undeclared crate or module `bevy_app`
```

In my opinion, this should work, as I imported the AppLabel from the appropriate crate
If you have any questions, feel free to contact me :)

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the example from crates/my-render/src/lib.rs with the bevy_app dependency and re-export shown in Cargo.toml. Investigate the AppLabel derive entry point and verify that deriving AppLabel succeeds when the trait is imported through my_bevy::app; done means the undeclared bevy_app error no longer occurs.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.