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

Future unexpected_cfgs warning from derive(CheckedBitPattern) #286

Closed
kpreid opened this issue Nov 28, 2024 · 2 comments · Fixed by #287
Closed

Future unexpected_cfgs warning from derive(CheckedBitPattern) #286

kpreid opened this issue Nov 28, 2024 · 2 comments · Fixed by #287

Comments

@kpreid
Copy link

kpreid commented Nov 28, 2024

Use Rust nightly or beta (1.84.0-beta.1), bytemuck 1.20.0, and compile this trivial program:

#[derive(Clone, Copy, bytemuck::CheckedBitPattern)]
#[repr(C)]
struct Foo {}

to receive this warning:

warning: unexpected `cfg` condition value: `spirv`
 --> src/lib.rs:1:23
  |
1 | #[derive(Clone, Copy, bytemuck::CheckedBitPattern)]
  |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: expected values for `target_arch` are: `aarch64`, `arm`, `arm64ec`, `avr`, `bpf`, `csky`, `hexagon`, `loongarch64`, `m68k`, `mips`, `mips32r6`, `mips64`, `mips64r6`, `msp430`, `nvptx64`, `powerpc`, `powerpc64`, `riscv32`, `riscv64`, `s390x`, `sparc`, `sparc64`, `wasm32`, `wasm64`, `x86`, `x86_64`, and `xtensa`
  = 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 `bytemuck::CheckedBitPattern` (in Nightly builds, run with -Z macro-backtrace for more info)
@Lokathor
Copy link
Owner

@CryZe i think you added the spirv support? did the name change or something?

@zachs18
Copy link
Contributor

zachs18 commented Nov 28, 2024

The lint configurations for bytemuck/bytemuck_derive itself don't apply to crates using bytemuck's derive macros, so the cfg_attr(not(target_arch = "spirv"), derive(Debug)) for the FooBits type generated by derive(CheckedBitPattern) hits the lint, since spirv is not an in-tree target IIUC.

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

Successfully merging a pull request may close this issue.

3 participants