Skip to content

Support supplied Clippy source repositories - #2132

Open
EricLiu2000 wants to merge 5 commits into
trailofbits:masterfrom
EricLiu2000:codex/supplied-clippy-symbols
Open

EricLiu2000 wants to merge 5 commits into
trailofbits:masterfrom
EricLiu2000:codex/supplied-clippy-symbols

Conversation

@EricLiu2000

@EricLiu2000 EricLiu2000 commented Oct 15, 2026 •

Copy link
Copy Markdown

Fixes #2131.

Add DYLINT_CLIPPY_REPO so Dylint can use a supplied local Clippy Git repository instead of cloning from GitHub. Operations use a temporary local clone, with existing revision selection and driver symbol generation unchanged. The supplied repository must contain the history needed by the existing lookup.

Verification: internal tests, formatting, and Clippy pass with network access denied. A local integration with the override backported to Dylint 6.0.1 generates the exact symbol table from its matching clippy_utils and passes the existing lint checks using unmodified driver sources. This does not test a complete upgrade to 6.2.0.

@EricLiu2000
EricLiu2000 requested a review from smoelius as a code owner October 15, 2026 19:31
@CLAassistant

CLAassistant commented Oct 15, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@EricLiu2000

Copy link
Copy Markdown
Author

The Linux cargo-dylint job failed in fix::fix while starting the generated driver, with Text file busy (os error 26). The driver had compiled successfully. This appears to be the concurrent driver installation/execution problem tracked in #1353; this PR does not change the driver installation code.

The corresponding macOS job and the separate Linux cargo-dylint-ci job passed. Could a maintainer rerun the failed job? This remains an unresolved CI failure until the rerun or investigation is complete.

@EricLiu2000
EricLiu2000 force-pushed the codex/supplied-clippy-symbols branch from 12beada to 7884914 Compare October 16, 2026 01:09
@EricLiu2000 EricLiu2000 changed the title Allow supplied Clippy symbols when building the driver Support supplied Clippy source repositories Oct 16, 2026
@EricLiu2000
EricLiu2000 force-pushed the codex/supplied-clippy-symbols branch 2 times, most recently from c5bdd31 to 3377f4b Compare October 16, 2026 04:24

@smoelius smoelius left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@EricLiu2000 A left a few comments below, including a couple of questions. This is not a complete review; I will need to look at this again.

Also, I noticed a couple of changes that appear unnecessary. If there are others that I have not yet noticed, please remove them.

Comment thread driver/build/extra_symbols.rs Outdated
const I_DAY: usize = 2;

pub fn build() -> Result<()> {
println!("cargo:rerun-if-env-changed={}", env::DYLINT_CLIPPY_REPO);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
println!("cargo:rerun-if-env-changed={}", env::DYLINT_CLIPPY_REPO);

I don't think this should be necessary. We should be able to consider any Clippy clone as good as another. Granted, they may differ in how current they are and what is checked out, but I don't think the repo's path is a good indication of that.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Different clones can be checked out to different commits, as you mention. I'd guess that changing the clone used is not going to be a very common operation at all. In that case, keeping this rerun-if-env-changed is a cheap safety guard that only costs anything in this uncommon scenario. Could we keep it?

@smoelius smoelius Oct 25, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like in my response to #2132 (comment), I worry this will cause confusion. I would prefer that it be removed.

Comment thread driver/build/extra_symbols.rs Outdated

pub fn build() -> Result<()> {
println!("cargo:rerun-if-env-changed={}", env::DYLINT_CLIPPY_REPO);
println!("cargo:rerun-if-env-changed={}", env::RUSTUP_TOOLCHAIN);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you tell me what your reasoning is for declaring RUSTUP_TOOLCHAIN rerun-if-env-changed?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The script uses the toolchain name for revision selection and compatibility checks. Cargo already handles compiler changes, but different names can refer to the same compiler. This is arguably a really niche edge case, but similar to the above - if it's a really niche edge case, then this is just a cheap safety guard.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

different names can refer to the same compiler

That's true, but that would cause additional recompilations; it wouldn't prevent necessary recompilations.

I think this is unnecessary and likely to cause confusion. Please remove it.

Comment thread driver/build/extra_symbols.rs Outdated
Comment thread driver/build/extra_symbols.rs Outdated
Comment thread internal/src/clippy_utils/repository.rs
@EricLiu2000
EricLiu2000 force-pushed the codex/supplied-clippy-symbols branch from 48093bf to 272df98 Compare October 22, 2026 08:24
@EricLiu2000
EricLiu2000 requested a review from smoelius October 22, 2026 17:12

@smoelius smoelius left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@EricLiu2000 I still have to review the tests. But I would like to please do that after you have had a chance to consider these comments.

Comment thread driver/build/extra_symbols.rs Outdated
const I_DAY: usize = 2;

pub fn build() -> Result<()> {
println!("cargo:rerun-if-env-changed={}", env::DYLINT_CLIPPY_REPO);

@smoelius smoelius Oct 25, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like in my response to #2132 (comment), I worry this will cause confusion. I would prefer that it be removed.

Comment thread driver/build/extra_symbols.rs Outdated

pub fn build() -> Result<()> {
println!("cargo:rerun-if-env-changed={}", env::DYLINT_CLIPPY_REPO);
println!("cargo:rerun-if-env-changed={}", env::RUSTUP_TOOLCHAIN);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

different names can refer to the same compiler

That's true, but that would cause additional recompilations; it wouldn't prevent necessary recompilations.

I think this is unnecessary and likely to cause confusion. Please remove it.

Comment thread driver/build/extra_symbols.rs Outdated
write(&path_buf, "const EXTRA_SYMBOLS: &[&str] = &[];")
.with_context(|| format!("`write` failed for `{}`", path_buf.display()))?;
return Ok(());
let sym_rs = if let Some(path) = clippy_repository_path()? {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this check is unnecessary. If it fails (i.e., DYLINT_CLIPPY_REPO is unset), the check is performed again in clippy_utils_sym_rs via its call to clippy_repository.

It should be possible to keep the old control flow and check DYLINT_CLIPPY_REPO in just clippy_repository.

So, unless you see a mistake in what I've said, please use the old control flow and remove supplied_clippy_sym_rs.

@EricLiu2000
EricLiu2000 force-pushed the codex/supplied-clippy-symbols branch from 5c2b3d9 to 94ef57e Compare October 26, 2026 17:28

This branch has not been deployed

No deployments
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.

Allow supplied Clippy symbol source when building the driver without network access

3 participants