Skip to content

"Stability" of the -C passes and -C llvm-args flags #40063

Open
@japaric

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.
  • 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

Metadata

Assignees

No one assigned

    Labels

    A-craneliftThings relevant to the [future] cranelift backendA-gccThings relevant to the [future] GCC backendA-stabilityArea: `#[stable]`, `#[unstable]` etc.C-bugCategory: This is a bug.I-needs-decisionIssue: In need of a decision.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.T-dev-toolsRelevant to the dev-tools subteam, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions