Unify no-library-target error into no-target warn#14163
Conversation
|
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @epage (or someone else) some time within the next two weeks. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
|
| libs.push(proposal) | ||
| } | ||
| } | ||
| if !all_targets && libs.is_empty() && *lib == LibRule::True { |
There was a problem hiding this comment.
Seems the earliest ancestor of this error is this: https://github.com/rust-lang/cargo/pull/839/files#r1658124748 (around Nov 15, 2014)
| }; | ||
| append(bins, " `bins`,"); | ||
| append(tests, " `tests`,"); | ||
| append(examples, " `examples`,"); |
There was a problem hiding this comment.
seems the earliest ancestor of the following out-of-diff warn is this: https://github.com/rust-lang/cargo/pull/9549/files#diff-98da1b66b532e50e9bca971b453ee7de96b17436de1d7ef3824c9888d55be9bbR1189-R1193 (for some reason, i can't comment on the referenced pr....) (around Jun 10, 2021)
return shell.warn(format!(
"target {}{} specified, but no targets matched; this is a no-op",
if miss_count > 1 { "filters" } else { "filter" },
filters,
));| let mut append = |t: &FilterRule, s| { | ||
| if let FilterRule::All = *t { | ||
| miss_count += 1; | ||
| filters.push_str(s); | ||
| } | ||
| }; | ||
|
|
There was a problem hiding this comment.
needed to move closer to the actually used place to avoid borrow check error.
(This is a stripped cherry-pick friendly version of the original pr: rust-lang#14163)
thanks for the heads-up. I just replied there: #10958 (comment) |
|
☔ The latest upstream changes (presumably #14226) made this pull request unmergeable. Please resolve the merge conflicts. |
|
☔ The latest upstream changes (possibly 081d7ba) made this pull request unmergeable. Please resolve the merge conflicts. |
|
As this is pending an agreed-to-design in #10958 , I'm going to close this for now. |
What does this PR try to resolve?
Fixes #10958
Fixes #15231
as far as i checked gitub issues, source code and git log, it seems that there's no strong reason for cargo to emit hard-errors, not warns, only if
--libis given. This is an inconsistent behavior compared to other filters like--bins.And the no-library-target error predates the generic no-target warn.
All being said, i think it's acceptable to demote the lib error into a generic warn.
How should we test and review this PR?
Updated existing unit tests demonstrate the new expected behavioral change (error => warn demotion)