Lokathor / bytemuck

A crate for mucking around with piles of bytes
https://docs.rs/bytemuck
Apache License 2.0
697 stars 77 forks source link

Fails to compile with rustc 1.72.0-nightly (fe7454bf4 2023-06-19) #197

Closed shepmaster closed 1 year ago

shepmaster commented 1 year ago
cargo +nightly new bm

cd bm

cargo +nightly add bytemuck --features "bytemuck_derive,derive,extern_crate_alloc,extern_crate_std,min_const_generics,wasm_simd,zeroable_atomics"

cargo +nightly build
error[E0404]: expected trait, found derive macro `NoUninit`
  --> /Users/shep/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bytemuck-1.13.1/src/allocation.rs:25:20
   |
25 | pub fn cast_box<A: NoUninit, B: AnyBitPattern>(input: Box<A>) -> Box<B> {
   |                    ^^^^^^^^ not a trait
   |
help: consider importing this trait instead
   |
12 + use crate::NoUninit;
   |

error[E0404]: expected trait, found derive macro `AnyBitPattern`
  --> /Users/shep/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bytemuck-1.13.1/src/allocation.rs:25:33
   |
25 | pub fn cast_box<A: NoUninit, B: AnyBitPattern>(input: Box<A>) -> Box<B> {
   |                                 ^^^^^^^^^^^^^ not a trait
   |
help: consider importing this trait instead
   |
12 + use crate::AnyBitPattern;
   |

[...]

error: could not compile `bytemuck` (lib) due to 58 previous errors

Notably, this affects the playground build.

Lokathor commented 1 year ago

Uh... what? "not a trait"? is this some new nightly bug?

king0952 commented 1 year ago

Same issue here, after I tried rustup update today:

info: syncing channel updates for 'nightly-x86_64-pc-windows-msvc'
info: latest update on 2023-06-20, rust version 1.72.0-nightly (fe7454bf4 2023-06-19)
info: downloading component 'rust-src'
info: downloading component 'cargo'
info: downloading component 'clippy'
info: downloading component 'rust-docs'
info: downloading component 'rust-std'
info: downloading component 'rustc'
info: downloading component 'rustfmt'
info: removing previous version of component 'rust-src'
info: removing previous version of component 'cargo'
info: removing previous version of component 'clippy'
info: removing previous version of component 'rust-docs'
info: removing previous version of component 'rust-std'
info: removing previous version of component 'rustc'
info: removing previous version of component 'rustfmt'
error[E0404]: expected trait, found derive macro `NoUninit`
  --> C:\Users\Vito\.cargo\registry\src\index.crates.io-6f17d22bba15001f\bytemuck-1.13.1\src\allocation.rs:25:20
   |
25 | pub fn cast_box<A: NoUninit, B: AnyBitPattern>(input: Box<A>) -> Box<B> {
   |                    ^^^^^^^^ not a trait
   |
help: consider importing this trait instead
   |
12 + use crate::NoUninit;
Lokathor commented 1 year ago

yeah but the top of the file says use super::*; so i can only surmise that this is a compiler bug.

https://github.com/Lokathor/bytemuck/blob/main/src/allocation.rs#L12

king0952 commented 1 year ago

@Lokathor @shepmaster Yes, it seems to be a rustc bug, so I retreat to nightly-2023-06-17 and it works fine for me.

kpreid commented 1 year ago

I (forgot to check this repo first and) filed a rustc issue: https://github.com/rust-lang/rust/issues/112860

[Update: … and missed it was already reported and fixed]

musl commented 1 year ago

For googlers: This issue appears to be fixed as of nightly-2023-06-20. Just run rustup update.❤️

eric-unc commented 1 year ago

Thanks ya'll! :)

Lokathor commented 1 year ago

Seems everyone agrees it's fixed, closing this one up.