Skip to content

Commit

Permalink
Stabilize --extern flag without a path.
Browse files Browse the repository at this point in the history
  • Loading branch information
ehuss committed Nov 7, 2019
1 parent 50f8aad commit b47e3d8
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 15 deletions.
7 changes: 6 additions & 1 deletion src/doc/rustc/src/command-line-arguments.md
Expand Up @@ -264,7 +264,12 @@ This flag, when combined with other flags, makes them produce extra output.

This flag allows you to pass the name and location of an external crate that
will be linked into the crate you are building. This flag may be specified
multiple times. The format of the value should be `CRATENAME=PATH`.
multiple times. This flag takes an argument with either of the following
formats:

* `CRATENAME=PATH` — Indicates the given crate is found at the given path.
* `CRATENAME` — Indicates the given crate may be found in the search path,
such as within the sysroot or via the `-L` flag.

<a id="option-sysroot"></a>
## `--sysroot`: Override the system root
Expand Down
7 changes: 0 additions & 7 deletions src/librustc/session/config.rs
Expand Up @@ -2392,13 +2392,6 @@ fn parse_externs(
let name = parts.next().unwrap_or_else(||
early_error(error_format, "--extern value must not be empty"));
let location = parts.next().map(|s| s.to_string());
if location.is_none() && !is_unstable_enabled {
early_error(
error_format,
"the `-Z unstable-options` flag must also be passed to \
enable `--extern crate_name` without `=path`",
);
};

let entry = externs
.entry(name.to_owned())
Expand Down
4 changes: 0 additions & 4 deletions src/librustdoc/config.rs
Expand Up @@ -615,10 +615,6 @@ fn parse_externs(matches: &getopts::Matches) -> Result<Externs, String> {
let mut parts = arg.splitn(2, '=');
let name = parts.next().ok_or("--extern value must not be empty".to_string())?;
let location = parts.next().map(|s| s.to_string());
if location.is_none() && !nightly_options::is_unstable_enabled(matches) {
return Err("the `-Z unstable-options` flag must also be passed to \
enable `--extern crate_name` without `=path`".to_string());
}
let name = name.to_string();
// For Rustdoc purposes, we can treat all externs as public
externs.entry(name)
Expand Down
1 change: 0 additions & 1 deletion src/test/run-make-fulldeps/extern-flag-fun/Makefile
Expand Up @@ -4,7 +4,6 @@ all:
$(RUSTC) bar.rs --crate-type=rlib
$(RUSTC) bar.rs --crate-type=rlib -C extra-filename=-a
$(RUSTC) bar-alt.rs --crate-type=rlib
$(RUSTC) foo.rs --extern hello && exit 1 || exit 0
$(RUSTC) foo.rs --extern bar=no-exist && exit 1 || exit 0
$(RUSTC) foo.rs --extern bar=foo.rs && exit 1 || exit 0
$(RUSTC) foo.rs \
Expand Down
3 changes: 1 addition & 2 deletions src/test/run-make-fulldeps/save-analysis-rfc2126/Makefile
@@ -1,8 +1,7 @@
-include ../tools.mk

all: extern_absolute_paths.rs krate2
$(RUSTC) extern_absolute_paths.rs -Zsave-analysis --edition=2018 \
-Z unstable-options --extern krate2
$(RUSTC) extern_absolute_paths.rs -Zsave-analysis --edition=2018 --extern krate2
cat $(TMPDIR)/save-analysis/extern_absolute_paths.json | "$(PYTHON)" validate_json.py

krate2: krate2.rs
Expand Down

0 comments on commit b47e3d8

Please sign in to comment.