1
Fork 0

Auto merge of #126104 - workingjubilee:rollup-t1ac2ld, r=workingjubilee

Rollup of 12 pull requests

Successful merges:

 - #125220 (Repair several `riscv64gc-unknown-linux-gnu` codegen tests)
 - #126033 (CI: fix publishing of toolstate history)
 - #126034 (Clarify our tier 1 Windows Server support)
 - #126035 (Some minor query system cleanups)
 - #126051 (Clarify an `x fmt` error.)
 - #126059 (Raise `DEFAULT_MIN_STACK_SIZE` to at least 64KiB)
 - #126064 (Migrate `run-make/manual-crate-name` to `rmake.rs`)
 - #126072 (compiletest: Allow multiple `//@ run-flags:` headers)
 - #126073 (Port `tests/run-make-fulldeps/obtain-borrowck` to ui-fulldeps)
 - #126081 (Do not use relative paths to Rust source root in run-make tests)
 - #126086 (use windows compatible executable name for libcxx-version)
 - #126096 ([RFC-2011] Allow `core_intrinsics` when activated)

r? `@ghost`
`@rustbot` modify labels: rollup
This commit is contained in:
bors 2024-06-06 22:27:56 +00:00
commit 76e7a0849c
36 changed files with 123 additions and 93 deletions

View file

@ -38,6 +38,8 @@ concurrency:
cancel-in-progress: true cancel-in-progress: true
env: env:
TOOLSTATE_REPO: "https://github.com/rust-lang-nursery/rust-toolstate" TOOLSTATE_REPO: "https://github.com/rust-lang-nursery/rust-toolstate"
# This will be empty in PR jobs.
TOOLSTATE_REPO_ACCESS_TOKEN: ${{ secrets.TOOLSTATE_REPO_ACCESS_TOKEN }}
jobs: jobs:
# The job matrix for `calculate_matrix` is defined in src/ci/github-actions/jobs.yml. # The job matrix for `calculate_matrix` is defined in src/ci/github-actions/jobs.yml.
# It calculates which jobs should be executed, based on the data of the ${{ github }} context. # It calculates which jobs should be executed, based on the data of the ${{ github }} context.
@ -242,6 +244,5 @@ jobs:
shell: bash shell: bash
if: needs.calculate_matrix.outputs.run_type == 'auto' if: needs.calculate_matrix.outputs.run_type == 'auto'
env: env:
TOOLSTATE_REPO_ACCESS_TOKEN: ${{ secrets.TOOLSTATE_REPO_ACCESS_TOKEN }}
TOOLSTATE_ISSUES_API_URL: https://api.github.com/repos/rust-lang/rust/issues TOOLSTATE_ISSUES_API_URL: https://api.github.com/repos/rust-lang/rust/issues
TOOLSTATE_PUBLISH: 1 TOOLSTATE_PUBLISH: 1

View file

@ -57,7 +57,6 @@ impl<'cx, 'a> Context<'cx, 'a> {
/// Builds the whole `assert!` expression. For example, `let elem = 1; assert!(elem == 1);` expands to: /// Builds the whole `assert!` expression. For example, `let elem = 1; assert!(elem == 1);` expands to:
/// ///
/// ```rust /// ```rust
/// #![feature(generic_assert_internals)]
/// let elem = 1; /// let elem = 1;
/// { /// {
/// #[allow(unused_imports)] /// #[allow(unused_imports)]

View file

@ -314,6 +314,17 @@ pub fn rustc_queries(input: TokenStream) -> TokenStream {
let mut query_description_stream = quote! {}; let mut query_description_stream = quote! {};
let mut query_cached_stream = quote! {}; let mut query_cached_stream = quote! {};
let mut feedable_queries = quote! {}; let mut feedable_queries = quote! {};
let mut errors = quote! {};
macro_rules! assert {
( $cond:expr, $span:expr, $( $tt:tt )+ ) => {
if !$cond {
errors.extend(
Error::new($span, format!($($tt)+)).into_compile_error(),
);
}
}
}
for query in queries.0 { for query in queries.0 {
let Query { name, arg, modifiers, .. } = &query; let Query { name, arg, modifiers, .. } = &query;
@ -369,10 +380,15 @@ pub fn rustc_queries(input: TokenStream) -> TokenStream {
[#attribute_stream] fn #name(#arg) #result, [#attribute_stream] fn #name(#arg) #result,
}); });
if modifiers.feedable.is_some() { if let Some(feedable) = &modifiers.feedable {
assert!(modifiers.anon.is_none(), "Query {name} cannot be both `feedable` and `anon`."); assert!(
modifiers.anon.is_none(),
feedable.span(),
"Query {name} cannot be both `feedable` and `anon`."
);
assert!( assert!(
modifiers.eval_always.is_none(), modifiers.eval_always.is_none(),
feedable.span(),
"Query {name} cannot be both `feedable` and `eval_always`." "Query {name} cannot be both `feedable` and `eval_always`."
); );
feedable_queries.extend(quote! { feedable_queries.extend(quote! {
@ -407,5 +423,6 @@ pub fn rustc_queries(input: TokenStream) -> TokenStream {
use super::*; use super::*;
#query_cached_stream #query_cached_stream
} }
#errors
}) })
} }

View file

@ -64,7 +64,6 @@ pub struct MarkFrame<'a> {
parent: Option<&'a MarkFrame<'a>>, parent: Option<&'a MarkFrame<'a>>,
} }
#[derive(PartialEq)]
enum DepNodeColor { enum DepNodeColor {
Red, Red,
Green(DepNodeIndex), Green(DepNodeIndex),
@ -925,7 +924,7 @@ impl<D: Deps> DepGraph<D> {
/// Returns true if the given node has been marked as red during the /// Returns true if the given node has been marked as red during the
/// current compilation session. Used in various assertions /// current compilation session. Used in various assertions
pub fn is_red(&self, dep_node: &DepNode) -> bool { pub fn is_red(&self, dep_node: &DepNode) -> bool {
self.node_color(dep_node) == Some(DepNodeColor::Red) matches!(self.node_color(dep_node), Some(DepNodeColor::Red))
} }
/// Returns true if the given node has been marked as green during the /// Returns true if the given node has been marked as green during the

View file

@ -1569,7 +1569,12 @@ pub(crate) mod builtin {
#[rustc_builtin_macro] #[rustc_builtin_macro]
#[macro_export] #[macro_export]
#[rustc_diagnostic_item = "assert_macro"] #[rustc_diagnostic_item = "assert_macro"]
#[allow_internal_unstable(panic_internals, edition_panic, generic_assert_internals)] #[allow_internal_unstable(
core_intrinsics,
panic_internals,
edition_panic,
generic_assert_internals
)]
macro_rules! assert { macro_rules! assert {
($cond:expr $(,)?) => {{ /* compiler built-in */ }}; ($cond:expr $(,)?) => {{ /* compiler built-in */ }};
($cond:expr, $($arg:tt)+) => {{ /* compiler built-in */ }}; ($cond:expr, $($arg:tt)+) => {{ /* compiler built-in */ }};

View file

@ -7,7 +7,7 @@ use crate::time::Duration;
pub struct Thread(!); pub struct Thread(!);
pub const DEFAULT_MIN_STACK_SIZE: usize = 4096; pub const DEFAULT_MIN_STACK_SIZE: usize = 64 * 1024;
impl Thread { impl Thread {
// unsafe: see thread::Builder::spawn_unchecked for safety requirements // unsafe: see thread::Builder::spawn_unchecked for safety requirements

View file

@ -6,7 +6,7 @@ use crate::time::Duration;
pub struct Thread(!); pub struct Thread(!);
pub const DEFAULT_MIN_STACK_SIZE: usize = 4096; pub const DEFAULT_MIN_STACK_SIZE: usize = 64 * 1024;
impl Thread { impl Thread {
// unsafe: see thread::Builder::spawn_unchecked for safety requirements // unsafe: see thread::Builder::spawn_unchecked for safety requirements

View file

@ -66,7 +66,7 @@ cfg_if::cfg_if! {
} }
} }
pub const DEFAULT_MIN_STACK_SIZE: usize = 4096; pub const DEFAULT_MIN_STACK_SIZE: usize = 64 * 1024;
impl Thread { impl Thread {
// unsafe: see thread::Builder::spawn_unchecked for safety requirements // unsafe: see thread::Builder::spawn_unchecked for safety requirements

View file

@ -6,7 +6,7 @@ use crate::time::Duration;
pub struct Thread(!); pub struct Thread(!);
pub const DEFAULT_MIN_STACK_SIZE: usize = 4096; pub const DEFAULT_MIN_STACK_SIZE: usize = 64 * 1024;
impl Thread { impl Thread {
// unsafe: see thread::Builder::spawn_unchecked for safety requirements // unsafe: see thread::Builder::spawn_unchecked for safety requirements

View file

@ -118,7 +118,9 @@ fn print_paths(verb: &str, adjective: Option<&str>, paths: &[String]) {
pub fn format(build: &Builder<'_>, check: bool, all: bool, paths: &[PathBuf]) { pub fn format(build: &Builder<'_>, check: bool, all: bool, paths: &[PathBuf]) {
if !paths.is_empty() { if !paths.is_empty() {
eprintln!("fmt error: path arguments are not accepted"); eprintln!(
"fmt error: path arguments are no longer accepted; use `--all` to format everything"
);
crate::exit!(1); crate::exit!(1);
}; };
if build.config.dry_run() { if build.config.dry_run() {

View file

@ -834,7 +834,7 @@ impl Step for LibcxxVersionTool {
let compiler = builder.cxx(self.target).unwrap(); let compiler = builder.cxx(self.target).unwrap();
let mut cmd = Command::new(compiler); let mut cmd = Command::new(compiler);
let executable = out_dir.join("libcxx-version"); let executable = out_dir.join(exe("libcxx-version", self.target));
cmd.arg("-o").arg(&executable).arg(builder.src.join("src/tools/libcxx-version/main.cpp")); cmd.arg("-o").arg(&executable).arg(builder.src.join("src/tools/libcxx-version/main.cpp"));
builder.run_cmd(&mut cmd); builder.run_cmd(&mut cmd);

View file

@ -58,6 +58,7 @@ envs:
CACHES_AWS_ACCESS_KEY_ID: AKIA46X5W6CZI5DHEBFL CACHES_AWS_ACCESS_KEY_ID: AKIA46X5W6CZI5DHEBFL
ARTIFACTS_AWS_ACCESS_KEY_ID: AKIA46X5W6CZN24CBO55 ARTIFACTS_AWS_ACCESS_KEY_ID: AKIA46X5W6CZN24CBO55
AWS_REGION: us-west-1 AWS_REGION: us-west-1
TOOLSTATE_PUBLISH: 1
try: try:
<<: *production <<: *production

View file

@ -24,8 +24,8 @@ cd rust-toolstate
FAILURE=1 FAILURE=1
for RETRY_COUNT in 1 2 3 4 5; do for RETRY_COUNT in 1 2 3 4 5; do
# The purpose of this is to publish the new "current" toolstate in the toolstate repo. # The purpose of this is to publish the new "current" toolstate in the toolstate repo.
# This happens post-landing, on master. # This happens at the end of auto builds.
# (Publishing the per-commit test results happens pre-landing in src/bootstrap/toolstate.rs). # (Publishing the per-commit test results happens in src/bootstrap/toolstate.rs).
"$(ciCheckoutPath)/src/tools/publish_toolstate.py" "$GIT_COMMIT" \ "$(ciCheckoutPath)/src/tools/publish_toolstate.py" "$GIT_COMMIT" \
"$GIT_COMMIT_MSG" \ "$GIT_COMMIT_MSG" \
"$MESSAGE_FILE" \ "$MESSAGE_FILE" \

View file

@ -33,12 +33,12 @@ All tier 1 targets with host tools support the full standard library.
target | notes target | notes
-------|------- -------|-------
`aarch64-unknown-linux-gnu` | ARM64 Linux (kernel 4.1, glibc 2.17+) `aarch64-unknown-linux-gnu` | ARM64 Linux (kernel 4.1, glibc 2.17+)
`i686-pc-windows-gnu` | 32-bit MinGW (Windows 10+) [^x86_32-floats-return-ABI] `i686-pc-windows-gnu` | 32-bit MinGW (Windows 10+, Windows Server 2016+) [^x86_32-floats-return-ABI]
`i686-pc-windows-msvc` | 32-bit MSVC (Windows 10+) [^x86_32-floats-return-ABI] `i686-pc-windows-msvc` | 32-bit MSVC (Windows 10+, Windows Server 2016+) [^x86_32-floats-return-ABI]
`i686-unknown-linux-gnu` | 32-bit Linux (kernel 3.2+, glibc 2.17+) [^x86_32-floats-return-ABI] `i686-unknown-linux-gnu` | 32-bit Linux (kernel 3.2+, glibc 2.17+) [^x86_32-floats-return-ABI]
[`x86_64-apple-darwin`](platform-support/apple-darwin.md) | 64-bit macOS (10.12+, Sierra+) [`x86_64-apple-darwin`](platform-support/apple-darwin.md) | 64-bit macOS (10.12+, Sierra+)
`x86_64-pc-windows-gnu` | 64-bit MinGW (Windows 10+) `x86_64-pc-windows-gnu` | 64-bit MinGW (Windows 10+, Windows Server 2016+)
`x86_64-pc-windows-msvc` | 64-bit MSVC (Windows 10+) `x86_64-pc-windows-msvc` | 64-bit MSVC (Windows 10+, Windows Server 2016+)
`x86_64-unknown-linux-gnu` | 64-bit Linux (kernel 3.2+, glibc 2.17+) `x86_64-unknown-linux-gnu` | 64-bit Linux (kernel 3.2+, glibc 2.17+)
[^x86_32-floats-return-ABI]: Due to limitations of the C ABI, floating-point support on `i686` targets is non-compliant: floating-point return values are passed via an x87 register, so NaN payload bits can be lost. See [issue #114479][x86-32-float-issue]. [^x86_32-floats-return-ABI]: Due to limitations of the C ABI, floating-point support on `i686` targets is non-compliant: floating-point return values are passed via an x87 register, so NaN payload bits can be lost. See [issue #114479][x86-32-float-issue].

View file

@ -94,7 +94,7 @@ pub struct TestProps {
// Extra flags to pass to the compiler // Extra flags to pass to the compiler
pub compile_flags: Vec<String>, pub compile_flags: Vec<String>,
// Extra flags to pass when the compiled code is run (such as --bench) // Extra flags to pass when the compiled code is run (such as --bench)
pub run_flags: Option<String>, pub run_flags: Vec<String>,
// If present, the name of a file that this test should match when // If present, the name of a file that this test should match when
// pretty-printed // pretty-printed
pub pp_exact: Option<PathBuf>, pub pp_exact: Option<PathBuf>,
@ -262,7 +262,7 @@ impl TestProps {
error_patterns: vec![], error_patterns: vec![],
regex_error_patterns: vec![], regex_error_patterns: vec![],
compile_flags: vec![], compile_flags: vec![],
run_flags: None, run_flags: vec![],
pp_exact: None, pp_exact: None,
aux_builds: vec![], aux_builds: vec![],
aux_bins: vec![], aux_bins: vec![],
@ -399,7 +399,9 @@ impl TestProps {
config.parse_and_update_revisions(ln, &mut self.revisions); config.parse_and_update_revisions(ln, &mut self.revisions);
config.set_name_value_directive(ln, RUN_FLAGS, &mut self.run_flags, |r| r); if let Some(flags) = config.parse_name_value_directive(ln, RUN_FLAGS) {
self.run_flags.extend(split_flags(&flags));
}
if self.pp_exact.is_none() { if self.pp_exact.is_none() {
self.pp_exact = config.parse_pp_exact(ln, testfile); self.pp_exact = config.parse_pp_exact(ln, testfile);

View file

@ -2355,7 +2355,7 @@ impl<'test> TestCx<'test> {
args.push(exe_file.into_os_string()); args.push(exe_file.into_os_string());
// Add the arguments in the run_flags directive // Add the arguments in the run_flags directive
args.extend(self.split_maybe_args(&self.props.run_flags)); args.extend(self.props.run_flags.iter().map(OsString::from));
let prog = args.remove(0); let prog = args.remove(0);
ProcArgs { prog, args } ProcArgs { prog, args }
@ -2469,6 +2469,7 @@ impl<'test> TestCx<'test> {
} }
} }
#[track_caller]
fn fatal(&self, err: &str) -> ! { fn fatal(&self, err: &str) -> ! {
self.error(err); self.error(err);
error!("fatal error, panic: {:?}", err); error!("fatal error, panic: {:?}", err);
@ -4173,10 +4174,12 @@ impl<'test> TestCx<'test> {
} }
fn normalize_output(&self, output: &str, custom_rules: &[(String, String)]) -> String { fn normalize_output(&self, output: &str, custom_rules: &[(String, String)]) -> String {
let rflags = self.props.run_flags.as_ref(); // Crude heuristic to detect when the output should have JSON-specific
// normalization steps applied.
let rflags = self.props.run_flags.join(" ");
let cflags = self.props.compile_flags.join(" "); let cflags = self.props.compile_flags.join(" ");
let json = rflags let json = rflags.contains("--format json")
.map_or(false, |s| s.contains("--format json") || s.contains("--format=json")) || rflags.contains("--format=json")
|| cflags.contains("--error-format json") || cflags.contains("--error-format json")
|| cflags.contains("--error-format pretty-json") || cflags.contains("--error-format pretty-json")
|| cflags.contains("--error-format=json") || cflags.contains("--error-format=json")

View file

@ -83,11 +83,12 @@ pub fn python_command() -> Command {
pub fn htmldocck() -> Command { pub fn htmldocck() -> Command {
let mut python = python_command(); let mut python = python_command();
python.arg(source_path().join("src/etc/htmldocck.py")); python.arg(source_root().join("src/etc/htmldocck.py"));
python python
} }
pub fn source_path() -> PathBuf { /// Path to the root rust-lang/rust source checkout.
pub fn source_root() -> PathBuf {
env_var("S").into() env_var("S").into()
} }

View file

@ -123,9 +123,7 @@ If you want to install the `browser-ui-test` dependency, run `npm install browse
cargo.env("RUSTDOCFLAGS", test_props.compile_flags.join(" ")); cargo.env("RUSTDOCFLAGS", test_props.compile_flags.join(" "));
} }
if let Some(flags) = &test_props.run_flags { cargo.args(&test_props.run_flags);
cargo.arg(flags);
}
} }
if try_run(&mut cargo, config.verbose).is_err() { if try_run(&mut cargo, config.verbose).is_err() {

View file

@ -135,7 +135,6 @@ run-make/lto-readonly-lib/Makefile
run-make/lto-smoke-c/Makefile run-make/lto-smoke-c/Makefile
run-make/macos-deployment-target/Makefile run-make/macos-deployment-target/Makefile
run-make/macos-fat-archive/Makefile run-make/macos-fat-archive/Makefile
run-make/manual-crate-name/Makefile
run-make/manual-link/Makefile run-make/manual-link/Makefile
run-make/many-crates-but-no-match/Makefile run-make/many-crates-but-no-match/Makefile
run-make/metadata-dep-info/Makefile run-make/metadata-dep-info/Makefile

View file

@ -23,7 +23,7 @@ pub fn do_call() {
unsafe { unsafe {
// Ensure that we `call` LLVM intrinsics instead of trying to `invoke` them // Ensure that we `call` LLVM intrinsics instead of trying to `invoke` them
// CHECK: store float 4.000000e+00, float* %{{.}}, align 4 // CHECK: store float 4.000000e+00, ptr %{{.}}, align 4
// CHECK: call float @llvm.sqrt.f32(float %{{.}} // CHECK: call float @llvm.sqrt.f32(float %{{.}}
sqrt(4.0); sqrt(4.0);
} }

View file

@ -1,10 +1,19 @@
// //@ compile-flags: -O -C no-prepopulate-passes --target riscv64gc-unknown-linux-gnu
//@ compile-flags: -C no-prepopulate-passes //@ needs-llvm-components: riscv
//@ only-riscv64
//@ only-linux
#![crate_type = "lib"]
// CHECK: define void @f_fpr_tracking(double %0, double %1, double %2, double %3, double %4, double %5, double %6, double %7, i8 zeroext %i) #![feature(no_core, lang_items)]
#![crate_type = "lib"]
#![no_std]
#![no_core]
#[lang = "sized"]
trait Sized {}
#[lang = "freeze"]
trait Freeze {}
#[lang = "copy"]
trait Copy {}
// CHECK: define void @f_fpr_tracking(double %0, double %1, double %2, double %3, double %4, double %5, double %6, double %7, i8 noundef zeroext %i)
#[no_mangle] #[no_mangle]
pub extern "C" fn f_fpr_tracking( pub extern "C" fn f_fpr_tracking(
a: f64, a: f64,
@ -144,7 +153,7 @@ pub extern "C" fn f_ret_double_int64_s() -> DoubleInt64 {
DoubleInt64 { f: 1., i: 2 } DoubleInt64 { f: 1., i: 2 }
} }
// CHECK: define void @f_double_int8_s_arg_insufficient_gprs(i32 signext %a, i32 signext %b, i32 signext %c, i32 signext %d, i32 signext %e, i32 signext %f, i32 signext %g, i32 signext %h, [2 x i64] %0) // CHECK: define void @f_double_int8_s_arg_insufficient_gprs(i32 noundef signext %a, i32 noundef signext %b, i32 noundef signext %c, i32 noundef signext %d, i32 noundef signext %e, i32 noundef signext %f, i32 noundef signext %g, i32 noundef signext %h, [2 x i64] %0)
#[no_mangle] #[no_mangle]
pub extern "C" fn f_double_int8_s_arg_insufficient_gprs( pub extern "C" fn f_double_int8_s_arg_insufficient_gprs(
a: i32, a: i32,
@ -250,11 +259,11 @@ pub struct IntDoubleInt {
c: i32, c: i32,
} }
// CHECK: define void @f_int_double_int_s_arg(%IntDoubleInt* {{.*}}%a) // CHECK: define void @f_int_double_int_s_arg(ptr {{.*}} %a)
#[no_mangle] #[no_mangle]
pub extern "C" fn f_int_double_int_s_arg(a: IntDoubleInt) {} pub extern "C" fn f_int_double_int_s_arg(a: IntDoubleInt) {}
// CHECK: define void @f_ret_int_double_int_s(%IntDoubleInt* {{.*}}sret // CHECK: define void @f_ret_int_double_int_s(ptr {{.*}} sret([24 x i8]) align 8 dereferenceable(24) %_0)
#[no_mangle] #[no_mangle]
pub extern "C" fn f_ret_int_double_int_s() -> IntDoubleInt { pub extern "C" fn f_ret_int_double_int_s() -> IntDoubleInt {
IntDoubleInt { a: 1, b: 2., c: 3 } IntDoubleInt { a: 1, b: 2., c: 3 }

View file

@ -1,10 +1,19 @@
// //@ compile-flags: -O -C no-prepopulate-passes --target riscv64gc-unknown-linux-gnu
//@ compile-flags: -C no-prepopulate-passes //@ needs-llvm-components: riscv
//@ only-riscv64
//@ only-linux
#![crate_type = "lib"]
// CHECK: define void @f_fpr_tracking(float %0, float %1, float %2, float %3, float %4, float %5, float %6, float %7, i8 zeroext %i) #![feature(no_core, lang_items)]
#![crate_type = "lib"]
#![no_std]
#![no_core]
#[lang = "sized"]
trait Sized {}
#[lang = "freeze"]
trait Freeze {}
#[lang = "copy"]
trait Copy {}
// CHECK: define void @f_fpr_tracking(float %0, float %1, float %2, float %3, float %4, float %5, float %6, float %7, i8 noundef zeroext %i)
#[no_mangle] #[no_mangle]
pub extern "C" fn f_fpr_tracking( pub extern "C" fn f_fpr_tracking(
a: f32, a: f32,
@ -128,7 +137,7 @@ pub extern "C" fn f_ret_float_int64_s() -> FloatInt64 {
FloatInt64 { f: 1., i: 2 } FloatInt64 { f: 1., i: 2 }
} }
// CHECK: define void @f_float_int8_s_arg_insufficient_gprs(i32 signext %a, i32 signext %b, i32 signext %c, i32 signext %d, i32 signext %e, i32 signext %f, i32 signext %g, i32 signext %h, i64 %0) // CHECK: define void @f_float_int8_s_arg_insufficient_gprs(i32 noundef signext %a, i32 noundef signext %b, i32 noundef signext %c, i32 noundef signext %d, i32 noundef signext %e, i32 noundef signext %f, i32 noundef signext %g, i32 noundef signext %h, i64 %0)
#[no_mangle] #[no_mangle]
pub extern "C" fn f_float_int8_s_arg_insufficient_gprs( pub extern "C" fn f_float_int8_s_arg_insufficient_gprs(
a: i32, a: i32,

View file

@ -1,26 +0,0 @@
include ../../run-make/tools.mk
# This example shows how to implement a rustc driver that retrieves MIR bodies
# together with the borrow checker information.
# How to run this
# $ ./x.py test tests/run-make-fulldeps/obtain-borrowck
DRIVER_BINARY := "$(TMPDIR)"/driver
SYSROOT := $(shell $(RUSTC) --print sysroot)
ifdef IS_WINDOWS
LIBSTD := -L "$(SYSROOT)\\lib\\rustlib\\$(TARGET)\\lib"
else
LIBSTD :=
endif
all:
$(RUSTC) driver.rs -o "$(DRIVER_BINARY)"
$(TARGET_RPATH_ENV) "$(DRIVER_BINARY)" --sysroot $(SYSROOT) $(LIBSTD) test.rs -o "$(TMPDIR)/driver_test" > "$(TMPDIR)"/output.stdout
ifdef RUSTC_BLESS_TEST
cp "$(TMPDIR)"/output.stdout output.stdout
else
$(DIFF) output.stdout "$(TMPDIR)"/output.stdout
endif

View file

@ -2,14 +2,14 @@
// when the unstable no_global_oom_handling feature is turned on. // when the unstable no_global_oom_handling feature is turned on.
// See https://github.com/rust-lang/rust/pull/84266 // See https://github.com/rust-lang/rust/pull/84266
use run_make_support::rustc; use run_make_support::{rustc, source_root};
fn main() { fn main() {
rustc() rustc()
.edition("2021") .edition("2021")
.arg("-Dwarnings") .arg("-Dwarnings")
.crate_type("rlib") .crate_type("rlib")
.input("../../../library/alloc/src/lib.rs") .input(source_root().join("library/alloc/src/lib.rs"))
.cfg("no_global_oom_handling") .cfg("no_global_oom_handling")
.run(); .run();
} }

View file

@ -2,14 +2,14 @@
// when the unstable no_rc feature is turned on. // when the unstable no_rc feature is turned on.
// See https://github.com/rust-lang/rust/pull/84266 // See https://github.com/rust-lang/rust/pull/84266
use run_make_support::rustc; use run_make_support::{rustc, source_root};
fn main() { fn main() {
rustc() rustc()
.edition("2021") .edition("2021")
.arg("-Dwarnings") .arg("-Dwarnings")
.crate_type("rlib") .crate_type("rlib")
.input("../../../library/alloc/src/lib.rs") .input(source_root().join("library/alloc/src/lib.rs"))
.cfg("no_rc") .cfg("no_rc")
.run(); .run();
} }

View file

@ -2,14 +2,14 @@
// when the unstable no_sync feature is turned on. // when the unstable no_sync feature is turned on.
// See https://github.com/rust-lang/rust/pull/84266 // See https://github.com/rust-lang/rust/pull/84266
use run_make_support::rustc; use run_make_support::{rustc, source_root};
fn main() { fn main() {
rustc() rustc()
.edition("2021") .edition("2021")
.arg("-Dwarnings") .arg("-Dwarnings")
.crate_type("rlib") .crate_type("rlib")
.input("../../../library/alloc/src/lib.rs") .input(source_root().join("library/alloc/src/lib.rs"))
.cfg("no_sync") .cfg("no_sync")
.run(); .run();
} }

View file

@ -1,14 +1,14 @@
// This test checks that the core library of Rust can be compiled without enabling // This test checks that the core library of Rust can be compiled without enabling
// support for formatting and parsing floating-point numbers. // support for formatting and parsing floating-point numbers.
use run_make_support::rustc; use run_make_support::{rustc, source_root};
fn main() { fn main() {
rustc() rustc()
.edition("2021") .edition("2021")
.arg("-Dwarnings") .arg("-Dwarnings")
.crate_type("rlib") .crate_type("rlib")
.input("../../../library/core/src/lib.rs") .input(source_root().join("library/core/src/lib.rs"))
.cfg("no_fp_fmt_parse") .cfg("no_fp_fmt_parse")
.run(); .run();
} }

View file

@ -2,14 +2,14 @@
// when the no_global_oom_handling feature is turned on. // when the no_global_oom_handling feature is turned on.
// See https://github.com/rust-lang/rust/pull/110649 // See https://github.com/rust-lang/rust/pull/110649
use run_make_support::{rustc, tmp_dir}; use run_make_support::{rustc, source_root, tmp_dir};
fn main() { fn main() {
rustc() rustc()
.edition("2021") .edition("2021")
.arg("-Dwarnings") .arg("-Dwarnings")
.crate_type("rlib") .crate_type("rlib")
.input("../../../library/core/src/lib.rs") .input(source_root().join("library/core/src/lib.rs"))
.sysroot(tmp_dir().join("fakeroot")) .sysroot(tmp_dir().join("fakeroot"))
.cfg("no_global_oom_handling") .cfg("no_global_oom_handling")
.run(); .run();

View file

@ -1,5 +0,0 @@
include ../tools.mk
all:
$(RUSTC) --crate-name foo bar.rs
rm $(TMPDIR)/libfoo.rlib

View file

@ -0,0 +1,6 @@
use run_make_support::{rustc, tmp_dir};
fn main() {
rustc().input("bar.rs").crate_name("foo").run();
assert!(tmp_dir().join("libfoo.rlib").is_file());
}

View file

@ -1,4 +1,4 @@
use run_make_support::{htmldocck, rustc, rustdoc, source_path, tmp_dir}; use run_make_support::{htmldocck, rustc, rustdoc, source_root, tmp_dir};
use std::fs::read_dir; use std::fs::read_dir;
use std::path::Path; use std::path::Path;

View file

@ -1,13 +1,13 @@
// Test that rustdoc will properly load in a theme file and display it in the theme selector. // Test that rustdoc will properly load in a theme file and display it in the theme selector.
use run_make_support::{htmldocck, rustdoc, source_path, tmp_dir}; use run_make_support::{htmldocck, rustdoc, source_root, tmp_dir};
fn main() { fn main() {
let out_dir = tmp_dir().join("rustdoc-themes"); let out_dir = tmp_dir().join("rustdoc-themes");
let test_css = out_dir.join("test.css"); let test_css = out_dir.join("test.css");
let no_script = let no_script =
std::fs::read_to_string(source_path().join("src/librustdoc/html/static/css/noscript.css")) std::fs::read_to_string(source_root().join("src/librustdoc/html/static/css/noscript.css"))
.unwrap(); .unwrap();
let mut test_content = String::new(); let mut test_content = String::new();

View file

@ -1,3 +1,5 @@
#![allow(dead_code)]
trait X { trait X {
fn provided(&self) -> usize { fn provided(&self) -> usize {
5 5

View file

@ -1,3 +1,10 @@
//@ edition: 2021
//@ run-pass
//@ check-run-results
//@ run-flags: --sysroot {{sysroot-base}} --edition=2021 {{src-base}}/auxiliary/obtain-borrowck-input.rs
//@ ignore-stage1 (requires matching sysroot built with in-tree compiler)
// ignore-tidy-linelength
#![feature(rustc_private)] #![feature(rustc_private)]
//! This program implements a rustc driver that retrieves MIR bodies with //! This program implements a rustc driver that retrieves MIR bodies with

View file

@ -1,5 +1,6 @@
//@ build-pass //@ build-pass
//@ only-linux //@ only-linux
//@ ignore-riscv64 On this platform `-Csplit-debuginfo=unpacked` is unstable, see #120518
// //
//@ compile-flags: -g --emit=llvm-ir -Csplit-debuginfo=unpacked //@ compile-flags: -g --emit=llvm-ir -Csplit-debuginfo=unpacked
// //