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

Error with the latest release on crates.io #32

Closed
Gui-Yom opened this issue Jul 24, 2021 · 3 comments
Closed

Error with the latest release on crates.io #32

Gui-Yom opened this issue Jul 24, 2021 · 3 comments

Comments

@Gui-Yom
Copy link
Contributor

Gui-Yom commented Jul 24, 2021

I have the following code :

#[derive(AsStd430, Clone)]
pub struct Globals {
    pub resolution: mint::Vector2<u32>,
    pub mouse: mint::Vector2<u32>,
    pub mouse_wheel: f32,
    pub ratio: f32,
    pub time: f32,
    pub frame: u32,
}

Which fails to build if I include crevice like that :

[dependencies.crevice]
version = "0.7"

with the error :

error[E0046]: not all trait items implemented, missing: `from_std430`
  --> src\lib.rs:55:10
   |
55 | #[derive(AsStd430, Clone)]
   |          ^^^^^^^^ missing `from_std430` in implementation
   |
   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
   = help: implement the missing item: `fn from_std430(_: <Self as AsStd430>::Std430Type) -> Self { todo!() }`

But it works correctly if I specify the latest commit from this repo (78165c1) :

[dependencies.crevice]
version = "0.7"
git = "https://github.com/LPGhatguy/crevice"
rev = "78165c1bdb22c699b2523cdfa4bd13dd60ced79f"

Running cargo-expand shows that from_std430 is effectively missing in the former.

impl ::crevice::std430::AsStd430 for Globals {
    type Std430Type = Std430Globals;
    fn as_std430(&self) -> Self::Std430Type {
        Self::Std430Type {
            resolution: self.resolution.as_std430(),
            mouse: self.mouse.as_std430(),
            mouse_wheel: self.mouse_wheel.as_std430(),
            ratio: self.ratio.as_std430(),
            time: self.time.as_std430(),
            frame: self.frame.as_std430(),
            ..::crevice::internal::bytemuck::Zeroable::zeroed()
        }
    }
    // With the crate built from the repo we get this impl as well
    fn from_std430(value: Self::Std430Type) -> Self {
        Self {
            resolution: <mint::Vector2<u32> as ::crevice::std430::AsStd430>::from_std430(
                value.resolution,
            ),
            mouse: <mint::Vector2<u32> as ::crevice::std430::AsStd430>::from_std430(value.mouse),
            mouse_wheel: <f32 as ::crevice::std430::AsStd430>::from_std430(value.mouse_wheel),
            ratio: <f32 as ::crevice::std430::AsStd430>::from_std430(value.ratio),
            time: <f32 as ::crevice::std430::AsStd430>::from_std430(value.time),
            frame: <u32 as ::crevice::std430::AsStd430>::from_std430(value.frame),
        }
    }
}

This is really weird assuming the release on crates.io is built from this specific commit. This makes me think the release on crates.io is not built from the code we see on this repo.

Please note that I tried cleaning the build cache and the cargo crate cache.

@Gui-Yom
Copy link
Contributor Author

Gui-Yom commented Jul 24, 2021

After further investigation, I can conclude the code for the crate crevice-derive on crates.io isn't up to date with the changes made available in crevice 0.7.0.

crevice-derive has not been updated since 5 months (as shown on crates.io) so it does not include the commit f2a74aa which changes the AsStd430 trait. The code generated by crevice-derive 0.6.0 is invalid.

May I ask you to release a new up to date crevice-derive version ? (Along with a new crevice version which depends on it)

@LPGhatguy
Copy link
Owner

Oh darn, thank you for filing an issue!

I'll bump the versions here and yank 0.7.0.

@LPGhatguy
Copy link
Owner

0.7.1 of both crevice and crevice-derive is up, with fixed version ranges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants