Skip to content

Commit

Permalink
Rollup merge of rust-lang#129529 - lqd:stable-new-solver, r=Kobzol
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
workingjubilee authored Sep 9, 2024
2 parents feda28d + a178559 commit c5de40e
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 4 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_type_ir/src/elaborate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ pub fn supertrait_def_ids<I: Interner>(
cx: I,
trait_def_id: I::DefId,
) -> impl Iterator<Item = I::DefId> {
let mut set: HashSet<I::DefId> = HashSet::default();
let mut set = HashSet::default();
let mut stack = vec![trait_def_id];

set.insert(trait_def_id);
Expand Down
7 changes: 7 additions & 0 deletions src/tools/run-make-support/src/external_deps/cargo.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
use crate::command::Command;
use crate::env_var;

/// Returns a command that can be used to invoke Cargo.
pub fn cargo() -> Command {
Command::new(env_var("BOOTSTRAP_CARGO"))
}
1 change: 1 addition & 0 deletions src/tools/run-make-support/src/external_deps/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
//! such as `cc` or `python`.
pub mod c_build;
pub mod cargo;
pub mod cc;
pub mod clang;
pub mod htmldocck;
Expand Down
7 changes: 5 additions & 2 deletions src/tools/run-make-support/src/external_deps/rustc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,13 @@ pub struct Rustc {

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

pub fn rustc_path() -> String {
env_var("RUSTC")
}

#[track_caller]
fn setup_common() -> Command {
let rustc = env_var("RUSTC");
let mut cmd = Command::new(rustc);
let mut cmd = Command::new(rustc_path());
set_host_rpath(&mut cmd);
cmd
}
Expand Down
4 changes: 3 additions & 1 deletion src/tools/run-make-support/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ pub use external_deps::{c_build, cc, clang, htmldocck, llvm, python, rustc, rust
// These rely on external dependencies.
pub use cc::{cc, cxx, extra_c_flags, extra_cxx_flags, Cc};
pub use c_build::{build_native_dynamic_lib, build_native_static_lib, build_native_static_lib_optimized, build_native_static_lib_cxx};
pub use cargo::cargo;
pub use clang::{clang, Clang};
pub use htmldocck::htmldocck;
pub use llvm::{
Expand All @@ -58,7 +59,7 @@ pub use llvm::{
LlvmProfdata, LlvmReadobj,
};
pub use python::python_command;
pub use rustc::{aux_build, bare_rustc, rustc, Rustc};
pub use rustc::{aux_build, bare_rustc, rustc, rustc_path, Rustc};
pub use rustdoc::{bare_rustdoc, rustdoc, Rustdoc};

/// [`diff`][mod@diff] is implemented in terms of the [similar] library.
Expand Down Expand Up @@ -98,3 +99,4 @@ pub use assertion_helpers::{
pub use string::{
count_regex_matches_in_files_with_extension, invalid_utf8_contains, invalid_utf8_not_contains,
};
use crate::external_deps::cargo;
36 changes: 36 additions & 0 deletions tests/run-make/rustc-crates-on-stable/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
//! Checks if selected rustc crates can be compiled on the stable channel (or a "simulation" of it).
//! These crates are designed to be used by downstream users.
use run_make_support::{cargo, rustc_path, source_root};

fn main() {
// Use the stage0 beta cargo for the compilation (it shouldn't really matter which cargo we use)
cargo()
// Ensure `proc-macro2`'s nightly detection is disabled
.env("RUSTC_STAGE", "0")
.env("RUSTC", rustc_path())
// We want to disallow all nightly features to simulate a stable build
.env("RUSTFLAGS", "-Zallow-features=")
.arg("build")
.arg("--manifest-path")
.arg(source_root().join("Cargo.toml"))
.args(&[
// Avoid depending on transitive rustc crates
"--no-default-features",
// Emit artifacts in this temporary directory, not in the source_root's `target` folder
"--target-dir",
"target",
])
// Check that these crates can be compiled on "stable"
.args(&[
"-p",
"rustc_type_ir",
"-p",
"rustc_next_trait_solver",
"-p",
"rustc_pattern_analysis",
"-p",
"rustc_lexer",
])
.run();
}

0 comments on commit c5de40e

Please sign in to comment.