rust-lang / rust-lang/compiler-team
Add testing for lint machinery at runtime
Nobody has claimed this yet.
- Dominant language
- HTML
- Stars
- 433
- Forks
- 73
- Avg merge
- 1m
- Merged PRs (30d)
- 1
Description
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 (https://github.com/rust-lang/rust/pull/157707) contains no tests at all, and the lint that motivated that (https://github.com/rust-lang/rust/pull/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 https://github.com/rust-lang/rust/pull/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 secondor kickoff a team FCP with@rfcbot fcp $RESOLUTION.- Refer to Proposals, Approvals and Stabilization docs for when a second is sufficient, or when a full team FCP is required.
- 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.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the proposal and linked PR 157721, then inspect the bootstrap and compiletest machinery it changes. Confirm how the proposed aux-lint directive loads a custom rustc_driver and how arbitrary lint diagnostics would be exercised. Done means the testing mechanism is agreed through the MCP process and supports thorough lint-emission tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers, testing
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100