Skip to content

fix: Apply lint cap to recompilable dependency crates#23

Merged
zalanlevai merged 2 commits into
mainfrom
fix-lint-cap
Jul 23, 2026
Merged

fix: Apply lint cap to recompilable dependency crates#23
zalanlevai merged 2 commits into
mainfrom
fix-lint-cap

Conversation

@zalanlevai

@zalanlevai zalanlevai commented Jul 23, 2026

Copy link
Copy Markdown
Owner

This PR fixes lint errors triggered when compiling recompilable dependency crates (i.e., --crate-kind=mutable-dep-for-external-tests, which are used for Cargo integration tests to generate a mostly unmodified dependency (the package's lib target) to perform cross-crate analysis against. These recompilable dependency crates are mostly identical to the original crate, except for the insertion of some constant items in a generated mod that store necessary information to be able to transparently recompile the crate as a meta-mutant for a specific integration test.

error: missing documentation for a module
  |
note: the lint level is defined here
 --> tests/ui/harness/cap_lints_recompilable_dep_crate.rs:7:11
  |
7 | #![forbid(missing_docs)]
  |           ^^^^^^^^^^^^

error: missing documentation for a constant

The missing lint cap on the recompilable dependency crates was causing issues with warn lints polluting the output because of the generated items, and deny and forbid lints outright preventing compilation, for example with the missing_docs lint.

This change mirrors the lint cap already applied in the regular test output compilation code path.


This PR also fixes an issue that was revealed by Windows CI with one of the new test cases introduced: certain generated string literals containing strings from the environment, such as file paths, were not escaped. The second commit fixes this issue by applying escaping to these strings before they are written out as string literals.

The missing lint cap on the recompilable dependency crates was causing issues with `warn` lints polluting the output because of the generated items, and `deny` and `forbid` lints outright preventing compilation, for example with the `missing_docs` lint.

This change mirrors the lint cap already applied in the regular test output compilation code path.
Strings containing special characters may be embedded in generated code if the data is coming from the environment, such as various file paths (especially on Windows), and the invocation arguments and environment variables stored for recompilable dependency crates. This change applies escaping to these strings before they are written out as string literals.
@zalanlevai
zalanlevai merged commit 0664560 into main Jul 23, 2026
3 checks passed
@zalanlevai
zalanlevai deleted the fix-lint-cap branch July 23, 2026 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant