[][src]Function rustc_driver::handle_options

pub fn handle_options(args: &[String]) -> Option<Matches>
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Process command line options. Emits messages as appropriate. If compilation should continue, returns a getopts::Matches object parsed from args, otherwise returns None.

The compiler's handling of options is a little complicated as it ties into our stability story. The current intention of each compiler option is to have one of two modes:

  1. An option is stable and can be used everywhere.
  2. An option is unstable, and can only be used on nightly.

Like unstable library and language features, however, unstable options have always required a form of "opt in" to indicate that you're using them. This provides the easy ability to scan a code base to check to see if anything unstable is being used. Currently, this "opt in" is the -Z "zed" flag.

All options behind -Z are considered unstable by default. Other top-level options can also be considered unstable, and they were unlocked through the -Z unstable-options flag. Note that -Z remains to be the root of instability in both cases, though.

So with all that in mind, the comments below have some more detail about the contortions done here to get things to work out correctly.