Add a run-make test for checking that certain rustc_ crates build on stable

This commit is contained in:
Jakub Beránek 2024-08-24 10:55:31 +02:00 committed by Rémy Rakic
parent f48062e7d0
commit 893413de5b
5 changed files with 51 additions and 3 deletions

View File

@ -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"))
}

View File

@ -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;

View File

@ -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
}

View File

@ -48,6 +48,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::{
@ -56,7 +57,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.
@ -96,3 +97,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;

View File

@ -0,0 +1,35 @@
//! 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)
let cargo = cargo()
// This is required to allow using nightly cargo features (public-dependency) with beta
// cargo
.env("RUSTC_BOOTSTRAP", "1")
.env("RUSTC", rustc_path())
.arg("build")
.arg("--manifest-path")
.arg(source_root().join("Cargo.toml"))
.args(&[
"--config",
r#"workspace.exclude=["library/core"]"#,
// We want to disallow all nightly features, to simulate a stable build
// public-dependency needs to be enabled for cargo to work
"-Zallow-features=public-dependency",
// Avoid depending on transitive rustc crates
"--no-default-features",
// Check that these crates can be compiled on "stable"
"-p",
"rustc_type_ir",
"-p",
"rustc_next_trait_solver",
"-p",
"rustc_pattern_analysis",
"-p",
"rustc_lexer",
])
.run();
}