Skip to content

Test failures due to new cargo warning #239

@taiki-e

Description

@taiki-e

cargo-hack supports cargo 1.26+, so our test crates usually don't set the edition. (edition field requires 1.31+)

However, the new cargo warning for the unset edition (rust-lang/cargo#13505, I think the warning itself is a good idea, except for a few small problems) pollutes the logs, and it confuses assertions.

I think a reasonable workaround is to check while excluding warnings. The potentially difficult part is that in some cases we want to check the content of warnings as well.

Ideally, I would like to see cargo provide a way to opt out of this warning, but I don't think that is realistic as I think cargo has never provided such a way in the past.

thread 'short_flag' panicked at tests/test.rs:1317:10:
assertion failed: `!self.stderr.contains(..)`:

EXPECTED:
------------------------------------------------------------
member2
------------------------------------------------------------

ACTUAL:
------------------------------------------------------------
info: running `/home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/cargo check -v --manifest-path member1/Cargo.toml` (1/1)
warning: /tmp/.tmp6qlpGb/dir/not_find_manifest/Cargo.toml: no edition set: defaulting to the 2015 edition
warning: /tmp/.tmp6qlpGb/member2/Cargo.toml: no edition set: defaulting to the 2015 edition
warning: /tmp/.tmp6qlpGb/member1/Cargo.toml: no edition set: defaulting to the 2015 edition
    Checking member1 v0.0.0 (/tmp/.tmp6qlpGb/member1)
     Running `/home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rustc --crate-name member1 --edition=2015 member1/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata -C embed-bitcode=no -C debuginfo=2 --cfg 'feature="a"' --cfg 'feature="default"' -C metadata=154f9d0d15063b83 -C extra-filename=-154f9d0d15063b83 --out-dir /tmp/.tmp6qlpGb/target/debug/deps -L dependency=/tmp/.tmp6qlpGb/target/debug/deps`
     Running `/home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rustc --crate-name member1 --edition=2015 member1/src/main.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type bin --emit=dep-info,metadata -C embed-bitcode=no -C debuginfo=2 --cfg 'feature="a"' --cfg 'feature="default"' -C metadata=ccedeb65f0fb4624 -C extra-filename=-ccedeb65f0fb4624 --out-dir /tmp/.tmp6qlpGb/target/debug/deps -L dependency=/tmp/.tmp6qlpGb/target/debug/deps --extern member1=/tmp/.tmp6qlpGb/target/debug/deps/libmember1-154f9d0d15063b83.rmeta`
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.06s

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions