From fb9fa5ba3ee08171e7d2ff35d28ec0dd93b0287b Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Fri, 3 Jul 2020 12:12:50 +0200 Subject: [PATCH 01/14] adjust ub-enum test to be endianess-independent --- src/test/ui/consts/const-eval/ub-enum.rs | 5 +++-- src/test/ui/consts/const-eval/ub-enum.stderr | 12 ++++++------ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/test/ui/consts/const-eval/ub-enum.rs b/src/test/ui/consts/const-eval/ub-enum.rs index c49997c6c33f6..136b33208c293 100644 --- a/src/test/ui/consts/const-eval/ub-enum.rs +++ b/src/test/ui/consts/const-eval/ub-enum.rs @@ -88,9 +88,10 @@ const BAD_OPTION_CHAR: Option<(char, char)> = Some(('x', unsafe { mem::transmute //~^ ERROR is undefined behavior // All variants are uninhabited but also have data. -const BAD_UNINHABITED_WITH_DATA1: Result<(i32, Never), (i32, !)> = unsafe { mem::transmute(1u64) }; +// Use `0` as constant to make behavior endianess-independent. +const BAD_UNINHABITED_WITH_DATA1: Result<(i32, Never), (i32, !)> = unsafe { mem::transmute(0u64) }; //~^ ERROR is undefined behavior -const BAD_UNINHABITED_WITH_DATA2: Result<(i32, !), (i32, Never)> = unsafe { mem::transmute(1u64) }; +const BAD_UNINHABITED_WITH_DATA2: Result<(i32, !), (i32, Never)> = unsafe { mem::transmute(0u64) }; //~^ ERROR is undefined behavior fn main() { diff --git a/src/test/ui/consts/const-eval/ub-enum.stderr b/src/test/ui/consts/const-eval/ub-enum.stderr index 1f7593c6db9b6..9c29aa1a51d1c 100644 --- a/src/test/ui/consts/const-eval/ub-enum.stderr +++ b/src/test/ui/consts/const-eval/ub-enum.stderr @@ -87,18 +87,18 @@ LL | const BAD_OPTION_CHAR: Option<(char, char)> = Some(('x', unsafe { mem::tran = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-enum.rs:91:1 + --> $DIR/ub-enum.rs:92:1 | -LL | const BAD_UNINHABITED_WITH_DATA1: Result<(i32, Never), (i32, !)> = unsafe { mem::transmute(1u64) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a value of the never type `!` at ..0.1 +LL | const BAD_UNINHABITED_WITH_DATA1: Result<(i32, Never), (i32, !)> = unsafe { mem::transmute(0u64) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a value of uninhabited type Never at ..0.1 | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-enum.rs:93:1 + --> $DIR/ub-enum.rs:94:1 | -LL | const BAD_UNINHABITED_WITH_DATA2: Result<(i32, !), (i32, Never)> = unsafe { mem::transmute(1u64) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a value of uninhabited type Never at ..0.1 +LL | const BAD_UNINHABITED_WITH_DATA2: Result<(i32, !), (i32, Never)> = unsafe { mem::transmute(0u64) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a value of the never type `!` at ..0.1 | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. From 81fbfc40594e0c74aa46bbf50225c4d923f1464b Mon Sep 17 00:00:00 2001 From: Seth Pellegrino Date: Sun, 5 Jul 2020 17:22:21 -0700 Subject: [PATCH 02/14] Use relative path for local links to primitives in libcore Else, links to `char::foo` would point into `/path/to/src/libcore/std/primitive.char.html#method.foo`. Split out from #73804. --- src/librustdoc/clean/types.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/librustdoc/clean/types.rs b/src/librustdoc/clean/types.rs index 6dec016cc2ee3..34f91bfec5a88 100644 --- a/src/librustdoc/clean/types.rs +++ b/src/librustdoc/clean/types.rs @@ -628,6 +628,7 @@ impl Attributes { /// Cache must be populated before call pub fn links(&self, krate: &CrateNum) -> Vec<(String, String)> { use crate::html::format::href; + use crate::html::render::CURRENT_DEPTH; self.links .iter() @@ -648,12 +649,13 @@ impl Attributes { if let Some(ref fragment) = *fragment { let cache = cache(); let url = match cache.extern_locations.get(krate) { - Some(&(_, ref src, ExternalLocation::Local)) => { - src.to_str().expect("invalid file path") + Some(&(_, _, ExternalLocation::Local)) => { + let depth = CURRENT_DEPTH.with(|l| l.get()); + "../".repeat(depth) } - Some(&(_, _, ExternalLocation::Remote(ref s))) => s, + Some(&(_, _, ExternalLocation::Remote(ref s))) => s.to_string(), Some(&(_, _, ExternalLocation::Unknown)) | None => { - "https://doc.rust-lang.org/nightly" + String::from("https://doc.rust-lang.org/nightly") } }; // This is a primitive so the url is done "by hand". From ee3a0f867e938f469cbbb422a76ed5662be2ecc7 Mon Sep 17 00:00:00 2001 From: Seth Pellegrino Date: Mon, 6 Jul 2020 08:46:44 -0700 Subject: [PATCH 03/14] Add guard to check for local `core` crate --- src/librustdoc/clean/types.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/librustdoc/clean/types.rs b/src/librustdoc/clean/types.rs index 34f91bfec5a88..d2ba34ccb8107 100644 --- a/src/librustdoc/clean/types.rs +++ b/src/librustdoc/clean/types.rs @@ -649,14 +649,16 @@ impl Attributes { if let Some(ref fragment) = *fragment { let cache = cache(); let url = match cache.extern_locations.get(krate) { - Some(&(_, _, ExternalLocation::Local)) => { + Some(&(ref krate_name, _, ExternalLocation::Local)) + if krate_name == "core" => + { let depth = CURRENT_DEPTH.with(|l| l.get()); "../".repeat(depth) } Some(&(_, _, ExternalLocation::Remote(ref s))) => s.to_string(), - Some(&(_, _, ExternalLocation::Unknown)) | None => { - String::from("https://doc.rust-lang.org/nightly") - } + Some(&(_, _, ExternalLocation::Local)) + | Some(&(_, _, ExternalLocation::Unknown)) + | None => String::from("https://doc.rust-lang.org/nightly"), }; // This is a primitive so the url is done "by hand". let tail = fragment.find('#').unwrap_or_else(|| fragment.len()); From 5702e0289f7d19f0ea133d43da7dcd7cbfc5b557 Mon Sep 17 00:00:00 2001 From: Gary Guo Date: Mon, 6 Jul 2020 20:42:19 +0100 Subject: [PATCH 04/14] Only allow `repr(i128/u128)` on enum --- src/librustc_passes/check_attr.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/librustc_passes/check_attr.rs b/src/librustc_passes/check_attr.rs index ef84f251390e6..fee63b1ee524e 100644 --- a/src/librustc_passes/check_attr.rs +++ b/src/librustc_passes/check_attr.rs @@ -292,6 +292,8 @@ impl CheckAttrVisitor<'tcx> { | sym::u32 | sym::i64 | sym::u64 + | sym::i128 + | sym::u128 | sym::isize | sym::usize => { int_reprs += 1; From 97867bbe5cd09df7754864c826f58d3029f4422e Mon Sep 17 00:00:00 2001 From: Gary Guo Date: Mon, 6 Jul 2020 21:04:54 +0100 Subject: [PATCH 05/14] Add UI test for issue 74082 --- src/test/ui/issues/issue-74082.rs | 9 +++++++++ src/test/ui/issues/issue-74082.stderr | 19 +++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 src/test/ui/issues/issue-74082.rs create mode 100644 src/test/ui/issues/issue-74082.stderr diff --git a/src/test/ui/issues/issue-74082.rs b/src/test/ui/issues/issue-74082.rs new file mode 100644 index 0000000000000..982f8ef02538b --- /dev/null +++ b/src/test/ui/issues/issue-74082.rs @@ -0,0 +1,9 @@ +#![allow(dead_code)] + +#[repr(i128)] //~ ERROR: attribute should be applied to enum +struct Foo; + +#[repr(u128)] //~ ERROR: attribute should be applied to enum +struct Bar; + +fn main() {} diff --git a/src/test/ui/issues/issue-74082.stderr b/src/test/ui/issues/issue-74082.stderr new file mode 100644 index 0000000000000..08fe415513d0d --- /dev/null +++ b/src/test/ui/issues/issue-74082.stderr @@ -0,0 +1,19 @@ +error[E0517]: attribute should be applied to enum + --> $DIR/issue-74082.rs:3:8 + | +LL | #[repr(i128)] + | ^^^^ +LL | struct Foo; + | ----------- not an enum + +error[E0517]: attribute should be applied to enum + --> $DIR/issue-74082.rs:6:8 + | +LL | #[repr(u128)] + | ^^^^ +LL | struct Bar; + | ----------- not an enum + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0517`. From 33a5d00efb4347736dd766c06cb9e0bcc0d6c377 Mon Sep 17 00:00:00 2001 From: Seth Pellegrino Date: Mon, 6 Jul 2020 19:35:07 -0700 Subject: [PATCH 06/14] Two new rustdoc tests for intra links They both produce less-than-desirable output (links going to docs.rust-lang.org), but I haven't figured out yet how to assert about them properly. --- src/test/rustdoc/auxiliary/my-core.rs | 18 ++++++++++++++++ .../intra-link-prim-methods-external-core.rs | 10 +++++++++ .../rustdoc/intra-link-prim-methods-local.rs | 21 +++++++++++++++++++ 3 files changed, 49 insertions(+) create mode 100644 src/test/rustdoc/auxiliary/my-core.rs create mode 100644 src/test/rustdoc/intra-link-prim-methods-external-core.rs create mode 100644 src/test/rustdoc/intra-link-prim-methods-local.rs diff --git a/src/test/rustdoc/auxiliary/my-core.rs b/src/test/rustdoc/auxiliary/my-core.rs new file mode 100644 index 0000000000000..999dfbdd8a3f5 --- /dev/null +++ b/src/test/rustdoc/auxiliary/my-core.rs @@ -0,0 +1,18 @@ +#![feature(no_core, lang_items)] +#![no_core] + +#[lang = "char"] +impl char { + pub fn len_utf8(self) -> usize { + 42 + } +} + +#[lang = "sized"] +pub trait Sized {} + +#[lang = "clone"] +pub trait Clone: Sized {} + +#[lang = "copy"] +pub trait Copy: Clone {} diff --git a/src/test/rustdoc/intra-link-prim-methods-external-core.rs b/src/test/rustdoc/intra-link-prim-methods-external-core.rs new file mode 100644 index 0000000000000..85e017e89b146 --- /dev/null +++ b/src/test/rustdoc/intra-link-prim-methods-external-core.rs @@ -0,0 +1,10 @@ +// aux-build:my-core.rs +// ignore-cross-compile + +#![deny(intra_doc_link_resolution_failure)] +#![feature(no_core, lang_items)] +#![no_core] + +//! A [`char`] and its [`char::len_utf8`]. + +extern crate my_core; diff --git a/src/test/rustdoc/intra-link-prim-methods-local.rs b/src/test/rustdoc/intra-link-prim-methods-local.rs new file mode 100644 index 0000000000000..c0be16885dae8 --- /dev/null +++ b/src/test/rustdoc/intra-link-prim-methods-local.rs @@ -0,0 +1,21 @@ +#![deny(intra_doc_link_resolution_failure)] +#![feature(no_core, lang_items)] +#![no_core] + +//! A [`char`] and its [`char::len_utf8`]. + +#[lang = "char"] +impl char { + pub fn len_utf8(self) -> usize { + 42 + } +} + +#[lang = "sized"] +pub trait Sized {} + +#[lang = "clone"] +pub trait Clone: Sized {} + +#[lang = "copy"] +pub trait Copy: Clone {} From 165aecbee31c3e628aaa8e6e7edbbd113f46e3f2 Mon Sep 17 00:00:00 2001 From: Seth Pellegrino Date: Mon, 6 Jul 2020 19:46:53 -0700 Subject: [PATCH 07/14] build extern docs as well --- src/test/rustdoc/intra-link-prim-methods-external-core.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/test/rustdoc/intra-link-prim-methods-external-core.rs b/src/test/rustdoc/intra-link-prim-methods-external-core.rs index 85e017e89b146..a7f243f63a893 100644 --- a/src/test/rustdoc/intra-link-prim-methods-external-core.rs +++ b/src/test/rustdoc/intra-link-prim-methods-external-core.rs @@ -1,4 +1,5 @@ // aux-build:my-core.rs +// build-aux-docs // ignore-cross-compile #![deny(intra_doc_link_resolution_failure)] From 561d5acb9e6a968be8532a50611e9aa41e25a001 Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Tue, 7 Jul 2020 06:37:47 -0700 Subject: [PATCH 08/14] Fix occasional bootstrap panic in docs. --- src/bootstrap/doc.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bootstrap/doc.rs b/src/bootstrap/doc.rs index ed351354c441d..4bec6c7791a21 100644 --- a/src/bootstrap/doc.rs +++ b/src/bootstrap/doc.rs @@ -156,7 +156,7 @@ impl Step for RustbookSrc { let index = out.join("index.html"); let rustbook = builder.tool_exe(Tool::Rustbook); let mut rustbook_cmd = builder.tool_cmd(Tool::Rustbook); - if up_to_date(&src, &index) && up_to_date(&rustbook, &index) { + if builder.config.dry_run || up_to_date(&src, &index) && up_to_date(&rustbook, &index) { return; } builder.info(&format!("Rustbook ({}) - {}", target, name)); From 865b930bc99680bd170a677c095a2116a5c4159d Mon Sep 17 00:00:00 2001 From: Seth Pellegrino Date: Tue, 7 Jul 2020 10:23:29 -0700 Subject: [PATCH 09/14] Assert current behavior for links For the two of these tests that have a local `char` to link to, this behavior isn't what's expected, but is what's happening presently. --- src/test/rustdoc/intra-link-prim-methods-external-core.rs | 4 ++++ src/test/rustdoc/intra-link-prim-methods-local.rs | 4 ++++ src/test/rustdoc/intra-link-prim-methods.rs | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/src/test/rustdoc/intra-link-prim-methods-external-core.rs b/src/test/rustdoc/intra-link-prim-methods-external-core.rs index a7f243f63a893..f3953ef3f2eb4 100644 --- a/src/test/rustdoc/intra-link-prim-methods-external-core.rs +++ b/src/test/rustdoc/intra-link-prim-methods-external-core.rs @@ -6,6 +6,10 @@ #![feature(no_core, lang_items)] #![no_core] +// @has intra_link_prim_methods_external_core/index.html +// @has - '//*[@id="main"]//a[@href="https://doc.rust-lang.org/nightly/std/primitive.char.html"]' 'char' +// @has - '//*[@id="main"]//a[@href="https://doc.rust-lang.org/nightly/std/primitive.char.html#method.len_utf8"]' 'char::len_utf8' + //! A [`char`] and its [`char::len_utf8`]. extern crate my_core; diff --git a/src/test/rustdoc/intra-link-prim-methods-local.rs b/src/test/rustdoc/intra-link-prim-methods-local.rs index c0be16885dae8..ed72b5f40de87 100644 --- a/src/test/rustdoc/intra-link-prim-methods-local.rs +++ b/src/test/rustdoc/intra-link-prim-methods-local.rs @@ -2,6 +2,10 @@ #![feature(no_core, lang_items)] #![no_core] +// @has intra_link_prim_methods_local/index.html +// @has - '//*[@id="main"]//a[@href="https://doc.rust-lang.org/nightly/std/primitive.char.html"]' 'char' +// @has - '//*[@id="main"]//a[@href="https://doc.rust-lang.org/nightly/std/primitive.char.html#method.len_utf8"]' 'char::len_utf8' + //! A [`char`] and its [`char::len_utf8`]. #[lang = "char"] diff --git a/src/test/rustdoc/intra-link-prim-methods.rs b/src/test/rustdoc/intra-link-prim-methods.rs index af0426b22c557..ba050968ce0ac 100644 --- a/src/test/rustdoc/intra-link-prim-methods.rs +++ b/src/test/rustdoc/intra-link-prim-methods.rs @@ -1,3 +1,7 @@ #![deny(intra_doc_link_resolution_failure)] +// @has intra_link_prim_methods/index.html +// @has - '//*[@id="main"]//a[@href="https://doc.rust-lang.org/nightly/std/primitive.char.html"]' 'char' +// @has - '//*[@id="main"]//a[@href="https://doc.rust-lang.org/nightly/std/primitive.char.html#method.len_utf8"]' 'char::len_utf8' + //! A [`char`] and its [`char::len_utf8`]. From 56fb71786a77706cefec8170bd06a5c990493b2b Mon Sep 17 00:00:00 2001 From: Oliver Middleton Date: Tue, 7 Jul 2020 18:23:15 +0100 Subject: [PATCH 10/14] rustdoc: Rename invalid_codeblock_attribute lint to be plural --- src/librustc_lint/lib.rs | 4 ++-- src/librustc_session/lint/builtin.rs | 4 ++-- src/librustdoc/core.rs | 4 ++-- src/librustdoc/html/markdown.rs | 2 +- src/librustdoc/test.rs | 2 +- src/test/rustdoc-ui/check-attr-test.rs | 2 +- src/test/rustdoc-ui/check-attr-test.stderr | 4 ++-- src/test/rustdoc-ui/check-attr.rs | 2 +- src/test/rustdoc-ui/check-attr.stderr | 4 ++-- 9 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/librustc_lint/lib.rs b/src/librustc_lint/lib.rs index 4da98d201593b..4556c3547f7fc 100644 --- a/src/librustc_lint/lib.rs +++ b/src/librustc_lint/lib.rs @@ -62,7 +62,7 @@ use rustc_middle::ty::query::Providers; use rustc_middle::ty::TyCtxt; use rustc_session::lint::builtin::{ BARE_TRAIT_OBJECTS, ELIDED_LIFETIMES_IN_PATHS, EXPLICIT_OUTLIVES_REQUIREMENTS, - INTRA_DOC_LINK_RESOLUTION_FAILURE, INVALID_CODEBLOCK_ATTRIBUTE, MISSING_DOC_CODE_EXAMPLES, + INTRA_DOC_LINK_RESOLUTION_FAILURE, INVALID_CODEBLOCK_ATTRIBUTES, MISSING_DOC_CODE_EXAMPLES, PRIVATE_DOC_TESTS, }; use rustc_span::symbol::{Ident, Symbol}; @@ -304,7 +304,7 @@ fn register_builtins(store: &mut LintStore, no_interleave_lints: bool) { add_lint_group!( "rustdoc", INTRA_DOC_LINK_RESOLUTION_FAILURE, - INVALID_CODEBLOCK_ATTRIBUTE, + INVALID_CODEBLOCK_ATTRIBUTES, MISSING_DOC_CODE_EXAMPLES, PRIVATE_DOC_TESTS ); diff --git a/src/librustc_session/lint/builtin.rs b/src/librustc_session/lint/builtin.rs index 5deee6eb48e6a..aa2a133952f8f 100644 --- a/src/librustc_session/lint/builtin.rs +++ b/src/librustc_session/lint/builtin.rs @@ -404,7 +404,7 @@ declare_lint! { } declare_lint! { - pub INVALID_CODEBLOCK_ATTRIBUTE, + pub INVALID_CODEBLOCK_ATTRIBUTES, Warn, "codeblock attribute looks a lot like a known one" } @@ -602,7 +602,7 @@ declare_lint_pass! { UNSTABLE_NAME_COLLISIONS, IRREFUTABLE_LET_PATTERNS, INTRA_DOC_LINK_RESOLUTION_FAILURE, - INVALID_CODEBLOCK_ATTRIBUTE, + INVALID_CODEBLOCK_ATTRIBUTES, MISSING_CRATE_LEVEL_DOCS, MISSING_DOC_CODE_EXAMPLES, PRIVATE_DOC_TESTS, diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs index 38f202e84accb..db98ec5d0a72e 100644 --- a/src/librustdoc/core.rs +++ b/src/librustdoc/core.rs @@ -214,7 +214,7 @@ pub fn new_handler( /// This function is used to setup the lint initialization. By default, in rustdoc, everything /// is "allowed". Depending if we run in test mode or not, we want some of them to be at their -/// default level. For example, the "INVALID_CODEBLOCK_ATTRIBUTE" lint is activated in both +/// default level. For example, the "INVALID_CODEBLOCK_ATTRIBUTES" lint is activated in both /// modes. /// /// A little detail easy to forget is that there is a way to set the lint level for all lints @@ -315,7 +315,7 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt let missing_doc_example = rustc_lint::builtin::MISSING_DOC_CODE_EXAMPLES.name; let private_doc_tests = rustc_lint::builtin::PRIVATE_DOC_TESTS.name; let no_crate_level_docs = rustc_lint::builtin::MISSING_CRATE_LEVEL_DOCS.name; - let invalid_codeblock_attribute_name = rustc_lint::builtin::INVALID_CODEBLOCK_ATTRIBUTE.name; + let invalid_codeblock_attribute_name = rustc_lint::builtin::INVALID_CODEBLOCK_ATTRIBUTES.name; // In addition to those specific lints, we also need to whitelist those given through // command line, otherwise they'll get ignored and we don't want that. diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs index 7a6626766d388..a0f8eb04e2efb 100644 --- a/src/librustdoc/html/markdown.rs +++ b/src/librustdoc/html/markdown.rs @@ -665,7 +665,7 @@ impl<'a, 'b> ExtraInfo<'a, 'b> { (None, None) => return, }; self.tcx.struct_span_lint_hir( - lint::builtin::INVALID_CODEBLOCK_ATTRIBUTE, + lint::builtin::INVALID_CODEBLOCK_ATTRIBUTES, hir_id, self.sp, |lint| { diff --git a/src/librustdoc/test.rs b/src/librustdoc/test.rs index e9504aa3af123..a89cb130c6b05 100644 --- a/src/librustdoc/test.rs +++ b/src/librustdoc/test.rs @@ -46,7 +46,7 @@ pub struct TestOptions { pub fn run(options: Options) -> Result<(), String> { let input = config::Input::File(options.input.clone()); - let invalid_codeblock_attribute_name = rustc_lint::builtin::INVALID_CODEBLOCK_ATTRIBUTE.name; + let invalid_codeblock_attribute_name = rustc_lint::builtin::INVALID_CODEBLOCK_ATTRIBUTES.name; // In addition to those specific lints, we also need to whitelist those given through // command line, otherwise they'll get ignored and we don't want that. diff --git a/src/test/rustdoc-ui/check-attr-test.rs b/src/test/rustdoc-ui/check-attr-test.rs index c4140bbb70a78..665f330e34ea5 100644 --- a/src/test/rustdoc-ui/check-attr-test.rs +++ b/src/test/rustdoc-ui/check-attr-test.rs @@ -1,6 +1,6 @@ // compile-flags:--test -#![deny(invalid_codeblock_attribute)] +#![deny(invalid_codeblock_attributes)] /// foo /// diff --git a/src/test/rustdoc-ui/check-attr-test.stderr b/src/test/rustdoc-ui/check-attr-test.stderr index 45a2d6ec15e7d..1e067a5d21c44 100644 --- a/src/test/rustdoc-ui/check-attr-test.stderr +++ b/src/test/rustdoc-ui/check-attr-test.stderr @@ -11,8 +11,8 @@ error: unknown attribute `compile-fail`. Did you mean `compile_fail`? note: the lint level is defined here --> $DIR/check-attr-test.rs:3:9 | -3 | #![deny(invalid_codeblock_attribute)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 | #![deny(invalid_codeblock_attributes)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: the code block will either not be tested if not marked as a rust one or won't fail if it compiles successfully error: unknown attribute `compilefail`. Did you mean `compile_fail`? diff --git a/src/test/rustdoc-ui/check-attr.rs b/src/test/rustdoc-ui/check-attr.rs index a93ec29131907..9e02eab753e26 100644 --- a/src/test/rustdoc-ui/check-attr.rs +++ b/src/test/rustdoc-ui/check-attr.rs @@ -1,4 +1,4 @@ -#![deny(invalid_codeblock_attribute)] +#![deny(invalid_codeblock_attributes)] /// foo //~^ ERROR diff --git a/src/test/rustdoc-ui/check-attr.stderr b/src/test/rustdoc-ui/check-attr.stderr index 5d6939bd09205..919eb047eefb5 100644 --- a/src/test/rustdoc-ui/check-attr.stderr +++ b/src/test/rustdoc-ui/check-attr.stderr @@ -13,8 +13,8 @@ LL | | /// ``` note: the lint level is defined here --> $DIR/check-attr.rs:1:9 | -LL | #![deny(invalid_codeblock_attribute)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #![deny(invalid_codeblock_attributes)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: the code block will either not be tested if not marked as a rust one or won't fail if it compiles successfully error: unknown attribute `compilefail`. Did you mean `compile_fail`? From f258d98f65ef1408a6045f5ca7873371720409c2 Mon Sep 17 00:00:00 2001 From: Seth Pellegrino Date: Tue, 7 Jul 2020 10:39:10 -0700 Subject: [PATCH 11/14] ignore-tidy-linelength for @has assertions --- src/test/rustdoc/intra-link-prim-methods-external-core.rs | 1 + src/test/rustdoc/intra-link-prim-methods-local.rs | 2 ++ src/test/rustdoc/intra-link-prim-methods.rs | 2 ++ 3 files changed, 5 insertions(+) diff --git a/src/test/rustdoc/intra-link-prim-methods-external-core.rs b/src/test/rustdoc/intra-link-prim-methods-external-core.rs index f3953ef3f2eb4..1569cf4734075 100644 --- a/src/test/rustdoc/intra-link-prim-methods-external-core.rs +++ b/src/test/rustdoc/intra-link-prim-methods-external-core.rs @@ -1,6 +1,7 @@ // aux-build:my-core.rs // build-aux-docs // ignore-cross-compile +// ignore-tidy-linelength #![deny(intra_doc_link_resolution_failure)] #![feature(no_core, lang_items)] diff --git a/src/test/rustdoc/intra-link-prim-methods-local.rs b/src/test/rustdoc/intra-link-prim-methods-local.rs index ed72b5f40de87..ea64efe6d6701 100644 --- a/src/test/rustdoc/intra-link-prim-methods-local.rs +++ b/src/test/rustdoc/intra-link-prim-methods-local.rs @@ -2,6 +2,8 @@ #![feature(no_core, lang_items)] #![no_core] +// ignore-tidy-linelength + // @has intra_link_prim_methods_local/index.html // @has - '//*[@id="main"]//a[@href="https://doc.rust-lang.org/nightly/std/primitive.char.html"]' 'char' // @has - '//*[@id="main"]//a[@href="https://doc.rust-lang.org/nightly/std/primitive.char.html#method.len_utf8"]' 'char::len_utf8' diff --git a/src/test/rustdoc/intra-link-prim-methods.rs b/src/test/rustdoc/intra-link-prim-methods.rs index ba050968ce0ac..76636b80b5eb5 100644 --- a/src/test/rustdoc/intra-link-prim-methods.rs +++ b/src/test/rustdoc/intra-link-prim-methods.rs @@ -1,5 +1,7 @@ #![deny(intra_doc_link_resolution_failure)] +// ignore-tidy-linelength + // @has intra_link_prim_methods/index.html // @has - '//*[@id="main"]//a[@href="https://doc.rust-lang.org/nightly/std/primitive.char.html"]' 'char' // @has - '//*[@id="main"]//a[@href="https://doc.rust-lang.org/nightly/std/primitive.char.html#method.len_utf8"]' 'char::len_utf8' From b50c13cc28b3c6c5968ec3f8cf0c1aa11e463d9f Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Tue, 7 Jul 2020 13:53:46 -0700 Subject: [PATCH 12/14] Update books --- src/doc/book | 2 +- src/doc/embedded-book | 2 +- src/doc/reference | 2 +- src/doc/rust-by-example | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/doc/book b/src/doc/book index 4e7c00bece154..84a31397b34f9 160000 --- a/src/doc/book +++ b/src/doc/book @@ -1 +1 @@ -Subproject commit 4e7c00bece1544d409312ec93467beb62b5bd0cb +Subproject commit 84a31397b34f9d405df44f2899ff17a4828dba18 diff --git a/src/doc/embedded-book b/src/doc/embedded-book index 616962ad0dd80..94d9ea8460bcb 160000 --- a/src/doc/embedded-book +++ b/src/doc/embedded-book @@ -1 +1 @@ -Subproject commit 616962ad0dd80f34d8b802da038d0aed9dd691bb +Subproject commit 94d9ea8460bcbbbfef1877b47cb930260b5849a7 diff --git a/src/doc/reference b/src/doc/reference index 04d5d5d7ba624..0ea7bc494f128 160000 --- a/src/doc/reference +++ b/src/doc/reference @@ -1 +1 @@ -Subproject commit 04d5d5d7ba624b6f5016298451f3a63d557f3260 +Subproject commit 0ea7bc494f1289234d8800bb9185021e0ad946f0 diff --git a/src/doc/rust-by-example b/src/doc/rust-by-example index 6f94ccb48da6f..229c6945a26a5 160000 --- a/src/doc/rust-by-example +++ b/src/doc/rust-by-example @@ -1 +1 @@ -Subproject commit 6f94ccb48da6fa4ed0031290f21411cf789f7d5e +Subproject commit 229c6945a26a53a751ffa4f9cb418388c00029d3 From 8d267db31a767f22f07e06439ae682329c22bef1 Mon Sep 17 00:00:00 2001 From: Seth Pellegrino Date: Tue, 7 Jul 2020 14:15:31 -0700 Subject: [PATCH 13/14] Revert "Add guard to check for local `core` crate" This reverts commit ee3a0f867e938f469cbbb422a76ed5662be2ecc7. --- src/librustdoc/clean/types.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/librustdoc/clean/types.rs b/src/librustdoc/clean/types.rs index d2ba34ccb8107..34f91bfec5a88 100644 --- a/src/librustdoc/clean/types.rs +++ b/src/librustdoc/clean/types.rs @@ -649,16 +649,14 @@ impl Attributes { if let Some(ref fragment) = *fragment { let cache = cache(); let url = match cache.extern_locations.get(krate) { - Some(&(ref krate_name, _, ExternalLocation::Local)) - if krate_name == "core" => - { + Some(&(_, _, ExternalLocation::Local)) => { let depth = CURRENT_DEPTH.with(|l| l.get()); "../".repeat(depth) } Some(&(_, _, ExternalLocation::Remote(ref s))) => s.to_string(), - Some(&(_, _, ExternalLocation::Local)) - | Some(&(_, _, ExternalLocation::Unknown)) - | None => String::from("https://doc.rust-lang.org/nightly"), + Some(&(_, _, ExternalLocation::Unknown)) | None => { + String::from("https://doc.rust-lang.org/nightly") + } }; // This is a primitive so the url is done "by hand". let tail = fragment.find('#').unwrap_or_else(|| fragment.len()); From 1a021edfa1d2ac2e830ccae26aa3ba3688461f5c Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Tue, 7 Jul 2020 15:33:21 -0700 Subject: [PATCH 14/14] Update cargo --- src/tools/cargo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/cargo b/src/tools/cargo index fede83ccf9734..729e5676a0240 160000 --- a/src/tools/cargo +++ b/src/tools/cargo @@ -1 +1 @@ -Subproject commit fede83ccf973457de319ba6fa0e36ead454d2e20 +Subproject commit 729e5676a02404b1d745013f8b280945cfa2d50d