Skip to content

Rollup of 7 pull requests #129057

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

Closed
wants to merge 26 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
acb0241
Add windows-targets crate to std's sysroot
ChrisDenton Aug 9, 2024
a1b2b7f
Exclude windows-targets from the workspace
ChrisDenton Aug 9, 2024
7b86c98
do not use the global solver cache for proof trees
lcnr Jul 23, 2024
51338ca
expand fuzzing support
lcnr Jul 23, 2024
e87157b
simplify match + move `debug!` call
lcnr Jul 23, 2024
9308401
tracing: debug to trace
lcnr Jul 23, 2024
e83eacd
move behavior out of shared fn
lcnr Jul 23, 2024
0c75c08
merge impl blocks
lcnr Jul 23, 2024
f860873
split provisional cache and stack lookup
lcnr Jul 23, 2024
fe52572
rewrite remap-path-prefix-dwarf to rmake
Oneirical Jul 30, 2024
1e445f4
Add must_use attribute to Coroutine trait
henryksloan Aug 13, 2024
399ef23
Allow to customize `// TODO:` comment for deprecated safe autofix
tbu- Jul 17, 2024
811d7dd
`#[deprecated_safe_2024]`: Also use the `// TODO:` hint in the compil…
tbu- Jul 29, 2024
2a000c8
Don't panic on unknown JSON-like output lines
Zalathar Aug 13, 2024
355f264
Remove a confusing comment
Zalathar Aug 13, 2024
53e87d2
Remove duplicated rustdoc ui test
GuillaumeGomez Aug 13, 2024
d2177d9
Emit a warning instead of an error if `--generate-link-to-definition`…
GuillaumeGomez Aug 13, 2024
afbab80
Update rustdoc-ui test for `--generate-link-to-definition` option
GuillaumeGomez Aug 13, 2024
0aa17a4
implement a performant and fuzzed solver cache
lcnr Jul 24, 2024
e321a19
Rollup merge of #127857 - tbu-:pr_deprecated_safe_todo, r=petrochenkov
GuillaumeGomez Aug 13, 2024
a6f5a8e
Rollup merge of #128410 - Oneirical:dwarf-fortestress, r=jieyouxu
GuillaumeGomez Aug 13, 2024
2e344d6
Rollup merge of #128828 - lcnr:search-graph-11, r=compiler-errors
GuillaumeGomez Aug 13, 2024
8bf0656
Rollup merge of #128873 - ChrisDenton:windows-targets, r=Mark-Simulacrum
GuillaumeGomez Aug 13, 2024
f5611fb
Rollup merge of #129034 - henryksloan:coroutine-must-use, r=joboet
GuillaumeGomez Aug 13, 2024
fb6cf56
Rollup merge of #129049 - Zalathar:json-like, r=jieyouxu
GuillaumeGomez Aug 13, 2024
d3a37ef
Rollup merge of #129050 - GuillaumeGomez:generate-link-to-definition-…
GuillaumeGomez Aug 13, 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
Prev Previous commit
Next Next commit
rewrite remap-path-prefix-dwarf to rmake
  • Loading branch information
Oneirical committed Aug 12, 2024
commit fe52572a4aa5e81bb9c7bc56306271cd3045477c
30 changes: 30 additions & 0 deletions src/tools/run-make-support/src/external_deps/llvm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ pub fn llvm_bcanalyzer() -> LlvmBcanalyzer {
LlvmBcanalyzer::new()
}

/// Construct a new `llvm-dwarfdump` invocation. This assumes that `llvm-dwarfdump` is available
/// at `$LLVM_BIN_DIR/llvm-dwarfdump`.
pub fn llvm_dwarfdump() -> LlvmDwarfdump {
LlvmDwarfdump::new()
}

/// A `llvm-readobj` invocation builder.
#[derive(Debug)]
#[must_use]
Expand Down Expand Up @@ -97,13 +103,21 @@ pub struct LlvmBcanalyzer {
cmd: Command,
}

/// A `llvm-dwarfdump` invocation builder.
#[derive(Debug)]
#[must_use]
pub struct LlvmDwarfdump {
cmd: Command,
}

crate::macros::impl_common_helpers!(LlvmReadobj);
crate::macros::impl_common_helpers!(LlvmProfdata);
crate::macros::impl_common_helpers!(LlvmFilecheck);
crate::macros::impl_common_helpers!(LlvmObjdump);
crate::macros::impl_common_helpers!(LlvmAr);
crate::macros::impl_common_helpers!(LlvmNm);
crate::macros::impl_common_helpers!(LlvmBcanalyzer);
crate::macros::impl_common_helpers!(LlvmDwarfdump);

/// Generate the path to the bin directory of LLVM.
#[must_use]
Expand Down Expand Up @@ -317,3 +331,19 @@ impl LlvmBcanalyzer {
self
}
}

impl LlvmDwarfdump {
/// Construct a new `llvm-dwarfdump` invocation. This assumes that `llvm-dwarfdump` is available
/// at `$LLVM_BIN_DIR/llvm-dwarfdump`.
pub fn new() -> Self {
let llvm_dwarfdump = llvm_bin_dir().join("llvm-dwarfdump");
let cmd = Command::new(llvm_dwarfdump);
Self { cmd }
}

/// Provide an input file.
pub fn input<P: AsRef<Path>>(&mut self, path: P) -> &mut Self {
self.cmd.arg(path.as_ref());
self
}
}
5 changes: 3 additions & 2 deletions src/tools/run-make-support/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,9 @@ pub use c_build::{build_native_dynamic_lib, build_native_static_lib, build_nativ
pub use clang::{clang, Clang};
pub use htmldocck::htmldocck;
pub use llvm::{
llvm_ar, llvm_bcanalyzer, llvm_filecheck, llvm_nm, llvm_objdump, llvm_profdata, llvm_readobj,
LlvmAr, LlvmBcanalyzer, LlvmFilecheck, LlvmNm, LlvmObjdump, LlvmProfdata, LlvmReadobj,
llvm_ar, llvm_bcanalyzer, llvm_dwarfdump, llvm_filecheck, llvm_nm, llvm_objdump, llvm_profdata,
llvm_readobj, LlvmAr, LlvmBcanalyzer, LlvmDwarfdump, LlvmFilecheck, LlvmNm, LlvmObjdump,
LlvmProfdata, LlvmReadobj,
};
pub use python::python_command;
pub use rustc::{aux_build, bare_rustc, rustc, Rustc};
Expand Down
1 change: 0 additions & 1 deletion src/tools/tidy/src/allowed_run_make_makefiles.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ run-make/macos-deployment-target/Makefile
run-make/min-global-align/Makefile
run-make/native-link-modifier-bundle/Makefile
run-make/no-alloc-shim/Makefile
run-make/remap-path-prefix-dwarf/Makefile
run-make/reproducible-build/Makefile
run-make/rlib-format-packed-bundled-libs/Makefile
run-make/split-debuginfo/Makefile
Expand Down
112 changes: 0 additions & 112 deletions tests/run-make/remap-path-prefix-dwarf/Makefile

This file was deleted.

202 changes: 202 additions & 0 deletions tests/run-make/remap-path-prefix-dwarf/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,202 @@
// This test makes sure that --remap-path-prefix has the expected effects on paths in debuginfo.
// We explicitly switch to a directory that *is* a prefix of the directory our
// source code is contained in.
// It tests several cases, each of them has a detailed description attached to it.
// See https://github.com/rust-lang/rust/pull/96867

//@ ignore-windows
// Reason: the remap path prefix is not printed in the dwarf dump.

use run_make_support::{cwd, is_darwin, llvm_dwarfdump, rust_lib_name, rustc};

fn main() {
// The compiler is called with an *ABSOLUTE PATH* as input, and that absolute path *is* within
// the working directory of the compiler. We are remapping the path that contains `src`.
check_dwarf(DwarfTest {
lib_name: "abs_input_inside_working_dir",
input_path: PathType::Absolute,
scope: None,
remap_path_prefix: PrefixType::Regular(format!("{}=REMAPPED", cwd().display())),
dwarf_test: DwarfDump::ContainsSrcPath,
});
check_dwarf(DwarfTest {
lib_name: "abs_input_inside_working_dir_scope",
input_path: PathType::Absolute,
scope: Some(ScopeType::Object),
remap_path_prefix: PrefixType::Regular(format!("{}=REMAPPED", cwd().display())),
dwarf_test: DwarfDump::ContainsSrcPath,
});
// The compiler is called with an *ABSOLUTE PATH* as input, and that absolute path is *not*
// within the working directory of the compiler. We are remapping both the path that contains
// `src` and the working directory to the same thing. This setup corresponds to a workaround
// that is needed when trying to remap everything to something that looks like a local
// path. Relative paths are interpreted as relative to the compiler's working directory (e.g.
// in debuginfo). If we also remap the working directory, the compiler strip it from other
// paths so that the final outcome is the desired one again.
check_dwarf(DwarfTest {
lib_name: "abs_input_outside_working_dir",
input_path: PathType::Absolute,
scope: None,
remap_path_prefix: PrefixType::Dual((
format!("{}=REMAPPED", cwd().display()),
"rmake_out=REMAPPED".to_owned(),
)),
dwarf_test: DwarfDump::ContainsSrcPath,
});
// The compiler is called with a *RELATIVE PATH* as input. We are remapping the working
// directory of the compiler, which naturally is an implicit prefix of our relative input path.
// Debuginfo will expand the relative path to an absolute path and we expect the working
// directory to be remapped in that expansion.
check_dwarf(DwarfTest {
lib_name: "rel_input_remap_working_dir",
input_path: PathType::Relative,
scope: None,
remap_path_prefix: PrefixType::Regular(format!("{}=REMAPPED", cwd().display())),
dwarf_test: DwarfDump::ContainsSrcPath,
});
check_dwarf(DwarfTest {
lib_name: "rel_input_remap_working_dir_scope",
input_path: PathType::Relative,
scope: Some(ScopeType::Object),
remap_path_prefix: PrefixType::Regular(format!("{}=REMAPPED", cwd().display())),
dwarf_test: DwarfDump::ContainsSrcPath,
});
check_dwarf(DwarfTest {
lib_name: "rel_input_remap_working_dir_scope",
input_path: PathType::Relative,
scope: Some(ScopeType::Diagnostics),
remap_path_prefix: PrefixType::Regular(format!("{}=REMAPPED", cwd().display())),
dwarf_test: DwarfDump::AvoidSrcPath,
});
// The compiler is called with a *RELATIVE PATH* as input. We are remapping a *SUB-DIRECTORY*
// of the compiler's working directory. This test makes sure that that directory is remapped
// even though it won't actually show up in this form in the compiler's SourceMap and instead
// is only constructed on demand during debuginfo generation.
check_dwarf(DwarfTest {
lib_name: "rel_input_remap_working_dir_child",
input_path: PathType::Relative,
scope: None,
remap_path_prefix: PrefixType::Regular(format!("{}=REMAPPED", cwd().join("src").display())),
dwarf_test: DwarfDump::ChildTest,
});
// The compiler is called with a *RELATIVE PATH* as input. We are remapping a
// *PARENT DIRECTORY* of the compiler's working directory.
check_dwarf(DwarfTest {
lib_name: "rel_input_remap_working_dir_parent",
input_path: PathType::Relative,
scope: None,
remap_path_prefix: PrefixType::Regular(format!(
"{}=REMAPPED",
cwd().parent().unwrap().display()
)),
dwarf_test: DwarfDump::ParentTest,
});
}

#[track_caller]
fn check_dwarf(test: DwarfTest) {
let mut rustc = rustc();
match test.input_path {
PathType::Absolute => rustc.input(cwd().join("src/quux.rs")),
PathType::Relative => rustc.input("src/quux.rs"),
};
rustc.output(rust_lib_name(test.lib_name));
rustc.arg("-Cdebuginfo=2");
if let Some(scope) = test.scope {
match scope {
ScopeType::Object => rustc.arg("-Zremap-path-scope=object"),
ScopeType::Diagnostics => rustc.arg("-Zremap-path-scope=diagnostics"),
};
if is_darwin() {
rustc.arg("-Csplit-debuginfo=off");
}
}
match test.remap_path_prefix {
PrefixType::Regular(prefix) => {
// We explicitly switch to a directory that *is* a prefix of the directory our
// source code is contained in.
rustc.arg("--remap-path-prefix");
rustc.arg(prefix);
}
PrefixType::Dual((prefix1, prefix2)) => {
// We explicitly switch to a directory that is *not* a prefix of the directory our
// source code is contained in.
rustc.arg("--remap-path-prefix");
rustc.arg(prefix1);
rustc.arg("--remap-path-prefix");
rustc.arg(prefix2);
}
}
rustc.run();
match test.dwarf_test {
DwarfDump::ContainsSrcPath => {
llvm_dwarfdump()
.input(rust_lib_name(test.lib_name))
.run()
// We expect the path to the main source file to be remapped.
.assert_stdout_contains("REMAPPED/src/quux.rs")
// No weird duplication of remapped components (see #78479)
.assert_stdout_not_contains("REMAPPED/REMAPPED");
}
DwarfDump::AvoidSrcPath => {
llvm_dwarfdump()
.input(rust_lib_name(test.lib_name))
.run()
.assert_stdout_not_contains("REMAPPED/src/quux.rs")
.assert_stdout_not_contains("REMAPPED/REMAPPED");
}
DwarfDump::ChildTest => {
llvm_dwarfdump()
.input(rust_lib_name(test.lib_name))
.run()
// We expect `src/quux.rs` to have been remapped to `REMAPPED/quux.rs`.
.assert_stdout_contains("REMAPPED/quux.rs")
// We don't want to find the path that we just remapped anywhere in the DWARF
.assert_stdout_not_contains(cwd().join("src").to_str().unwrap())
// No weird duplication of remapped components (see #78479)
.assert_stdout_not_contains("REMAPPED/REMAPPED");
}
DwarfDump::ParentTest => {
llvm_dwarfdump()
.input(rust_lib_name(test.lib_name))
.run()
// We expect `src/quux.rs` to have been remapped to
// `REMAPPED/remap-path-prefix-dwarf/src/quux.rs`.
.assert_stdout_contains("REMAPPED/rmake_out/src/quux.rs")
// We don't want to find the path that we just remapped anywhere in the DWARF
.assert_stdout_not_contains(cwd().parent().unwrap().to_str().unwrap())
// No weird duplication of remapped components (see #78479)
.assert_stdout_not_contains("REMAPPED/REMAPPED");
}
};
}

struct DwarfTest {
lib_name: &'static str,
input_path: PathType,
scope: Option<ScopeType>,
remap_path_prefix: PrefixType,
dwarf_test: DwarfDump,
}

enum PathType {
Absolute,
Relative,
}

enum ScopeType {
Object,
Diagnostics,
}

enum DwarfDump {
ContainsSrcPath,
AvoidSrcPath,
ChildTest,
ParentTest,
}

enum PrefixType {
Regular(String),
Dual((String, String)),
}
Loading