Auto merge of #127121 - GuillaumeGomez:rollup-xjjjckn, r=GuillaumeGomez

Rollup of 7 pull requests

Successful merges:

 - #126805 (Migrate `pdb-alt-path`, `mismatching-target-triples` and `mingw-export-call-convention` `run-make` tests to rmake)
 - #126995 (Migrate `pretty-print-with-dep-file`, `pretty-print-to-file` and `libtest-padding` `run-make` tests to rmake)
 - #127041 (Migrate `run-make/override-aliased-flags` to `rmake.rs`)
 - #127072 (docs: say "includes" instead of "does include")
 - #127073 (Remove unnecessary SeqCst in `impl fmt::Pointer for AtomicPtr`)
 - #127112 (Bootstrap: Don't get output if `lldb --version` errors)
 - #127116 (Migrate `run-make/return-non-c-like-enum` to `rmake.rs`)

Failed merges:

 - #127050 (Make mtime of reproducible tarballs dependent on git commit)

r? `@ghost`
`@rustbot` modify labels: rollup
This commit is contained in:
bors 2024-06-29 14:00:29 +00:00
commit 19a1d2b404
20 changed files with 203 additions and 124 deletions

View File

@ -3766,7 +3766,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
#[stable(feature = "atomic_pointer", since = "1.24.0")]
impl<T> fmt::Pointer for AtomicPtr<T> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Pointer::fmt(&self.load(Ordering::SeqCst), f)
fmt::Pointer::fmt(&self.load(Ordering::Relaxed), f)
}
}

View File

@ -842,7 +842,7 @@ pub const fn checked_div(self, rhs: u32) -> Option<Duration> {
/// Returns the number of seconds contained by this `Duration` as `f64`.
///
/// The returned value does include the fractional (nanosecond) part of the duration.
/// The returned value includes the fractional (nanosecond) part of the duration.
///
/// # Examples
/// ```
@ -861,7 +861,7 @@ pub const fn as_secs_f64(&self) -> f64 {
/// Returns the number of seconds contained by this `Duration` as `f32`.
///
/// The returned value does include the fractional (nanosecond) part of the duration.
/// The returned value includes the fractional (nanosecond) part of the duration.
///
/// # Examples
/// ```
@ -880,7 +880,7 @@ pub const fn as_secs_f32(&self) -> f32 {
/// Returns the number of milliseconds contained by this `Duration` as `f64`.
///
/// The returned value does include the fractional (nanosecond) part of the duration.
/// The returned value includes the fractional (nanosecond) part of the duration.
///
/// # Examples
/// ```
@ -901,7 +901,7 @@ pub const fn as_millis_f64(&self) -> f64 {
/// Returns the number of milliseconds contained by this `Duration` as `f32`.
///
/// The returned value does include the fractional (nanosecond) part of the duration.
/// The returned value includes the fractional (nanosecond) part of the duration.
///
/// # Examples
/// ```

View File

@ -1817,23 +1817,25 @@ fn run(self, builder: &Builder<'_>) {
cmd.arg("--gdb").arg(gdb);
}
let run = |cmd: &mut Command| {
cmd.output().map(|output| {
String::from_utf8_lossy(&output.stdout)
.lines()
.next()
.unwrap_or_else(|| panic!("{:?} failed {:?}", cmd, output))
.to_string()
})
};
let lldb_exe = builder.config.lldb.clone().unwrap_or_else(|| PathBuf::from("lldb"));
let lldb_version = Command::new(&lldb_exe)
.arg("--version")
.output()
.map(|output| String::from_utf8_lossy(&output.stdout).to_string())
.ok();
.map(|output| {
(String::from_utf8_lossy(&output.stdout).to_string(), output.status.success())
})
.ok()
.and_then(|(output, success)| if success { Some(output) } else { None });
if let Some(ref vers) = lldb_version {
let run = |cmd: &mut Command| {
cmd.output().map(|output| {
String::from_utf8_lossy(&output.stdout)
.lines()
.next()
.unwrap_or_else(|| panic!("{:?} failed {:?}", cmd, output))
.to_string()
})
};
cmd.arg("--lldb-version").arg(vers);
let lldb_python_dir = run(Command::new(&lldb_exe).arg("-P")).ok();
if let Some(ref dir) = lldb_python_dir {

View File

@ -82,7 +82,6 @@ run-make/jobserver-error/Makefile
run-make/libs-through-symlinks/Makefile
run-make/libtest-json/Makefile
run-make/libtest-junit/Makefile
run-make/libtest-padding/Makefile
run-make/libtest-thread-limit/Makefile
run-make/link-cfg/Makefile
run-make/link-framework/Makefile
@ -100,8 +99,6 @@ run-make/macos-fat-archive/Makefile
run-make/manual-link/Makefile
run-make/metadata-dep-info/Makefile
run-make/min-global-align/Makefile
run-make/mingw-export-call-convention/Makefile
run-make/mismatching-target-triples/Makefile
run-make/missing-crate-dependency/Makefile
run-make/mixing-libs/Makefile
run-make/msvc-opt-minsize/Makefile
@ -114,13 +111,11 @@ run-make/obey-crate-type-flag/Makefile
run-make/optimization-remarks-dir-pgo/Makefile
run-make/optimization-remarks-dir/Makefile
run-make/output-type-permutations/Makefile
run-make/override-aliased-flags/Makefile
run-make/panic-abort-eh_frame/Makefile
run-make/pass-linker-flags-flavor/Makefile
run-make/pass-linker-flags-from-dep/Makefile
run-make/pass-linker-flags/Makefile
run-make/pass-non-c-like-enum-to-c/Makefile
run-make/pdb-alt-path/Makefile
run-make/pdb-buildinfo-cl-cmd/Makefile
run-make/pgo-gen-lto/Makefile
run-make/pgo-gen-no-imp-symbols/Makefile
@ -128,8 +123,6 @@ run-make/pgo-gen/Makefile
run-make/pgo-indirect-call-promotion/Makefile
run-make/pgo-use/Makefile
run-make/pointer-auth-link-with-c/Makefile
run-make/pretty-print-to-file/Makefile
run-make/pretty-print-with-dep-file/Makefile
run-make/print-calling-conventions/Makefile
run-make/print-target-list/Makefile
run-make/profile/Makefile
@ -147,7 +140,6 @@ run-make/remap-path-prefix/Makefile
run-make/reproducible-build-2/Makefile
run-make/reproducible-build/Makefile
run-make/return-non-c-like-enum-from-c/Makefile
run-make/return-non-c-like-enum/Makefile
run-make/rlib-chain/Makefile
run-make/rlib-format-packed-bundled-libs-2/Makefile
run-make/rlib-format-packed-bundled-libs-3/Makefile

View File

@ -1,14 +0,0 @@
# ignore-cross-compile because we run the compiled code
# needs-unwind because #[bench] and -Cpanic=abort requires -Zpanic-abort-tests
include ../tools.mk
NORMALIZE=sed 's%[0-9,\.]\{1,\} ns/iter (+/- [0-9,\.]\{1,\})%?? ns/iter (+/- ??)%' | sed 's%finished in [0-9\.]\{1,\}%finished in ??%'
all:
$(RUSTC) --test tests.rs
$(call RUN,tests) --test-threads=1 | $(NORMALIZE) > "$(TMPDIR)"/test.stdout
$(RUSTC_TEST_OP) "$(TMPDIR)"/test.stdout test.stdout
$(call RUN,tests) --test-threads=1 --bench | $(NORMALIZE) > "$(TMPDIR)"/bench.stdout
$(RUSTC_TEST_OP) "$(TMPDIR)"/bench.stdout bench.stdout

View File

@ -0,0 +1,46 @@
// Benchmarks, when ran as tests, would cause strange indentations
// to appear in the output. This was because padding formatting was
// applied before the conversion from bench to test, and not afterwards.
// Now that this bug has been fixed in #118548, this test checks that it
// does not make a resurgence by comparing the output of --bench with an
// example stdout file.
// See https://github.com/rust-lang/rust/issues/104092
//@ ignore-cross-compile
// Reason: the compiled code is ran
//@ needs-unwind
// Reason: #[bench] requires -Z panic-abort-tests
use run_make_support::{diff, run_with_args, rustc};
fn main() {
rustc().arg("--test").input("tests.rs").run();
let out = run_with_args("tests", &["--test-threads=1"]).stdout_utf8();
diff()
.expected_file("test.stdout")
.actual_text("actual-test-stdout", out)
.normalize(
// Replace all instances of (arbitrary numbers)
// [1.2345 ns/iter (+/- 0.1234)]
// with
// [?? ns/iter (+/- ??)]
r#"(\d+(?:[.,]\d+)*)\s*ns/iter\s*\(\+/-\s*(\d+(?:[.,]\d+)*)\)"#,
"?? ns/iter (+/- ??)",
)
// Replace all instances of (arbitrary numbers)
// finished in 8.0000 s
// with
// finished in ??
.normalize(r#"finished\s+in\s+(\d+(?:\.\d+)*)"#, "finished in ??")
.run();
let out = run_with_args("tests", &["--test-threads=1", "--bench"]).stdout_utf8();
diff()
.expected_file("bench.stdout")
.actual_text("actual-bench-stdout", out)
.normalize(
r#"(\d+(?:[.,]\d+)*)\s*ns/iter\s*\(\+/-\s*(\d+(?:[.,]\d+)*)\)"#,
"?? ns/iter (+/- ??)",
)
.normalize(r#"finished\s+in\s+(\d+(?:\.\d+)*)"#, "finished in ??")
.run();
}

View File

@ -1,9 +0,0 @@
include ../tools.mk
# only-windows-gnu
all:
$(RUSTC) foo.rs
# FIXME: we should make sure __stdcall calling convention is used here
# but that only works with LLD right now
nm -g "$(call IMPLIB,foo)" | $(CGREP) bar

View File

@ -0,0 +1,13 @@
// On windows-gnu, symbol exporting used to fail to export names
// with no_mangle. #72049 brought this feature up to par with msvc,
// and this test checks that the symbol "bar" is successfully exported.
// See https://github.com/rust-lang/rust/issues/50176
//@ only-x86_64-pc-windows-gnu
use run_make_support::{llvm_readobj, rustc};
fn main() {
rustc().input("foo.rs").run();
llvm_readobj().arg("--all").input("libfoo.dll.a").run().assert_stdout_contains("bar");
}

View File

@ -1,11 +0,0 @@
include ../tools.mk
# Issue #10814
#
# these are no_std to avoid having to have the standard library or any
# linkers/assemblers for the relevant platform
all:
$(RUSTC) foo.rs --target=i686-unknown-linux-gnu
$(RUSTC) bar.rs --target=x86_64-unknown-linux-gnu 2>&1 \
| $(CGREP) 'couldn'"'"'t find crate `foo` with expected target triple x86_64-unknown-linux-gnu'

View File

@ -0,0 +1,15 @@
// In this test, foo links against 32-bit architecture, and then, bar, which depends
// on foo, links against 64-bit architecture, causing a metadata mismatch due to the
// differences in target architectures. This used to cause an internal compiler error,
// now replaced by a clearer normal error message. This test checks that this aforementioned
// error message is used.
// See https://github.com/rust-lang/rust/issues/10814
use run_make_support::rustc;
fn main() {
rustc().input("foo.rs").target("i686-unknown-linux-gnu").run();
rustc().input("bar.rs").target("x86_64-unknown-linux-gnu").run_fail().assert_stderr_contains(
r#"couldn't find crate `foo` with expected target triple x86_64-unknown-linux-gnu"#,
);
}

View File

@ -1,23 +0,0 @@
# ignore-cross-compile
include ../tools.mk
# FIXME: it would be good to check that it's actually the rightmost flags
# that are used when multiple flags are specified, but I can't think of a
# reliable way to check this.
all:
# Test that `-O` and `-C opt-level` can be specified multiple times.
# The rightmost flag will be used over any previous flags.
$(RUSTC) -O -O main.rs
$(RUSTC) -O -C opt-level=0 main.rs
$(RUSTC) -C opt-level=0 -O main.rs
$(RUSTC) -C opt-level=0 -C opt-level=2 main.rs
$(RUSTC) -C opt-level=2 -C opt-level=0 main.rs
# Test that `-g` and `-C debuginfo` can be specified multiple times.
# The rightmost flag will be used over any previous flags.
$(RUSTC) -g -g main.rs
$(RUSTC) -g -C debuginfo=0 main.rs
$(RUSTC) -C debuginfo=0 -g main.rs
$(RUSTC) -C debuginfo=0 -C debuginfo=2 main.rs
$(RUSTC) -C debuginfo=2 -C debuginfo=0 main.rs

View File

@ -0,0 +1,24 @@
//@ ignore-cross-compile
use run_make_support::rustc;
// FIXME: it would be good to check that it's actually the rightmost flags
// that are used when multiple flags are specified, but I can't think of a
// reliable way to check this.
fn main() {
// Test that `-O` and `-C opt-level` can be specified multiple times.
// The rightmost flag will be used over any previous flags.
rustc().arg("-O").arg("-O").input("main.rs").run();
rustc().arg("-O").arg("-C").arg("opt-level=0").input("main.rs").run();
rustc().arg("-C").arg("opt-level=0").arg("-O").input("main.rs").run();
rustc().arg("-C").arg("opt-level=0").arg("-C").arg("opt-level=2").input("main.rs").run();
rustc().arg("-C").arg("opt-level=2").arg("-C").arg("opt-level=0").input("main.rs").run();
// Test that `-g` and `-C debuginfo` can be specified multiple times.
// The rightmost flag will be used over any previous flags.
rustc().arg("-g").arg("-g").input("main.rs").run();
rustc().arg("-g").arg("-C").arg("debuginfo=0").input("main.rs").run();
rustc().arg("-C").arg("debuginfo=0").arg("-g").input("main.rs").run();
rustc().arg("-C").arg("debuginfo=0").arg("-C").arg("debuginfo=2").input("main.rs").run();
rustc().arg("-C").arg("debuginfo=2").arg("-C").arg("debuginfo=0").input("main.rs").run();
}

View File

@ -1,20 +0,0 @@
include ../tools.mk
# only-windows-msvc
all:
# Test that we don't have the full path to the PDB file in the binary
$(RUSTC) main.rs -g --crate-name my_crate_name --crate-type bin -Cforce-frame-pointers
$(CGREP) "my_crate_name.pdb" < $(TMPDIR)/my_crate_name.exe
$(CGREP) -v "\\my_crate_name.pdb" < $(TMPDIR)/my_crate_name.exe
# Test that backtraces still can find debuginfo by checking that they contain symbol names and
# source locations.
$(TMPDIR)/my_crate_name.exe &> $(TMPDIR)/backtrace.txt
$(CGREP) "my_crate_name::fn_in_backtrace" < $(TMPDIR)/backtrace.txt
$(CGREP) "main.rs:15" < $(TMPDIR)/backtrace.txt
# Test that explicitly passed `-Clink-arg=/PDBALTPATH:...` is respected
$(RUSTC) main.rs -g --crate-name my_crate_name --crate-type bin -Clink-arg=/PDBALTPATH:abcdefg.pdb -Cforce-frame-pointers
$(CGREP) "abcdefg.pdb" < $(TMPDIR)/my_crate_name.exe
$(CGREP) -v "my_crate_name.pdb" < $(TMPDIR)/my_crate_name.exe

View File

@ -0,0 +1,39 @@
// The information inside a .exe file contains a string of the PDB file name.
// This could be a security concern if the full path was exposed, as it could
// reveal information about the filesystem where the bin was first compiled.
// This should only be overridden by `-Clink-arg=/PDBALTPATH:...` - this test
// checks that no full file paths are exposed and that the override flag is respected.
// See https://github.com/rust-lang/rust/pull/121297
//@ only-x86_64-pc-windows-msvc
use run_make_support::{bin_name, invalid_utf8_contains, invalid_utf8_not_contains, run, rustc};
fn main() {
// Test that we don't have the full path to the PDB file in the binary
rustc()
.input("main.rs")
.arg("-g")
.crate_name("my_crate_name")
.crate_type("bin")
.arg("-Cforce-frame-pointers")
.run();
invalid_utf8_contains(&bin_name("my_crate_name"), "my_crate_name.pdb");
invalid_utf8_not_contains(&bin_name("my_crate_name"), r#"\my_crate_name.pdb"#);
// Test that backtraces still can find debuginfo by checking that they contain symbol names and
// source locations.
let out = run(&bin_name("my_crate_name"));
out.assert_stdout_contains("my_crate_name::fn_in_backtrace");
out.assert_stdout_contains("main.rs:15");
// Test that explicitly passed `-Clink-arg=/PDBALTPATH:...` is respected
rustc()
.input("main.rs")
.arg("-g")
.crate_name("my_crate_name")
.crate_type("bin")
.link_arg("/PDBALTPATH:abcdefg.pdb")
.arg("-Cforce-frame-pointers")
.run();
invalid_utf8_contains(&bin_name("my_crate_name"), "abcdefg.pdb");
invalid_utf8_not_contains(&bin_name("my_crate_name"), "my_crate_name.pdb");
}

View File

@ -1,5 +0,0 @@
include ../tools.mk
all:
$(RUSTC) -o $(TMPDIR)/input.out -Zunpretty=normal input.rs
diff -u $(TMPDIR)/input.out input.pp

View File

@ -0,0 +1,12 @@
// The "pretty-printer" of rustc translates source code into other formats,
// which is useful for debugging. This test checks the "normal" version of
// -Zunpretty, which should format the poorly formatted input.rs into a one-line
// function identical to the one in input.pp.
// See https://github.com/rust-lang/rust/commit/da25539c1ab295ec40261109557dd4526923928c
use run_make_support::{diff, rustc};
fn main() {
rustc().output("input.out").arg("-Zunpretty=normal").input("input.rs").run();
diff().expected_file("input.out").actual_file("input.pp").run();
}

View File

@ -1,9 +0,0 @@
include ../tools.mk
all:
$(RUSTC) --emit=dep-info -Zunpretty=expanded with-dep.rs
$(CGREP) "with-dep.rs" < $(TMPDIR)/with-dep.d
-rm $(TMPDIR)/with-dep.d
$(RUSTC) --emit=dep-info -Zunpretty=normal with-dep.rs
! test -f $(TMPDIR)/with-dep.d

View File

@ -0,0 +1,17 @@
// Passing --emit=dep-info to the Rust compiler should create a .d file...
// but it failed to do so in Rust 1.69.0 when combined with -Z unpretty=expanded
// due to a bug. This test checks that -Z unpretty=expanded does not prevent the
// generation of the dep-info file, and that its -Z unpretty=normal counterpart
// does not get an unexpected dep-info file.
// See https://github.com/rust-lang/rust/issues/112898
use run_make_support::{fs_wrapper, invalid_utf8_contains, rustc};
use std::path::Path;
fn main() {
rustc().emit("dep-info").arg("-Zunpretty=expanded").input("with-dep.rs").run();
invalid_utf8_contains("with-dep.d", "with-dep.rs");
fs_wrapper::remove_file("with-dep.d");
rustc().emit("dep-info").arg("-Zunpretty=normal").input("with-dep.rs").run();
assert!(!Path::new("with-dep.d").exists());
}

View File

@ -1,8 +0,0 @@
# ignore-cross-compile
include ../tools.mk
all:
$(RUSTC) --crate-type=staticlib nonclike.rs
$(CC) test.c $(call STATICLIB,nonclike) $(call OUT_EXE,test) \
$(EXTRACFLAGS) $(EXTRACXXFLAGS)
$(call RUN,test)

View File

@ -0,0 +1,18 @@
// Check that we treat enum variants like union members in call ABIs.
// Added in #68443.
// Original issue: #68190.
//@ ignore-cross-compile
use run_make_support::{cc, extra_c_flags, extra_cxx_flags, run, rustc, static_lib_name};
fn main() {
rustc().crate_type("staticlib").input("nonclike.rs").run();
cc().input("test.c")
.arg(&static_lib_name("nonclike"))
.out_exe("test")
.args(&extra_c_flags())
.args(&extra_cxx_flags())
.run();
run("test");
}