compiletest: Add testing for lint machinery at runtime#157721
compiletest: Add testing for lint machinery at runtime#157721clubby789 wants to merge 2 commits into
Conversation
|
These commits modify the If this was unintentional then you should revert the changes before this PR is merged. Some changes occurred in src/tools/compiletest cc @jieyouxu |
|
rustbot has assigned @Mark-Simulacrum. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
|
| let lint_driver: PathBuf = builder | ||
| .ensure(tool::CompiletestLintDriver { | ||
| compiler: test_compiler, | ||
| target: test_compiler.host, | ||
| }) | ||
| .tool_path; |
There was a problem hiding this comment.
This does add some tool+std builds unconditionally to any ui-fulldeps invoke; this should hopefully be relatively low impact in practice
|
Just because I'm a little unsure on the correctness of some of the logic: |
This comment has been minimized.
This comment has been minimized.
compiletest: Add testing for lint machinery at runtime try-job: x86_64-gnu-stable try-job: dist-x86_64-msvc
I'm a bit confused (probably just missing something...)... but aren't those macros tested by every diagnostics-related UI test in the existing suite? It's an indirect test but it should still catch bugs in practice, right? If we wanted to test the raw output, I'd expect that to be done with something more like proc-macro2 + insta to snapshot test what is produced by the macro? I think in general it would make sense to make a compiler MCP for this since it'll at minimum make it a bit more painful to edit the lint infrastructure. |
|
'Output' as in the runtime diagnostics emission. The machinery in general is tested, but when introducing new features to the system (i.e. lint MSRV) it would be nice to test the edge cases of behaviour. An MCP probably does make sense here though. |
While implementing #157707, I noticed that we don't have 'runtime' tests for the diagnostic machinery (i.e. we test the derive macros themselves, but not their output when emitted). This introduces a new way to test this machinery.
//@ aux-lint: file.rs, which builds a lint library inauxiliary/file.rsrustc_private, and export aextern "C" fn register_lints(...)compiletest-lint-driverwraps rustc and installs the provided lints when building the testIncluded is a simple demo lint for example
AI Disclosure: I used an LLM to plan out the broad structure of the machinery and identify issues; all code in this PR is written by hand