Function rustc_driver::handle_options [] [src]

pub fn handle_options(args: &[String]) -> Option<Matches>
Unstable (rustc_private)

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 complication as it ties into our stability story, and it's even more complicated by historical accidents. The current intention of each compiler option is to have one of three modes:

  1. An option is stable and can be used everywhere.
  2. An option is unstable, but was historically allowed on the stable channel.
  3. 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.