Browse Source

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

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>
Paolo Bonzini 7 months ago
parent
commit
1d03e9771e
1 changed files with 2 additions and 0 deletions
  1. 2 0
      scripts/rust/rustc_args.py

+ 2 - 0
scripts/rust/rustc_args.py

@@ -215,6 +215,8 @@ def main() -> None:
 
     if rustc_version >= (1, 80):
         if args.lints:
+            print("--check-cfg")
+            print("cfg(test)")
             for cfg in sorted(cargo_toml.check_cfg):
                 print("--check-cfg")
                 print(cfg)