bevy's bevy_ecs for macros path fails target arch specific dependency config
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 3d 22h
- Merged PRs (30d)
- 161
Description
## Bevy version and features
- git version `c7a16115cd783e5db98acf9830f6293371ac066d`, also v0.19.0, this is likely a rust bug but i do not feel like finding the minimal example in macros and is still relevent here
- default features = false
## \[Optional\] Relevant system information
If you cannot get Bevy to build or run on your machine, please include:
- cargo 1.97.1 (c980f4866 2026-06-30)
- arch linux
## What you did
code being
```
use bevy::ecs::resource::Resource;
fn main() {}
#[derive(Resource)]
pub struct Foo;
```
fails with
```
[dependencies]
[target.'cfg(target_arch = "wasm32")'.dependencies]
bevy = {git = "https://github.com/bevyengine/bevy", default-features = false}
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
bevy = {git = "https://github.com/bevyengine/bevy", default-features = false}
```
giving error
```
error[E0433]: cannot find module or crate `bevy_ecs` in this scope
--> src/main.rs:3:10
|
3 | #[derive(Resource)]
| ^^^^^^^^ use of unresolved module or unlinked crate `bevy_ecs`
|
= help: if you wanted to use a crate named `bevy_ecs`, use `cargo add bevy_ecs` to add it to your `Cargo.toml`
= note: this error originates in the derive macro `Resource` (in Nightly builds, run with -Z macro-backtrace for more info)
For more information about this error, try `rustc --explain E0433`.
error: could not compile `bevy_test` (bin "bevy_test") due to 1 previous error
```
but does not fail with
```
[dependencies]
bevy = {git = "https://github.com/bevyengine/bevy", default-features = false}
```
or v0.19.0 bevy version
Contributor guide
Research direction
Start with the target-specific dependency entries in Cargo.toml and reproduce the Resource derive failure using the minimal main.rs example. Compare builds with the target-specific configuration, a single dependency entry, and Bevy v0.19.0; done means the derive compiles with equivalent target-specific Bevy dependencies.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100