Skip to content
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

Rollup of 8 pull requests #130461

Closed
wants to merge 32 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
6360287
Fix #128930: Print documentation of CLI options missing their arg
GKFX Aug 11, 2024
ae75a9b
Update expectations
GKFX Aug 11, 2024
13e36cf
add new_cyclic_in for rc
Aug 28, 2024
21cb847
fix fmt
Aug 29, 2024
4abb8e2
fix new_cyclic_in for rc
Aug 29, 2024
2383cc9
improve comments
Aug 29, 2024
68169d3
add new_cyclic_in for Arc
Aug 29, 2024
97df334
remove the Clone requirement
Sep 6, 2024
550e55f
Remove duplicate impl
Sep 6, 2024
9d5d03b
Don't call extern_crate when local crate name is the same as a depend…
compiler-errors Sep 12, 2024
05483d5
Relate receiver invariantly in method probe for Mode::Path
compiler-errors Aug 14, 2024
6e982f5
Don't ICE in opaque_hidden_inferred_bound lint for RPITIT in trait wi…
compiler-errors Sep 16, 2024
062ff4d
Encode coroutine_by_move_body_def_id in crate metadata
compiler-errors Sep 10, 2024
af1ca77
Record synthetic MIR bodies in mir_keys
compiler-errors Sep 10, 2024
6750f04
Update library/alloc/src/sync.rs
matthewpipie Sep 17, 2024
978f10d
tests: allow trunc/select instructions to be missing
durin42 Sep 17, 2024
4beb1cf
Fix a couple more DefKind discrepancies between DefKind::Closure and …
compiler-errors Sep 17, 2024
bdacdfe
Minimize visibilities.
nnethercote Sep 5, 2024
cd3da00
Clean up formatting.
nnethercote Sep 10, 2024
52c5de0
Streamline `bin_op_to_[if]cmp_predicate`.
nnethercote Sep 10, 2024
b3b56d8
Remove unnecessary `cx` argument.
nnethercote Sep 11, 2024
ae1f092
Streamline `coroutine_kind_label`.
nnethercote Sep 11, 2024
3ec2f12
Rename some lifetimes.
nnethercote Sep 11, 2024
c629538
Merge some impl blocks.
nnethercote Sep 13, 2024
9b91d67
Rollup merge of #128961 - GKFX:issue-128930-explain-missing-option, r…
fee1-dead Sep 17, 2024
1f1beb6
Rollup merge of #129073 - compiler-errors:receiver-variance, r=lcnr
fee1-dead Sep 17, 2024
5385303
Rollup merge of #129674 - matthewpipie:rc-arc-new-cyclic-in, r=dtolnay
fee1-dead Sep 17, 2024
8a5f499
Rollup merge of #130201 - compiler-errors:foreign-synthetic-body, r=lcnr
fee1-dead Sep 17, 2024
4922280
Rollup merge of #130275 - compiler-errors:extern-crate, r=lcnr
fee1-dead Sep 17, 2024
4a9fbc3
Rollup merge of #130440 - compiler-errors:rpitit-opaque-hidden, r=jie…
fee1-dead Sep 17, 2024
50a8de3
Rollup merge of #130454 - durin42:llvm-20-notrunc, r=workingjubilee
fee1-dead Sep 17, 2024
50fd6ce
Rollup merge of #130458 - nnethercote:rustc_codegen_ssa-cleanups, r=j…
fee1-dead Sep 17, 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
Next Next commit
Fix #128930: Print documentation of CLI options missing their arg
  • Loading branch information
GKFX committed Aug 11, 2024
commit 6360287fd91c5d02597b45ef65c34388af348638
17 changes: 15 additions & 2 deletions compiler/rustc_driver_impl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1221,17 +1221,30 @@ pub fn handle_options(early_dcx: &EarlyDiagCtxt, args: &[String]) -> Option<geto
// Parse with *all* options defined in the compiler, we don't worry about
// option stability here we just want to parse as much as possible.
let mut options = getopts::Options::new();
for option in config::rustc_optgroups() {
let optgroups = config::rustc_optgroups();
for option in &optgroups {
(option.apply)(&mut options);
}
let matches = options.parse(args).unwrap_or_else(|e| {
let msg = match e {
let msg: Option<String> = match e {
getopts::Fail::UnrecognizedOption(ref opt) => CG_OPTIONS
.iter()
.map(|&(name, ..)| ('C', name))
.chain(Z_OPTIONS.iter().map(|&(name, ..)| ('Z', name)))
.find(|&(_, name)| *opt == name.replace('_', "-"))
.map(|(flag, _)| format!("{e}. Did you mean `-{flag} {opt}`?")),
getopts::Fail::ArgumentMissing(ref opt) => {
optgroups.iter().find(|option| option.name == opt).map(|option| {
// Print the help just for the option in question.
let mut options = getopts::Options::new();
(option.apply)(&mut options);
// getopt requires us to pass a function for joining an iterator of
// strings, even though in this case we expect exactly one string.
options.usage_with_format(|it| {
it.fold(format!("{e}\nUsage:"), |a, b| a + "\n" + &b)
})
})
}
_ => None,
};
early_dcx.early_fatal(msg.unwrap_or_else(|| e.to_string()));
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_session/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1349,7 +1349,7 @@ enum OptionStability {

pub struct RustcOptGroup {
pub apply: Box<dyn Fn(&mut getopts::Options) -> &mut getopts::Options>,
name: &'static str,
pub name: &'static str,
stability: OptionStability,
}

Expand Down
1 change: 1 addition & 0 deletions tests/ui/invalid-compile-flags/print-without-arg.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//@ compile-flags: --print
5 changes: 5 additions & 0 deletions tests/ui/invalid-compile-flags/print-without-arg.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
error: Argument to option 'print' missing
Usage:
--print [crate-name|file-names|sysroot|target-libdir|cfg|check-cfg|calling-conventions|target-list|target-cpus|target-features|relocation-models|code-models|tls-models|target-spec-json|all-target-specs-json|native-static-libs|stack-protector-strategies|link-args|deployment-target]
Compiler information to print on stdout

Loading