From 035ec5bbb62c2cef64840389508707da5febeb8b Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sat, 31 Mar 2018 14:49:56 +0200 Subject: [PATCH 1/6] Add warning if a resolution failed --- src/bootstrap/test.rs | 35 +++++++++++++++++++++++++++++++++++ src/librustdoc/clean/mod.rs | 8 ++++++++ 2 files changed, 43 insertions(+) diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index 29c8cd1568a39..e7610976f8e35 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -514,6 +514,41 @@ impl Step for RustdocJS { } } +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +pub struct RustdocUi { + pub host: Interned, + pub target: Interned, + pub compiler: Compiler, +} + +impl Step for RustdocUi { + type Output = (); + const DEFAULT: bool = true; + const ONLY_HOSTS: bool = true; + + fn should_run(run: ShouldRun) -> ShouldRun { + run.path("src/test/rustdoc-ui") + } + + fn make_run(run: RunConfig) { + let compiler = run.builder.compiler(run.builder.top_stage, run.host); + run.builder.ensure(RustdocUi { + host: run.host, + target: run.target, + compiler, + }); + } + + fn run(self, builder: &Builder) { + builder.ensure(Compiletest { + compiler: self.compiler, + target: self.target, + mode: "ui", + suite: "rustdoc-ui", + }) + } +} + #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub struct Tidy; diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index da8085d84c3f6..443caa7618d74 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -1178,6 +1178,10 @@ enum PathKind { Type, } +fn resolution_failure(cx: &DocContext, path_str: &str) { + cx.sess().warn(&format!("[{}] cannot be resolved, ignoring it...", path_str)); +} + impl Clean for [ast::Attribute] { fn clean(&self, cx: &DocContext) -> Attributes { let mut attrs = Attributes::from_ast(cx.sess().diagnostic(), self); @@ -1228,6 +1232,7 @@ impl Clean for [ast::Attribute] { if let Ok(def) = resolve(cx, path_str, true) { def } else { + resolution_failure(cx, path_str); // this could just be a normal link or a broken link // we could potentially check if something is // "intra-doc-link-like" and warn in that case @@ -1238,6 +1243,7 @@ impl Clean for [ast::Attribute] { if let Ok(def) = resolve(cx, path_str, false) { def } else { + resolution_failure(cx, path_str); // this could just be a normal link continue; } @@ -1282,6 +1288,7 @@ impl Clean for [ast::Attribute] { } else if let Ok(value_def) = resolve(cx, path_str, true) { value_def } else { + resolution_failure(cx, path_str); // this could just be a normal link continue; } @@ -1290,6 +1297,7 @@ impl Clean for [ast::Attribute] { if let Some(def) = macro_resolve(cx, path_str) { (def, None) } else { + resolution_failure(cx, path_str); continue } } From a6fefdecdfff6641111ff6446f73d8364459e1f0 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sun, 1 Apr 2018 00:09:00 +0200 Subject: [PATCH 2/6] Add error-format and color-config options to rustdoc --- src/librustdoc/core.rs | 45 +++++++++++++++++++++++++++------ src/librustdoc/lib.rs | 56 ++++++++++++++++++++++++++++++++++++++---- 2 files changed, 89 insertions(+), 12 deletions(-) diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs index 781379d2d8c3e..97c4e859327a9 100644 --- a/src/librustdoc/core.rs +++ b/src/librustdoc/core.rs @@ -18,6 +18,7 @@ use rustc::middle::privacy::AccessLevels; use rustc::ty::{self, TyCtxt, AllArenas}; use rustc::hir::map as hir_map; use rustc::lint; +use rustc::session::config::ErrorOutputType; use rustc::util::nodemap::{FxHashMap, FxHashSet}; use rustc_resolve as resolve; use rustc_metadata::creader::CrateLoader; @@ -28,8 +29,9 @@ use syntax::ast::NodeId; use syntax::codemap; use syntax::edition::Edition; use syntax::feature_gate::UnstableFeatures; +use syntax::json::JsonEmitter; use errors; -use errors::emitter::ColorConfig; +use errors::emitter::{Emitter, EmitterWriter}; use std::cell::{RefCell, Cell}; use std::mem; @@ -115,7 +117,6 @@ impl DocAccessLevels for AccessLevels { } } - pub fn run_core(search_paths: SearchPaths, cfgs: Vec, externs: config::Externs, @@ -126,7 +127,8 @@ pub fn run_core(search_paths: SearchPaths, crate_name: Option, force_unstable_if_unmarked: bool, edition: Edition, - cg: CodegenOptions) -> (clean::Crate, RenderInfo) + cg: CodegenOptions, + error_format: ErrorOutputType) -> (clean::Crate, RenderInfo) { // Parse, resolve, and typecheck the given crate. @@ -138,6 +140,7 @@ pub fn run_core(search_paths: SearchPaths, let warning_lint = lint::builtin::WARNINGS.name_lower(); let host_triple = TargetTriple::from_triple(config::host_triple()); + // plays with error output here! let sessopts = config::Options { maybe_sysroot, search_paths, @@ -155,14 +158,42 @@ pub fn run_core(search_paths: SearchPaths, edition, ..config::basic_debugging_options() }, + error_format, ..config::basic_options().clone() }; let codemap = Lrc::new(codemap::CodeMap::new(sessopts.file_path_mapping())); - let diagnostic_handler = errors::Handler::with_tty_emitter(ColorConfig::Auto, - true, - false, - Some(codemap.clone())); + let emitter: Box = match error_format { + ErrorOutputType::HumanReadable(color_config) => Box::new( + EmitterWriter::stderr( + color_config, + Some(codemap.clone()), + false, + sessopts.debugging_opts.teach, + ).ui_testing(sessopts.debugging_opts.ui_testing) + ), + ErrorOutputType::Json(pretty) => Box::new( + JsonEmitter::stderr( + None, + codemap.clone(), + pretty, + sessopts.debugging_opts.approximate_suggestions, + ).ui_testing(sessopts.debugging_opts.ui_testing) + ), + ErrorOutputType::Short(color_config) => Box::new( + EmitterWriter::stderr(color_config, Some(codemap.clone()), true, false) + ), + }; + + let diagnostic_handler = errors::Handler::with_emitter_and_flags( + emitter, + errors::HandlerFlags { + can_emit_warnings: true, + treat_err_as_bug: false, + external_macro_backtrace: false, + ..Default::default() + }, + ); let mut sess = session::build_session_( sessopts, cpath, diagnostic_handler, codemap, diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index 1339a66f8b2e9..390924c83e1e2 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -23,6 +23,7 @@ #![feature(test)] #![feature(vec_remove_item)] #![feature(entry_and_modify)] +#![feature(dyn_trait)] extern crate arena; extern crate getopts; @@ -48,6 +49,8 @@ extern crate tempdir; extern crate serialize as rustc_serialize; // used by deriving +use errors::ColorConfig; + use std::collections::{BTreeMap, BTreeSet}; use std::default::Default; use std::env; @@ -278,6 +281,21 @@ pub fn opts() -> Vec { "edition to use when compiling rust code (default: 2015)", "EDITION") }), + unstable("color", |o| { + o.optopt("", + "color", + "Configure coloring of output: + auto = colorize, if output goes to a tty (default); + always = always colorize output; + never = never colorize output", + "auto|always|never") + }), + unstable("error-format", |o| { + o.optopt("", + "error-format", + "How errors and other messages are produced", + "human|json|short") + }), ] } @@ -362,9 +380,33 @@ pub fn main_args(args: &[String]) -> isize { } let input = &matches.free[0]; + let color = match matches.opt_str("color").as_ref().map(|s| &s[..]) { + Some("auto") => ColorConfig::Auto, + Some("always") => ColorConfig::Always, + Some("never") => ColorConfig::Never, + None => ColorConfig::Auto, + Some(arg) => { + print_error(&format!("argument for --color must be `auto`, `always` or `never` \ + (instead was `{}`)", arg)); + return 1; + } + }; + let error_format = match matches.opt_str("error-format").as_ref().map(|s| &s[..]) { + Some("human") => ErrorOutputType::HumanReadable(color), + Some("json") => ErrorOutputType::Json(false), + Some("pretty-json") => ErrorOutputType::Json(true), + Some("short") => ErrorOutputType::Short(color), + None => ErrorOutputType::HumanReadable(color), + Some(arg) => { + print_error(&format!("argument for --error-format must be `human`, `json` or \ + `short` (instead was `{}`)", arg)); + return 1; + } + }; + let mut libs = SearchPaths::new(); for s in &matches.opt_strs("L") { - libs.add_path(s, ErrorOutputType::default()); + libs.add_path(s, error_format); } let externs = match parse_externs(&matches) { Ok(ex) => ex, @@ -464,7 +506,9 @@ pub fn main_args(args: &[String]) -> isize { } let output_format = matches.opt_str("w"); - let res = acquire_input(PathBuf::from(input), externs, edition, cg, &matches, move |out| { + + let res = acquire_input(PathBuf::from(input), externs, edition, cg, &matches, error_format, + move |out| { let Output { krate, passes, renderinfo } = out; info!("going to format"); match output_format.as_ref().map(|s| &**s) { @@ -508,13 +552,14 @@ fn acquire_input(input: PathBuf, edition: Edition, cg: CodegenOptions, matches: &getopts::Matches, + error_format: ErrorOutputType, f: F) -> Result where R: 'static + Send, F: 'static + Send + FnOnce(Output) -> R { match matches.opt_str("r").as_ref().map(|s| &**s) { - Some("rust") => Ok(rust_input(input, externs, edition, cg, matches, f)), + Some("rust") => Ok(rust_input(input, externs, edition, cg, matches, error_format, f)), Some(s) => Err(format!("unknown input format: {}", s)), - None => Ok(rust_input(input, externs, edition, cg, matches, f)) + None => Ok(rust_input(input, externs, edition, cg, matches, error_format, f)) } } @@ -545,6 +590,7 @@ fn rust_input(cratefile: PathBuf, edition: Edition, cg: CodegenOptions, matches: &getopts::Matches, + error_format: ErrorOutputType, f: F) -> R where R: 'static + Send, F: 'static + Send + FnOnce(Output) -> R @@ -597,7 +643,7 @@ where R: 'static + Send, let (mut krate, renderinfo) = core::run_core(paths, cfgs, externs, Input::File(cratefile), triple, maybe_sysroot, display_warnings, crate_name.clone(), - force_unstable_if_unmarked, edition, cg); + force_unstable_if_unmarked, edition, cg, error_format); info!("finished with rustc"); From b2192ae157eab3b83d7cbc42d2e08925cbdfd8b6 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sun, 1 Apr 2018 21:06:35 +0200 Subject: [PATCH 3/6] Add rustdoc-ui test suite --- src/bootstrap/builder.rs | 2 +- src/bootstrap/test.rs | 28 +++++++--- src/librustdoc/html/render.rs | 2 +- src/libstd/lib.rs | 4 +- src/libtest/lib.rs | 1 - src/test/rustdoc-ui/intra-links-warning.rs | 19 +++++++ .../rustdoc-ui/intra-links-warning.stderr | 6 +++ src/tools/compiletest/src/main.rs | 6 ++- src/tools/compiletest/src/runtest.rs | 51 +++++++++++-------- 9 files changed, 85 insertions(+), 34 deletions(-) create mode 100644 src/test/rustdoc-ui/intra-links-warning.rs create mode 100644 src/test/rustdoc-ui/intra-links-warning.stderr diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index 7ff64af919671..d30933d2efd22 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 e7610976f8e35..992dec5217d4f 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 9e2c7bd7ef1ed..abeaef723d487 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 a34fcb5a7f98b..3242e136ff39f 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 9291eaa910bd7..a4d1797c3ec5b 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 0000000000000..36bcc307d55d1 --- /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 0000000000000..67d7bdd02b359 --- /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 80cab96434ba7..ae4f4aa404609 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 db0ac9279046c..9fa176aa68c58 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); From 16a39382e2232555472388d6962c9186c08d7a4e Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sat, 7 Apr 2018 18:41:16 +0200 Subject: [PATCH 4/6] Fix nits --- src/bootstrap/test.rs | 2 -- src/test/rustdoc-ui/intra-links-warning.rs | 2 -- 2 files changed, 4 deletions(-) diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index 992dec5217d4f..8a933ccacb2d7 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -919,8 +919,6 @@ impl Step for Compiletest { 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()); diff --git a/src/test/rustdoc-ui/intra-links-warning.rs b/src/test/rustdoc-ui/intra-links-warning.rs index 36bcc307d55d1..9a3709b0dd805 100644 --- a/src/test/rustdoc-ui/intra-links-warning.rs +++ b/src/test/rustdoc-ui/intra-links-warning.rs @@ -8,8 +8,6 @@ // 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] From a3ed2abed7bfb432168eb33492af71ebb16724d9 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sun, 15 Apr 2018 13:05:14 +0200 Subject: [PATCH 5/6] Fix empty tests --- src/bootstrap/test.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index 8a933ccacb2d7..e6af4202c19c6 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -919,10 +919,8 @@ impl Step for Compiletest { if build.config.rust_debuginfo_tests { flags.push("-g".to_string()); } - 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) { From 05275dafaaa602fe4a5d275ef724ced39d30465f Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sun, 15 Apr 2018 16:17:18 +0200 Subject: [PATCH 6/6] Remove unwanted auto-linking and update --- src/libcore/iter/iterator.rs | 2 +- src/libcore/str/pattern.rs | 2 +- src/librustc/ty/sty.rs | 2 +- src/libstd/ffi/os_str.rs | 5 +++-- src/libstd/macros.rs | 4 ++-- src/libsyntax_pos/hygiene.rs | 4 ++-- src/libunwind/macros.rs | 4 ++-- src/test/run-pass/issue-16819.rs | 2 +- src/test/rustdoc-ui/intra-links-warning.rs | 2 +- 9 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/libcore/iter/iterator.rs b/src/libcore/iter/iterator.rs index 4ccf446aa6346..6a77de2c9868d 100644 --- a/src/libcore/iter/iterator.rs +++ b/src/libcore/iter/iterator.rs @@ -998,7 +998,7 @@ pub trait Iterator { /// an extra layer of indirection. `flat_map()` will remove this extra layer /// on its own. /// - /// You can think of [`flat_map(f)`][flat_map] as the semantic equivalent + /// You can think of `flat_map(f)` as the semantic equivalent /// of [`map`]ping, and then [`flatten`]ing as in `map(f).flatten()`. /// /// Another way of thinking about `flat_map()`: [`map`]'s closure returns diff --git a/src/libcore/str/pattern.rs b/src/libcore/str/pattern.rs index 95bb8f18947ec..464d57a270241 100644 --- a/src/libcore/str/pattern.rs +++ b/src/libcore/str/pattern.rs @@ -258,7 +258,7 @@ pub struct CharSearcher<'a> { /// `finger` is the current byte index of the forward search. /// Imagine that it exists before the byte at its index, i.e. - /// haystack[finger] is the first byte of the slice we must inspect during + /// `haystack[finger]` is the first byte of the slice we must inspect during /// forward searching finger: usize, /// `finger_back` is the current byte index of the reverse search. diff --git a/src/librustc/ty/sty.rs b/src/librustc/ty/sty.rs index d68393956efd1..310fcbcfcb374 100644 --- a/src/librustc/ty/sty.rs +++ b/src/librustc/ty/sty.rs @@ -1550,7 +1550,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> { } } - /// Returns the type of ty[i] + /// Returns the type of `ty[i]`. pub fn builtin_index(&self) -> Option> { match self.sty { TyArray(ty, _) | TySlice(ty) => Some(ty), diff --git a/src/libstd/ffi/os_str.rs b/src/libstd/ffi/os_str.rs index 7520121a8c290..4850ed0c5be05 100644 --- a/src/libstd/ffi/os_str.rs +++ b/src/libstd/ffi/os_str.rs @@ -61,7 +61,7 @@ use sys_common::{AsInner, IntoInner, FromInner}; /// # Conversions /// /// See the [module's toplevel documentation about conversions][conversions] for a discussion on -/// the traits which `OsString` implements for conversions from/to native representations. +/// the traits which `OsString` implements for [conversions] from/to native representations. /// /// [`OsStr`]: struct.OsStr.html /// [`&OsStr`]: struct.OsStr.html @@ -74,6 +74,7 @@ use sys_common::{AsInner, IntoInner, FromInner}; /// [`new`]: #method.new /// [`push`]: #method.push /// [`as_os_str`]: #method.as_os_str +/// [conversions]: index.html#conversions #[derive(Clone)] #[stable(feature = "rust1", since = "1.0.0")] pub struct OsString { @@ -89,7 +90,7 @@ pub struct OsString { /// references; the latter are owned strings. /// /// See the [module's toplevel documentation about conversions][conversions] for a discussion on -/// the traits which `OsStr` implements for conversions from/to native representations. +/// the traits which `OsStr` implements for [conversions] from/to native representations. /// /// [`OsString`]: struct.OsString.html /// [`&str`]: ../primitive.str.html diff --git a/src/libstd/macros.rs b/src/libstd/macros.rs index 5ef7c15965505..6902ec82047d7 100644 --- a/src/libstd/macros.rs +++ b/src/libstd/macros.rs @@ -787,13 +787,13 @@ pub mod builtin { } } -/// A macro for defining #[cfg] if-else statements. +/// A macro for defining `#[cfg]` if-else statements. /// /// This is similar to the `if/elif` C preprocessor macro by allowing definition /// of a cascade of `#[cfg]` cases, emitting the implementation which matches /// first. /// -/// This allows you to conveniently provide a long list #[cfg]'d blocks of code +/// This allows you to conveniently provide a long list `#[cfg]`'d blocks of code /// without having to rewrite each clause multiple times. macro_rules! cfg_if { ($( diff --git a/src/libsyntax_pos/hygiene.rs b/src/libsyntax_pos/hygiene.rs index 8cb5776fdeb01..5e96b5ce6733c 100644 --- a/src/libsyntax_pos/hygiene.rs +++ b/src/libsyntax_pos/hygiene.rs @@ -8,9 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -//! Machinery for hygienic macros, inspired by the MTWT[1] paper. +//! Machinery for hygienic macros, inspired by the `MTWT[1]` paper. //! -//! [1] Matthew Flatt, Ryan Culpepper, David Darais, and Robert Bruce Findler. 2012. +//! `[1]` Matthew Flatt, Ryan Culpepper, David Darais, and Robert Bruce Findler. 2012. //! *Macros that work together: Compile-time bindings, partial expansion, //! and definition contexts*. J. Funct. Program. 22, 2 (March 2012), 181-216. //! DOI=10.1017/S0956796812000093 diff --git a/src/libunwind/macros.rs b/src/libunwind/macros.rs index 26376a3733f4f..a962d5fc41537 100644 --- a/src/libunwind/macros.rs +++ b/src/libunwind/macros.rs @@ -8,13 +8,13 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -/// A macro for defining #[cfg] if-else statements. +/// A macro for defining `#[cfg]` if-else statements. /// /// This is similar to the `if/elif` C preprocessor macro by allowing definition /// of a cascade of `#[cfg]` cases, emitting the implementation which matches /// first. /// -/// This allows you to conveniently provide a long list #[cfg]'d blocks of code +/// This allows you to conveniently provide a long list `#[cfg]`'d blocks of code /// without having to rewrite each clause multiple times. macro_rules! cfg_if { ($( diff --git a/src/test/run-pass/issue-16819.rs b/src/test/run-pass/issue-16819.rs index fb35ce33157d6..ecd8a3390b753 100644 --- a/src/test/run-pass/issue-16819.rs +++ b/src/test/run-pass/issue-16819.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -//`#[cfg]` on struct field permits empty unusable struct +// `#[cfg]` on struct field permits empty unusable struct struct S { #[cfg(untrue)] diff --git a/src/test/rustdoc-ui/intra-links-warning.rs b/src/test/rustdoc-ui/intra-links-warning.rs index 9a3709b0dd805..2a00d31e3d715 100644 --- a/src/test/rustdoc-ui/intra-links-warning.rs +++ b/src/test/rustdoc-ui/intra-links-warning.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// must-compile-successfully +// compile-pass //! Test with [Foo::baz], [Bar::foo], [Uniooon::X]