Skip to content

Commit c20e0e1

Browse files
ChrisDentonjyn514ehuss
committed
Document unstable --extern options
Co-Authored-By: Joshua Nelson <[email protected]> Co-Authored-By: Eric Huss <[email protected]>
1 parent ff86b27 commit c20e0e1

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# `--extern` Options
2+
3+
The behavior of the `--extern` flag can be modified with `noprelude`, `priv` or `nounused` options.
4+
5+
This is unstable feature, so you have to provide `-Zunstable-options` to enable it.
6+
7+
## Examples
8+
9+
Use your own build of the `core` crate.
10+
11+
`rustc main.rs -Z unstable-options --extern noprelude:core=libcore.rlib`
12+
13+
To use multiple options, separate them with a comma:
14+
15+
`rustc main.rs -Z unstable-options --extern noprelude,priv,nounused:mydep=mydep.rlib`
16+
17+
## Options
18+
19+
* `noprelude`: Do not add the crate to the external prelude. If used, it will need to be imported using `extern crate`.
20+
This is used by the [build-std project](https://github.com/rust-lang/wg-cargo-std-aware/) to simulate compatibility with sysroot-only crates.
21+
* `priv`: Mark the crate as a private dependency for the [`exported_private_dependencies`](../../rustc/lints/listing/warn-by-default.html#exported-private-dependencies) lint.
22+
* `nounused`: Suppress [`unused-crate-dependencies`](../../rustc/lints/listing/allowed-by-default.html#unused-crate-dependencies) warnings for the crate.

0 commit comments

Comments
 (0)