Skip to content

Commit c8b5819

Browse files
authored
Unrolled build for rust-lang#129529
Rollup merge of rust-lang#129529 - lqd:stable-new-solver, r=Kobzol Add test to build crates used by r-a on stable r? ````````@Kobzol```````` I've opened other PRs for this one to work and they've landed already. I cherry-picked your commit, and added the last remaining pieces we needed I think.
2 parents 304b7f8 + a178559 commit c8b5819

File tree

6 files changed

+53
-4
lines changed

6 files changed

+53
-4
lines changed

compiler/rustc_type_ir/src/elaborate.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ pub fn supertrait_def_ids<I: Interner>(
237237
cx: I,
238238
trait_def_id: I::DefId,
239239
) -> impl Iterator<Item = I::DefId> {
240-
let mut set: HashSet<I::DefId> = HashSet::default();
240+
let mut set = HashSet::default();
241241
let mut stack = vec![trait_def_id];
242242

243243
set.insert(trait_def_id);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
use crate::command::Command;
2+
use crate::env_var;
3+
4+
/// Returns a command that can be used to invoke Cargo.
5+
pub fn cargo() -> Command {
6+
Command::new(env_var("BOOTSTRAP_CARGO"))
7+
}

src/tools/run-make-support/src/external_deps/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
//! such as `cc` or `python`.
33
44
pub mod c_build;
5+
pub mod cargo;
56
pub mod cc;
67
pub mod clang;
78
pub mod htmldocck;

src/tools/run-make-support/src/external_deps/rustc.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,13 @@ pub struct Rustc {
3636

3737
crate::macros::impl_common_helpers!(Rustc);
3838

39+
pub fn rustc_path() -> String {
40+
env_var("RUSTC")
41+
}
42+
3943
#[track_caller]
4044
fn setup_common() -> Command {
41-
let rustc = env_var("RUSTC");
42-
let mut cmd = Command::new(rustc);
45+
let mut cmd = Command::new(rustc_path());
4346
set_host_rpath(&mut cmd);
4447
cmd
4548
}

src/tools/run-make-support/src/lib.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ pub use external_deps::{c_build, cc, clang, htmldocck, llvm, python, rustc, rust
5050
// These rely on external dependencies.
5151
pub use cc::{cc, cxx, extra_c_flags, extra_cxx_flags, Cc};
5252
pub use c_build::{build_native_dynamic_lib, build_native_static_lib, build_native_static_lib_optimized, build_native_static_lib_cxx};
53+
pub use cargo::cargo;
5354
pub use clang::{clang, Clang};
5455
pub use htmldocck::htmldocck;
5556
pub use llvm::{
@@ -58,7 +59,7 @@ pub use llvm::{
5859
LlvmProfdata, LlvmReadobj,
5960
};
6061
pub use python::python_command;
61-
pub use rustc::{aux_build, bare_rustc, rustc, Rustc};
62+
pub use rustc::{aux_build, bare_rustc, rustc, rustc_path, Rustc};
6263
pub use rustdoc::{bare_rustdoc, rustdoc, Rustdoc};
6364

6465
/// [`diff`][mod@diff] is implemented in terms of the [similar] library.
@@ -98,3 +99,4 @@ pub use assertion_helpers::{
9899
pub use string::{
99100
count_regex_matches_in_files_with_extension, invalid_utf8_contains, invalid_utf8_not_contains,
100101
};
102+
use crate::external_deps::cargo;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
//! Checks if selected rustc crates can be compiled on the stable channel (or a "simulation" of it).
2+
//! These crates are designed to be used by downstream users.
3+
4+
use run_make_support::{cargo, rustc_path, source_root};
5+
6+
fn main() {
7+
// Use the stage0 beta cargo for the compilation (it shouldn't really matter which cargo we use)
8+
cargo()
9+
// Ensure `proc-macro2`'s nightly detection is disabled
10+
.env("RUSTC_STAGE", "0")
11+
.env("RUSTC", rustc_path())
12+
// We want to disallow all nightly features to simulate a stable build
13+
.env("RUSTFLAGS", "-Zallow-features=")
14+
.arg("build")
15+
.arg("--manifest-path")
16+
.arg(source_root().join("Cargo.toml"))
17+
.args(&[
18+
// Avoid depending on transitive rustc crates
19+
"--no-default-features",
20+
// Emit artifacts in this temporary directory, not in the source_root's `target` folder
21+
"--target-dir",
22+
"target",
23+
])
24+
// Check that these crates can be compiled on "stable"
25+
.args(&[
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();
36+
}

0 commit comments

Comments
 (0)