Skip to content

Commit

Permalink
Rollup merge of #73567 - adetaylor:extern-doc-fix, r=dtolnay
Browse files Browse the repository at this point in the history
Clarify --extern documentation.

Fixes #64731, #73531.

See also #64402 (comment)
  • Loading branch information
Manishearth committed Jun 23, 2020
2 parents 0f9a6ed a63eb3c commit 0560151
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/doc/rustc/src/command-line-arguments.md
Original file line number Diff line number Diff line change
Expand Up @@ -273,10 273,18 @@ This flag, when combined with other flags, makes them produce extra output.
This flag allows you to pass the name and location for an external crate of a
direct dependency. Indirect dependencies (dependencies of dependencies) are
located using the [`-L` flag](#option-l-search-path). The given crate name is
added to the [extern prelude], which is the same as specifying `extern crate`
within the root module. The given crate name does not need to match the name
added to the [extern prelude], similar to specifying `extern crate` within the
root module. The given crate name does not need to match the name
the library was built with.

Specifying `--extern` has one behavior difference from `extern crate`:
`--extern` merely makes the crate a _candidate_ for being linked; it does not
actually link it unless it's actively used. In rare occasions you may wish
to ensure a crate is linked even if you don't actively use it from your
code: for example, if it changes the global allocator or if it contains
`#[no_mangle]` symbols for use by other programming languages. In such
cases you'll need to use `extern crate`.

This flag may be specified multiple times. This flag takes an argument with
either of the following formats:

Expand Down

0 comments on commit 0560151

Please sign in to comment.