Function rustc_driver_impl::handle_options
source · pub fn handle_options(
handler: &EarlyErrorHandler,
args: &[String]
) -> Option<Matches>
Expand description
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:
- An option is stable and can be used everywhere.
- 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.