Stabilize --extern flag without a path.
This commit is contained in:
parent
50f8aadd74
commit
b47e3d8fe4
5 changed files with 7 additions and 15 deletions
|
@ -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
|
||||
|
|
|
@ -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())
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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 \
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue