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

rustc: Start "stabilizing" some flags #19900

Merged
merged 1 commit into from
Dec 20, 2014

Conversation

alexcrichton
Copy link
Member

This commit shuffles around some CLI flags of the compiler to some more stable
locations with some renamings. The changes made were:

  • The -v flag has been repurposes as the "verbose" flag. The version flag has
    been renamed to -V.
  • The -h screen has been split into two parts. Most top-level options (not
    all) show with -h, and the remaining options (generally obscure) can be
    shown with --help -v which is a "verbose help screen"
  • The -V flag (version flag now) has lost its argument as it is now requested
    with rustc -vV "verbose version".
  • The --emit option has had its ir and bc variants renamed to llvm-ir
    and llvm-bc to emphasize that they are LLVM's IR/bytecode.
  • The --emit option has grown a new variant, dep-info, which subsumes the
    --dep-info CLI argument. The --dep-info flag is now deprecated.
  • The --parse-only, --no-trans, --no-analysis, and --pretty flags have
    moved behind the -Z family of flags.
  • The --debuginfo and --opt-level flags were moved behind the top-level -C
    flag.
  • The --print-file-name and --print-crate-name flags were moved behind one
    global --print flag which now accepts one of crate-name, file-names, or
    sysroot. This global --print flag is intended to serve as a mechanism for
    learning various metadata about the compiler itself.
  • The top-level --pretty flag was moved to a number of -Z options.

No warnings are currently enabled to allow tools like Cargo to have time to
migrate to the new flags before spraying warnings to all users.

cc #19051

@alexcrichton
Copy link
Member Author

cc @brson, @cmr, @nick29581

@sinistersnare
Copy link
Contributor

Not a huge fan of -v being verbose. I think that if people want verbose, they might as well just type --verbose.

@emberian
Copy link
Member

Looks as discussed, 👍

@emberian
Copy link
Member

@sinistersnare existing tools aren't consistent about the treatment of -v, -V, --version, and --verbose. This brings us in line with Cargo and some other compilers, including cc.

@sinistersnare
Copy link
Contributor

Ah ok :) sounds good, +1 then

@mdinger
Copy link
Contributor

mdinger commented Dec 16, 2014

Looks like this fixes #17938 and rust-lang/cargo#690

@pnkfelix
Copy link
Member

cc me

@pnkfelix
Copy link
Member

The summary claims that --pretty was moved to a number of -Z flags, but not all functionality currently located there was preserved. I suspect everything will pass in this PR as-is, because it does not actually remove "pretty" from the optgroups() result; it just has a comment saying that it and a number of other options are deprecated. (And therefore if I understand correctly, the --pretty flowgraph tests in src/tests/run-make will still run; they are just using an option that has been silently deprecated without a replacement.)

I have proposed -Z unstable-options in PR #19964 as a path towards keeping some getopts-based options that we do not want to be part of the stable interface for our users.

@alexcrichton alexcrichton force-pushed the compiler-flags branch 3 times, most recently from c51860c to 2c23def Compare December 19, 2014 18:46
This commit shuffles around some CLI flags of the compiler to some more stable
locations with some renamings. The changes made were:

* The `-v` flag has been repurposes as the "verbose" flag. The version flag has
  been renamed to `-V`.
* The `-h` screen has been split into two parts. Most top-level options (not
  all) show with `-h`, and the remaining options (generally obscure) can be
  shown with `--help -v` which is a "verbose help screen"
* The `-V` flag (version flag now) has lost its argument as it is now requested
  with `rustc -vV` "verbose version".
* The `--emit` option has had its `ir` and `bc` variants renamed to `llvm-ir`
  and `llvm-bc` to emphasize that they are LLVM's IR/bytecode.
* The `--emit` option has grown a new variant, `dep-info`, which subsumes the
  `--dep-info` CLI argument. The `--dep-info` flag is now deprecated.
* The `--parse-only`, `--no-trans`, and `--no-analysis` flags have
  moved behind the `-Z` family of flags.
* The `--debuginfo` and `--opt-level` flags were moved behind the top-level `-C`
  flag.
* The `--print-file-name` and `--print-crate-name` flags were moved behind one
  global `--print` flag which now accepts one of `crate-name`, `file-names`, or
  `sysroot`. This global `--print` flag is intended to serve as a mechanism for
  learning various metadata about the compiler itself.

No warnings are currently enabled to allow tools like Cargo to have time to
migrate to the new flags before spraying warnings to all users.
bors added a commit that referenced this pull request Dec 20, 2014
This commit shuffles around some CLI flags of the compiler to some more stable
locations with some renamings. The changes made were:

* The `-v` flag has been repurposes as the "verbose" flag. The version flag has
  been renamed to `-V`.
* The `-h` screen has been split into two parts. Most top-level options (not
  all) show with `-h`, and the remaining options (generally obscure) can be
  shown with `--help -v` which is a "verbose help screen"
* The `-V` flag (version flag now) has lost its argument as it is now requested
  with `rustc -vV` "verbose version".
* The `--emit` option has had its `ir` and `bc` variants renamed to `llvm-ir`
  and `llvm-bc` to emphasize that they are LLVM's IR/bytecode.
* The `--emit` option has grown a new variant, `dep-info`, which subsumes the
  `--dep-info` CLI argument. The `--dep-info` flag is now deprecated.
* The `--parse-only`, `--no-trans`, `--no-analysis`, and `--pretty` flags have
  moved behind the `-Z` family of flags.
* The `--debuginfo` and `--opt-level` flags were moved behind the top-level `-C`
  flag.
* The `--print-file-name` and `--print-crate-name` flags were moved behind one
  global `--print` flag which now accepts one of `crate-name`, `file-names`, or
  `sysroot`. This global `--print` flag is intended to serve as a mechanism for
  learning various metadata about the compiler itself.
* The top-level `--pretty` flag was moved to a number of `-Z` options.

No warnings are currently enabled to allow tools like Cargo to have time to
migrate to the new flags before spraying warnings to all users.

cc #19051
@bors bors merged commit 117984b into rust-lang:master Dec 20, 2014

let pretty = matches.opt_default("pretty", "normal").map(|a| {
pretty::parse_pretty(&sess, a.as_slice())
});
match pretty {
match pretty.into_iter().next() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hey @alexcrichton , why did you put in this code that, AFAICT, is the identity function on Option<T> ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm I think I forgot to remove this after some other refactoring in this area, feel free to remove though!

@pnkfelix
Copy link
Member

@alexcrichton do we have a good place to discuss moving options around (either out of the short groups, or into the unstable-options that I am planning to land today)? In particular, I would imagine --target, --print, --crate-name, and --cfg could all be moved out of the short group.

@alexcrichton
Copy link
Member Author

I'm fine with chatting on IRC, I was personally thinking that all of those options would stay at the top-level, but they're certainly flexible!

@alexcrichton alexcrichton deleted the compiler-flags branch December 22, 2014 16:07
@pnkfelix
Copy link
Member

nagisa added a commit to nagisa/rust that referenced this pull request Dec 22, 2014
This pull request updates the rustc manual page to represent post-rust-lang#19900
state of rustc options better.

A bit unrelatedly, --help output is changed to fix some issues too:
  * -g and -O descriptions were changed from deprected flags to the new
    codegen flags.
  * dep-info value was moved from crate-type to emit flag.

Fixes rust-lang#20111
Fixes rust-lang#20131
alexcrichton added a commit to alexcrichton/rust that referenced this pull request Dec 22, 2014
This pull request updates the rustc manual page to represent current state of rustc option handling better. Moved the apparently deprecated options (rust-lang#19900) to their own section and added all the new codegen options.

A bit unrelatedly, I also updated description of `-O` and `-g` flags to point to the new codegen options rather than old, deprecated ones.

Fixes rust-lang#20111.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants