File tree Expand file tree Collapse file tree 5 files changed +79
-17
lines changed Expand file tree Collapse file tree 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
7070
7171{{> options-timings }}
7272
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+
7386{{/options}}
7487
7588### Output Options
@@ -123,5 +136,9 @@ See the [the reference](../reference/profiles.html) for more details on profiles
123136
124137 cargo rustc --lib -- -Z print-type-sizes
125138
139+ 3 . Override ` crate-type ` field in Cargo.toml with command-line option:
140+
141+ cargo rustc --lib --crate-type lib,cdylib
142+
126143## SEE ALSO
127144{{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
191191 o json (unstable, requires -Zunstable-options): Emit
192192 machine-readable JSON information about timing information.
193193
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+
194207 Output Options
195208 --target-dir directory
196209 Directory for all generated artifacts and intermediate files. May
@@ -339,6 +352,10 @@ EXAMPLES
339352
340353 cargo rustc --lib -- -Z print-type-sizes
341354
355+ 3. Override crate-type field in Cargo.toml with command-line option:
356+
357+ cargo rustc --lib --crate-type lib,cdylib
358+
342359SEE ALSO
343360 cargo(1), cargo-build(1), rustc(1)
344361
Original file line number Diff line number Diff line change @@ -226,6 +226,17 @@ information about timing information.</li>
226226
227227
228228
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+
229240</dl >
230241
231242### Output Options
@@ -410,5 +421,9 @@ details on environment variables that Cargo reads.
410421
411422 cargo rustc --lib -- -Z print-type-sizes
412423
424+ 3 . Override ` crate-type ` field in Cargo.toml with command-line option:
425+
426+ cargo rustc --lib --crate-type lib,cdylib
427+
413428## SEE ALSO
414429[ 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!
437437
438438[ rust-lang/rust#64158 ] : https://github.com/rust-lang/rust/pull/64158
439439
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-
457440### keep-going
458441* Tracking Issue: [ #0 ] ( https://github.com/rust-lang/cargo/issues/10496 )
459442
@@ -1569,3 +1552,9 @@ unstable and require `-Zunstable-options`.)
15691552The ` --config ` CLI option has been stabilized in the 1.63 release. See
15701553the [ config documentation] ( config.html#command-line-overrides ) for more
15711554information.
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.
224224information about timing information.
225225.RE
226226.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
227241.SS "Output Options"
228242.sp
229243\fB \-\- target \- dir \fR \fI directory \fR
@@ -432,5 +446,15 @@ cargo rustc \-\-lib \-\- \-Z print\-type\-sizes
432446.fi
433447.RE
434448.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
435459.SH "SEE ALSO"
436460\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