"Stability" of the -C passes
and -C llvm-args
flags #40063
Description
These flags are part of the stable rustc
CLI but they let you tap into LLVM internals that we can't guarantee the stability of. Known usages of these flags include:
-
Generating code coverage files. Works on stable
-
Fuzzing (
cargo fuzz
). This additionally requires using a sanitizer so it requires nightly.
Concerns:
-
An LLVM upgrade may break the functionality exposed by these flags. An LLVM pass may be removed or renamed, the code coverage format may change, etc.
-
These flags may pose an obstacle for the adoption of non-LLVM backends (like Cranelift). For example,
-C llvm-args
has no meaning for the Cranelift backend.
We discussed this a bit towards the end of the last tools meeting. Some ways to communicate the unstability of these flags were brought up:
-
Discourage their use. Something along these lines:
- Stable: remove them from
-C help
, and print a warning if they are used - Beta/nightly: show a warning if these flags are used without the
-Z unstable-options
flag.
- Stable: remove them from
-
Document what are the real stability guarantees of the functionality exposed by
-C
flags. -
Provide more targeted unstable
-Z
flags for the LLVM functionality that can be accessed through these flags and encourage users to use those instead the-C
ones. For example,-Z fuzz
,-Z code-coverage
, etc.
cc @rust-lang/tools