Skip to content

Commit b47e3d8

Browse files
committed
Stabilize --extern flag without a path.
1 parent 50f8aad commit b47e3d8

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
@@ -264,7 +264,12 @@ This flag, when combined with other flags, makes them produce extra output.
264264

265265
This flag allows you to pass the name and location of an external crate that
266266
will be linked into the crate you are building. This flag may be specified
267-
multiple times. The format of the value should be `CRATENAME=PATH`.
267+
multiple times. This flag takes an argument with either of the following
268+
formats:
269+
270+
* `CRATENAME=PATH` — Indicates the given crate is found at the given path.
271+
* `CRATENAME` — Indicates the given crate may be found in the search path,
272+
such as within the sysroot or via the `-L` flag.
268273

269274
<a id="option-sysroot"></a>
270275
## `--sysroot`: Override the system root

src/librustc/session/config.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2392,13 +2392,6 @@ fn parse_externs(
23922392
let name = parts.next().unwrap_or_else(||
23932393
early_error(error_format, "--extern value must not be empty"));
23942394
let location = parts.next().map(|s| s.to_string());
2395-
if location.is_none() && !is_unstable_enabled {
2396-
early_error(
2397-
error_format,
2398-
"the `-Z unstable-options` flag must also be passed to \
2399-
enable `--extern crate_name` without `=path`",
2400-
);
2401-
};
24022395

24032396
let entry = externs
24042397
.entry(name.to_owned())

src/librustdoc/config.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -615,10 +615,6 @@ fn parse_externs(matches: &getopts::Matches) -> Result<Externs, String> {
615615
let mut parts = arg.splitn(2, '=');
616616
let name = parts.next().ok_or("--extern value must not be empty".to_string())?;
617617
let location = parts.next().map(|s| s.to_string());
618-
if location.is_none() && !nightly_options::is_unstable_enabled(matches) {
619-
return Err("the `-Z unstable-options` flag must also be passed to \
620-
enable `--extern crate_name` without `=path`".to_string());
621-
}
622618
let name = name.to_string();
623619
// For Rustdoc purposes, we can treat all externs as public
624620
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)