|
1 | 1 | //! Checks if selected rustc crates can be compiled on the stable channel (or a "simulation" of it). |
2 | 2 | //! These crates are designed to be used by downstream users. |
3 | 3 |
|
4 | | -use run_make_support::{cargo, rustc_path, source_root}; |
| 4 | +use std::env::current_dir; |
| 5 | + |
| 6 | +use run_make_support::{cargo, run_in_tmpdir, rustc_path, source_root}; |
5 | 7 |
|
6 | 8 | fn main() { |
7 | | - // Use the stage0 beta cargo for the compilation (it shouldn't really matter which cargo we use) |
8 | | - let cargo = cargo() |
9 | | - // This is required to allow using nightly cargo features (public-dependency) with beta |
10 | | - // cargo |
11 | | - .env("RUSTC_BOOTSTRAP", "1") |
12 | | - .env("RUSTC_STAGE", "0") // ensure `proc-macro2`'s nightly detection is disabled |
13 | | - .env("RUSTC", rustc_path()) |
14 | | - .arg("build") |
15 | | - .arg("--manifest-path") |
16 | | - .arg(source_root().join("Cargo.toml")) |
17 | | - .args(&[ |
18 | | - "--config", |
19 | | - r#"workspace.exclude=["library/core"]"#, |
20 | | - // We want to disallow all nightly features, to simulate a stable build |
21 | | - // public-dependency needs to be enabled for cargo to work |
22 | | - "-Zallow-features=public-dependency", |
23 | | - // Avoid depending on transitive rustc crates |
24 | | - "--no-default-features", |
25 | | - // Check that these crates can be compiled on "stable" |
26 | | - "-p", |
27 | | - "rustc_type_ir", |
28 | | - "-p", |
29 | | - "rustc_next_trait_solver", |
30 | | - "-p", |
31 | | - "rustc_pattern_analysis", |
32 | | - "-p", |
33 | | - "rustc_lexer", |
34 | | - ]) |
35 | | - .run(); |
| 9 | + run_in_tmpdir(|| { |
| 10 | + // Use the stage0 beta cargo for the compilation (it shouldn't really matter which cargo we |
| 11 | + // use) |
| 12 | + let cargo = cargo() |
| 13 | + // Run from the current temporary directory and emit artifacts there, not in the |
| 14 | + // source_root's `target` folder |
| 15 | + .current_dir(current_dir().unwrap()) |
| 16 | + // This is required to allow using nightly cargo features (public-dependency) with beta |
| 17 | + // cargo |
| 18 | + .env("RUSTC_BOOTSTRAP", "1") |
| 19 | + .env("RUSTC_STAGE", "0") // ensure `proc-macro2`'s nightly detection is disabled |
| 20 | + .env("RUSTC", rustc_path()) |
| 21 | + .arg("build") |
| 22 | + .arg("--manifest-path") |
| 23 | + .arg(source_root().join("Cargo.toml")) |
| 24 | + .args(&[ |
| 25 | + "--config", |
| 26 | + r#"workspace.exclude=["library/core"]"#, |
| 27 | + // We want to disallow all nightly features, to simulate a stable build |
| 28 | + // public-dependency needs to be enabled for cargo to work |
| 29 | + "-Zallow-features=public-dependency", |
| 30 | + // Avoid depending on transitive rustc crates |
| 31 | + "--no-default-features", |
| 32 | + // Emit artifacts in this temporary directory |
| 33 | + "--target-dir", |
| 34 | + ".", |
| 35 | + // Check that these crates can be compiled on "stable" |
| 36 | + "-p", |
| 37 | + "rustc_type_ir", |
| 38 | + "-p", |
| 39 | + "rustc_next_trait_solver", |
| 40 | + "-p", |
| 41 | + "rustc_pattern_analysis", |
| 42 | + "-p", |
| 43 | + "rustc_lexer", |
| 44 | + ]) |
| 45 | + .run(); |
| 46 | + }); |
36 | 47 | } |
0 commit comments