Amanieu / naked-function

Proc macro implementation of #[naked]
Apache License 2.0
29 stars 5 forks source link

Fix cfg names in test #8

Closed taiki-e closed 1 year ago

taiki-e commented 1 year ago

https://github.com/Amanieu/naked-function/blob/b0461cab8cdb28ab447c1dc2dd5afad7520a22f4/tests/conditional.rs#L22-L24

Both cfg(x86_64) and cfg(aarch64) are not valid cfg names.

# cfg(is_thumb) is set by build script.
$ RUSTFLAGS='-Z unstable-options --check-cfg=names(is_thumb)' cargo check -Z check-cfg=names --tests
warning: unexpected `cfg` condition name
  --> tests/conditional.rs:22:13
   |
22 |     if cfg!(x86_64) {
   |             ^^^^^^
   |
   = note: `#[warn(unexpected_cfgs)]` on by default

warning: unexpected `cfg` condition name
  --> tests/conditional.rs:24:20
   |
24 |     } else if cfg!(aarch64) {
   |                    ^^^^^^^

In fact, adding else { panic!() } to end of this if block will cause the test to fail.