-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get all members as available targets
even though default-members was specified.
#15199
base: master
Are you sure you want to change the base?
Conversation
r? @weihanglo rustbot has assigned @weihanglo. Use |
[ERROR] "--bin" takes one argument. | ||
Available binaries: | ||
crate1 | ||
crate2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixes #14544
If the fix only adds bins from all targets to this error theo it will lead to user frustration as they then add --bin crate2
and it fails without saying why.
The core problem in the Issue is the --bin crate2
error message. It only suggested touching this error message as an addendum and suggested it show what the needed package is. I agree with that with the caveat that we need to double check if our completion or fish's completion script uses the output from this. While this is meant for humans and can change, we still want to play nice with these.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While the focus of #14544 is now included, two of the 3 improvements still require investigating their impact on cargo's and fish's completions and one still has the issue of showing values that can't be used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@linyihai maybe we should just split this PR so we can move forward the --bin foo
case and deal with --bin
separately
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let us focus on the --bin foo case
case
3c409c9
to
ee13fd6
Compare
ee13fd6
to
d1ed4c8
Compare
d1ed4c8
to
7389aff
Compare
3d78767
to
7735088
Compare
tests/testsuite/workspaces.rs
Outdated
[ERROR] no bin target named `crate2`. | ||
Available bin targets: | ||
another | ||
Available bin targets in crate2: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For cases like this where the bin and target name are redundant, should we clarify this
Available bin targets in package
crate2
:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed the targets
that it seems not nessary.
2ae0f25
to
c3aa679
Compare
@@ -286,7 +286,7 @@ impl<'a> UnitGenerator<'a, '_> { | |||
if !suggestion.is_empty() { | |||
write!( | |||
msg, | |||
"no {} target {} `{}`{}{}", | |||
"no {} target {} `{}` in default-run packages{}{}", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're always saying in default-run packages
even if the user explicitly said --package foo
?
let pattern = build_glob(target_name)?; | ||
let filter = |t: &Target| { | ||
if is_glob { | ||
is_expected_kind(t) && pattern.matches(t.name()) | ||
} else { | ||
is_expected_kind(t) && t.name() == target_name | ||
} | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A refactor for pulling out the filter
creation should probably be in its own refactor commit
tests/testsuite/workspaces.rs
Outdated
[HELP] a target with a similar name exists: `crate1` | ||
Available bin in `crate2` package: | ||
crate2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't these have separate [HELP]
prefixes?
c3aa679
to
685f0fd
Compare
What does this PR try to resolve?
The old behavior gets members from
default-members
if specified in a virtual workspace, this PR gets all workspace members forAvailable
target hints.Fixes #14544
How should we test and review this PR?
The first commit added the test, the second commit addressed the issue.
Additional information