authorbors <bors@rust-lang.org> 2024-06-29 14:00:29 UTC
committerbors <bors@rust-lang.org> 2024-06-29 14:00:29 UTC
log19a1d2b404e9f56eb1792cc06ec3c86b5a260b41
treed4e5597952dd1006c96da6eaafdad46e2660bd01
parentf8453359bb30e768a686e5de351c079772c24975
parent69f355a74bf54ff088bbf73d3a540f1a4585003d

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

20 files changed, 203 insertions(+), 124 deletions(-)

library/core/src/sync/atomic.rs+1-1
......@@ -3766,7 +3766,7 @@ impl<T> fmt::Debug for AtomicPtr<T> {
37663766#[stable(feature = "atomic_pointer", since = "1.24.0")]
37673767impl<T> fmt::Pointer for AtomicPtr<T> {
37683768 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3769 fmt::Pointer::fmt(&self.load(Ordering::SeqCst), f)
3769 fmt::Pointer::fmt(&self.load(Ordering::Relaxed), f)
37703770 }
37713771}
37723772
library/core/src/time.rs+4-4
......@@ -842,7 +842,7 @@ impl Duration {
842842
843843 /// Returns the number of seconds contained by this `Duration` as `f64`.
844844 ///
845 /// The returned value does include the fractional (nanosecond) part of the duration.
845 /// The returned value includes the fractional (nanosecond) part of the duration.
846846 ///
847847 /// # Examples
848848 /// ```
......@@ -861,7 +861,7 @@ impl Duration {
861861
862862 /// Returns the number of seconds contained by this `Duration` as `f32`.
863863 ///
864 /// The returned value does include the fractional (nanosecond) part of the duration.
864 /// The returned value includes the fractional (nanosecond) part of the duration.
865865 ///
866866 /// # Examples
867867 /// ```
......@@ -880,7 +880,7 @@ impl Duration {
880880
881881 /// Returns the number of milliseconds contained by this `Duration` as `f64`.
882882 ///
883 /// The returned value does include the fractional (nanosecond) part of the duration.
883 /// The returned value includes the fractional (nanosecond) part of the duration.
884884 ///
885885 /// # Examples
886886 /// ```
......@@ -901,7 +901,7 @@ impl Duration {
901901
902902 /// Returns the number of milliseconds contained by this `Duration` as `f32`.
903903 ///
904 /// The returned value does include the fractional (nanosecond) part of the duration.
904 /// The returned value includes the fractional (nanosecond) part of the duration.
905905 ///
906906 /// # Examples
907907 /// ```
src/bootstrap/src/core/build_steps/test.rs+14-12
......@@ -1817,23 +1817,25 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the
18171817 cmd.arg("--gdb").arg(gdb);
18181818 }
18191819
1820 let run = |cmd: &mut Command| {
1821 cmd.output().map(|output| {
1822 String::from_utf8_lossy(&output.stdout)
1823 .lines()
1824 .next()
1825 .unwrap_or_else(|| panic!("{:?} failed {:?}", cmd, output))
1826 .to_string()
1827 })
1828 };
1829
18301820 let lldb_exe = builder.config.lldb.clone().unwrap_or_else(|| PathBuf::from("lldb"));
18311821 let lldb_version = Command::new(&lldb_exe)
18321822 .arg("--version")
18331823 .output()
1834 .map(|output| String::from_utf8_lossy(&output.stdout).to_string())
1835 .ok();
1824 .map(|output| {
1825 (String::from_utf8_lossy(&output.stdout).to_string(), output.status.success())
1826 })
1827 .ok()
1828 .and_then(|(output, success)| if success { Some(output) } else { None });
18361829 if let Some(ref vers) = lldb_version {
1830 let run = |cmd: &mut Command| {
1831 cmd.output().map(|output| {
1832 String::from_utf8_lossy(&output.stdout)
1833 .lines()
1834 .next()
1835 .unwrap_or_else(|| panic!("{:?} failed {:?}", cmd, output))
1836 .to_string()
1837 })
1838 };
18371839 cmd.arg("--lldb-version").arg(vers);
18381840 let lldb_python_dir = run(Command::new(&lldb_exe).arg("-P")).ok();
18391841 if let Some(ref dir) = lldb_python_dir {
src/tools/tidy/src/allowed_run_make_makefiles.txt-8
......@@ -82,7 +82,6 @@ run-make/jobserver-error/Makefile
8282run-make/libs-through-symlinks/Makefile
8383run-make/libtest-json/Makefile
8484run-make/libtest-junit/Makefile
85run-make/libtest-padding/Makefile
8685run-make/libtest-thread-limit/Makefile
8786run-make/link-cfg/Makefile
8887run-make/link-framework/Makefile
......@@ -100,8 +99,6 @@ run-make/macos-fat-archive/Makefile
10099run-make/manual-link/Makefile
101100run-make/metadata-dep-info/Makefile
102101run-make/min-global-align/Makefile
103run-make/mingw-export-call-convention/Makefile
104run-make/mismatching-target-triples/Makefile
105102run-make/missing-crate-dependency/Makefile
106103run-make/mixing-libs/Makefile
107104run-make/msvc-opt-minsize/Makefile
......@@ -114,13 +111,11 @@ run-make/obey-crate-type-flag/Makefile
114111run-make/optimization-remarks-dir-pgo/Makefile
115112run-make/optimization-remarks-dir/Makefile
116113run-make/output-type-permutations/Makefile
117run-make/override-aliased-flags/Makefile
118114run-make/panic-abort-eh_frame/Makefile
119115run-make/pass-linker-flags-flavor/Makefile
120116run-make/pass-linker-flags-from-dep/Makefile
121117run-make/pass-linker-flags/Makefile
122118run-make/pass-non-c-like-enum-to-c/Makefile
123run-make/pdb-alt-path/Makefile
124119run-make/pdb-buildinfo-cl-cmd/Makefile
125120run-make/pgo-gen-lto/Makefile
126121run-make/pgo-gen-no-imp-symbols/Makefile
......@@ -128,8 +123,6 @@ run-make/pgo-gen/Makefile
128123run-make/pgo-indirect-call-promotion/Makefile
129124run-make/pgo-use/Makefile
130125run-make/pointer-auth-link-with-c/Makefile
131run-make/pretty-print-to-file/Makefile
132run-make/pretty-print-with-dep-file/Makefile
133126run-make/print-calling-conventions/Makefile
134127run-make/print-target-list/Makefile
135128run-make/profile/Makefile
......@@ -147,7 +140,6 @@ run-make/remap-path-prefix/Makefile
147140run-make/reproducible-build-2/Makefile
148141run-make/reproducible-build/Makefile
149142run-make/return-non-c-like-enum-from-c/Makefile
150run-make/return-non-c-like-enum/Makefile
151143run-make/rlib-chain/Makefile
152144run-make/rlib-format-packed-bundled-libs-2/Makefile
153145run-make/rlib-format-packed-bundled-libs-3/Makefile
tests/run-make/libtest-padding/Makefile deleted-14
......@@ -1,14 +0,0 @@
1# ignore-cross-compile because we run the compiled code
2# needs-unwind because #[bench] and -Cpanic=abort requires -Zpanic-abort-tests
3include ../tools.mk
4
5NORMALIZE=sed 's%[0-9,\.]\{1,\} ns/iter (+/- [0-9,\.]\{1,\})%?? ns/iter (+/- ??)%' | sed 's%finished in [0-9\.]\{1,\}%finished in ??%'
6
7all:
8 $(RUSTC) --test tests.rs
9
10 $(call RUN,tests) --test-threads=1 | $(NORMALIZE) > "$(TMPDIR)"/test.stdout
11 $(RUSTC_TEST_OP) "$(TMPDIR)"/test.stdout test.stdout
12
13 $(call RUN,tests) --test-threads=1 --bench | $(NORMALIZE) > "$(TMPDIR)"/bench.stdout
14 $(RUSTC_TEST_OP) "$(TMPDIR)"/bench.stdout bench.stdout
tests/run-make/libtest-padding/rmake.rs created+46
......@@ -0,0 +1,46 @@
1// Benchmarks, when ran as tests, would cause strange indentations
2// to appear in the output. This was because padding formatting was
3// applied before the conversion from bench to test, and not afterwards.
4// Now that this bug has been fixed in #118548, this test checks that it
5// does not make a resurgence by comparing the output of --bench with an
6// example stdout file.
7// See https://github.com/rust-lang/rust/issues/104092
8
9//@ ignore-cross-compile
10// Reason: the compiled code is ran
11//@ needs-unwind
12// Reason: #[bench] requires -Z panic-abort-tests
13
14use run_make_support::{diff, run_with_args, rustc};
15
16fn main() {
17 rustc().arg("--test").input("tests.rs").run();
18 let out = run_with_args("tests", &["--test-threads=1"]).stdout_utf8();
19 diff()
20 .expected_file("test.stdout")
21 .actual_text("actual-test-stdout", out)
22 .normalize(
23 // Replace all instances of (arbitrary numbers)
24 // [1.2345 ns/iter (+/- 0.1234)]
25 // with
26 // [?? ns/iter (+/- ??)]
27 r#"(\d+(?:[.,]\d+)*)\s*ns/iter\s*\(\+/-\s*(\d+(?:[.,]\d+)*)\)"#,
28 "?? ns/iter (+/- ??)",
29 )
30 // Replace all instances of (arbitrary numbers)
31 // finished in 8.0000 s
32 // with
33 // finished in ??
34 .normalize(r#"finished\s+in\s+(\d+(?:\.\d+)*)"#, "finished in ??")
35 .run();
36 let out = run_with_args("tests", &["--test-threads=1", "--bench"]).stdout_utf8();
37 diff()
38 .expected_file("bench.stdout")
39 .actual_text("actual-bench-stdout", out)
40 .normalize(
41 r#"(\d+(?:[.,]\d+)*)\s*ns/iter\s*\(\+/-\s*(\d+(?:[.,]\d+)*)\)"#,
42 "?? ns/iter (+/- ??)",
43 )
44 .normalize(r#"finished\s+in\s+(\d+(?:\.\d+)*)"#, "finished in ??")
45 .run();
46}
tests/run-make/mingw-export-call-convention/Makefile deleted-9
......@@ -1,9 +0,0 @@
1include ../tools.mk
2
3# only-windows-gnu
4
5all:
6 $(RUSTC) foo.rs
7 # FIXME: we should make sure __stdcall calling convention is used here
8 # but that only works with LLD right now
9 nm -g "$(call IMPLIB,foo)" | $(CGREP) bar
tests/run-make/mingw-export-call-convention/rmake.rs created+13
......@@ -0,0 +1,13 @@
1// On windows-gnu, symbol exporting used to fail to export names
2// with no_mangle. #72049 brought this feature up to par with msvc,
3// and this test checks that the symbol "bar" is successfully exported.
4// See https://github.com/rust-lang/rust/issues/50176
5
6//@ only-x86_64-pc-windows-gnu
7
8use run_make_support::{llvm_readobj, rustc};
9
10fn main() {
11 rustc().input("foo.rs").run();
12 llvm_readobj().arg("--all").input("libfoo.dll.a").run().assert_stdout_contains("bar");
13}
tests/run-make/mismatching-target-triples/Makefile deleted-11
......@@ -1,11 +0,0 @@
1include ../tools.mk
2
3# Issue #10814
4#
5# these are no_std to avoid having to have the standard library or any
6# linkers/assemblers for the relevant platform
7
8all:
9 $(RUSTC) foo.rs --target=i686-unknown-linux-gnu
10 $(RUSTC) bar.rs --target=x86_64-unknown-linux-gnu 2>&1 \
11 | $(CGREP) 'couldn'"'"'t find crate `foo` with expected target triple x86_64-unknown-linux-gnu'
tests/run-make/mismatching-target-triples/rmake.rs created+15
......@@ -0,0 +1,15 @@
1// In this test, foo links against 32-bit architecture, and then, bar, which depends
2// on foo, links against 64-bit architecture, causing a metadata mismatch due to the
3// differences in target architectures. This used to cause an internal compiler error,
4// now replaced by a clearer normal error message. This test checks that this aforementioned
5// error message is used.
6// See https://github.com/rust-lang/rust/issues/10814
7
8use run_make_support::rustc;
9
10fn main() {
11 rustc().input("foo.rs").target("i686-unknown-linux-gnu").run();
12 rustc().input("bar.rs").target("x86_64-unknown-linux-gnu").run_fail().assert_stderr_contains(
13 r#"couldn't find crate `foo` with expected target triple x86_64-unknown-linux-gnu"#,
14 );
15}
tests/run-make/override-aliased-flags/Makefile deleted-23
......@@ -1,23 +0,0 @@
1# ignore-cross-compile
2include ../tools.mk
3
4# FIXME: it would be good to check that it's actually the rightmost flags
5# that are used when multiple flags are specified, but I can't think of a
6# reliable way to check this.
7
8all:
9 # Test that `-O` and `-C opt-level` can be specified multiple times.
10 # The rightmost flag will be used over any previous flags.
11 $(RUSTC) -O -O main.rs
12 $(RUSTC) -O -C opt-level=0 main.rs
13 $(RUSTC) -C opt-level=0 -O main.rs
14 $(RUSTC) -C opt-level=0 -C opt-level=2 main.rs
15 $(RUSTC) -C opt-level=2 -C opt-level=0 main.rs
16
17 # Test that `-g` and `-C debuginfo` can be specified multiple times.
18 # The rightmost flag will be used over any previous flags.
19 $(RUSTC) -g -g main.rs
20 $(RUSTC) -g -C debuginfo=0 main.rs
21 $(RUSTC) -C debuginfo=0 -g main.rs
22 $(RUSTC) -C debuginfo=0 -C debuginfo=2 main.rs
23 $(RUSTC) -C debuginfo=2 -C debuginfo=0 main.rs
tests/run-make/override-aliased-flags/rmake.rs created+24
......@@ -0,0 +1,24 @@
1//@ ignore-cross-compile
2
3use run_make_support::rustc;
4
5// FIXME: it would be good to check that it's actually the rightmost flags
6// that are used when multiple flags are specified, but I can't think of a
7// reliable way to check this.
8fn main() {
9 // Test that `-O` and `-C opt-level` can be specified multiple times.
10 // The rightmost flag will be used over any previous flags.
11 rustc().arg("-O").arg("-O").input("main.rs").run();
12 rustc().arg("-O").arg("-C").arg("opt-level=0").input("main.rs").run();
13 rustc().arg("-C").arg("opt-level=0").arg("-O").input("main.rs").run();
14 rustc().arg("-C").arg("opt-level=0").arg("-C").arg("opt-level=2").input("main.rs").run();
15 rustc().arg("-C").arg("opt-level=2").arg("-C").arg("opt-level=0").input("main.rs").run();
16
17 // Test that `-g` and `-C debuginfo` can be specified multiple times.
18 // The rightmost flag will be used over any previous flags.
19 rustc().arg("-g").arg("-g").input("main.rs").run();
20 rustc().arg("-g").arg("-C").arg("debuginfo=0").input("main.rs").run();
21 rustc().arg("-C").arg("debuginfo=0").arg("-g").input("main.rs").run();
22 rustc().arg("-C").arg("debuginfo=0").arg("-C").arg("debuginfo=2").input("main.rs").run();
23 rustc().arg("-C").arg("debuginfo=2").arg("-C").arg("debuginfo=0").input("main.rs").run();
24}
tests/run-make/pdb-alt-path/Makefile deleted-20
......@@ -1,20 +0,0 @@
1include ../tools.mk
2
3# only-windows-msvc
4
5all:
6 # Test that we don't have the full path to the PDB file in the binary
7 $(RUSTC) main.rs -g --crate-name my_crate_name --crate-type bin -Cforce-frame-pointers
8 $(CGREP) "my_crate_name.pdb" < $(TMPDIR)/my_crate_name.exe
9 $(CGREP) -v "\\my_crate_name.pdb" < $(TMPDIR)/my_crate_name.exe
10
11 # Test that backtraces still can find debuginfo by checking that they contain symbol names and
12 # source locations.
13 $(TMPDIR)/my_crate_name.exe &> $(TMPDIR)/backtrace.txt
14 $(CGREP) "my_crate_name::fn_in_backtrace" < $(TMPDIR)/backtrace.txt
15 $(CGREP) "main.rs:15" < $(TMPDIR)/backtrace.txt
16
17 # Test that explicitly passed `-Clink-arg=/PDBALTPATH:...` is respected
18 $(RUSTC) main.rs -g --crate-name my_crate_name --crate-type bin -Clink-arg=/PDBALTPATH:abcdefg.pdb -Cforce-frame-pointers
19 $(CGREP) "abcdefg.pdb" < $(TMPDIR)/my_crate_name.exe
20 $(CGREP) -v "my_crate_name.pdb" < $(TMPDIR)/my_crate_name.exe
tests/run-make/pdb-alt-path/rmake.rs created+39
......@@ -0,0 +1,39 @@
1// The information inside a .exe file contains a string of the PDB file name.
2// This could be a security concern if the full path was exposed, as it could
3// reveal information about the filesystem where the bin was first compiled.
4// This should only be overridden by `-Clink-arg=/PDBALTPATH:...` - this test
5// checks that no full file paths are exposed and that the override flag is respected.
6// See https://github.com/rust-lang/rust/pull/121297
7
8//@ only-x86_64-pc-windows-msvc
9
10use run_make_support::{bin_name, invalid_utf8_contains, invalid_utf8_not_contains, run, rustc};
11
12fn main() {
13 // Test that we don't have the full path to the PDB file in the binary
14 rustc()
15 .input("main.rs")
16 .arg("-g")
17 .crate_name("my_crate_name")
18 .crate_type("bin")
19 .arg("-Cforce-frame-pointers")
20 .run();
21 invalid_utf8_contains(&bin_name("my_crate_name"), "my_crate_name.pdb");
22 invalid_utf8_not_contains(&bin_name("my_crate_name"), r#"\my_crate_name.pdb"#);
23 // Test that backtraces still can find debuginfo by checking that they contain symbol names and
24 // source locations.
25 let out = run(&bin_name("my_crate_name"));
26 out.assert_stdout_contains("my_crate_name::fn_in_backtrace");
27 out.assert_stdout_contains("main.rs:15");
28 // Test that explicitly passed `-Clink-arg=/PDBALTPATH:...` is respected
29 rustc()
30 .input("main.rs")
31 .arg("-g")
32 .crate_name("my_crate_name")
33 .crate_type("bin")
34 .link_arg("/PDBALTPATH:abcdefg.pdb")
35 .arg("-Cforce-frame-pointers")
36 .run();
37 invalid_utf8_contains(&bin_name("my_crate_name"), "abcdefg.pdb");
38 invalid_utf8_not_contains(&bin_name("my_crate_name"), "my_crate_name.pdb");
39}
tests/run-make/pretty-print-to-file/Makefile deleted-5
......@@ -1,5 +0,0 @@
1include ../tools.mk
2
3all:
4 $(RUSTC) -o $(TMPDIR)/input.out -Zunpretty=normal input.rs
5 diff -u $(TMPDIR)/input.out input.pp
tests/run-make/pretty-print-to-file/rmake.rs created+12
......@@ -0,0 +1,12 @@
1// The "pretty-printer" of rustc translates source code into other formats,
2// which is useful for debugging. This test checks the "normal" version of
3// -Zunpretty, which should format the poorly formatted input.rs into a one-line
4// function identical to the one in input.pp.
5// See https://github.com/rust-lang/rust/commit/da25539c1ab295ec40261109557dd4526923928c
6
7use run_make_support::{diff, rustc};
8
9fn main() {
10 rustc().output("input.out").arg("-Zunpretty=normal").input("input.rs").run();
11 diff().expected_file("input.out").actual_file("input.pp").run();
12}
tests/run-make/pretty-print-with-dep-file/Makefile deleted-9
......@@ -1,9 +0,0 @@
1include ../tools.mk
2
3all:
4 $(RUSTC) --emit=dep-info -Zunpretty=expanded with-dep.rs
5 $(CGREP) "with-dep.rs" < $(TMPDIR)/with-dep.d
6 -rm $(TMPDIR)/with-dep.d
7
8 $(RUSTC) --emit=dep-info -Zunpretty=normal with-dep.rs
9 ! test -f $(TMPDIR)/with-dep.d
tests/run-make/pretty-print-with-dep-file/rmake.rs created+17
......@@ -0,0 +1,17 @@
1// Passing --emit=dep-info to the Rust compiler should create a .d file...
2// but it failed to do so in Rust 1.69.0 when combined with -Z unpretty=expanded
3// due to a bug. This test checks that -Z unpretty=expanded does not prevent the
4// generation of the dep-info file, and that its -Z unpretty=normal counterpart
5// does not get an unexpected dep-info file.
6// See https://github.com/rust-lang/rust/issues/112898
7
8use run_make_support::{fs_wrapper, invalid_utf8_contains, rustc};
9use std::path::Path;
10
11fn main() {
12 rustc().emit("dep-info").arg("-Zunpretty=expanded").input("with-dep.rs").run();
13 invalid_utf8_contains("with-dep.d", "with-dep.rs");
14 fs_wrapper::remove_file("with-dep.d");
15 rustc().emit("dep-info").arg("-Zunpretty=normal").input("with-dep.rs").run();
16 assert!(!Path::new("with-dep.d").exists());
17}
tests/run-make/return-non-c-like-enum/Makefile deleted-8
......@@ -1,8 +0,0 @@
1# ignore-cross-compile
2include ../tools.mk
3
4all:
5 $(RUSTC) --crate-type=staticlib nonclike.rs
6 $(CC) test.c $(call STATICLIB,nonclike) $(call OUT_EXE,test) \
7 $(EXTRACFLAGS) $(EXTRACXXFLAGS)
8 $(call RUN,test)
tests/run-make/return-non-c-like-enum/rmake.rs created+18
......@@ -0,0 +1,18 @@
1// Check that we treat enum variants like union members in call ABIs.
2// Added in #68443.
3// Original issue: #68190.
4
5//@ ignore-cross-compile
6
7use run_make_support::{cc, extra_c_flags, extra_cxx_flags, run, rustc, static_lib_name};
8
9fn main() {
10 rustc().crate_type("staticlib").input("nonclike.rs").run();
11 cc().input("test.c")
12 .arg(&static_lib_name("nonclike"))
13 .out_exe("test")
14 .args(&extra_c_flags())
15 .args(&extra_cxx_flags())
16 .run();
17 run("test");
18}