-
Notifications
You must be signed in to change notification settings - Fork 13.8k
Open
Open
Bug
Copy link
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
Code
use bevy::prelude::*;
#[derive(Component)]
struct Comp1(NonZeroU8);
fn main() {}
fn setup(mut commands: Commands) {
commands.spawn((Comp1(1.try_into().unwrap()),));
}
Current output
Compiling game v0.1.0 (/playground)
error[E0412]: cannot find type `NonZeroU8` in this scope
--> src/main.rs:4:14
|
4 | struct Comp1(NonZeroU8);
| ^^^^^^^^^ not found in this scope
|
help: consider importing this type alias
|
1 + use std::num::NonZeroU8;
|
error[E0277]: `(Comp1,)` is not a `Bundle`
--> src/main.rs:9:20
|
9 | commands.spawn((Comp1(1.try_into().unwrap()),));
| ----- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invalid `Bundle`
| |
| required by a bound introduced by this call
|
= help: the trait `Bundle` is not implemented for `(Comp1,)`
= note: consider annotating `(Comp1,)` with `#[derive(Component)]` or `#[derive(Bundle)]`
= help: the following other types implement trait `Bundle`:
()
(B0, B1)
(B0, B1, B2)
(B0, B1, B2, B3)
(B0, B1, B2, B3, B4)
(B0, B1, B2, B3, B4, B5)
(B0, B1, B2, B3, B4, B5, B6)
(B0, B1, B2, B3, B4, B5, B6, B7)
and 8 others
note: required by a bound in `bevy::prelude::Commands::<'w, 's>::spawn`
--> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_ecs-0.14.2/src/system/commands/mod.rs:362:21
|
362 | pub fn spawn<T: Bundle>(&mut self, bundle: T) -> EntityCommands {
| ^^^^^^ required by this bound in `Commands::<'w, 's>::spawn`
Some errors have detailed explanations: E0277, E0412.
For more information about an error, try `rustc --explain E0277`.
error: could not compile `game` (bin "game") due to 2 previous errors
Desired output
Compiling game v0.1.0 (/playground)
error[E0412]: cannot find type `NonZeroU8` in this scope
--> src/main.rs:4:14
|
4 | struct Comp1(NonZeroU8);
| ^^^^^^^^^ not found in this scope
|
help: consider importing this type alias
|
1 + use std::num::NonZeroU8;
|
Some errors have detailed explanations: E0277, E0412.
For more information about an error, try `rustc --explain E0277`.
error: could not compile `game` (bin "game") due to 2 previous errors
Rationale and extra context
this is a bug, because E0277
is not shown when trying to directly use a trait on a type that contains an error, or when the trait is Default
. only when using a user-defined trait within a tuple is this shown.
Other cases
No response
Rust Version
rustc 1.83.0-nightly (04a3187 2024-09-15)
binary: rustc
commit-hash: 04a3187
commit-date: 2024-09-15
host: x86_64-unknown-linux-gnu
release: 1.83.0-nightly
LLVM version: 19.1.0
Anything else?
No response
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.