You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Given that usually a project uses a rather fixed set of lints, I think it would make sense to make it possible to install (or at least cache) lints so that they can be reused. Right now, AFAIU, the built lints are put into the target directory, which allows reuse, but:
It does not survive cargo clean
It becomes problematic with, say, git worktrees unless you use a shared target directory (which has its own quirks)
It makes CI harder to optimize
I guess it should be possible to attach the required metadata (target triple etc) for the built libraries, and then, if a proper version is stored in ~/.dylint_drivers/libraries (or any other acceptable path), reuse it instead of rebuilding.
And then maybe an optional (and separate) step further would be to make it possible to download prebuilt artifacts from GH releases (similarly to cargo binstall), though here IDK how viable would it be; AFAIU dylint right now uses unstable Rust ABI, however I assume that many people would have their compiler pinned, so at least within a single user base it could be beneficial.
P.S. if this feature will be considered desireable, but maintainers don't have enough bandwidth, I can implement it myself and submit a PR.
Given that usually a project uses a rather fixed set of lints, I think it would make sense to make it possible to install (or at least cache) lints so that they can be reused. Right now, AFAIU, the built lints are put into the target directory, which allows reuse, but:
It does not survive cargo clean
It becomes problematic with, say, git worktrees unless you use a shared target directory (which has its own quirks)
It makes CI harder to optimize
...
P.S. if this feature will be considered desireable, but maintainers don't have enough bandwidth, I can implement it myself and submit a PR.
I, too, have thought about this, and I would accept a PR to implement it.
Here is how I think the feature should work. Please let me know if you disagree with anything.
There is an environment variable, DYLINT_LIBRARIES_DIR. When unset, cargo-dylint defaults to its current behavior of storing compiled libraries in target/dylint/libraries. When set, cargo-dylint stores compiled libraries under that named directory. The organization of that directory is the same either way, e.g., its immediate subdirectories are toolchain names.
When set, DYLINT_LIBRARIES_DIR should hold an absolute path.
I think there are two uses of "dylint/libraries" in dylint/src/library_packages/mod.rs. Those two uses would need to change to support this feature. Hopefully, that's all that should need to change.
I guess it should be possible to attach the required metadata (target triple etc) for the built libraries, and then, if a proper version is stored in ~/.dylint_drivers/libraries (or any other acceptable path), reuse it instead of rebuilding.
As described, I think setting DYLINT_LIBRARIES_DIR to ~/.dylint_drivers/libraries should work. (Though, in a future version of Dylint, I may choose a different location to be the default.)
And then maybe an optional (and separate) step further would be to make it possible to download prebuilt artifacts from GH releases (similarly to cargo binstall), though here IDK how viable would it be; AFAIU dylint right now uses unstable Rust ABI, however I assume that many people would have their compiler pinned, so at least within a single user base it could be beneficial.
This part is less clear to me. But that could be the subject of a future investigation.
Please let me know if anything I wrote doesn't make sense.
It makes sense! The last part is indeed not relevant for this feature, it was more of me wondering about potential use cases / optimizations for users.
Activity
smoelius commentedon Oct 28, 2026
🙏
I, too, have thought about this, and I would accept a PR to implement it.
Here is how I think the feature should work. Please let me know if you disagree with anything.
There is an environment variable,
DYLINT_LIBRARIES_DIR. When unset,cargo-dylintdefaults to its current behavior of storing compiled libraries intarget/dylint/libraries. When set,cargo-dylintstores compiled libraries under that named directory. The organization of that directory is the same either way, e.g., its immediate subdirectories are toolchain names.When set,
DYLINT_LIBRARIES_DIRshould hold an absolute path.I think there are two uses of
"dylint/libraries"indylint/src/library_packages/mod.rs. Those two uses would need to change to support this feature. Hopefully, that's all that should need to change.As described, I think setting
DYLINT_LIBRARIES_DIRto~/.dylint_drivers/librariesshould work. (Though, in a future version of Dylint, I may choose a different location to be the default.)This part is less clear to me. But that could be the subject of a future investigation.
Please let me know if anything I wrote doesn't make sense.
popzxc commentedon Oct 28, 2026
It makes sense! The last part is indeed not relevant for this feature, it was more of me wondering about potential use cases / optimizations for users.
Support a shared Dylint libraries directory
Support a shared Dylint libraries directory
dblock commentedon Nov 13, 2026
I got this going in #2179 and a more comprehensive solution in #2180
Support a shared Dylint libraries directory
Support a shared Dylint libraries directory