fix: Apply lint cap to recompilable dependency crates#23
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.The missing lint cap on the recompilable dependency crates was causing issues with
warnlints polluting the output because of the generated items, anddenyandforbidlints outright preventing compilation, for example with themissing_docslint.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.