flycheck: Fix label for source file - #4238
Open
tyler-breisacher-zipline wants to merge 3 commits into
Open
Conversation
UebelAndre
requested changes
Aug 24, 2026
UebelAndre
left a comment
Collaborator
There was a problem hiding this comment.
Thanks! Can you think of any regression testing that could be added for this?
dzbarsky
added a commit
to hermeticbuild/rules_rust
that referenced
this pull request
Aug 25, 2026
Use source_file_label to preserve filenames relative to the owning Bazel package when query_label_for builds the srcs query. Files such as src/adb.rs now match the target's source label instead of :adb.rs. Add a regression test for root packages, nested directories, and direct source files. The test fails with the old basename behavior. Based on bazelbuild#4238; addresses hermeticbuild/rules_rs#232. Validation: 10 Flycheck tests and 44 rust-analyzer library tests pass through rules_rs. --saved-file command checks pass for four package layouts.
Author
Maybe something like this 5f2c153 but the function naming needs some work: it's not obvious without reading the doc comments that |
| /// files. Returns the dir path; caller is responsible for cleanup | ||
| /// (use `remove_dir_all` in a `_guard`-style drop, or accept the | ||
| /// leak — TMPDIR gets cleaned eventually). | ||
| pub fn make_workspace(tag: &str, files: &[(&str, &str)]) -> Utf8PathBuf { |
There was a problem hiding this comment.
I wanted to make this #[cfg(test)] but it got configured out, maybe better to make a separate crate of test utils or something
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.
For example, if you have a BUILD file at
my/cool/project/BUILD, and a source file atmy/cool/project/src/utils/lib.rs, the label for that source file should be//my/cool/project:src/utils/lib.rsnot//my/cool/project:lib.rs