Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Rollup of 7 pull requests #127360

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

Merged
merged 24 commits into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
3d90595
DependencyList: remove outdated comment
klensy Apr 23, 2024
9e40b54
add fixme
klensy Apr 23, 2024
45b0f68
Use the native unwind function in miri where possible
bjorn3 Jul 1, 2024
e03c3b6
Allow _Unwind_RaiseException with MinGW
bjorn3 Jul 1, 2024
34860a5
Update windows-bindgen to 0.58.0
ChrisDenton Jul 4, 2024
14f4ed2
Add comments to windows_targets.rs
ChrisDenton Jul 4, 2024
40cad01
rewrite and rename include_bytes_deps to rmake
Oneirical Jun 19, 2024
73d7dc7
rewrite optimization-remarks-dir-pgo to rmake
Oneirical Jun 19, 2024
651f023
rewrite optimization-remarks-dir to rmake
Oneirical Jun 19, 2024
5e23dfe
rewrite and rename issue-40535 to rmake
Oneirical Jun 19, 2024
b167a15
rewrite rmeta-preferred to rmake
Oneirical Jun 19, 2024
3ea36f5
add shallow_find_files helper function to run-make-support
Oneirical Jun 20, 2024
86a1946
Tweak `-1 as usize` suggestion
estebank Jul 5, 2024
f095de4
coverage: Rename `mir::coverage::BranchInfo` to `CoverageInfoHi`
Zalathar Jul 4, 2024
f96f443
Tweak how the extra newline is printed after coverage info
Zalathar Jul 5, 2024
3e43680
Improve `Command::args` API in `run-make-support`
GuillaumeGomez Jul 2, 2024
415e202
Improve code of `run-make/llvm-ident` test
GuillaumeGomez Jul 5, 2024
7a79392
Rollup merge of #124290 - klensy:dep-format, r=jieyouxu
GuillaumeGomez Jul 5, 2024
e66f4d3
Rollup merge of #126709 - Oneirical:exitestial-crisis, r=jieyouxu
GuillaumeGomez Jul 5, 2024
7a208c7
Rollup merge of #127214 - bjorn3:miri_native_unwind, r=oli-obk
GuillaumeGomez Jul 5, 2024
80a9717
Rollup merge of #127320 - ChrisDenton:win-sys, r=Mark-Simulacrum
GuillaumeGomez Jul 5, 2024
6d3f2b1
Rollup merge of #127349 - estebank:negative-unsigned-literal, r=petro…
GuillaumeGomez Jul 5, 2024
e4d7f7c
Rollup merge of #127352 - Zalathar:coverage-info, r=oli-obk
GuillaumeGomez Jul 5, 2024
4fd3b12
Rollup merge of #127359 - GuillaumeGomez:improve-run-make-llvm-ident-…
GuillaumeGomez Jul 5, 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
34 changes: 34 additions & 0 deletions 34 src/tools/run-make-support/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,40 @@ pub fn test_while_readonly<P: AsRef<Path>, F: FnOnce() + std::panic::UnwindSafe>
success.unwrap();
}

/// Browse the directory `path` non-recursively and return all files which respect the parameters
/// outlined by `closure`.
#[track_caller]
pub fn shallow_find_files<P: AsRef<Path>, F: Fn(&PathBuf) -> bool>(
path: P,
closure: F,
) -> Vec<PathBuf> {
let mut matching_files = Vec::new();
for entry in fs_wrapper::read_dir(path) {
let entry = entry.expect("failed to read directory entry.");
let path = entry.path();

if path.is_file() && closure(&path) {
matching_files.push(path);
}
}
matching_files
}

/// Returns true if the filename at `path` starts with `prefix`.
pub fn has_prefix<P: AsRef<Path>>(path: P, prefix: &str) -> bool {
path.as_ref().file_name().is_some_and(|name| name.to_str().unwrap().starts_with(prefix))
}

/// Returns true if the filename at `path` has the extension `extension`.
pub fn has_extension<P: AsRef<Path>>(path: P, extension: &str) -> bool {
path.as_ref().extension().is_some_and(|ext| ext == extension)
}

/// Returns true if the filename at `path` does not contain `expected`.
pub fn not_contains<P: AsRef<Path>>(path: P, expected: &str) -> bool {
!path.as_ref().file_name().is_some_and(|name| name.to_str().unwrap().contains(expected))
}

/// Use `cygpath -w` on a path to get a Windows path string back. This assumes that `cygpath` is
/// available on the platform!
#[track_caller]
Expand Down
5 changes: 0 additions & 5 deletions 5 src/tools/tidy/src/allowed_run_make_makefiles.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ run-make/fmt-write-bloat/Makefile
run-make/foreign-double-unwind/Makefile
run-make/foreign-exceptions/Makefile
run-make/foreign-rust-exceptions/Makefile
run-make/include_bytes_deps/Makefile
run-make/incr-add-rust-src-component/Makefile
run-make/incr-foreign-head-span/Makefile
run-make/interdependent-c-libraries/Makefile
Expand All @@ -64,7 +63,6 @@ run-make/issue-33329/Makefile
run-make/issue-35164/Makefile
run-make/issue-36710/Makefile
run-make/issue-37839/Makefile
run-make/issue-40535/Makefile
run-make/issue-47551/Makefile
run-make/issue-69368/Makefile
run-make/issue-83045/Makefile
Expand Down Expand Up @@ -102,8 +100,6 @@ run-make/no-alloc-shim/Makefile
run-make/no-builtins-attribute/Makefile
run-make/no-duplicate-libs/Makefile
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/panic-abort-eh_frame/Makefile
run-make/pass-linker-flags-flavor/Makefile
Expand Down Expand Up @@ -136,7 +132,6 @@ run-make/return-non-c-like-enum-from-c/Makefile
run-make/rlib-format-packed-bundled-libs-2/Makefile
run-make/rlib-format-packed-bundled-libs-3/Makefile
run-make/rlib-format-packed-bundled-libs/Makefile
run-make/rmeta-preferred/Makefile
run-make/rustc-macro-dep-files/Makefile
run-make/sanitizer-cdylib-link/Makefile
run-make/sanitizer-dylib-link/Makefile
Expand Down
13 changes: 13 additions & 0 deletions 13 tests/run-make/include-bytes-deps/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// include_bytes! and include_str! in `main.rs`
// should register the included file as of #24423,
// and this test checks that this is still the case.
// See https://github.com/rust-lang/rust/pull/24423

use run_make_support::{invalid_utf8_contains, rustc};

fn main() {
rustc().emit("dep-info").input("main.rs").run();
invalid_utf8_contains("main.d", "input.txt");
invalid_utf8_contains("main.d", "input.bin");
invalid_utf8_contains("main.d", "input.md");
}
7 changes: 0 additions & 7 deletions 7 tests/run-make/include_bytes_deps/Makefile

This file was deleted.

13 changes: 0 additions & 13 deletions 13 tests/run-make/issue-40535/Makefile

This file was deleted.

14 changes: 14 additions & 0 deletions 14 tests/run-make/metadata-only-crate-no-ice/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// In a dependency hierarchy, metadata-only crates could cause an Internal
// Compiler Error (ICE) due to a compiler bug - not correctly fetching sources for
// metadata-only crates. This test is a minimal reproduction of a program that triggered
// this bug, and checks that no ICE occurs.
// See https://github.com/rust-lang/rust/issues/40535

use run_make_support::rustc;

fn main() {
rustc().input("baz.rs").emit("metadata").run();
rustc().input("bar.rs").emit("metadata").extern_("baz", "libbaz.rmeta").run();
// There should be no internal compiler error.
rustc().input("foo.rs").emit("metadata").extern_("bar", "libbaz.rmeta").run();
}
17 changes: 0 additions & 17 deletions 17 tests/run-make/optimization-remarks-dir-pgo/Makefile

This file was deleted.

41 changes: 41 additions & 0 deletions 41 tests/run-make/optimization-remarks-dir-pgo/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// This test checks the -Zremark-dir flag, which writes LLVM
// optimization remarks to the YAML format. When using PGO (Profile
// Guided Optimization), the Hotness attribute should be included in
// the output remark files.
// See https://github.com/rust-lang/rust/pull/114439

//@ needs-profiler-support
//@ ignore-cross-compile

use run_make_support::{
has_extension, has_prefix, invalid_utf8_contains, llvm_profdata, run, rustc, shallow_find_files,
};

fn main() {
rustc().profile_generate("profdata").opt().input("foo.rs").output("foo").run();
run("foo");
// The profdata filename is a long sequence of numbers, fetch it by prefix and extension
// to keep the test working even if the filename changes.
let profdata_files = shallow_find_files("profdata", |path| {
has_prefix(path, "default") && has_extension(path, "profraw")
});
let profdata_file = profdata_files.get(0).unwrap();
llvm_profdata().merge().output("merged.profdata").input(profdata_file).run();
rustc()
.profile_use("merged.profdata")
.opt()
.input("foo.rs")
.arg("-Cremark=all")
.arg("-Zremark-dir=profiles")
.run();
// Check that PGO hotness is included in the remark files
let remark_files = shallow_find_files("profiles", |path| {
has_prefix(path, "foo") && has_extension(path, "yaml")
});
assert!(!remark_files.is_empty());
for file in remark_files {
if !file.to_str().unwrap().contains("codegen") {
invalid_utf8_contains(file, "Hotness")
};
}
}
12 changes: 0 additions & 12 deletions 12 tests/run-make/optimization-remarks-dir/Makefile

This file was deleted.

39 changes: 39 additions & 0 deletions 39 tests/run-make/optimization-remarks-dir/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// In this test, the function `bar` has #[inline(never)] and the function `foo`
// does not. This test outputs LLVM optimization remarks twice - first for all
// functions (including `bar`, and the `inline` mention), and then for only `foo`
// (should not have the `inline` mention).
// See https://github.com/rust-lang/rust/pull/113040

use run_make_support::{
has_extension, has_prefix, invalid_utf8_contains, invalid_utf8_not_contains, not_contains,
rustc, shallow_find_files,
};

fn main() {
rustc()
.opt()
.input("foo.rs")
.crate_type("lib")
.arg("-Cremark=all")
.arg("-Zremark-dir=profiles_all")
.run();
let all_remark_files = shallow_find_files("profiles_all", |path| {
has_prefix(path, "foo") && has_extension(path, "yaml") && not_contains(path, "codegen")
});
for file in all_remark_files {
invalid_utf8_contains(file, "inline")
}
rustc()
.opt()
.input("foo.rs")
.crate_type("lib")
.arg("-Cremark=foo")
.arg("-Zremark-dir=profiles_foo")
.run();
let foo_remark_files = shallow_find_files("profiles_foo", |path| {
has_prefix(path, "foo") && has_extension(path, "yaml")
});
for file in foo_remark_files {
invalid_utf8_not_contains(file, "inline")
}
}
16 changes: 0 additions & 16 deletions 16 tests/run-make/rmeta-preferred/Makefile

This file was deleted.

18 changes: 18 additions & 0 deletions 18 tests/run-make/rmeta-preferred/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// This test compiles `lib.rs`'s dependency, `rmeta_aux.rs`, as both an rlib
// and an rmeta crate. By default, rustc should give the metadata crate (rmeta)
// precedence over the rust-lib (rlib). This test inspects the contents of the binary
// and that the correct (rmeta) crate was used.
// rlibs being preferred could indicate a resurgence of the -Zbinary-dep-depinfo bug
// seen in #68298.
// See https://github.com/rust-lang/rust/pull/37681

//@ ignore-cross-compile

use run_make_support::{invalid_utf8_contains, invalid_utf8_not_contains, rustc};

fn main() {
rustc().input("rmeta_aux.rs").crate_type("rlib").emit("link,metadata").run();
rustc().input("lib.rs").crate_type("rlib").emit("dep-info").arg("-Zbinary-dep-depinfo").run();
invalid_utf8_contains("lib.d", "librmeta_aux.rmeta");
invalid_utf8_not_contains("lib.d", "librmeta_aux.rlib");
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.