Stabilize -Zremap-path-scope as --remap-path-scope
In the process also document that new `--remap-path-scope` scopes may be added in the future, and that the `all` scope always represent all the scopes. Co-authored-by: David Wood <agile.lion3441@fuligin.ink>
This commit is contained in:
parent
8188f6c808
commit
d0d8258886
22 changed files with 124 additions and 97 deletions
|
|
@ -24,7 +24,9 @@ use rustc_hashes::Hash64;
|
|||
use rustc_macros::{BlobDecodable, Decodable, Encodable, HashStable_Generic};
|
||||
use rustc_span::edition::{DEFAULT_EDITION, EDITION_NAME_LIST, Edition, LATEST_STABLE_EDITION};
|
||||
use rustc_span::source_map::FilePathMapping;
|
||||
use rustc_span::{FileName, RealFileName, SourceFileHashAlgorithm, Symbol, sym};
|
||||
use rustc_span::{
|
||||
FileName, RealFileName, RemapPathScopeComponents, SourceFileHashAlgorithm, Symbol, sym,
|
||||
};
|
||||
use rustc_target::spec::{
|
||||
FramePointer, LinkSelfContainedComponents, LinkerFeatures, PanicStrategy, SplitDebuginfo,
|
||||
Target, TargetTuple,
|
||||
|
|
@ -1315,6 +1317,29 @@ impl OutputFilenames {
|
|||
}
|
||||
}
|
||||
|
||||
pub(crate) fn parse_remap_path_scope(
|
||||
early_dcx: &EarlyDiagCtxt,
|
||||
matches: &getopts::Matches,
|
||||
) -> RemapPathScopeComponents {
|
||||
if let Some(v) = matches.opt_str("remap-path-scope") {
|
||||
let mut slot = RemapPathScopeComponents::empty();
|
||||
for s in v.split(',') {
|
||||
slot |= match s {
|
||||
"macro" => RemapPathScopeComponents::MACRO,
|
||||
"diagnostics" => RemapPathScopeComponents::DIAGNOSTICS,
|
||||
"debuginfo" => RemapPathScopeComponents::DEBUGINFO,
|
||||
"coverage" => RemapPathScopeComponents::COVERAGE,
|
||||
"object" => RemapPathScopeComponents::OBJECT,
|
||||
"all" => RemapPathScopeComponents::all(),
|
||||
_ => early_dcx.early_fatal("argument for `--remap-path-scope` must be a comma separated list of scopes: `macro`, `diagnostics`, `debuginfo`, `coverage`, `object`, `all`"),
|
||||
}
|
||||
}
|
||||
slot
|
||||
} else {
|
||||
RemapPathScopeComponents::all()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct Sysroot {
|
||||
pub explicit: Option<PathBuf>,
|
||||
|
|
@ -1351,9 +1376,9 @@ pub fn host_tuple() -> &'static str {
|
|||
|
||||
fn file_path_mapping(
|
||||
remap_path_prefix: Vec<(PathBuf, PathBuf)>,
|
||||
unstable_opts: &UnstableOptions,
|
||||
remap_path_scope: RemapPathScopeComponents,
|
||||
) -> FilePathMapping {
|
||||
FilePathMapping::new(remap_path_prefix.clone(), unstable_opts.remap_path_scope)
|
||||
FilePathMapping::new(remap_path_prefix.clone(), remap_path_scope)
|
||||
}
|
||||
|
||||
impl Default for Options {
|
||||
|
|
@ -1365,7 +1390,7 @@ impl Default for Options {
|
|||
// to create a default working directory.
|
||||
let working_dir = {
|
||||
let working_dir = std::env::current_dir().unwrap();
|
||||
let file_mapping = file_path_mapping(Vec::new(), &unstable_opts);
|
||||
let file_mapping = file_path_mapping(Vec::new(), RemapPathScopeComponents::empty());
|
||||
file_mapping.to_real_filename(&RealFileName::empty(), &working_dir)
|
||||
};
|
||||
|
||||
|
|
@ -1401,6 +1426,7 @@ impl Default for Options {
|
|||
cli_forced_codegen_units: None,
|
||||
cli_forced_local_thinlto_off: false,
|
||||
remap_path_prefix: Vec::new(),
|
||||
remap_path_scope: RemapPathScopeComponents::all(),
|
||||
real_rust_source_base_dir: None,
|
||||
real_rustc_dev_source_base_dir: None,
|
||||
edition: DEFAULT_EDITION,
|
||||
|
|
@ -1427,7 +1453,7 @@ impl Options {
|
|||
}
|
||||
|
||||
pub fn file_path_mapping(&self) -> FilePathMapping {
|
||||
file_path_mapping(self.remap_path_prefix.clone(), &self.unstable_opts)
|
||||
file_path_mapping(self.remap_path_prefix.clone(), self.remap_path_scope)
|
||||
}
|
||||
|
||||
/// Returns `true` if there will be an output file generated.
|
||||
|
|
@ -1864,6 +1890,14 @@ pub fn rustc_optgroups() -> Vec<RustcOptGroup> {
|
|||
"Remap source names in all output (compiler messages and output files)",
|
||||
"<FROM>=<TO>",
|
||||
),
|
||||
opt(
|
||||
Stable,
|
||||
Opt,
|
||||
"",
|
||||
"remap-path-scope",
|
||||
"Defines which scopes of paths should be remapped by `--remap-path-prefix`",
|
||||
"<macro,diagnostics,debuginfo,coverage,object,all>",
|
||||
),
|
||||
opt(Unstable, Multi, "", "env-set", "Inject an environment variable", "<VAR>=<VALUE>"),
|
||||
];
|
||||
options.extend(verbose_only.into_iter().map(|mut opt| {
|
||||
|
|
@ -2704,6 +2738,7 @@ pub fn build_session_options(early_dcx: &mut EarlyDiagCtxt, matches: &getopts::M
|
|||
let externs = parse_externs(early_dcx, matches, &unstable_opts);
|
||||
|
||||
let remap_path_prefix = parse_remap_path_prefix(early_dcx, matches, &unstable_opts);
|
||||
let remap_path_scope = parse_remap_path_scope(early_dcx, matches);
|
||||
|
||||
let pretty = parse_pretty(early_dcx, &unstable_opts);
|
||||
|
||||
|
|
@ -2770,7 +2805,7 @@ pub fn build_session_options(early_dcx: &mut EarlyDiagCtxt, matches: &getopts::M
|
|||
early_dcx.early_fatal(format!("Current directory is invalid: {e}"));
|
||||
});
|
||||
|
||||
let file_mapping = file_path_mapping(remap_path_prefix.clone(), &unstable_opts);
|
||||
let file_mapping = file_path_mapping(remap_path_prefix.clone(), remap_path_scope);
|
||||
file_mapping.to_real_filename(&RealFileName::empty(), &working_dir)
|
||||
};
|
||||
|
||||
|
|
@ -2808,6 +2843,7 @@ pub fn build_session_options(early_dcx: &mut EarlyDiagCtxt, matches: &getopts::M
|
|||
cli_forced_codegen_units: codegen_units,
|
||||
cli_forced_local_thinlto_off: disable_local_thinlto,
|
||||
remap_path_prefix,
|
||||
remap_path_scope,
|
||||
real_rust_source_base_dir,
|
||||
real_rustc_dev_source_base_dir,
|
||||
edition,
|
||||
|
|
|
|||
|
|
@ -454,6 +454,8 @@ top_level_options!(
|
|||
|
||||
/// Remap source path prefixes in all output (messages, object files, debug, etc.).
|
||||
remap_path_prefix: Vec<(PathBuf, PathBuf)> [TRACKED_NO_CRATE_HASH],
|
||||
/// Defines which scopes of paths should be remapped by `--remap-path-prefix`.
|
||||
remap_path_scope: RemapPathScopeComponents [TRACKED_NO_CRATE_HASH],
|
||||
|
||||
/// Base directory containing the `library/` directory for the Rust standard library.
|
||||
/// Right now it's always `$sysroot/lib/rustlib/src/rust`
|
||||
|
|
@ -872,7 +874,6 @@ mod desc {
|
|||
pub(crate) const parse_branch_protection: &str = "a `,` separated combination of `bti`, `gcs`, `pac-ret`, (optionally with `pc`, `b-key`, `leaf` if `pac-ret` is set)";
|
||||
pub(crate) const parse_proc_macro_execution_strategy: &str =
|
||||
"one of supported execution strategies (`same-thread`, or `cross-thread`)";
|
||||
pub(crate) const parse_remap_path_scope: &str = "comma separated list of scopes: `macro`, `diagnostics`, `debuginfo`, `coverage`, `object`, `all`";
|
||||
pub(crate) const parse_inlining_threshold: &str =
|
||||
"either a boolean (`yes`, `no`, `on`, `off`, etc), or a non-negative number";
|
||||
pub(crate) const parse_llvm_module_flag: &str = "<key>:<type>:<value>:<behavior>. Type must currently be `u32`. Behavior should be one of (`error`, `warning`, `require`, `override`, `append`, `appendunique`, `max`, `min`)";
|
||||
|
|
@ -1711,29 +1712,6 @@ pub mod parse {
|
|||
true
|
||||
}
|
||||
|
||||
pub(crate) fn parse_remap_path_scope(
|
||||
slot: &mut RemapPathScopeComponents,
|
||||
v: Option<&str>,
|
||||
) -> bool {
|
||||
if let Some(v) = v {
|
||||
*slot = RemapPathScopeComponents::empty();
|
||||
for s in v.split(',') {
|
||||
*slot |= match s {
|
||||
"macro" => RemapPathScopeComponents::MACRO,
|
||||
"diagnostics" => RemapPathScopeComponents::DIAGNOSTICS,
|
||||
"debuginfo" => RemapPathScopeComponents::DEBUGINFO,
|
||||
"coverage" => RemapPathScopeComponents::COVERAGE,
|
||||
"object" => RemapPathScopeComponents::OBJECT,
|
||||
"all" => RemapPathScopeComponents::all(),
|
||||
_ => return false,
|
||||
}
|
||||
}
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn parse_relocation_model(slot: &mut Option<RelocModel>, v: Option<&str>) -> bool {
|
||||
match v.and_then(|s| RelocModel::from_str(s).ok()) {
|
||||
Some(relocation_model) => *slot = Some(relocation_model),
|
||||
|
|
@ -2584,8 +2562,6 @@ options! {
|
|||
"whether ELF relocations can be relaxed"),
|
||||
remap_cwd_prefix: Option<PathBuf> = (None, parse_opt_pathbuf, [TRACKED],
|
||||
"remap paths under the current working directory to this path prefix"),
|
||||
remap_path_scope: RemapPathScopeComponents = (RemapPathScopeComponents::all(), parse_remap_path_scope, [TRACKED],
|
||||
"remap path scope (default: all)"),
|
||||
remark_dir: Option<PathBuf> = (None, parse_opt_pathbuf, [UNTRACKED],
|
||||
"directory into which to write optimization remarks (if not specified, they will be \
|
||||
written to standard error output)"),
|
||||
|
|
|
|||
|
|
@ -428,6 +428,14 @@ specified multiple times.
|
|||
Refer to the [Remap source paths](remap-source-paths.md) section of this book for
|
||||
further details and explanation.
|
||||
|
||||
<a id="option-remap-path-scope"></a>
|
||||
## `--remap-path-scope`: remap source paths in output
|
||||
|
||||
Defines which scopes of paths should be remapped by `--remap-path-prefix`.
|
||||
|
||||
Refer to the [Remap source paths](remap-source-paths.md) section of this book for
|
||||
further details and explanation.
|
||||
|
||||
<a id="option-json"></a>
|
||||
## `--json`: configure json messages printed by the compiler
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ output, including compiler diagnostics, debugging information, macro expansions,
|
|||
This is useful for normalizing build products, for example by removing the current directory
|
||||
out of the paths emitted into object files.
|
||||
|
||||
The remapping is done via the `--remap-path-prefix` option.
|
||||
The remapping is done via the `--remap-path-prefix` flag and can be customized via the `--remap-path-scope` flag.
|
||||
|
||||
## `--remap-path-prefix`
|
||||
|
||||
|
|
@ -25,6 +25,31 @@ rustc --remap-path-prefix "/home/user/project=/redacted"
|
|||
|
||||
This example replaces all occurrences of `/home/user/project` in emitted paths with `/redacted`.
|
||||
|
||||
## `--remap-path-scope`
|
||||
|
||||
Defines which scopes of paths should be remapped by `--remap-path-prefix`.
|
||||
|
||||
This flag accepts a comma-separated list of values and may be specified multiple times, in which case the scopes are aggregated together.
|
||||
|
||||
The valid scopes are:
|
||||
|
||||
- `macro` - apply remappings to the expansion of `std::file!()` macro. This is where paths in embedded panic messages come from
|
||||
- `diagnostics` - apply remappings to printed compiler diagnostics
|
||||
- `debuginfo` - apply remappings to debug information
|
||||
- `coverage` - apply remappings to coverage information
|
||||
- `object` - apply remappings to all paths in compiled executables or libraries, but not elsewhere. Currently an alias for `macro,coverage,debuginfo`.
|
||||
- `all` (default) - an alias for all of the above, also equivalent to supplying only `--remap-path-prefix` without `--remap-path-scope`.
|
||||
|
||||
The scopes accepted by `--remap-path-scope` are not exhaustive - new scopes may be added in future releases for eventual stabilisation.
|
||||
This implies that the `all` scope can correspond to different scopes between releases.
|
||||
|
||||
### Example
|
||||
|
||||
```sh
|
||||
# With `object` scope only the build outputs will be remapped, the diagnostics won't be remapped.
|
||||
rustc --remap-path-prefix=$(PWD)=/remapped --remap-path-scope=object main.rs
|
||||
```
|
||||
|
||||
## Caveats and Limitations
|
||||
|
||||
### Linkers generated paths
|
||||
|
|
|
|||
|
|
@ -1,23 +0,0 @@
|
|||
# `remap-path-scope`
|
||||
|
||||
The tracking issue for this feature is: [#111540](https://github.com/rust-lang/rust/issues/111540).
|
||||
|
||||
------------------------
|
||||
|
||||
When the `--remap-path-prefix` option is passed to rustc, source path prefixes in all output will be affected by default.
|
||||
The `--remap-path-scope` argument can be used in conjunction with `--remap-path-prefix` to determine paths in which output context should be affected.
|
||||
This flag accepts a comma-separated list of values and may be specified multiple times, in which case the scopes are aggregated together. The valid scopes are:
|
||||
|
||||
- `macro` - apply remappings to the expansion of `std::file!()` macro. This is where paths in embedded panic messages come from
|
||||
- `diagnostics` - apply remappings to printed compiler diagnostics
|
||||
- `debuginfo` - apply remappings to debug information
|
||||
- `coverage` - apply remappings to coverage information
|
||||
- `object` - apply remappings to all paths in compiled executables or libraries, but not elsewhere. Currently an alias for `macro,debuginfo`.
|
||||
- `all` - an alias for all of the above, also equivalent to supplying only `--remap-path-prefix` without `--remap-path-scope`.
|
||||
|
||||
## Example
|
||||
```sh
|
||||
# This would produce an absolute path to main.rs in build outputs of
|
||||
# "./main.rs".
|
||||
rustc --remap-path-prefix=$(PWD)=/remapped -Zremap-path-scope=object main.rs
|
||||
```
|
||||
|
|
@ -10,8 +10,8 @@
|
|||
//@ revisions: with_remap with_coverage_scope with_object_scope with_macro_scope
|
||||
//@ compile-flags: --remap-path-prefix={{src-base}}=remapped
|
||||
//
|
||||
//@[with_coverage_scope] compile-flags: -Zremap-path-scope=coverage
|
||||
//@[with_object_scope] compile-flags: -Zremap-path-scope=object
|
||||
//@[with_macro_scope] compile-flags: -Zremap-path-scope=macro
|
||||
//@[with_coverage_scope] compile-flags: --remap-path-scope=coverage
|
||||
//@[with_object_scope] compile-flags: --remap-path-scope=object
|
||||
//@[with_macro_scope] compile-flags: --remap-path-scope=macro
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -10,9 +10,9 @@
|
|||
LL| |//@ revisions: with_remap with_coverage_scope with_object_scope with_macro_scope
|
||||
LL| |//@ compile-flags: --remap-path-prefix={{src-base}}=remapped
|
||||
LL| |//
|
||||
LL| |//@[with_coverage_scope] compile-flags: -Zremap-path-scope=coverage
|
||||
LL| |//@[with_object_scope] compile-flags: -Zremap-path-scope=object
|
||||
LL| |//@[with_macro_scope] compile-flags: -Zremap-path-scope=macro
|
||||
LL| |//@[with_coverage_scope] compile-flags: --remap-path-scope=coverage
|
||||
LL| |//@[with_object_scope] compile-flags: --remap-path-scope=object
|
||||
LL| |//@[with_macro_scope] compile-flags: --remap-path-scope=macro
|
||||
LL| |
|
||||
LL| 1|fn main() {}
|
||||
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ fn main() {
|
|||
location_caller
|
||||
.crate_type("lib")
|
||||
.remap_path_prefix(cwd(), "/remapped")
|
||||
.arg("-Zremap-path-scope=object")
|
||||
.arg("--remap-path-scope=object")
|
||||
.input(cwd().join("location-caller.rs"));
|
||||
location_caller.run();
|
||||
|
||||
|
|
@ -105,7 +105,7 @@ fn main() {
|
|||
runner
|
||||
.crate_type("bin")
|
||||
.remap_path_prefix(cwd(), "/remapped")
|
||||
.arg("-Zremap-path-scope=diagnostics")
|
||||
.arg("--remap-path-scope=diagnostics")
|
||||
.input(cwd().join("runner.rs"))
|
||||
.output(&runner_bin);
|
||||
runner.run();
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ fn check_dwarf_deps(scope: &str, dwarf_test: DwarfDump) {
|
|||
let mut rustc_sm = rustc();
|
||||
rustc_sm.input(cwd().join("src/some_value.rs"));
|
||||
rustc_sm.arg("-Cdebuginfo=2");
|
||||
rustc_sm.arg(format!("-Zremap-path-scope={}", scope));
|
||||
rustc_sm.arg(format!("--remap-path-scope={}", scope));
|
||||
rustc_sm.arg("--remap-path-prefix");
|
||||
rustc_sm.arg(format!("{}=/REMAPPED", cwd().display()));
|
||||
rustc_sm.arg("-Csplit-debuginfo=off");
|
||||
|
|
@ -117,7 +117,7 @@ fn check_dwarf_deps(scope: &str, dwarf_test: DwarfDump) {
|
|||
rustc_pv.input(cwd().join("src/print_value.rs"));
|
||||
rustc_pv.output(&print_value_rlib);
|
||||
rustc_pv.arg("-Cdebuginfo=2");
|
||||
rustc_pv.arg(format!("-Zremap-path-scope={}", scope));
|
||||
rustc_pv.arg(format!("--remap-path-scope={}", scope));
|
||||
rustc_pv.arg("--remap-path-prefix");
|
||||
rustc_pv.arg(format!("{}=/REMAPPED", cwd().display()));
|
||||
rustc_pv.arg("-Csplit-debuginfo=off");
|
||||
|
|
@ -158,8 +158,8 @@ fn check_dwarf(test: DwarfTest) {
|
|||
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"),
|
||||
ScopeType::Object => rustc.arg("--remap-path-scope=object"),
|
||||
ScopeType::Diagnostics => rustc.arg("--remap-path-scope=diagnostics"),
|
||||
};
|
||||
if is_darwin() {
|
||||
rustc.arg("-Csplit-debuginfo=off");
|
||||
|
|
|
|||
|
|
@ -38,9 +38,9 @@ fn main() {
|
|||
rmeta_contains("/the/aux/lib.rs");
|
||||
rmeta_not_contains("auxiliary");
|
||||
|
||||
out_object.arg("-Zremap-path-scope=object");
|
||||
out_macro.arg("-Zremap-path-scope=macro");
|
||||
out_diagobj.arg("-Zremap-path-scope=diagnostics,object");
|
||||
out_object.arg("--remap-path-scope=object");
|
||||
out_macro.arg("--remap-path-scope=macro");
|
||||
out_diagobj.arg("--remap-path-scope=diagnostics,object");
|
||||
if is_darwin() {
|
||||
out_object.arg("-Csplit-debuginfo=off");
|
||||
out_macro.arg("-Csplit-debuginfo=off");
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
@@ -65,10 +65,28 @@
|
||||
@@ -65,10 +65,31 @@
|
||||
Set a codegen option
|
||||
-V, --version Print version info and exit
|
||||
-v, --verbose Use verbose output
|
||||
|
|
@ -20,6 +20,9 @@
|
|||
+ --remap-path-prefix <FROM>=<TO>
|
||||
+ Remap source names in all output (compiler messages
|
||||
+ and output files)
|
||||
+ --remap-path-scope <macro,diagnostics,debuginfo,coverage,object,all>
|
||||
+ Defines which scopes of paths should be remapped by
|
||||
+ `--remap-path-prefix`
|
||||
+ @path Read newline separated options from `path`
|
||||
|
||||
Additional help:
|
||||
|
|
|
|||
|
|
@ -83,6 +83,9 @@ Options:
|
|||
--remap-path-prefix <FROM>=<TO>
|
||||
Remap source names in all output (compiler messages
|
||||
and output files)
|
||||
--remap-path-scope <macro,diagnostics,debuginfo,coverage,object,all>
|
||||
Defines which scopes of paths should be remapped by
|
||||
`--remap-path-prefix`
|
||||
@path Read newline separated options from `path`
|
||||
|
||||
Additional help:
|
||||
|
|
|
|||
|
|
@ -171,8 +171,7 @@ enum RemapPathPrefix {
|
|||
Unspecified,
|
||||
}
|
||||
|
||||
/// `-Zremap-path-scope`. See
|
||||
/// <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/remap-path-scope.html#remap-path-scope>.
|
||||
/// `--remap-path-scope`
|
||||
#[derive(Debug, Clone)]
|
||||
enum RemapPathScope {
|
||||
/// Comma-separated list of remap scopes: `macro`, `diagnostics`, `debuginfo`, `object`, `all`.
|
||||
|
|
@ -921,7 +920,7 @@ mod shared_linux_other_tests {
|
|||
.debuginfo(level.cli_value())
|
||||
.arg(format!("-Zsplit-dwarf-kind={}", split_dwarf_kind.cli_value()))
|
||||
.remap_path_prefix(cwd(), remapped_prefix)
|
||||
.arg(format!("-Zremap-path-scope={scope}"))
|
||||
.arg(format!("--remap-path-scope={scope}"))
|
||||
.run();
|
||||
let found_files = cwd_filenames();
|
||||
FileAssertions { expected_files: BTreeSet::from(["foo", "foo.dwp"]) }
|
||||
|
|
@ -950,7 +949,7 @@ mod shared_linux_other_tests {
|
|||
.debuginfo(level.cli_value())
|
||||
.arg(format!("-Zsplit-dwarf-kind={}", split_dwarf_kind.cli_value()))
|
||||
.remap_path_prefix(cwd(), remapped_prefix)
|
||||
.arg(format!("-Zremap-path-scope={scope}"))
|
||||
.arg(format!("--remap-path-scope={scope}"))
|
||||
.run();
|
||||
let found_files = cwd_filenames();
|
||||
FileAssertions { expected_files: BTreeSet::from(["foo", "foo.dwp"]) }
|
||||
|
|
@ -1202,7 +1201,7 @@ mod shared_linux_other_tests {
|
|||
.debuginfo(level.cli_value())
|
||||
.arg(format!("-Zsplit-dwarf-kind={}", split_dwarf_kind.cli_value()))
|
||||
.remap_path_prefix(cwd(), remapped_prefix)
|
||||
.arg(format!("-Zremap-path-scope={scope}"))
|
||||
.arg(format!("--remap-path-scope={scope}"))
|
||||
.run();
|
||||
|
||||
let found_files = cwd_filenames();
|
||||
|
|
@ -1242,7 +1241,7 @@ mod shared_linux_other_tests {
|
|||
.debuginfo(level.cli_value())
|
||||
.arg(format!("-Zsplit-dwarf-kind={}", split_dwarf_kind.cli_value()))
|
||||
.remap_path_prefix(cwd(), remapped_prefix)
|
||||
.arg(format!("-Zremap-path-scope={scope}"))
|
||||
.arg(format!("--remap-path-scope={scope}"))
|
||||
.run();
|
||||
|
||||
let found_files = cwd_filenames();
|
||||
|
|
@ -1356,7 +1355,7 @@ fn main() {
|
|||
// NOTE: these combinations are not exhaustive, because while porting to rmake.rs initially I
|
||||
// tried to preserve the existing test behavior closely. Notably, no attempt was made to
|
||||
// exhaustively cover all cases in the 6-fold Cartesian product of `{,-Csplit=debuginfo=...}` x
|
||||
// `{,-Cdebuginfo=...}` x `{,--remap-path-prefix}` x `{,-Zremap-path-scope=...}` x
|
||||
// `{,-Cdebuginfo=...}` x `{,--remap-path-prefix}` x `{,--remap-path-scope=...}` x
|
||||
// `{,-Zsplit-dwarf-kind=...}` x `{,-Clinker-plugin-lto}`. If you really want to, you can
|
||||
// identify which combination isn't exercised with a 6-layers nested for loop iterating through
|
||||
// each of the cli flag enum variants.
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
//@ compile-flags: --remap-path-prefix={{src-base}}=remapped
|
||||
//@ compile-flags: -Zremap-path-scope=debuginfo
|
||||
//@ compile-flags: --remap-path-scope=debuginfo
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! my_file {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
//@ compile-flags: --remap-path-prefix={{src-base}}=remapped
|
||||
//@ compile-flags: -Zremap-path-scope=diagnostics
|
||||
//@ compile-flags: --remap-path-scope=diagnostics
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! my_file {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
//@ compile-flags: --remap-path-prefix={{src-base}}=remapped
|
||||
//@ compile-flags: -Zremap-path-scope=macro
|
||||
//@ compile-flags: --remap-path-scope=macro
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! my_file {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
//@ compile-flags: --remap-path-prefix={{src-base}}=remapped
|
||||
//@ compile-flags: -Zremap-path-scope=debuginfo
|
||||
//@ compile-flags: --remap-path-scope=debuginfo
|
||||
|
||||
pub trait Trait: std::fmt::Display {}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
//@ compile-flags: --remap-path-prefix={{src-base}}=remapped
|
||||
//@ compile-flags: -Zremap-path-scope=diagnostics
|
||||
//@ compile-flags: --remap-path-scope=diagnostics
|
||||
|
||||
pub trait Trait: std::fmt::Display {}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
//@ compile-flags: --remap-path-prefix={{src-base}}=remapped
|
||||
//@ compile-flags: -Zremap-path-scope=macro
|
||||
//@ compile-flags: --remap-path-scope=macro
|
||||
|
||||
pub trait Trait: std::fmt::Display {}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// This test exercises `-Zremap-path-scope`, diagnostics printing paths and dependency.
|
||||
// This test exercises `--remap-path-scope`, diagnostics printing paths and dependency.
|
||||
//
|
||||
// We test different combinations with/without remap in deps, with/without remap in this
|
||||
// crate but always in deps and always here but never in deps.
|
||||
|
|
@ -12,10 +12,10 @@
|
|||
//@[with-debuginfo-in-deps] compile-flags: --remap-path-prefix={{src-base}}=remapped
|
||||
//@[not-diag-in-deps] compile-flags: --remap-path-prefix={{src-base}}=remapped
|
||||
|
||||
//@[with-diag-in-deps] compile-flags: -Zremap-path-scope=diagnostics
|
||||
//@[with-macro-in-deps] compile-flags: -Zremap-path-scope=macro
|
||||
//@[with-debuginfo-in-deps] compile-flags: -Zremap-path-scope=debuginfo
|
||||
//@[not-diag-in-deps] compile-flags: -Zremap-path-scope=diagnostics
|
||||
//@[with-diag-in-deps] compile-flags: --remap-path-scope=diagnostics
|
||||
//@[with-macro-in-deps] compile-flags: --remap-path-scope=macro
|
||||
//@[with-debuginfo-in-deps] compile-flags: --remap-path-scope=debuginfo
|
||||
//@[not-diag-in-deps] compile-flags: --remap-path-scope=diagnostics
|
||||
|
||||
//@[with-diag-in-deps] aux-build:trait-diag.rs
|
||||
//@[with-macro-in-deps] aux-build:trait-macro.rs
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// This test exercises `-Zremap-path-scope`, macros (like file!()) and dependency.
|
||||
// This test exercises `--remap-path-scope`, macros (like file!()) and dependency.
|
||||
//
|
||||
// We test different combinations with/without remap in deps, with/without remap in
|
||||
// this crate but always in deps and always here but never in deps.
|
||||
|
|
@ -15,10 +15,10 @@
|
|||
//@[with-debuginfo-in-deps] compile-flags: --remap-path-prefix={{src-base}}=remapped
|
||||
//@[not-macro-in-deps] compile-flags: --remap-path-prefix={{src-base}}=remapped
|
||||
|
||||
//@[with-diag-in-deps] compile-flags: -Zremap-path-scope=diagnostics
|
||||
//@[with-macro-in-deps] compile-flags: -Zremap-path-scope=macro
|
||||
//@[with-debuginfo-in-deps] compile-flags: -Zremap-path-scope=debuginfo
|
||||
//@[not-macro-in-deps] compile-flags: -Zremap-path-scope=macro
|
||||
//@[with-diag-in-deps] compile-flags: --remap-path-scope=diagnostics
|
||||
//@[with-macro-in-deps] compile-flags: --remap-path-scope=macro
|
||||
//@[with-debuginfo-in-deps] compile-flags: --remap-path-scope=debuginfo
|
||||
//@[not-macro-in-deps] compile-flags: --remap-path-scope=macro
|
||||
|
||||
//@[with-diag-in-deps] aux-build:file-diag.rs
|
||||
//@[with-macro-in-deps] aux-build:file-macro.rs
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
//@ revisions: normal with-diagnostic-scope without-diagnostic-scope
|
||||
//@ compile-flags: --remap-path-prefix={{src-base}}=remapped
|
||||
//@ [with-diagnostic-scope]compile-flags: -Zremap-path-scope=diagnostics
|
||||
//@ [without-diagnostic-scope]compile-flags: -Zremap-path-scope=object
|
||||
//@ [with-diagnostic-scope]compile-flags: --remap-path-scope=diagnostics
|
||||
//@ [without-diagnostic-scope]compile-flags: --remap-path-scope=object
|
||||
// Manually remap, so the remapped path remains in .stderr file.
|
||||
|
||||
// The remapped paths are not normalized by compiletest.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue