Skip to content

Add testing for lint machinery at runtime #1004

Description

@clubby789

Proposal

Currently, there seems to be no dedicated tests for the compiler's lint emission. There are tests for the #[derive(Diagnostic)] macro, and the existing UI test suite tests the system generally, but there is no mechanism to test the emission of arbitrary diagnostics. This means that PRs adding new features or behaviour to the diagnostic system will not be able to test edge cases.

For example, the motivating PR (rust-lang/rust#157707) contains no tests at all, and the lint that motivated that (rust-lang/rust#158136) only tests the behaviour very briefly.

I would like to propose allowing testing lints more fully with a new aux-lint directive; this will compile a test using a custom rustc_driver that loads the provided lint library. This is implemented in rust-lang/rust#157721.

The actual change only impacts bootstrap and compiletest, but @Mark-Simulacrum suggested an MCP as this machinery would need to be kept up to date with any changes to the lint infrastructure.

Process

The main points of the Major Change Process are as follows:

  • File an issue describing the proposal.
  • A compiler team member who is knowledgeable in the area can second by writing @rustbot second or kickoff a team FCP with @rfcbot fcp $RESOLUTION.
  • Once an MCP is seconded, the Final Comment Period begins.
    • Final Comment Period lasts for 10 days after all outstanding concerns are solved.
    • Outstanding concerns will block the Final Comment Period from finishing. Once all concerns are resolved, the 10 day countdown is restarted.
    • If no concerns are raised after 10 days since the resolution of the last outstanding concern, the MCP is considered approved.

You can read more about Major Change Proposals on forge.

Metadata

Metadata

Assignees

No one assigned

    Labels

    T-compilerAdd this label so rfcbot knows to poll the compiler teammajor-changeA proposal to make a major change to rustc

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions