Remove Label
wrappers for target string literals
#1728
Merged
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.
Description
Removes all the
Label
wrappers added in #1696 that aren't strictly necessary.Removed instances:
Remaining instances:
Motivation
Inspired by research I did while writing a blog post reflecting upon the motivations behind #1696.
Bazel evaluates target string literals in the context of the repository that appears to contain the assignment of the literal to a
Label
attribute.Label
wrappers are necessary for target string literals within macros, passed to external functions, and included in files generated by a repository rule. This ensures that the targets refer to the originating repository by preventing Bazel from interpreting them within the context of the repository using them.Keeping the
Label
wrappers doesn't hurt, but leaving only the ones that are required helps those instances stand out.