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

#[derive(Reflect)] compile error when std::fmt::Result is imported #7747

Closed
Seldom-SE opened this issue Feb 19, 2023 · 2 comments
Closed

#[derive(Reflect)] compile error when std::fmt::Result is imported #7747

Seldom-SE opened this issue Feb 19, 2023 · 2 comments
Labels
A-Reflection Runtime information about types C-Bug An unexpected or incorrect behavior

Comments

@Seldom-SE
Copy link

Bevy version

0.9.1

What you did

For example,

use std::fmt::{Debug, Formatter, Result};

use bevy::prelude::*;

fn main() {}

#[derive(Reflect)]
struct MyStruct;

struct MyError;

impl Debug for MyError {
    fn fmt(&self, f: &mut Formatter<'_>) -> Result {
        write!(f, "something occured")
    }
}

What went wrong

I get this error:

error[E0107]: this type alias takes 0 generic arguments but 2 generic arguments were supplied
  --> src/main.rs:7:10
   |
7  | #[derive(Reflect)]
   |          ^^^^^^^- help: remove these generics
   |          |
   |          expected 0 generic arguments
   |
note: type alias defined here, with 0 generic parameters
  --> /home/seldom/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/fmt/mod.rs:72:10
   |
72 | pub type Result = result::Result<(), Error>;
   |          ^^^^^^
   = note: this error originates in the derive macro `Reflect` (in Nightly builds, run with -Z macro-backtrace for more info)

Additional information

Looks like #[derive(Reflect)] uses Result instead of ::core::result::Result. I looked into it, but I couldn't find how this was occurring haha.

Thanks!

@Seldom-SE Seldom-SE added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Feb 19, 2023
@MrGVSV
Copy link
Member

MrGVSV commented Feb 19, 2023

Duplicate of #3004.

This should be fixed in main and the soon-to-be-released 0.10 version! 😄

@Seldom-SE
Copy link
Author

Ah, nice

@MrGVSV MrGVSV added A-Reflection Runtime information about types and removed S-Needs-Triage This issue needs to be labelled labels Feb 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Reflection Runtime information about types C-Bug An unexpected or incorrect behavior
Projects
None yet
Development

No branches or pull requests

2 participants