Skip to content

Rollup of 9 pull requests #139979

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 23 commits into from
Apr 17, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
96984c0
add retry support to recursive_remove
Shourya742 Apr 15, 2025
003d633
add remove_and_create_dir_all in build_helper
Shourya742 Apr 15, 2025
d4eab8a
remove old remove_and_create_dir_all and use build_helpers remove_and…
Shourya742 Apr 15, 2025
b4b9cfb
Upgrade to `rustc-rayon-core` 0.5.1
cuviper Apr 16, 2025
3863018
Fix replacing supertrait aliases in ReplaceProjectionWith
compiler-errors Apr 16, 2025
e1936d2
Remove FIXME that is no longer relevant
compiler-errors Apr 14, 2025
9f548e2
Support inlined cross-crate re-exported trait aliases
fmease Apr 17, 2025
675360a
Remove some unnecessary lifetimes.
nnethercote Oct 22, 2024
99a60eb
`intern_with_temp_alloc` is for `DummyMachine` only.
nnethercote Oct 22, 2024
bf26963
bootstrap: enable zlib for LLVM when we compile it for profiling
ognevny Apr 17, 2025
62a104d
opt-dist: add a flag for running tests
ognevny Apr 17, 2025
289a23e
do not emit `OpaqueCast` projections with `-Znext-solver`
lcnr Apr 16, 2025
c85b5fc
check OpaqueCast tests with next-solver
lcnr Apr 17, 2025
8562110
Hide unstable print kinds within emit_unknown_print_request_help in s…
xizheyin Apr 15, 2025
da43826
Rollup merge of #139774 - compiler-errors:supertrait-alias, r=lcnr
matthiaskrgr Apr 17, 2025
d2db1c1
Rollup merge of #139850 - xizheyin:issue-138698, r=jieyouxu
matthiaskrgr Apr 17, 2025
cecc7a4
Rollup merge of #139870 - Shourya742:2025-04-15-add-retries-to-remove…
matthiaskrgr Apr 17, 2025
67e2358
Rollup merge of #139902 - lcnr:no-opaque-cast-projection, r=oli-obk
matthiaskrgr Apr 17, 2025
dce7506
Rollup merge of #139931 - ognevny:bootstrap-llvm-zlib, r=Kobzol
matthiaskrgr Apr 17, 2025
b79996d
Rollup merge of #139935 - cuviper:rustc-rayon-core-0.5.1, r=lqd
matthiaskrgr Apr 17, 2025
7a4525c
Rollup merge of #139943 - fmease:rustdoc-ixcre-trait-aliases, r=Guill…
matthiaskrgr Apr 17, 2025
8281a54
Rollup merge of #139961 - nnethercote:two-rustc_const_eval-cleanups, …
matthiaskrgr Apr 17, 2025
6922524
Rollup merge of #139962 - ognevny:opt-dist-tests, r=Kobzol
matthiaskrgr Apr 17, 2025
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
37 changes: 25 additions & 12 deletions compiler/rustc_session/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2065,7 +2065,8 @@ fn collect_print_requests(
check_print_request_stability(early_dcx, unstable_opts, (print_name, *print_kind));
*print_kind
} else {
emit_unknown_print_request_help(early_dcx, req)
let is_nightly = nightly_options::match_is_nightly_build(matches);
emit_unknown_print_request_help(early_dcx, req, is_nightly)
};

let out = out.unwrap_or(OutFileName::Stdout);
Expand All @@ -2089,25 +2090,37 @@ fn check_print_request_stability(
unstable_opts: &UnstableOptions,
(print_name, print_kind): (&str, PrintKind),
) {
if !is_print_request_stable(print_kind) && !unstable_opts.unstable_options {
early_dcx.early_fatal(format!(
"the `-Z unstable-options` flag must also be passed to enable the `{print_name}` \
print option"
));
}
}

fn is_print_request_stable(print_kind: PrintKind) -> bool {
match print_kind {
PrintKind::AllTargetSpecsJson
| PrintKind::CheckCfg
| PrintKind::CrateRootLintLevels
| PrintKind::SupportedCrateTypes
| PrintKind::TargetSpecJson
if !unstable_opts.unstable_options =>
{
early_dcx.early_fatal(format!(
"the `-Z unstable-options` flag must also be passed to enable the `{print_name}` \
print option"
));
}
_ => {}
| PrintKind::TargetSpecJson => false,
_ => true,
}
}

fn emit_unknown_print_request_help(early_dcx: &EarlyDiagCtxt, req: &str) -> ! {
let prints = PRINT_KINDS.iter().map(|(name, _)| format!("`{name}`")).collect::<Vec<_>>();
fn emit_unknown_print_request_help(early_dcx: &EarlyDiagCtxt, req: &str, is_nightly: bool) -> ! {
let prints = PRINT_KINDS
.iter()
.filter_map(|(name, kind)| {
// If we're not on nightly, we don't want to print unstable options
if !is_nightly && !is_print_request_stable(*kind) {
None
} else {
Some(format!("`{name}`"))
}
})
.collect::<Vec<_>>();
let prints = prints.join(", ");

let mut diag = early_dcx.early_struct_fatal(format!("unknown print request: `{req}`"));
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@@ -1,5 +1,5 @@
error: unknown print request: `xxx`
|
- = help: valid print requests are: `calling-conventions`, `cfg`, `code-models`, `crate-name`, `deployment-target`, `file-names`, `host-tuple`, `link-args`, `native-static-libs`, `relocation-models`, `split-debuginfo`, `stack-protector-strategies`, `sysroot`, `target-cpus`, `target-features`, `target-libdir`, `target-list`, `tls-models`
+ = help: valid print requests are: `all-target-specs-json`, `calling-conventions`, `cfg`, `check-cfg`, `code-models`, `crate-name`, `crate-root-lint-levels`, `deployment-target`, `file-names`, `host-tuple`, `link-args`, `native-static-libs`, `relocation-models`, `split-debuginfo`, `stack-protector-strategies`, `supported-crate-types`, `sysroot`, `target-cpus`, `target-features`, `target-libdir`, `target-list`, `target-spec-json`, `tls-models`
= help: for more information, see the rustc book: https://doc.rust-lang.org/rustc/command-line-arguments.html#--print-print-compiler-information

33 changes: 33 additions & 0 deletions tests/run-make/print-request-help-stable-unstable/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
//! Check that unstable print requests are omitted from help if compiler is in stable channel.
//!
//! Issue: <https://github.com/rust-lang/rust/issues/138698>
use run_make_support::{diff, rustc, similar};

fn main() {
let stable_invalid_print_request_help = rustc()
.env("RUSTC_BOOTSTRAP", "-1")
.cfg("force_stable")
.print("xxx")
.run_fail()
.stderr_utf8();
assert!(!stable_invalid_print_request_help.contains("all-target-specs-json"));
diff()
.expected_file("stable-invalid-print-request-help.err")
.actual_text("stable_invalid_print_request_help", &stable_invalid_print_request_help)
.run();

let unstable_invalid_print_request_help = rustc().print("xxx").run_fail().stderr_utf8();
assert!(unstable_invalid_print_request_help.contains("all-target-specs-json"));
diff()
.expected_file("unstable-invalid-print-request-help.err")
.actual_text("unstable_invalid_print_request_help", &unstable_invalid_print_request_help)
.run();

let help_diff = similar::TextDiff::from_lines(
&stable_invalid_print_request_help,
&unstable_invalid_print_request_help,
)
.unified_diff()
.to_string();
diff().expected_file("help-diff.diff").actual_text("help_diff", help_diff).run();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
error: unknown print request: `xxx`
|
= help: valid print requests are: `calling-conventions`, `cfg`, `code-models`, `crate-name`, `deployment-target`, `file-names`, `host-tuple`, `link-args`, `native-static-libs`, `relocation-models`, `split-debuginfo`, `stack-protector-strategies`, `sysroot`, `target-cpus`, `target-features`, `target-libdir`, `target-list`, `tls-models`
= help: for more information, see the rustc book: https://doc.rust-lang.org/rustc/command-line-arguments.html#--print-print-compiler-information

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
error: unknown print request: `xxx`
|
= help: valid print requests are: `all-target-specs-json`, `calling-conventions`, `cfg`, `check-cfg`, `code-models`, `crate-name`, `crate-root-lint-levels`, `deployment-target`, `file-names`, `host-tuple`, `link-args`, `native-static-libs`, `relocation-models`, `split-debuginfo`, `stack-protector-strategies`, `supported-crate-types`, `sysroot`, `target-cpus`, `target-features`, `target-libdir`, `target-list`, `target-spec-json`, `tls-models`
= help: for more information, see the rustc book: https://doc.rust-lang.org/rustc/command-line-arguments.html#--print-print-compiler-information