Skip to content

Commit f128cbd

Browse files
committed
Stabilize --crate-type flag for cargo rust
1 parent bd5db30 commit f128cbd

File tree

2 files changed

+10
-36
lines changed

2 files changed

+10
-36
lines changed

src/bin/cargo/commands/rustc.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ pub fn cli() -> App {
3939
.arg(multi_opt(
4040
CRATE_TYPE_ARG_NAME,
4141
"CRATE-TYPE",
42-
"Comma separated list of types of crates for the compiler to emit (unstable)",
42+
"Comma separated list of types of crates for the compiler to emit",
4343
))
4444
.arg_target_dir()
4545
.arg_manifest_path()
@@ -88,9 +88,6 @@ pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult {
8888
compile_opts.target_rustc_crate_types = if crate_types.is_empty() {
8989
None
9090
} else {
91-
config
92-
.cli_unstable()
93-
.fail_if_stable_opt(CRATE_TYPE_ARG_NAME, 10083)?;
9491
Some(crate_types)
9592
};
9693
ops::compile(&ws, &compile_opts)?;

tests/testsuite/rustc.rs

Lines changed: 9 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -134,20 +134,6 @@ fn fails_with_args_to_all_binaries() {
134134
.run();
135135
}
136136

137-
#[cargo_test]
138-
fn fails_with_crate_type_and_without_unstable_options() {
139-
let p = project().file("src/lib.rs", r#" "#).build();
140-
141-
p.cargo("rustc --crate-type lib")
142-
.masquerade_as_nightly_cargo(&["crate-type"])
143-
.with_status(101)
144-
.with_stderr(
145-
"[ERROR] the `crate-type` flag is unstable, pass `-Z unstable-options` to enable it
146-
See https://github.com/rust-lang/cargo/issues/10083 for more information about the `crate-type` flag.",
147-
)
148-
.run();
149-
}
150-
151137
#[cargo_test]
152138
fn fails_with_crate_type_to_multi_binaries() {
153139
let p = project()
@@ -157,8 +143,7 @@ fn fails_with_crate_type_to_multi_binaries() {
157143
.file("src/lib.rs", r#" "#)
158144
.build();
159145

160-
p.cargo("rustc --crate-type lib -Zunstable-options")
161-
.masquerade_as_nightly_cargo(&["crate-type"])
146+
p.cargo("rustc --crate-type lib")
162147
.with_status(101)
163148
.with_stderr(
164149
"[ERROR] crate types to rustc can only be passed to one target, consider filtering
@@ -191,8 +176,7 @@ fn fails_with_crate_type_to_multi_examples() {
191176
.file("examples/ex2.rs", "")
192177
.build();
193178

194-
p.cargo("rustc -v --example ex1 --example ex2 --crate-type lib,cdylib -Zunstable-options")
195-
.masquerade_as_nightly_cargo(&["crate-type"])
179+
p.cargo("rustc -v --example ex1 --example ex2 --crate-type lib,cdylib")
196180
.with_status(101)
197181
.with_stderr(
198182
"[ERROR] crate types to rustc can only be passed to one target, consider filtering
@@ -205,8 +189,7 @@ the package by passing, e.g., `--lib` or `--example` to specify a single target"
205189
fn fails_with_crate_type_to_binary() {
206190
let p = project().file("src/bin/foo.rs", "fn main() {}").build();
207191

208-
p.cargo("rustc --crate-type lib -Zunstable-options")
209-
.masquerade_as_nightly_cargo(&["crate-type"])
192+
p.cargo("rustc --crate-type lib")
210193
.with_status(101)
211194
.with_stderr(
212195
"[ERROR] crate types can only be specified for libraries and example libraries.
@@ -219,8 +202,7 @@ Binaries, tests, and benchmarks are always the `bin` crate type",
219202
fn build_with_crate_type_for_foo() {
220203
let p = project().file("src/lib.rs", "").build();
221204

222-
p.cargo("rustc -v --crate-type cdylib -Zunstable-options")
223-
.masquerade_as_nightly_cargo(&["crate-type"])
205+
p.cargo("rustc -v --crate-type cdylib")
224206
.with_stderr(
225207
"\
226208
[COMPILING] foo v0.0.1 ([CWD])
@@ -257,8 +239,7 @@ fn build_with_crate_type_for_foo_with_deps() {
257239
.file("a/src/lib.rs", "pub fn hello() {}")
258240
.build();
259241

260-
p.cargo("rustc -v --crate-type cdylib -Zunstable-options")
261-
.masquerade_as_nightly_cargo(&["crate-type"])
242+
p.cargo("rustc -v --crate-type cdylib")
262243
.with_stderr(
263244
"\
264245
[COMPILING] a v0.1.0 ([CWD]/a)
@@ -275,8 +256,7 @@ fn build_with_crate_type_for_foo_with_deps() {
275256
fn build_with_crate_types_for_foo() {
276257
let p = project().file("src/lib.rs", "").build();
277258

278-
p.cargo("rustc -v --crate-type lib,cdylib -Zunstable-options")
279-
.masquerade_as_nightly_cargo(&["crate-type"])
259+
p.cargo("rustc -v --crate-type lib,cdylib")
280260
.with_stderr(
281261
"\
282262
[COMPILING] foo v0.0.1 ([CWD])
@@ -307,8 +287,7 @@ fn build_with_crate_type_to_example() {
307287
.file("examples/ex.rs", "")
308288
.build();
309289

310-
p.cargo("rustc -v --example ex --crate-type cdylib -Zunstable-options")
311-
.masquerade_as_nightly_cargo(&["crate-type"])
290+
p.cargo("rustc -v --example ex --crate-type cdylib")
312291
.with_stderr(
313292
"\
314293
[COMPILING] foo v0.0.1 ([CWD])
@@ -340,8 +319,7 @@ fn build_with_crate_types_to_example() {
340319
.file("examples/ex.rs", "")
341320
.build();
342321

343-
p.cargo("rustc -v --example ex --crate-type lib,cdylib -Zunstable-options")
344-
.masquerade_as_nightly_cargo(&["crate-type"])
322+
p.cargo("rustc -v --example ex --crate-type lib,cdylib")
345323
.with_stderr(
346324
"\
347325
[COMPILING] foo v0.0.1 ([CWD])
@@ -377,8 +355,7 @@ fn build_with_crate_types_to_one_of_multi_examples() {
377355
.file("examples/ex2.rs", "")
378356
.build();
379357

380-
p.cargo("rustc -v --example ex1 --crate-type lib,cdylib -Zunstable-options")
381-
.masquerade_as_nightly_cargo(&["crate-type"])
358+
p.cargo("rustc -v --example ex1 --crate-type lib,cdylib")
382359
.with_stderr(
383360
"\
384361
[COMPILING] foo v0.0.1 ([CWD])

0 commit comments

Comments
 (0)