Skip to content

Warnings for implicit tests and examples on cargo package/publish causes extra noise #14290

Open
@ia0

Description

@ia0

Problem

With nightly-2024-05-01-x86_64-unknown-linux-gnu, we don't get any warning during cargo package or cargo publish that implicit (i.e. not listed in the Cargo.toml) examples and tests are not included (when using package.include in the Cargo.toml).

But when using nightly-2024-05-24-x86_64-unknown-linux-gnu, we do get warnings:

warning: ignoring example `baz` as `examples/baz.rs` is not included in the published package
warning: ignoring test `bar` as `tests/bar.rs` is not included in the published package

This might have been caused by #13713.

Steps

cd /tmp
cargo new foo --lib
cd foo
mkdir tests
touch tests/bar.rs
mkdir examples
touch examples/baz.rs
sed -i 's#^$#include = ["/src/"]#' Cargo.toml
git add .
git commit -mx
cargo package

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

# Good version

cargo 1.80.0-nightly (b60a15551 2024-04-26)
release: 1.80.0-nightly
commit-hash: b60a1555155111e962018007a6d0ef85207db463
commit-date: 2024-04-26
host: x86_64-unknown-linux-gnu
libgit2: 1.7.2 (sys:0.18.3 vendored)
libcurl: 8.6.0-DEV (sys:0.4.72+curl-8.6.0 vendored ssl:OpenSSL/1.1.1w)
ssl: OpenSSL 1.1.1w  11 Sep 2023
os: Debian n/a (rodete) [64-bit]

# Bad version

cargo 1.80.0-nightly (84dc5dc11 2024-05-20)
release: 1.80.0-nightly
commit-hash: 84dc5dc11a9007a08f27170454da6097265e510e
commit-date: 2024-05-20
host: x86_64-unknown-linux-gnu
libgit2: 1.7.2 (sys:0.18.3 vendored)
libcurl: 8.6.0-DEV (sys:0.4.72+curl-8.6.0 vendored ssl:OpenSSL/1.1.1w)
ssl: OpenSSL 1.1.1w  11 Sep 2023
os: Debian n/a (rodete) [64-bit]

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bugCommand-packageCommand-publishS-needs-infoStatus: Needs more info, such as a reproduction or more background for a feature request.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions