diff mbox series

rust: add --check-cfg test to rustc arguments

Message ID 20250107155406.53161-1-pbonzini@redhat.com (mailing list archive)
State New
Headers show
Series rust: add --check-cfg test to rustc arguments | expand

Commit Message

Paolo Bonzini Jan. 7, 2025, 3:54 p.m. UTC
rustc will check that every reachable #[cfg] matches a list of
the expected config names and values.  Recent versions of rustc are
also complaining about #[cfg(test)], even if it is basically a standard
part of the language.  So, always allow it.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 scripts/rust/rustc_args.py | 2 ++
 1 file changed, 2 insertions(+)

Comments

Paolo Bonzini Jan. 7, 2025, 6:43 p.m. UTC | #1
Il mar 7 gen 2025, 16:54 Paolo Bonzini <pbonzini@redhat.com> ha scritto:

> rustc will check that every reachable #[cfg] matches a list of
> the expected config names and values.  Recent versions of rustc are
> also complaining about #[cfg(test)], even if it is basically a standard
> part of the language.  So, always allow it.
>

This is https://github.com/rust-lang/compiler-team/issues/785; I will add
it to the commit message.

Paolo


> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  scripts/rust/rustc_args.py | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/scripts/rust/rustc_args.py b/scripts/rust/rustc_args.py
> index 5525b3886fa..d79dc6d81f1 100644
> --- a/scripts/rust/rustc_args.py
> +++ b/scripts/rust/rustc_args.py
> @@ -215,6 +215,8 @@ def main() -> None:
>
>      if rustc_version >= (1, 80):
>          if args.lints:
> +            print("--check-cfg")
> +            print("test")
>              for cfg in sorted(cargo_toml.check_cfg):
>                  print("--check-cfg")
>                  print(cfg)
> --
> 2.47.1
>
diff mbox series

Patch

diff --git a/scripts/rust/rustc_args.py b/scripts/rust/rustc_args.py
index 5525b3886fa..d79dc6d81f1 100644
--- a/scripts/rust/rustc_args.py
+++ b/scripts/rust/rustc_args.py
@@ -215,6 +215,8 @@  def main() -> None:
 
     if rustc_version >= (1, 80):
         if args.lints:
+            print("--check-cfg")
+            print("test")
             for cfg in sorted(cargo_toml.check_cfg):
                 print("--check-cfg")
                 print(cfg)