diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index 7ff64af9196..d30933d2efd 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -326,7 +326,7 @@ impl<'a> Builder<'a> { test::TheBook, test::UnstableBook, test::Rustfmt, test::Miri, test::Clippy, test::RustdocJS, test::RustdocTheme, // Run run-make last, since these won't pass without make on Windows - test::RunMake), + test::RunMake, test::RustdocUi), Kind::Bench => describe!(test::Crate, test::CrateLibrustc), Kind::Doc => describe!(doc::UnstableBook, doc::UnstableBookGen, doc::TheBook, doc::Standalone, doc::Std, doc::Test, doc::WhitelistedRustc, doc::Rustc, diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index e7610976f8e..992dec5217d 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -886,8 +886,12 @@ impl Step for Compiletest { cmd.arg("--run-lib-path").arg(builder.sysroot_libdir(compiler, target)); cmd.arg("--rustc-path").arg(builder.rustc(compiler)); + let is_rustdoc_ui = suite.ends_with("rustdoc-ui"); + // Avoid depending on rustdoc when we don't need it. - if mode == "rustdoc" || (mode == "run-make" && suite.ends_with("fulldeps")) { + if mode == "rustdoc" || + (mode == "run-make" && suite.ends_with("fulldeps")) || + (mode == "ui" && is_rustdoc_ui) { cmd.arg("--rustdoc-path").arg(builder.rustdoc(compiler.host)); } @@ -903,14 +907,24 @@ impl Step for Compiletest { cmd.arg("--nodejs").arg(nodejs); } - let mut flags = vec!["-Crpath".to_string()]; - if build.config.rust_optimize_tests { - flags.push("-O".to_string()); + let mut flags = if is_rustdoc_ui { + Vec::new() + } else { + vec!["-Crpath".to_string()] + }; + if !is_rustdoc_ui { + if build.config.rust_optimize_tests { + flags.push("-O".to_string()); + } + if build.config.rust_debuginfo_tests { + flags.push("-g".to_string()); + } } - if build.config.rust_debuginfo_tests { - flags.push("-g".to_string()); + if !is_rustdoc_ui { + flags.push("-Zmiri -Zunstable-options".to_string()); + } else { + flags.push("-Zunstable-options".to_string()); } - flags.push("-Zunstable-options".to_string()); flags.push(build.config.cmd.rustc_args().join(" ")); if let Some(linker) = build.linker(target) { diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index 9e2c7bd7ef1..abeaef723d4 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -107,7 +107,7 @@ pub struct SharedContext { /// This describes the layout of each page, and is not modified after /// creation of the context (contains info like the favicon and added html). pub layout: layout::Layout, - /// This flag indicates whether [src] links should be generated or not. If + /// This flag indicates whether `[src]` links should be generated or not. If /// the source files are present in the html rendering, then this will be /// `true`. pub include_sources: bool, diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index a34fcb5a7f9..3242e136ff3 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -44,10 +44,10 @@ //! //! Once you are familiar with the contents of the standard library you may //! begin to find the verbosity of the prose distracting. At this stage in your -//! development you may want to press the **[-]** button near the top of the +//! development you may want to press the `[-]` button near the top of the //! page to collapse it into a more skimmable view. //! -//! While you are looking at that **[-]** button also notice the **[src]** +//! While you are looking at that `[-]` button also notice the `[src]` //! button. Rust's API documentation comes with the source code and you are //! encouraged to read it. The standard library source is generally high //! quality and a peek behind the curtains is often enlightening. diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs index 9291eaa910b..a4d1797c3ec 100644 --- a/src/libtest/lib.rs +++ b/src/libtest/lib.rs @@ -1288,7 +1288,6 @@ fn get_concurrency() -> usize { pub fn filter_tests(opts: &TestOpts, tests: Vec) -> Vec { let mut filtered = tests; - // Remove tests that don't match the test filter filtered = match opts.filter { None => filtered, diff --git a/src/test/rustdoc-ui/intra-links-warning.rs b/src/test/rustdoc-ui/intra-links-warning.rs new file mode 100644 index 00000000000..36bcc307d55 --- /dev/null +++ b/src/test/rustdoc-ui/intra-links-warning.rs @@ -0,0 +1,19 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![deny(warnings)] + +// must-compile-successfully + +//! Test with [Foo::baz], [Bar::foo], [Uniooon::X] + +pub struct Foo { + pub bar: usize, +} diff --git a/src/test/rustdoc-ui/intra-links-warning.stderr b/src/test/rustdoc-ui/intra-links-warning.stderr new file mode 100644 index 00000000000..67d7bdd02b3 --- /dev/null +++ b/src/test/rustdoc-ui/intra-links-warning.stderr @@ -0,0 +1,6 @@ +warning: [Foo::baz] cannot be resolved, ignoring it... + +warning: [Bar::foo] cannot be resolved, ignoring it... + +warning: [Uniooon::X] cannot be resolved, ignoring it... + diff --git a/src/tools/compiletest/src/main.rs b/src/tools/compiletest/src/main.rs index 80cab96434b..ae4f4aa4046 100644 --- a/src/tools/compiletest/src/main.rs +++ b/src/tools/compiletest/src/main.rs @@ -283,6 +283,8 @@ pub fn parse_config(args: Vec) -> Config { ), }; + let src_base = opt_path(matches, "src-base"); + let run_ignored = matches.opt_present("ignored"); Config { compile_lib_path: make_absolute(opt_path(matches, "compile-lib-path")), run_lib_path: make_absolute(opt_path(matches, "run-lib-path")), @@ -293,7 +295,7 @@ pub fn parse_config(args: Vec) -> Config { valgrind_path: matches.opt_str("valgrind-path"), force_valgrind: matches.opt_present("force-valgrind"), llvm_filecheck: matches.opt_str("llvm-filecheck").map(|s| PathBuf::from(&s)), - src_base: opt_path(matches, "src-base"), + src_base, build_base: opt_path(matches, "build-base"), stage_id: matches.opt_str("stage-id").unwrap(), mode: matches @@ -301,7 +303,7 @@ pub fn parse_config(args: Vec) -> Config { .unwrap() .parse() .expect("invalid mode"), - run_ignored: matches.opt_present("ignored"), + run_ignored, filter: matches.free.first().cloned(), filter_exact: matches.opt_present("exact"), logfile: matches.opt_str("logfile").map(|s| PathBuf::from(&s)), diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index db0ac927904..9fa176aa68c 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -1288,7 +1288,9 @@ impl<'test> TestCx<'test> { // want to actually assert warnings about all this code. Instead // let's just ignore unused code warnings by defaults and tests // can turn it back on if needed. - rustc.args(&["-A", "unused"]); + if !self.config.src_base.ends_with("rustdoc-ui") { + rustc.args(&["-A", "unused"]); + } } _ => {} } @@ -1582,7 +1584,12 @@ impl<'test> TestCx<'test> { } fn make_compile_args(&self, input_file: &Path, output_file: TargetLocation) -> Command { - let mut rustc = Command::new(&self.config.rustc_path); + let is_rustdoc = self.config.src_base.ends_with("rustdoc-ui"); + let mut rustc = if !is_rustdoc { + Command::new(&self.config.rustc_path) + } else { + Command::new(&self.config.rustdoc_path.clone().expect("no rustdoc built yet")) + }; rustc.arg(input_file).arg("-L").arg(&self.config.build_base); // Optionally prevent default --target if specified in test compile-flags. @@ -1605,17 +1612,19 @@ impl<'test> TestCx<'test> { rustc.args(&["--cfg", revision]); } - if let Some(ref incremental_dir) = self.props.incremental_dir { - rustc.args(&[ - "-C", - &format!("incremental={}", incremental_dir.display()), - ]); - rustc.args(&["-Z", "incremental-verify-ich"]); - rustc.args(&["-Z", "incremental-queries"]); - } + if !is_rustdoc { + if let Some(ref incremental_dir) = self.props.incremental_dir { + rustc.args(&[ + "-C", + &format!("incremental={}", incremental_dir.display()), + ]); + rustc.args(&["-Z", "incremental-verify-ich"]); + rustc.args(&["-Z", "incremental-queries"]); + } - if self.config.mode == CodegenUnits { - rustc.args(&["-Z", "human_readable_cgu_names"]); + if self.config.mode == CodegenUnits { + rustc.args(&["-Z", "human_readable_cgu_names"]); + } } match self.config.mode { @@ -1668,11 +1677,12 @@ impl<'test> TestCx<'test> { } } - - if self.config.target == "wasm32-unknown-unknown" { - // rustc.arg("-g"); // get any backtrace at all on errors - } else if !self.props.no_prefer_dynamic { - rustc.args(&["-C", "prefer-dynamic"]); + if !is_rustdoc { + if self.config.target == "wasm32-unknown-unknown" { + // rustc.arg("-g"); // get any backtrace at all on errors + } else if !self.props.no_prefer_dynamic { + rustc.args(&["-C", "prefer-dynamic"]); + } } match output_file { @@ -1696,8 +1706,10 @@ impl<'test> TestCx<'test> { } else { rustc.args(self.split_maybe_args(&self.config.target_rustcflags)); } - if let Some(ref linker) = self.config.linker { - rustc.arg(format!("-Clinker={}", linker)); + if !is_rustdoc { + if let Some(ref linker) = self.config.linker { + rustc.arg(format!("-Clinker={}", linker)); + } } rustc.args(&self.props.compile_flags); @@ -2509,7 +2521,6 @@ impl<'test> TestCx<'test> { .compile_flags .iter() .any(|s| s.contains("--error-format")); - let proc_res = self.compile_test(); self.check_if_test_should_compile(&proc_res);