Skip to content

Linting shouldn't be run on optimized MIR #6080

Open
@ecstatic-morse

Description

@ecstatic-morse

For example, const-checking needs to run before optimizations, otherwise it might miss some invalid operations that get optimized away. Specifically, it should run on the result of the mir_const query, but currently it uses optimized_mir. This is because the result of the mir_const query is "stolen" instead of cloned, so it no longer exists when clippy runs. clippy tries to work around this by setting mir-opt-level=0, but this doesn't disable every optimization pass.

Until this is fixed, missing_const_for_fn will have false positives and/or ICE (due to some assertions about the state of the MIR at the point const-checking is run).

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thingE-hardCall for participation: This a hard problem and requires more experience or effort to work onT-MIRType: This lint will require working with the MIR

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions