Skip to content

changes to build scripts and config.toml should always refresh#21969

Merged
Veykril merged 1 commit intorust-lang:masterfrom
BenjaminBrienen:reload
Apr 9, 2026
Merged

changes to build scripts and config.toml should always refresh#21969
Veykril merged 1 commit intorust-lang:masterfrom
BenjaminBrienen:reload

Conversation

@BenjaminBrienen
Copy link
Copy Markdown
Contributor

Discussed here
https://rust-lang.zulipchat.com/#narrow/channel/185405-t-compiler.2Frust-analyzer/topic/Why.20does.20this.20guard.20exist.3F/with/583780871

Note that this may cause a lot of annoying refreshes when editing build scripts, but this is technically correct.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 6, 2026
Copy link
Copy Markdown
Member

@Veykril Veykril left a comment

Choose a reason for hiding this comment

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

Reading this again this change is not correct I think. This will cause us to reload the crate graph entirely when the build script changes which is more work than we should be doing, we should only retrigger build scripts, which we already do on next file save.

The cargo config changes seems correct to me though.

View changes since this review

@BenjaminBrienen
Copy link
Copy Markdown
Contributor Author

Is it not possible for a build script to create output that would cause a change in the crate graph? For example, a build script that writes a new workspace member to disk (could be glob included). Maybe the resulting file changes would already trigger the refresh.

@BenjaminBrienen
Copy link
Copy Markdown
Contributor Author

Also, why does this logic use ends_with? That doesn't seem like the right way to get the "leaf".

@Veykril
Copy link
Copy Markdown
Member

Veykril commented Apr 7, 2026

A buildscript could create a new workspace member yes, but in that case a) I question what you are doing, b) r-a will reload on the creation notification fully (and probably get stuck in a reload loop)

Also, why does this logic use ends_with? That doesn't seem like the right way to get the "leaf".

good question, probably no reason. We should likely use filename there and check that directly

@BenjaminBrienen
Copy link
Copy Markdown
Contributor Author

BenjaminBrienen commented Apr 7, 2026

A build script could generate a rest API client crate based on an OpenAPI spec file, for example. If someone adds a line to the build script to generate a second one for another web service, then I wonder if they would have to manually reload the workspace.

@Veykril
Copy link
Copy Markdown
Member

Veykril commented Apr 9, 2026

The build script should generate the content of the crate then, not the crate itself. Having build scripts change the crate graph sounds incredibly fishy

@Veykril Veykril added this pull request to the merge queue Apr 9, 2026
Merged via the queue into rust-lang:master with commit 88662e1 Apr 9, 2026
17 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 9, 2026
@BenjaminBrienen BenjaminBrienen deleted the reload branch April 9, 2026 08:51
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.

3 participants