-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Warnings for implicit tests and examples on cargo package/publish causes extra noise #14290
Comments
Could you give an idea of what the impact to you is? This isn't a regression but intentional new-ish behavior. In fact, the behavior is in the name of #13713. We need to weigh the intent of #13713 against the user impact of those not interested in that intent. Before #13713, excluding a target could lead to different results
There also wasn't a good way to tell what targets are excluded. You could go through hoops to open up a #13713 turned all of the last three cases into "warn that its being excluded". Users who explicitly specify a target may be surprised that it is missing. By explicitly listing each target, you only need to look at your |
That's not how I read that name. For me, "Warn, rather than fail publish, if a target is excluded" means that a previous error turned into a warning, and not that a new warning is introduced. But that's no really relevant if the actual behavior was to introduce the warning, that's fine by me, and we can discuss ways to allow users to disable it.
I completely agree with that. The particular issue I have is about implicit targets (i.e. not listed in
That's probably the part I'm missing to understand the rationale. Do you mean that it is expected to never have implicit tests or examples (i.e. tests and examples should always be listed in the
I see 2 mechanisms to verify the
|
Sorry, I was talking within the context of #13713 and
Identifying the absence of something is not always obvious.
Our intention was to demote the existing error for "build-target is specified but the file is missing". |
I might be missing something here. It seems like before #13713 (or at least with nightly-2024-05-01) the build-targets are not explicitly listed. And it seems that after #13713 (or at least with nightly-2024-05-24) only the autoexamples = false
autotests = false So it looks like Note that I like this new behavior (expliciting the build-targets and only listing those meant to be published based on So from my side, we can close this issue. The behavior is as I would expect:
Thanks for the rubber-ducking! |
I spoke too fast, using Actually, if there was a [package]
include = ["/src/"]
autotests = false
[[test]]
name = "bar"
path = "tests/bar.rs"
publish = false # make it explicit that we don't want to publish this |
Yes, we only include a build-target in the published |
Actually, I would argue that having this Taking a step back, as more time passes, the more I believe that crates are not meant to carry more than one build-target. This has similar issues as cargo workspaces (which I'm not using for many reasons). This particular noisy warning is rather minor, but see #13844 (comment) for example. You can get quite surprised to see that |
Problem
With
nightly-2024-05-01-x86_64-unknown-linux-gnu
, we don't get any warning duringcargo package
orcargo publish
that implicit (i.e. not listed in theCargo.toml
) examples and tests are not included (when usingpackage.include
in theCargo.toml
).But when using
nightly-2024-05-24-x86_64-unknown-linux-gnu
, we do get warnings:This might have been caused by #13713.
Steps
Possible Solution(s)
Partially revert #13713 to not warn for implicit examples and tests (possibly also benches) like it was before.
Notes
Help was provided in https://users.rust-lang.org/t/rationale-behind-warning-for-examples-and-tests-in-cargo-publish/114840 to figure out the issue and culprit.
Version
The text was updated successfully, but these errors were encountered: