Skip to content

Commit

Permalink
Rollup merge of #104104 - kamirr:master, r=lcnr
Browse files Browse the repository at this point in the history
Add split-debuginfo print option

This option prints all supported values for `-Csplit-debuginfo=..`, i.e. only stable ones on stable/beta and all of them on nightly/dev.

Motivated by 1.65.0 regression causing builds with the following entry in `Cargo.toml` to fail on Windows:
```toml
[profile.dev]
split-debuginfo = "unpacked"
```

See rust-lang/cargo#11347 for details.

This will lead to closing #103976.
  • Loading branch information
Manishearth authored Nov 8, 2022
2 parents 62dd898 + 4c3cad0 commit 925045b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
11 changes: 11 additions & 0 deletions compiler/rustc_driver/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -736,6 +736,17 @@ fn print_crate_info(
// Any output here interferes with Cargo's parsing of other printed output
NativeStaticLibs => {}
LinkArgs => {}
SplitDebuginfo => {
use rustc_target::spec::SplitDebuginfo::{Off, Packed, Unpacked};

for split in &[Off, Packed, Unpacked] {
let stable = sess.target.options.supported_split_debuginfo.contains(split);
let unstable_ok = sess.unstable_options();
if stable || unstable_ok {
println!("{}", split);
}
}
}
}
}
Compilation::Stop
Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_session/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,7 @@ pub enum PrintRequest {
NativeStaticLibs,
StackProtectorStrategies,
LinkArgs,
SplitDebuginfo,
}

pub enum Input {
Expand Down Expand Up @@ -1806,6 +1807,7 @@ fn collect_print_requests(
("stack-protector-strategies", PrintRequest::StackProtectorStrategies),
("target-spec-json", PrintRequest::TargetSpec),
("link-args", PrintRequest::LinkArgs),
("split-debuginfo", PrintRequest::SplitDebuginfo),
];

prints.extend(matches.opt_strs("print").into_iter().map(|req| {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
error: unknown print request `uwu`. Valid print requests are: `crate-name`, `file-names`, `sysroot`, `target-libdir`, `cfg`, `calling-conventions`, `target-list`, `target-cpus`, `target-features`, `relocation-models`, `code-models`, `tls-models`, `native-static-libs`, `stack-protector-strategies`, `target-spec-json`, `link-args`
error: unknown print request `uwu`. Valid print requests are: `crate-name`, `file-names`, `sysroot`, `target-libdir`, `cfg`, `calling-conventions`, `target-list`, `target-cpus`, `target-features`, `relocation-models`, `code-models`, `tls-models`, `native-static-libs`, `stack-protector-strategies`, `target-spec-json`, `link-args`, `split-debuginfo`

0 comments on commit 925045b

Please sign in to comment.