Skip to content

Commit 9ccf4f2

Browse files
committed
Stabilize --extern flag without a path.
1 parent bfc5878 commit 9ccf4f2

File tree

5 files changed

+7
-15
lines changed

5 files changed

+7
-15
lines changed

src/doc/rustc/src/command-line-arguments.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,12 @@ This flag, when combined with other flags, makes them produce extra output.
233233

234234
This flag allows you to pass the name and location of an external crate that
235235
will be linked into the crate you are building. This flag may be specified
236-
multiple times. The format of the value should be `CRATENAME=PATH`.
236+
multiple times. This flag takes an argument with either of the following
237+
formats:
238+
239+
* `CRATENAME=PATH` — Indicates the given crate is found at the given path.
240+
* `CRATENAME` — Indicates the given crate may be found in the search path,
241+
such as within the sysroot or via the `-L` flag.
237242

238243
## `--sysroot`: Override the system root
239244

src/librustc/session/config.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2449,13 +2449,6 @@ fn parse_externs(
24492449
let name = parts.next().unwrap_or_else(||
24502450
early_error(error_format, "--extern value must not be empty"));
24512451
let location = parts.next().map(|s| s.to_string());
2452-
if location.is_none() && !is_unstable_enabled {
2453-
early_error(
2454-
error_format,
2455-
"the `-Z unstable-options` flag must also be passed to \
2456-
enable `--extern crate_name` without `=path`",
2457-
);
2458-
};
24592452

24602453
let entry = externs
24612454
.entry(name.to_owned())

src/librustdoc/config.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -611,10 +611,6 @@ fn parse_externs(matches: &getopts::Matches) -> Result<Externs, String> {
611611
let mut parts = arg.splitn(2, '=');
612612
let name = parts.next().ok_or("--extern value must not be empty".to_string())?;
613613
let location = parts.next().map(|s| s.to_string());
614-
if location.is_none() && !nightly_options::is_unstable_enabled(matches) {
615-
return Err("the `-Z unstable-options` flag must also be passed to \
616-
enable `--extern crate_name` without `=path`".to_string());
617-
}
618614
let name = name.to_string();
619615
// For Rustdoc purposes, we can treat all externs as public
620616
externs.entry(name)

src/test/run-make-fulldeps/extern-flag-fun/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ all:
44
$(RUSTC) bar.rs --crate-type=rlib
55
$(RUSTC) bar.rs --crate-type=rlib -C extra-filename=-a
66
$(RUSTC) bar-alt.rs --crate-type=rlib
7-
$(RUSTC) foo.rs --extern hello && exit 1 || exit 0
87
$(RUSTC) foo.rs --extern bar=no-exist && exit 1 || exit 0
98
$(RUSTC) foo.rs --extern bar=foo.rs && exit 1 || exit 0
109
$(RUSTC) foo.rs \

src/test/run-make-fulldeps/save-analysis-rfc2126/Makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
-include ../tools.mk
22

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

87
krate2: krate2.rs

0 commit comments

Comments
 (0)