Replace slashes with underscores in default crate names. #1336
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.
This is another attempt at #1334, which sought to make "/" characters legal in Rust target names.
This PR differs from #1334 in how it handles build artifacts that are based on
crate_info.output
. There are a few places that currently assume that callingctx.actions.declare_file(...)
will always declare a file in the same directory ascrate_info.output
, i.e. asctx.actions.declare_file(ctx.label.name + ...)
. In a world where label names may include slashes (which is the case today!), this is not a safe assumption, since a slash in the target name causes bazel to create a subdirectory for the output.Specifically, this PR fixes incorrect locations for the following items (when the target name includes a slash):
This leaves a few things that look like they make the same assumption, but I'm not sure how they're used or if they should be updated:
"_ambiguous_libs/" + crate_info.output.basename + "/" + symlink_name
for ambiguous libraries"_objs/" + crate_info.output.basename + "/" + ...
)