-
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
Unify no-library-target error into no-target warn #14163
base: master
Are you sure you want to change the base?
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 (
|
@@ -372,21 +372,6 @@ impl<'a> UnitGenerator<'a, '_> { | |||
libs.push(proposal) | |||
} | |||
} | |||
if !all_targets && libs.is_empty() && *lib == LibRule::True { |
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.
Seems the earliest ancestor of this error is this: https://github.com/rust-lang/cargo/pull/839/files#r1658124748 (around Nov 15, 2014)
miss_count += 1; | ||
filters.push_str(s); | ||
} | ||
}; | ||
append(bins, " `bins`,"); | ||
append(tests, " `tests`,"); | ||
append(examples, " `examples`,"); |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
What does this PR try to resolve?
Fixes #10958
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
--lib
is 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)