-
-
Notifications
You must be signed in to change notification settings - Fork 208
Closed
Description
Looking at the docs for CollisionLayers, it has this example code:
#[derive(PhysicsLayer, Default)]
enum GameLayer {
#[default]
Default, // Layer 0 - the default layer that objects are assigned to
Player, // Layer 1
Enemy, // Layer 2
Ground, // Layer 3
}This PhysicsLayer derive macro produces the following output:
#[cfg(feature = "2d")]
use avian2d::prelude::PhysicsLayer;
#[cfg(feature = "3d")]
use avian3d::prelude::PhysicsLayer;
impl PhysicsLayer for GameLayer {
fn all_bits() -> u32 {
15u32
}
fn to_bits(&self) -> u32 {
match self {
GameLayer::Default => 1u32,
GameLayer::Player => 2u32,
GameLayer::Enemy => 4u32,
GameLayer::Terrain => 8u32,
}
}
}which in turn produces the following compiler warning:
warning: unexpected `cfg` condition value: `2d`
--> src\game.rs:436:10
|
436 | #[derive(PhysicsLayer, Default)]
| ^^^^^^^^^^^^
|
= note: expected values for `feature` are: `one-of-my-features`
= help: consider adding `2d` as a feature in `Cargo.toml`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
= note: `#[warn(unexpected_cfgs)]` on by default
= note: this warning originates in the derive macro `PhysicsLayer` (in Nightly builds, run with -Z macro-backtrace for more info)
I feel like it has to be a bug that the macro expects there to be two features in any given crate they're used in. At least I can't find it documented anywhere that it expects this.
Metadata
Metadata
Assignees
Labels
No labels