Reject subdirectory manifests that are not members of the workspace #93
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.
The previous implementation had one fatal flaw: having a non-workspace
Cargo.toml
in a subdirectory, with a[workspace]
defined some directories higher is invalid when that[workspace]
doesn't include the givenCargo.toml
subdirectory/package.cargo
rejects this with acurrent package believes it's in a workspace when it's not
, and we should do the same instead of having anunwrap_or_else
that falls back to using the workspace rootCargo.toml
as a package (especially if it might not contain a[package]
at all).This would for example fail when running
x new template
in the repo directory,cd
'ing into it and invokingx build
. Instead of complaining abouttemplate/Cargo.toml
not being part of the workspace, it detects the workspace and falls back to building the root package because thetemplate
directory appears to just be a subdirectory of the root without defining a subpackage along it. Since our root doesn't define a[package]
, the supposed-to-be-infallibleunwrap()
onmanifest.package
below fails.