diff --git a/tests/testsuite/build_script.rs b/tests/testsuite/build_script.rs index ef7630923..65a004ee6 100644 --- a/tests/testsuite/build_script.rs +++ b/tests/testsuite/build_script.rs @@ -2177,61 +2177,6 @@ fn shared_dep_with_a_build_script() { p.cargo("build -v").run(); } -#[cargo_test] -fn transitive_dep_host() { - let p = project() - .file( - "Cargo.toml", - r#" - [package] - name = "foo" - version = "0.5.0" - edition = "2015" - authors = [] - build = "build.rs" - - [build-dependencies.b] - path = "b" - "#, - ) - .file("src/lib.rs", "") - .file("build.rs", "fn main() {}") - .file( - "a/Cargo.toml", - r#" - [package] - name = "a" - version = "0.5.0" - edition = "2015" - authors = [] - links = "foo" - build = "build.rs" - "#, - ) - .file("a/build.rs", "fn main() {}") - .file("a/src/lib.rs", "") - .file( - "b/Cargo.toml", - r#" - [package] - name = "b" - version = "0.5.0" - edition = "2015" - authors = [] - - [lib] - name = "b" - plugin = true - - [dependencies.a] - path = "../a" - "#, - ) - .file("b/src/lib.rs", "") - .build(); - p.cargo("build").run(); -} - #[cargo_test] fn test_a_lib_with_a_build_command() { let p = project() diff --git a/tests/testsuite/cross_compile.rs b/tests/testsuite/cross_compile.rs index bcb0a4190..85cc7174c 100644 --- a/tests/testsuite/cross_compile.rs +++ b/tests/testsuite/cross_compile.rs @@ -883,47 +883,6 @@ fn build_script_only_host() { p.cargo("build -v --target").arg(&target).run(); } -#[cargo_test] -fn plugin_build_script_right_arch() { - if cross_compile::disabled() { - return; - } - let p = project() - .file( - "Cargo.toml", - r#" - [package] - name = "foo" - version = "0.0.1" - edition = "2015" - authors = [] - build = "build.rs" - - [lib] - name = "foo" - plugin = true - "#, - ) - .file("build.rs", "fn main() {}") - .file("src/lib.rs", "") - .build(); - - p.cargo("build -v --target") - .arg(cross_compile::alternate()) - .with_stderr( - "\ -[WARNING] support for rustc plugins has been removed from rustc. library `foo` should not specify `plugin = true` -[WARNING] support for `plugin = true` will be removed from cargo in the future -[COMPILING] foo v0.0.1 ([..]) -[RUNNING] `rustc [..] build.rs [..]` -[RUNNING] `[..]/build-script-build` -[RUNNING] `rustc [..] src/lib.rs [..]` -[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..] -", - ) - .run(); -} - #[cargo_test] fn build_script_with_platform_specific_dependencies() { if cross_compile::disabled() { diff --git a/tests/testsuite/proc_macro.rs b/tests/testsuite/proc_macro.rs index 86bfe086c..0d793f10c 100644 --- a/tests/testsuite/proc_macro.rs +++ b/tests/testsuite/proc_macro.rs @@ -345,6 +345,28 @@ fn proc_macro_crate_type_warning() { .run(); } +#[cargo_test] +fn lib_plugin_unused_key_warning() { + let foo = project() + .file( + "Cargo.toml", + r#" + [package] + name = "foo" + version = "0.1.0" + edition = "2015" + [lib] + plugin = true + "#, + ) + .file("src/lib.rs", "") + .build(); + + foo.cargo("check") + .with_stderr_contains("[WARNING] unused manifest key: lib.plugin") + .run(); +} + #[cargo_test] fn proc_macro_crate_type_warning_plugin() { let foo = project() @@ -357,23 +379,15 @@ fn proc_macro_crate_type_warning_plugin() { edition = "2015" [lib] crate-type = ["proc-macro"] - plugin = true "#, ) .file("src/lib.rs", "") .build(); foo.cargo("check") - .with_stderr_contains( - "[WARNING] support for rustc plugins has been removed from rustc. \ - library `foo` should not specify `plugin = true`") - .with_stderr_contains( - "[WARNING] support for `plugin = true` will be removed from cargo in the future") - .with_stderr_contains( - "[WARNING] proc-macro library `foo` should not specify `plugin = true`") - .with_stderr_contains( - "[WARNING] library `foo` should only specify `proc-macro = true` instead of setting `crate-type`") - .run(); + .with_stderr_contains( + "[WARNING] library `foo` should only specify `proc-macro = true` instead of setting `crate-type`") + .run(); } #[cargo_test] diff --git a/tests/testsuite/rustflags.rs b/tests/testsuite/rustflags.rs index 1f7ca1bd7..564f70c33 100644 --- a/tests/testsuite/rustflags.rs +++ b/tests/testsuite/rustflags.rs @@ -1,9 +1,7 @@ //! Tests for setting custom rustc flags. use cargo_test_support::registry::Package; -use cargo_test_support::{ - basic_lib_manifest, basic_manifest, paths, project, project_in_home, rustc_host, -}; +use cargo_test_support::{basic_manifest, paths, project, project_in_home, rustc_host}; use std::fs; #[cargo_test] @@ -114,76 +112,6 @@ fn env_rustflags_build_script_dep() { foo.cargo("check").env("RUSTFLAGS", "--cfg foo").run(); } -#[cargo_test] -fn env_rustflags_plugin() { - // RUSTFLAGS should be passed to rustc for plugins - // when --target is not specified. - // In this test if --cfg foo is not passed the build will fail. - let p = project() - .file( - "Cargo.toml", - r#" - [package] - name = "foo" - version = "0.0.1" - - [lib] - name = "foo" - plugin = true - "#, - ) - .file( - "src/lib.rs", - r#" - fn main() { } - #[cfg(not(foo))] - fn main() { } - "#, - ) - .build(); - - p.cargo("check").env("RUSTFLAGS", "--cfg foo").run(); -} - -#[cargo_test] -fn env_rustflags_plugin_dep() { - // RUSTFLAGS should be passed to rustc for plugins - // when --target is not specified. - // In this test if --cfg foo is not passed the build will fail. - let foo = project() - .file( - "Cargo.toml", - r#" - [package] - name = "foo" - version = "0.0.1" - - [lib] - name = "foo" - plugin = true - - [dependencies.bar] - path = "../bar" - "#, - ) - .file("src/lib.rs", "fn foo() {}") - .build(); - let _bar = project() - .at("bar") - .file("Cargo.toml", &basic_lib_manifest("bar")) - .file( - "src/lib.rs", - r#" - fn bar() { } - #[cfg(not(foo))] - fn bar() { } - "#, - ) - .build(); - - foo.cargo("check").env("RUSTFLAGS", "--cfg foo").run(); -} - #[cargo_test] fn env_rustflags_normal_source_with_target() { let p = project() @@ -345,84 +273,6 @@ fn env_rustflags_build_script_dep_with_target() { .run(); } -#[cargo_test] -fn env_rustflags_plugin_with_target() { - // RUSTFLAGS should not be passed to rustc for plugins - // when --target is specified. - // In this test if --cfg foo is passed the build will fail. - let p = project() - .file( - "Cargo.toml", - r#" - [package] - name = "foo" - version = "0.0.1" - - [lib] - name = "foo" - plugin = true - "#, - ) - .file( - "src/lib.rs", - r#" - fn main() { } - #[cfg(foo)] - fn main() { } - "#, - ) - .build(); - - let host = rustc_host(); - p.cargo("check --target") - .arg(host) - .env("RUSTFLAGS", "--cfg foo") - .run(); -} - -#[cargo_test] -fn env_rustflags_plugin_dep_with_target() { - // RUSTFLAGS should not be passed to rustc for plugins - // when --target is specified. - // In this test if --cfg foo is passed the build will fail. - let foo = project() - .file( - "Cargo.toml", - r#" - [package] - name = "foo" - version = "0.0.1" - - [lib] - name = "foo" - plugin = true - - [dependencies.bar] - path = "../bar" - "#, - ) - .file("src/lib.rs", "fn foo() {}") - .build(); - let _bar = project() - .at("bar") - .file("Cargo.toml", &basic_lib_manifest("bar")) - .file( - "src/lib.rs", - r#" - fn bar() { } - #[cfg(foo)] - fn bar() { } - "#, - ) - .build(); - - let host = rustc_host(); - foo.cargo("check --target") - .arg(host) - .env("RUSTFLAGS", "--cfg foo") - .run(); -} - #[cargo_test] fn env_rustflags_recompile() { let p = project().file("src/lib.rs", "").build(); @@ -583,90 +433,6 @@ fn build_rustflags_build_script_dep() { foo.cargo("check").run(); } -#[cargo_test] -fn build_rustflags_plugin() { - // RUSTFLAGS should be passed to rustc for plugins - // when --target is not specified. - // In this test if --cfg foo is not passed the build will fail. - let p = project() - .file( - "Cargo.toml", - r#" - [package] - name = "foo" - version = "0.0.1" - - [lib] - name = "foo" - plugin = true - "#, - ) - .file( - "src/lib.rs", - r#" - fn main() { } - #[cfg(not(foo))] - fn main() { } - "#, - ) - .file( - ".cargo/config.toml", - r#" - [build] - rustflags = ["--cfg", "foo"] - "#, - ) - .build(); - - p.cargo("check").run(); -} - -#[cargo_test] -fn build_rustflags_plugin_dep() { - // RUSTFLAGS should be passed to rustc for plugins - // when --target is not specified. - // In this test if --cfg foo is not passed the build will fail. - let foo = project() - .file( - "Cargo.toml", - r#" - [package] - name = "foo" - version = "0.0.1" - - [lib] - name = "foo" - plugin = true - - [dependencies.bar] - path = "../bar" - "#, - ) - .file("src/lib.rs", "fn foo() {}") - .file( - ".cargo/config.toml", - r#" - [build] - rustflags = ["--cfg", "foo"] - "#, - ) - .build(); - let _bar = project() - .at("bar") - .file("Cargo.toml", &basic_lib_manifest("bar")) - .file( - "src/lib.rs", - r#" - fn bar() { } - #[cfg(not(foo))] - fn bar() { } - "#, - ) - .build(); - - foo.cargo("check").run(); -} - #[cargo_test] fn build_rustflags_normal_source_with_target() { let p = project() @@ -800,92 +566,6 @@ fn build_rustflags_build_script_dep_with_target() { foo.cargo("check --target").arg(host).run(); } -#[cargo_test] -fn build_rustflags_plugin_with_target() { - // RUSTFLAGS should not be passed to rustc for plugins - // when --target is specified. - // In this test if --cfg foo is passed the build will fail. - let p = project() - .file( - "Cargo.toml", - r#" - [package] - name = "foo" - version = "0.0.1" - - [lib] - name = "foo" - plugin = true - "#, - ) - .file( - "src/lib.rs", - r#" - fn main() { } - #[cfg(foo)] - fn main() { } - "#, - ) - .file( - ".cargo/config.toml", - r#" - [build] - rustflags = ["--cfg", "foo"] - "#, - ) - .build(); - - let host = rustc_host(); - p.cargo("check --target").arg(host).run(); -} - -#[cargo_test] -fn build_rustflags_plugin_dep_with_target() { - // RUSTFLAGS should not be passed to rustc for plugins - // when --target is specified. - // In this test if --cfg foo is passed the build will fail. - let foo = project() - .file( - "Cargo.toml", - r#" - [package] - name = "foo" - version = "0.0.1" - - [lib] - name = "foo" - plugin = true - - [dependencies.bar] - path = "../bar" - "#, - ) - .file("src/lib.rs", "fn foo() {}") - .file( - ".cargo/config.toml", - r#" - [build] - rustflags = ["--cfg", "foo"] - "#, - ) - .build(); - let _bar = project() - .at("bar") - .file("Cargo.toml", &basic_lib_manifest("bar")) - .file( - "src/lib.rs", - r#" - fn bar() { } - #[cfg(foo)] - fn bar() { } - "#, - ) - .build(); - - let host = rustc_host(); - foo.cargo("check --target").arg(host).run(); -} - #[cargo_test] fn build_rustflags_recompile() { let p = project().file("src/lib.rs", "").build();