@@ -202,11 +202,11 @@ def __post_init__(self):
202202]
203203
204204
205- def eprint (* args , ** kw ):
205+ def eprint (* args , ** kw ) -> None :
206206 print (* args , file = sys .stderr , ** kw )
207207
208208
209- def xtrace (args : Sequence [str | Path ], / , env : Optional [dict [str , str ]]):
209+ def xtrace (args : Sequence [str | Path ], / , env : Optional [dict [str , str ]]) -> None :
210210 """Print commands before running them."""
211211 astr = " " .join (str (arg ) for arg in args )
212212 if env is None :
@@ -224,12 +224,12 @@ def check_output(
224224 return sp .check_output (args , env = env , encoding = "utf8" )
225225
226226
227- def run (args : Sequence [str | Path ], / , env : Optional [dict [str , str ]] = None ):
227+ def run (args : Sequence [str | Path ], / , env : Optional [dict [str , str ]] = None ) -> None :
228228 xtrace (args , env = env )
229229 sp .run (args , env = env , check = True )
230230
231231
232- def check_dup_targets ():
232+ def check_dup_targets () -> None :
233233 """Ensure there are no duplicate targets in the list."""
234234 all = set ()
235235 duplicates = set ()
@@ -240,7 +240,7 @@ def check_dup_targets():
240240 assert len (duplicates ) == 0 , f"duplicate targets: { duplicates } "
241241
242242
243- def do_semver_checks (cfg : Cfg , target : Target ):
243+ def do_semver_checks (cfg : Cfg , target : Target ) -> None :
244244 tname = target .name
245245 if cfg .toolchain != Toolchain .STABLE :
246246 eprint ("Skipping semver checks" )
@@ -276,10 +276,13 @@ def do_semver_checks(cfg: Cfg, target: Target):
276276 eprint ("Running semver checks with cross compilation" )
277277
278278 env = os .environ .copy ()
279+ env .setdefault ("RUSTFLAGS" , "" )
279280 cmd = ["cargo" , "rustdoc" , "--target" , tname ]
280281 rustdoc_args = ["--" , "-Zunstable-options" , "--output-format=json" ]
281282
282283 run ([* cmd , * rustdoc_args ], env = env | {"RUSTC_BOOTSTRAP" : "1" })
284+
285+ env ["RUSTFLAGS" ] += " -Awarnings" # Don't lint the baseline
283286 run (
284287 [* cmd , "--manifest-path" , cfg .baseline_crate_dir , * rustdoc_args ],
285288 env = env | {"RUSTC_BOOTSTRAP" : "1" },
@@ -301,7 +304,7 @@ def do_semver_checks(cfg: Cfg, target: Target):
301304 )
302305
303306
304- def test_target (cfg : Cfg , target : Target ):
307+ def test_target (cfg : Cfg , target : Target ) -> None :
305308 """Run tests for a single target."""
306309 start = time .time ()
307310 env = os .environ .copy ()
@@ -328,14 +331,15 @@ def test_target(cfg: Cfg, target: Target):
328331 if not target .dist :
329332 # If we can't download a `core`, we need to build it
330333 cmd += ["-Zbuild-std=core" ]
331- # FIXME: With `build-std` feature, `compiler_builtins` emits a lot of lint warnings.
334+ # FIXME: With `the build-std` feature, `compiler_builtins` emits a lot of
335+ # lint warnings.
332336 env ["RUSTFLAGS" ] += " -Aimproper_ctypes_definitions"
333337 else :
334338 run (["rustup" , "target" , "add" , tname , "--toolchain" , cfg .toolchain_name ])
335339
336340 # Test with expected combinations of features
337341 run (cmd , env = env )
338- run (cmd + [ "--features=extra_traits" ], env = env )
342+ run ([ * cmd , "--features=extra_traits" ], env = env )
339343
340344 # Check with different env for 64-bit time_t
341345 if target_os == "linux" and target_bits == "32" :
@@ -353,20 +357,20 @@ def test_target(cfg: Cfg, target: Target):
353357 run (cmd , env = env | {"RUST_LIBC_UNSTABLE_MUSL_V1_2_3" : "1" })
354358
355359 # Test again without default features, i.e. without `std`
356- run (cmd + [ "--no-default-features" ])
357- run (cmd + [ "--no-default-features" , "--features=extra_traits" ])
360+ run ([ * cmd , "--no-default-features" ])
361+ run ([ * cmd , "--no-default-features" , "--features=extra_traits" ])
358362
359363 # Ensure the crate will build when used as a dependency of `std`
360364 if cfg .nightly ():
361- run (cmd + [ "--no-default-features" , "--features=rustc-dep-of-std" ])
365+ run ([ * cmd , "--no-default-features" , "--features=rustc-dep-of-std" ])
362366
363367 # For freebsd targets, check with the different versions we support
364368 # if on nightly or stable
365369 if "freebsd" in tname and cfg .toolchain >= Toolchain .STABLE :
366370 for version in FREEBSD_VERSIONS :
367371 run (cmd , env = env | {"RUST_LIBC_UNSTABLE_FREEBSD_VERSION" : str (version )})
368372 run (
369- cmd + [ "--no-default-features" ],
373+ [ * cmd , "--no-default-features" ],
370374 env = env | {"RUST_LIBC_UNSTABLE_FREEBSD_VERSION" : str (version )},
371375 )
372376
@@ -376,7 +380,7 @@ def test_target(cfg: Cfg, target: Target):
376380 eprint (f"Finished checking target { tname } in { elapsed } seconds" )
377381
378382
379- def main ():
383+ def main () -> None :
380384 p = argparse .ArgumentParser ()
381385 p .add_argument ("--toolchain" , required = True , help = "Rust toolchain" )
382386 p .add_argument ("--only" , help = "only targets matching this regex" )
0 commit comments