about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorAndreas Jonson <andjo403@users.noreply.github.com>2019-09-01 08:49:26 +0200
committerAndreas Jonson <andjo403@users.noreply.github.com>2019-09-01 08:50:23 +0200
commitf0b30c7ded69123cffe26b54fb1feedf45d1c5a8 (patch)
tree12867b40dfd5b5a0a0af1e816859f2be9167fde4 /src
parent59cc53e6e708e9b9e86822c1b4d69f28f6c45eae (diff)
downloadrust-f0b30c7ded69123cffe26b54fb1feedf45d1c5a8.tar.gz
rust-f0b30c7ded69123cffe26b54fb1feedf45d1c5a8.zip
remove the unstable rustdoc parameter --linker
use the code generation parameter -Clinker (same parameter as rustc)
to control what linker to use for building the rustdoc test executables.

closes: #63816
Diffstat (limited to 'src')
-rw-r--r--src/bootstrap/bin/rustdoc.rs5
-rw-r--r--src/doc/rustdoc/src/unstable-features.md13
-rw-r--r--src/librustdoc/config.rs5
-rw-r--r--src/librustdoc/lib.rs3
-rw-r--r--src/librustdoc/test.rs3
-rw-r--r--src/test/run-make-fulldeps/tools.mk2
-rw-r--r--src/tools/compiletest/src/runtest.rs6
7 files changed, 6 insertions, 31 deletions
diff --git a/src/bootstrap/bin/rustdoc.rs b/src/bootstrap/bin/rustdoc.rs
index 766a3463ecd..a13ff69a7b5 100644
--- a/src/bootstrap/bin/rustdoc.rs
+++ b/src/bootstrap/bin/rustdoc.rs
@@ -5,6 +5,7 @@
 use std::env;
 use std::process::Command;
 use std::path::PathBuf;
+use std::ffi::OsString;
 
 fn main() {
     let args = env::args_os().skip(1).collect::<Vec<_>>();
@@ -44,7 +45,9 @@ fn main() {
         cmd.arg("-Z").arg("force-unstable-if-unmarked");
     }
     if let Some(linker) = env::var_os("RUSTC_TARGET_LINKER") {
-        cmd.arg("--linker").arg(linker).arg("-Z").arg("unstable-options");
+        let mut arg = OsString::from("-Clinker=");
+        arg.push(&linker);
+        cmd.arg(arg);
     }
 
     // Bootstrap's Cargo-command builder sets this variable to the current Rust version; let's pick
diff --git a/src/doc/rustdoc/src/unstable-features.md b/src/doc/rustdoc/src/unstable-features.md
index 6e32468b64d..993fc841283 100644
--- a/src/doc/rustdoc/src/unstable-features.md
+++ b/src/doc/rustdoc/src/unstable-features.md
@@ -311,19 +311,6 @@ When `rustdoc` receives this flag, it will print an extra "Version (version)" in
 the crate root's docs. You can use this flag to differentiate between different versions of your
 library's documentation.
 
-### `--linker`: control the linker used for documentation tests
-
-Using this flag looks like this:
-
-```bash
-$ rustdoc --test src/lib.rs -Z unstable-options --linker foo
-$ rustdoc --test README.md -Z unstable-options --linker foo
-```
-
-When `rustdoc` runs your documentation tests, it needs to compile and link the tests as executables
-before running them. This flag can be used to change the linker used on these executables. It's
-equivalent to passing `-C linker=foo` to `rustc`.
-
 ### `--sort-modules-by-appearance`: control how items on module pages are sorted
 
 Using this flag looks like this:
diff --git a/src/librustdoc/config.rs b/src/librustdoc/config.rs
index 30b1706f294..d261408fc14 100644
--- a/src/librustdoc/config.rs
+++ b/src/librustdoc/config.rs
@@ -60,8 +60,6 @@ pub struct Options {
     pub edition: Edition,
     /// The path to the sysroot. Used during the compilation process.
     pub maybe_sysroot: Option<PathBuf>,
-    /// Linker to use when building doctests.
-    pub linker: Option<PathBuf>,
     /// Lint information passed over the command-line.
     pub lint_opts: Vec<(String, Level)>,
     /// Whether to ask rustc to describe the lints it knows. Practically speaking, this will not be
@@ -130,7 +128,6 @@ impl fmt::Debug for Options {
             .field("target", &self.target)
             .field("edition", &self.edition)
             .field("maybe_sysroot", &self.maybe_sysroot)
-            .field("linker", &self.linker)
             .field("lint_opts", &self.lint_opts)
             .field("describe_lints", &self.describe_lints)
             .field("lint_cap", &self.lint_cap)
@@ -454,7 +451,6 @@ impl Options {
         let playground_url = matches.opt_str("playground-url");
         let maybe_sysroot = matches.opt_str("sysroot").map(PathBuf::from);
         let display_warnings = matches.opt_present("display-warnings");
-        let linker = matches.opt_str("linker").map(PathBuf::from);
         let sort_modules_alphabetically = !matches.opt_present("sort-modules-by-appearance");
         let resource_suffix = matches.opt_str("resource-suffix").unwrap_or_default();
         let enable_minification = !matches.opt_present("disable-minification");
@@ -489,7 +485,6 @@ impl Options {
             target,
             edition,
             maybe_sysroot,
-            linker,
             lint_opts,
             describe_lints,
             lint_cap,
diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs
index 87dac0f2268..dfa0db0d23b 100644
--- a/src/librustdoc/lib.rs
+++ b/src/librustdoc/lib.rs
@@ -242,9 +242,6 @@ fn opts() -> Vec<RustcOptGroup> {
         unstable("crate-version", |o| {
             o.optopt("", "crate-version", "crate version to print into documentation", "VERSION")
         }),
-        unstable("linker", |o| {
-            o.optopt("", "linker", "linker used for building executable test code", "PATH")
-        }),
         unstable("sort-modules-by-appearance", |o| {
             o.optflag("", "sort-modules-by-appearance", "sort modules by where they appear in the \
                                                          program, rather than alphabetically")
diff --git a/src/librustdoc/test.rs b/src/librustdoc/test.rs
index 31c0b85a481..41df1ff8cd0 100644
--- a/src/librustdoc/test.rs
+++ b/src/librustdoc/test.rs
@@ -266,9 +266,6 @@ fn run_test(
     for codegen_options_str in &options.codegen_options_strs {
         compiler.arg("-C").arg(&codegen_options_str);
     }
-    if let Some(linker) = options.linker {
-        compiler.arg(&format!("-C linker={:?}", linker));
-    }
     if no_run {
         compiler.arg("--emit=metadata");
     }
diff --git a/src/test/run-make-fulldeps/tools.mk b/src/test/run-make-fulldeps/tools.mk
index 3b4df73cdfd..9a113b7fa63 100644
--- a/src/test/run-make-fulldeps/tools.mk
+++ b/src/test/run-make-fulldeps/tools.mk
@@ -12,7 +12,7 @@ RUSTC := $(BARE_RUSTC) --out-dir $(TMPDIR) -L $(TMPDIR) $(RUSTFLAGS)
 RUSTDOC := $(BARE_RUSTDOC) -L $(TARGET_RPATH_DIR)
 ifdef RUSTC_LINKER
 RUSTC := $(RUSTC) -Clinker=$(RUSTC_LINKER)
-RUSTDOC := $(RUSTDOC) --linker $(RUSTC_LINKER) -Z unstable-options
+RUSTDOC := $(RUSTDOC) -Clinker=$(RUSTC_LINKER)
 endif
 #CC := $(CC) -L $(TMPDIR)
 HTMLDOCCK := $(PYTHON) $(S)/src/etc/htmldocck.py
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs
index 3da6be74129..03c5177ee52 100644
--- a/src/tools/compiletest/src/runtest.rs
+++ b/src/tools/compiletest/src/runtest.rs
@@ -1603,11 +1603,7 @@ impl<'test> TestCx<'test> {
             .args(&self.props.compile_flags);
 
         if let Some(ref linker) = self.config.linker {
-            rustdoc
-                .arg("--linker")
-                .arg(linker)
-                .arg("-Z")
-                .arg("unstable-options");
+            rustdoc.arg(format!("-Clinker={}", linker));
         }
 
         self.compose_and_run_compiler(rustdoc, None)