Skip to content

Commit 3066142

Browse files
committed
Stabilize --crate-type flag for cargo rust
1 parent f4fad79 commit 3066142

File tree

2 files changed

+10
-27
lines changed

2 files changed

+10
-27
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 & 23 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()
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,7 +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")
146+
p.cargo("rustc --crate-type lib")
161147
.masquerade_as_nightly_cargo()
162148
.with_status(101)
163149
.with_stderr(
@@ -191,7 +177,7 @@ fn fails_with_crate_type_to_multi_examples() {
191177
.file("examples/ex2.rs", "")
192178
.build();
193179

194-
p.cargo("rustc -v --example ex1 --example ex2 --crate-type lib,cdylib -Zunstable-options")
180+
p.cargo("rustc -v --example ex1 --example ex2 --crate-type lib,cdylib")
195181
.masquerade_as_nightly_cargo()
196182
.with_status(101)
197183
.with_stderr(
@@ -205,7 +191,7 @@ the package by passing, e.g., `--lib` or `--example` to specify a single target"
205191
fn fails_with_crate_type_to_binary() {
206192
let p = project().file("src/bin/foo.rs", "fn main() {}").build();
207193

208-
p.cargo("rustc --crate-type lib -Zunstable-options")
194+
p.cargo("rustc --crate-type lib")
209195
.masquerade_as_nightly_cargo()
210196
.with_status(101)
211197
.with_stderr(
@@ -219,7 +205,7 @@ Binaries, tests, and benchmarks are always the `bin` crate type",
219205
fn build_with_crate_type_for_foo() {
220206
let p = project().file("src/lib.rs", "").build();
221207

222-
p.cargo("rustc -v --crate-type cdylib -Zunstable-options")
208+
p.cargo("rustc -v --crate-type cdylib")
223209
.masquerade_as_nightly_cargo()
224210
.with_stderr(
225211
"\
@@ -257,7 +243,7 @@ fn build_with_crate_type_for_foo_with_deps() {
257243
.file("a/src/lib.rs", "pub fn hello() {}")
258244
.build();
259245

260-
p.cargo("rustc -v --crate-type cdylib -Zunstable-options")
246+
p.cargo("rustc -v --crate-type cdylib")
261247
.masquerade_as_nightly_cargo()
262248
.with_stderr(
263249
"\
@@ -275,7 +261,7 @@ fn build_with_crate_type_for_foo_with_deps() {
275261
fn build_with_crate_types_for_foo() {
276262
let p = project().file("src/lib.rs", "").build();
277263

278-
p.cargo("rustc -v --crate-type lib,cdylib -Zunstable-options")
264+
p.cargo("rustc -v --crate-type lib,cdylib")
279265
.masquerade_as_nightly_cargo()
280266
.with_stderr(
281267
"\
@@ -307,7 +293,7 @@ fn build_with_crate_type_to_example() {
307293
.file("examples/ex.rs", "")
308294
.build();
309295

310-
p.cargo("rustc -v --example ex --crate-type cdylib -Zunstable-options")
296+
p.cargo("rustc -v --example ex --crate-type cdylib")
311297
.masquerade_as_nightly_cargo()
312298
.with_stderr(
313299
"\
@@ -340,7 +326,7 @@ fn build_with_crate_types_to_example() {
340326
.file("examples/ex.rs", "")
341327
.build();
342328

343-
p.cargo("rustc -v --example ex --crate-type lib,cdylib -Zunstable-options")
329+
p.cargo("rustc -v --example ex --crate-type lib,cdylib")
344330
.masquerade_as_nightly_cargo()
345331
.with_stderr(
346332
"\
@@ -377,7 +363,7 @@ fn build_with_crate_types_to_one_of_multi_examples() {
377363
.file("examples/ex2.rs", "")
378364
.build();
379365

380-
p.cargo("rustc -v --example ex1 --crate-type lib,cdylib -Zunstable-options")
366+
p.cargo("rustc -v --example ex1 --crate-type lib,cdylib")
381367
.masquerade_as_nightly_cargo()
382368
.with_stderr(
383369
"\

0 commit comments

Comments
 (0)