Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 7 pull requests #127121

Merged
merged 19 commits into from
Jun 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
790c238
rewrite pdb-alt-path to rmake
Oneirical Jun 21, 2024
9dff8a3
rewrite mismatching-target-triples to rmake
Oneirical Jun 21, 2024
a2ed16c
rewrite mingw-export-call-convention to rmake
Oneirical Jun 21, 2024
2ffff79
rewrite pretty-print-with-dep-file to rmake
Oneirical Jun 26, 2024
722ae22
rewrite pretty-print-to-file to rmake
Oneirical Jun 26, 2024
53109d5
rewrite libtest-padding to rmake
Oneirical Jun 26, 2024
9bbf3d9
docs: say "includes" instead of "does include"
Sky9x Jun 28, 2024
df7331f
Remove unnecessary SeqCst in `impl fmt::Pointer for AtomicPtr`
Sky9x Jun 28, 2024
fa12064
Don't get output if `lldb --version` errors
ChrisDenton Jun 29, 2024
a6ef91e
Update test.rs
ChrisDenton Jun 29, 2024
4ee077a
Migrate `run-make/override-aliased-flags` to `rmake.rs`
GuillaumeGomez Jun 27, 2024
8cbeeda
Migrate `run-make/return-non-c-like-enum` to `rmake.rs`
GuillaumeGomez Jun 29, 2024
06aeb67
Rollup merge of #126805 - Oneirical:weaves-of-testiny, r=Kobzol
GuillaumeGomez Jun 29, 2024
c70a2e3
Rollup merge of #126995 - Oneirical:test-friends-forever, r=Kobzol
GuillaumeGomez Jun 29, 2024
c1fb4e5
Rollup merge of #127041 - GuillaumeGomez:run-make-override-aliased-fl…
GuillaumeGomez Jun 29, 2024
e9594b5
Rollup merge of #127072 - Sky9x:docs-includes-vs-does-include, r=scot…
GuillaumeGomez Jun 29, 2024
0886faa
Rollup merge of #127073 - Sky9x:unnecessary-seqcst, r=Nilstrieb
GuillaumeGomez Jun 29, 2024
38983df
Rollup merge of #127112 - ChrisDenton:lldb, r=Kobzol
GuillaumeGomez Jun 29, 2024
69f355a
Rollup merge of #127116 - GuillaumeGomez:run-make-return-non-c-like-e…
GuillaumeGomez Jun 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion library/core/src/sync/atomic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3766,7 +3766,7 @@ impl<T> fmt::Debug for AtomicPtr<T> {
#[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)
}
}

Expand Down
8 changes: 4 additions & 4 deletions library/core/src/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -842,7 +842,7 @@ impl 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
/// ```
Expand All @@ -861,7 +861,7 @@ impl Duration {

/// 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
/// ```
Expand All @@ -880,7 +880,7 @@ impl Duration {

/// 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
/// ```
Expand All @@ -901,7 +901,7 @@ impl Duration {

/// 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
/// ```
Expand Down
26 changes: 14 additions & 12 deletions src/bootstrap/src/core/build_steps/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1817,23 +1817,25 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the
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 {
Expand Down
8 changes: 0 additions & 8 deletions src/tools/tidy/src/allowed_run_make_makefiles.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -114,22 +111,18 @@ 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
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
Expand All @@ -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
Expand Down
14 changes: 0 additions & 14 deletions tests/run-make/libtest-padding/Makefile

This file was deleted.

46 changes: 46 additions & 0 deletions tests/run-make/libtest-padding/rmake.rs
Original file line number Diff line number Diff line change
@@ -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();
}
9 changes: 0 additions & 9 deletions tests/run-make/mingw-export-call-convention/Makefile

This file was deleted.

13 changes: 13 additions & 0 deletions tests/run-make/mingw-export-call-convention/rmake.rs
Original file line number Diff line number Diff line change
@@ -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");
}
11 changes: 0 additions & 11 deletions tests/run-make/mismatching-target-triples/Makefile

This file was deleted.

15 changes: 15 additions & 0 deletions tests/run-make/mismatching-target-triples/rmake.rs
Original file line number Diff line number Diff line change
@@ -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"#,
);
}
23 changes: 0 additions & 23 deletions tests/run-make/override-aliased-flags/Makefile

This file was deleted.

24 changes: 24 additions & 0 deletions tests/run-make/override-aliased-flags/rmake.rs
Original file line number Diff line number Diff line change
@@ -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();
}
20 changes: 0 additions & 20 deletions tests/run-make/pdb-alt-path/Makefile

This file was deleted.

39 changes: 39 additions & 0 deletions tests/run-make/pdb-alt-path/rmake.rs
Original file line number Diff line number Diff line change
@@ -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");
}
5 changes: 0 additions & 5 deletions tests/run-make/pretty-print-to-file/Makefile

This file was deleted.

12 changes: 12 additions & 0 deletions tests/run-make/pretty-print-to-file/rmake.rs
Original file line number Diff line number Diff line change
@@ -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();
}
9 changes: 0 additions & 9 deletions tests/run-make/pretty-print-with-dep-file/Makefile

This file was deleted.

Loading
Loading