From 86037b8ab61c700677165acef7a4d0a7e6c1974b Mon Sep 17 00:00:00 2001 From: Fred Bunt Date: Wed, 5 Dec 2018 02:29:03 -0700 Subject: [PATCH] Add failing test for issue #6370 --- tests/testsuite/features.rs | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/tests/testsuite/features.rs b/tests/testsuite/features.rs index daf68a605..5438d0c58 100644 --- a/tests/testsuite/features.rs +++ b/tests/testsuite/features.rs @@ -1730,3 +1730,35 @@ fn feature_off_dylib() { // Check that building without `f1` uses a dylib without `f1`. p.cargo("run -p bar").run(); } + +#[test] +fn warn_if_default_features() { + let p = project() + .file( + "Cargo.toml", + r#" + [project] + name = "foo" + version = "0.0.1" + authors = [] + + [dependencies.bar] + path = "bar" + optional = true + + [features] + default-features = ["bar"] + "# + ).file("src/main.rs", "fn main() {}") + .file("bar/Cargo.toml",&basic_manifest("bar", "0.0.1")) + .file("bar/src/lib.rs", "pub fn bar() {}") + .build(); + + p.cargo("build") + .with_stderr("\ +[WARNING] `default-features = [\"..\"]` was found in [features]. Did you mean to use `default = [\"..\"]`? +[COMPILING] foo v0.0.1 ([CWD]) +[FINISHED] dev [unoptimized + debuginfo] target(s) in [..] +", + ).run(); +}