Commit a474391 1 parent 3066142 commit a474391 Copy full SHA for a474391
File tree 5 files changed +79
-17
lines changed
5 files changed +79
-17
lines changed Original file line number Diff line number Diff line change @@ -70,6 +70,19 @@ See the [the reference](../reference/profiles.html) for more details on profiles
70
70
71
71
{{> options-timings }}
72
72
73
+ {{#option "` --crate-type ` _ crate-type_ "}}
74
+ Build for the given crate type. This flag accepts a comma-separated list of
75
+ 1 or more crate types, of which the allowed values are the same as ` crate-type `
76
+ field in the manifest for configurating a Cargo target. See
77
+ [ ` crate-type ` field] ( ../reference/cargo-targets.html#the-crate-type-field )
78
+ for possible values.
79
+
80
+ If the manifest contains a list, and ` --crate-type ` is provided,
81
+ the command-line argument value will override what is in the manifest.
82
+
83
+ This flag only works when building a ` lib ` or ` example ` library target.
84
+ {{/option}}
85
+
73
86
{{/options}}
74
87
75
88
### Output Options
@@ -123,5 +136,9 @@ See the [the reference](../reference/profiles.html) for more details on profiles
123
136
124
137
cargo rustc --lib -- -Z print-type-sizes
125
138
139
+ 3 . Override ` crate-type ` field in Cargo.toml with command-line option:
140
+
141
+ cargo rustc --lib --crate-type lib,cdylib
142
+
126
143
## SEE ALSO
127
144
{{man "cargo" 1}}, {{man "cargo-build" 1}}, {{man "rustc" 1}}
Original file line number Diff line number Diff line change @@ -191,6 +191,19 @@ OPTIONS
191
191
o json (unstable, requires -Zunstable-options): Emit
192
192
machine-readable JSON information about timing information.
193
193
194
+ --crate-type crate-type
195
+ Build for the given crate type. This flag accepts a comma-separated
196
+ list of 1 or more crate types, of which the allowed values are the
197
+ same as crate-type field in the manifest for configurating a Cargo
198
+ target. See crate-type field
199
+ <https://doc.rust-lang.org/cargo/reference/cargo-targets.html#the-crate-type-field>
200
+ for possible values.
201
+
202
+ If the manifest contains a list, and --crate-type is provided, the
203
+ command-line argument value will override what is in the manifest.
204
+
205
+ This flag only works when building a lib or example library target.
206
+
194
207
Output Options
195
208
--target-dir directory
196
209
Directory for all generated artifacts and intermediate files. May
@@ -339,6 +352,10 @@ EXAMPLES
339
352
340
353
cargo rustc --lib -- -Z print-type-sizes
341
354
355
+ 3. Override crate-type field in Cargo.toml with command-line option:
356
+
357
+ cargo rustc --lib --crate-type lib,cdylib
358
+
342
359
SEE ALSO
343
360
cargo(1), cargo-build(1), rustc(1)
344
361
Original file line number Diff line number Diff line change @@ -226,6 +226,17 @@ information about timing information.</li>
226
226
227
227
228
228
229
+ <dt class =" option-term " id =" option-cargo-rustc---crate-type " ><a class =" option-anchor " href =" #option-cargo-rustc---crate-type " ></a ><code >--crate-type</code > <em >crate-type</em ></dt >
230
+ <dd class =" option-desc " >Build for the given crate type. This flag accepts a comma-separated list of
231
+ 1 or more crate types, of which the allowed values are the same as <code >crate-type</code >
232
+ field in the manifest for configurating a Cargo target. See
233
+ <a href =" ../reference/cargo-targets.html#the-crate-type-field " ><code >crate-type</code > field</a >
234
+ for possible values.</p >
235
+ <p >If the manifest contains a list, and <code >--crate-type</code > is provided,
236
+ the command-line argument value will override what is in the manifest.</p >
237
+ <p >This flag only works when building a <code >lib</code > or <code >example</code > library target.</dd >
238
+
239
+
229
240
</dl >
230
241
231
242
### Output Options
@@ -410,5 +421,9 @@ details on environment variables that Cargo reads.
410
421
411
422
cargo rustc --lib -- -Z print-type-sizes
412
423
424
+ 3 . Override ` crate-type ` field in Cargo.toml with command-line option:
425
+
426
+ cargo rustc --lib --crate-type lib,cdylib
427
+
413
428
## SEE ALSO
414
429
[ cargo(1)] ( cargo.html ) , [ cargo-build(1)] ( cargo-build.html ) , [ rustc(1)] ( https://doc.rust-lang.org/rustc/index.html )
Original file line number Diff line number Diff line change @@ -437,23 +437,6 @@ like to stabilize it somehow!
437
437
438
438
[ rust-lang/rust#64158 ] : https://github.com/rust-lang/rust/pull/64158
439
439
440
- ### crate-type
441
- * Tracking Issue: [ #10083 ] ( https://github.com/rust-lang/cargo/issues/10083 )
442
- * RFC: [ #3180 ] ( https://github.com/rust-lang/rfcs/pull/3180 )
443
- * Original Pull Request: [ #10093 ] ( https://github.com/rust-lang/cargo/pull/10093 )
444
-
445
- ` cargo rustc --crate-type=lib,cdylib ` forwards the ` --crate-type ` flag to ` rustc ` .
446
- This runs ` rustc ` with the corresponding
447
- [ ` --crate-type ` ] ( https://doc.rust-lang.org/rustc/command-line-arguments.html#--crate-type-a-list-of-types-of-crates-for-the-compiler-to-emit )
448
- flag, and compiling.
449
-
450
- When using it, it requires the ` -Z unstable-options `
451
- command-line option:
452
-
453
- ``` console
454
- cargo rustc --crate-type lib,cdylib -Z unstable-options
455
- ```
456
-
457
440
### keep-going
458
441
* Tracking Issue: [ #0 ] ( https://github.com/rust-lang/cargo/issues/10496 )
459
442
@@ -1569,3 +1552,9 @@ unstable and require `-Zunstable-options`.)
1569
1552
The ` --config ` CLI option has been stabilized in the 1.63 release. See
1570
1553
the [ config documentation] ( config.html#command-line-overrides ) for more
1571
1554
information.
1555
+
1556
+ ### crate-type
1557
+
1558
+ The ` --crate-type ` flag for ` cargo rustc ` has been stabilized in the 1.64
1559
+ release. See the [ ` cargo rustc ` documentation] ( ../commands/cargo-rustc.md )
1560
+ for more information.
Original file line number Diff line number Diff line change @@ -224,6 +224,20 @@ and does not provide machine\-readable timing data.
224
224
information about timing information.
225
225
.RE
226
226
.RE
227
+ .sp
228
+ \fB \-\- crate \- type \fR \fI crate \- type \fR
229
+ .RS 4
230
+ Build for the given crate type. This flag accepts a comma\- separated list of
231
+ 1 or more crate types, of which the allowed values are the same as \fB crate \- type \fR
232
+ field in the manifest for configurating a Cargo target. See
233
+ \fI\f(BI crate \- type \fI field \fR <https://doc.rust\- lang.org/cargo/reference/cargo\- targets.html#the\- crate\- type\- field>
234
+ for possible values.
235
+ .sp
236
+ If the manifest contains a list, and \fB \-\- crate \- type \fR is provided,
237
+ the command\- line argument value will override what is in the manifest.
238
+ .sp
239
+ This flag only works when building a \fB lib \fR or \fB example \fR library target.
240
+ .RE
227
241
.SS "Output Options"
228
242
.sp
229
243
\fB \-\- target \- dir \fR \fI directory \fR
@@ -432,5 +446,15 @@ cargo rustc \-\-lib \-\- \-Z print\-type\-sizes
432
446
.fi
433
447
.RE
434
448
.RE
449
+ .sp
450
+ .RS 4
451
+ \h '-04' 3.\h '+01' Override \fB crate \- type \fR field in Cargo.toml with command\- line option:
452
+ .sp
453
+ .RS 4
454
+ .nf
455
+ cargo rustc \-\- lib \-\- crate\- type lib,cdylib
456
+ .fi
457
+ .RE
458
+ .RE
435
459
.SH "SEE ALSO"
436
460
\fB cargo \fR (1), \fB cargo \- build \fR (1), \fB rustc \fR (1)
You can’t perform that action at this time.
0 commit comments