From 3eb84341506d4124290dc81f598334d774360408 Mon Sep 17 00:00:00 2001 From: Steve Klabnik Date: Tue, 21 Feb 2017 01:15:29 -0500 Subject: [PATCH] Get linkchecker clean This affects the book, some missed things in the reference, the grammar, and the standard library. Whew! --- src/doc/book/src/attributes.md | 2 +- src/doc/book/src/compiler-plugins.md | 13 +++++++------ src/doc/book/src/macros.md | 8 ++++---- src/doc/book/src/syntax-index.md | 8 ++++---- src/doc/grammar.md | 2 +- src/doc/reference/src/attributes.md | 21 +++++++++++---------- src/doc/reference/src/expressions.md | 13 +++++++------ src/doc/reference/src/identifiers.md | 6 +++--- src/doc/reference/src/items.md | 2 +- src/libcore/intrinsics.rs | 2 +- src/libcore/marker.rs | 4 ++-- src/libcore/mem.rs | 8 ++++---- src/libstd/f32.rs | 2 +- src/libstd/f64.rs | 2 +- src/libstd/macros.rs | 2 +- 15 files changed, 49 insertions(+), 46 deletions(-) diff --git a/src/doc/book/src/attributes.md b/src/doc/book/src/attributes.md index 9e3cdb7ec09..103ec39aa38 100644 --- a/src/doc/book/src/attributes.md +++ b/src/doc/book/src/attributes.md @@ -67,4 +67,4 @@ Rust attributes are used for a number of different things. There is a full list of attributes [in the reference][reference]. Currently, you are not allowed to create your own attributes, the Rust compiler defines them. -[reference]: ../reference.html#attributes +[reference]: ../reference/attributes.html diff --git a/src/doc/book/src/compiler-plugins.md b/src/doc/book/src/compiler-plugins.md index 1b7ce678982..c05d808a947 100644 --- a/src/doc/book/src/compiler-plugins.md +++ b/src/doc/book/src/compiler-plugins.md @@ -119,7 +119,7 @@ The advantages over a simple `fn(&str) -> u32` are: a way to define new literal syntax for any data type. In addition to procedural macros, you can define new -[`derive`](../reference.html#derive)-like attributes and other kinds of +[`derive`](../reference/attributes.html#derive)-like attributes and other kinds of extensions. See `Registry::register_syntax_extension` and the `SyntaxExtension` enum. For a more involved macro example, see [`regex_macros`](https://github.com/rust-lang/regex/blob/master/regex_macros/src/lib.rs). @@ -165,8 +165,8 @@ quasiquote as an ordinary plugin library. # Lint plugins Plugins can extend [Rust's lint -infrastructure](../reference.html#lint-check-attributes) with additional checks for -code style, safety, etc. Now let's write a plugin +infrastructure](../reference/attributes.html#lint-check-attributes) with +additional checks for code style, safety, etc. Now let's write a plugin [`lint_plugin_test.rs`](https://github.com/rust-lang/rust/blob/master/src/test/run-pass-fulldeps/auxiliary/lint_plugin_test.rs) that warns about any item named `lintme`. @@ -244,9 +244,10 @@ mostly use the same infrastructure as lint plugins, and provide examples of how to access type information. Lints defined by plugins are controlled by the usual [attributes and compiler -flags](../reference.html#lint-check-attributes), e.g. `#[allow(test_lint)]` or -`-A test-lint`. These identifiers are derived from the first argument to -`declare_lint!`, with appropriate case and punctuation conversion. +flags](../reference/attributes.html#lint-check-attributes), e.g. +`#[allow(test_lint)]` or `-A test-lint`. These identifiers are derived from the +first argument to `declare_lint!`, with appropriate case and punctuation +conversion. You can run `rustc -W help foo.rs` to see a list of lints known to `rustc`, including those provided by plugins loaded by `foo.rs`. diff --git a/src/doc/book/src/macros.md b/src/doc/book/src/macros.md index 861cb4371f9..93f63ddc0a5 100644 --- a/src/doc/book/src/macros.md +++ b/src/doc/book/src/macros.md @@ -101,7 +101,7 @@ trees, at compile time. The semicolon is optional on the last (here, only) case. The "pattern" on the left-hand side of `=>` is known as a ‘matcher’. These have [their own little grammar] within the language. -[their own little grammar]: ../reference.html#macros +[their own little grammar]: ../reference/macros.html The matcher `$x:expr` will match any Rust expression, binding that syntax tree to the ‘metavariable’ `$x`. The identifier `expr` is a ‘fragment specifier’; @@ -363,7 +363,7 @@ fn main() { } ``` -[items]: ../reference.html#items +[items]: ../reference/items.html # Recursive macros @@ -490,7 +490,7 @@ be forced to choose between parsing `$i` and parsing `$e`. Changing the invocation syntax to put a distinctive token in front can solve the problem. In this case, you can write `$(I $i:ident)* E $e:expr`. -[item]: ../reference.html#items +[item]: ../reference/items.html # Scoping and macro import/export @@ -565,7 +565,7 @@ When this library is loaded with `#[macro_use] extern crate`, only `m2` will be imported. The Rust Reference has a [listing of macro-related -attributes](../reference.html#macro-related-attributes). +attributes](../reference/attributes.html#macro-related-attributes). # The variable `$crate` diff --git a/src/doc/book/src/syntax-index.md b/src/doc/book/src/syntax-index.md index b2cd59c87af..a06520f4ac2 100644 --- a/src/doc/book/src/syntax-index.md +++ b/src/doc/book/src/syntax-index.md @@ -235,10 +235,10 @@ [Primitive Types (Tuple Indexing)]: primitive-types.html#tuple-indexing [Primitive Types (Tuples)]: primitive-types.html#tuples [Raw Pointers]: raw-pointers.html -[Reference (Byte String Literals)]: ../reference.html#byte-string-literals -[Reference (Integer literals)]: ../reference.html#integer-literals -[Reference (Raw Byte String Literals)]: ../reference.html#raw-byte-string-literals -[Reference (Raw String Literals)]: ../reference.html#raw-string-literals +[Reference (Byte String Literals)]: ../reference/tokens.html/#byte-string-literals +[Reference (Integer literals)]: ../reference/tokens.html#integer-literals +[Reference (Raw Byte String Literals)]: ../reference/tokens.html#raw-byte-string-literals +[Reference (Raw String Literals)]: ../reference/tokens.html#raw-string-literals [References and Borrowing]: references-and-borrowing.html [Strings]: strings.html [Structs (Update syntax)]: structs.html#update-syntax diff --git a/src/doc/grammar.md b/src/doc/grammar.md index c81f2e2282b..8e803aff4d6 100644 --- a/src/doc/grammar.md +++ b/src/doc/grammar.md @@ -187,7 +187,7 @@ literal : [ string_lit | char_lit | byte_string_lit | byte_lit | num_lit | bool_ The optional `lit_suffix` production is only used for certain numeric literals, but is reserved for future extension. That is, the above gives the lexical grammar, but a Rust parser will reject everything but the 12 special cases -mentioned in [Number literals](reference.html#number-literals) in the +mentioned in [Number literals](reference/tokens.html#number-literals) in the reference. #### Character and string literals diff --git a/src/doc/reference/src/attributes.md b/src/doc/reference/src/attributes.md index 4a839676ed3..da43e1cc057 100644 --- a/src/doc/reference/src/attributes.md +++ b/src/doc/reference/src/attributes.md @@ -46,7 +46,7 @@ type int8_t = i8; ## Crate-only attributes - `crate_name` - specify the crate's crate name. -- `crate_type` - see [linkage](#linkage). +- `crate_type` - see [linkage](linkage.html). - `feature` - see [compiler features](#compiler-features). - `no_builtins` - disable optimizing certain code patterns to invocations of library functions that are assumed to exist @@ -106,7 +106,7 @@ On an `extern` block, the following attributes are interpreted: - `link` - indicate that a native library should be linked to for the declarations in this block to be linked correctly. `link` supports an optional `kind` key with three possible values: `dylib`, `static`, and `framework`. See - [external blocks](#external-blocks) for more about external blocks. Two + [external blocks](items.html#external-blocks) for more about external blocks. Two examples: `#[link(name = "readline")]` and `#[link(name = "CoreFoundation", kind = "framework")]`. - `linked_from` - indicates what native library this block of FFI items is @@ -149,7 +149,7 @@ On `struct`s: list of names `#[macro_use(foo, bar)]` restricts the import to just those macros named. The `extern crate` must appear at the crate root, not inside `mod`, which ensures proper function of the [`$crate` macro - variable](book/macros.html#The%20variable%20%24crate). + variable](../book/macros.html#the-variable-crate). - `macro_reexport` on an `extern crate` — re-export the named macros. @@ -159,7 +159,7 @@ On `struct`s: link it into the output. See the [macros section of the -book](book/macros.html#Scoping%20and%20macro%20import%2Fexport) for more information on +book](../book/macros.html#scoping-and-macro-importexport) for more information on macro scope. ## Miscellaneous attributes @@ -317,7 +317,8 @@ For any lint check `C`: The lint checks supported by the compiler can be found via `rustc -W help`, along with their default settings. [Compiler -plugins](book/compiler-plugins.html#lint-plugins) can provide additional lint checks. +plugins](../book/compiler-plugins.html#lint-plugins) can provide additional +lint checks. ```{.ignore} pub mod m1 { @@ -442,7 +443,7 @@ impl PartialEq for Foo { ``` You can implement `derive` for your own type through [procedural -macros](#procedural-macros). +macros](procedural-macros.html). ### Compiler Features @@ -464,10 +465,10 @@ considered off, and using the features will result in a compiler error. The currently implemented features of the reference compiler are: -* `advanced_slice_patterns` - See the [match expressions](#match-expressions) - section for discussion; the exact semantics of - slice patterns are subject to change, so some types - are still unstable. +* `advanced_slice_patterns` - See the [match + expressions](expressions.html#match-expressions) + section for discussion; the exact semantics of +slice patterns are subject to change, so some types are still unstable. * `slice_patterns` - OK, actually, slice patterns are just scary and completely unstable. diff --git a/src/doc/reference/src/expressions.md b/src/doc/reference/src/expressions.md index e2fb41e424b..c9c0496dac6 100644 --- a/src/doc/reference/src/expressions.md +++ b/src/doc/reference/src/expressions.md @@ -85,7 +85,7 @@ be copied if its type implements `Copy`. All others are moved. ## Literal expressions -A _literal expression_ consists of one of the [literal](tokens.md#literals) forms +A _literal expression_ consists of one of the [literal](tokens.html#literals) forms described earlier. It directly describes a number, character, string, boolean value, or the unit value. @@ -124,19 +124,19 @@ comma: ## Struct expressions There are several forms of struct expressions. A _struct expression_ -consists of the [path](#paths) of a [struct item](items.html#structs), followed +consists of the [path](paths.html) of a [struct item](items.html#structs), followed by a brace-enclosed list of zero or more comma-separated name-value pairs, providing the field values of a new instance of the struct. A field name can be any identifier, and is separated from its value expression by a colon. The location denoted by a struct field is mutable if and only if the enclosing struct is mutable. -A _tuple struct expression_ consists of the [path](#paths) of a [struct +A _tuple struct expression_ consists of the [path](paths.html) of a [struct item](items.html#structs), followed by a parenthesized list of one or more comma-separated expressions (in other words, the path of a struct item followed by a tuple expression). The struct item must be a tuple struct item. -A _unit-like struct expression_ consists only of the [path](#paths) of a +A _unit-like struct expression_ consists only of the [path](paths.html) of a [struct item](items.html#structs). The following are examples of struct expressions: @@ -217,7 +217,8 @@ A _method call_ consists of an expression followed by a single dot, an identifier, and a parenthesized expression-list. Method calls are resolved to methods on specific traits, either statically dispatching to a method if the exact `self`-type of the left-hand-side is known, or dynamically dispatching if -the left-hand-side expression is an indirect [trait object](trait-objects.html). +the left-hand-side expression is an indirect [trait +object](types.html#trait-objects). ## Field expressions @@ -504,7 +505,7 @@ The `+`, `-`, `*`, `/`, `%`, `&`, `|`, `^`, `<<`, and `>>` operators may be composed with the `=` operator. The expression `lval OP= val` is equivalent to `lval = lval OP val`. For example, `x = x + 1` may be written as `x += 1`. -Any such expression always has the [`unit`](#tuple-types) type. +Any such expression always has the [`unit`](types.html#tuple-types) type. ### Operator precedence diff --git a/src/doc/reference/src/identifiers.md b/src/doc/reference/src/identifiers.md index 4df68b39b91..de657e3e312 100644 --- a/src/doc/reference/src/identifiers.md +++ b/src/doc/reference/src/identifiers.md @@ -13,12 +13,12 @@ Or * The identifier is more than one character, `_` alone is not an identifier * The remaining characters have property `XID_continue` -that does _not_ occur in the set of [keywords][keywords]. +that does _not_ occur in the set of [keywords]. > **Note**: `XID_start` and `XID_continue` as character properties cover the > character ranges used to form the more familiar C and Java language-family > identifiers. -keywords: ../grammar.html#keywords +[keywords]: ../grammar.html#keywords [^non_ascii_idents]: Non-ASCII characters in identifiers are currently feature - gated. This is expected to improve soon. \ No newline at end of file + gated. This is expected to improve soon. diff --git a/src/doc/reference/src/items.md b/src/doc/reference/src/items.md index ccace77795c..ba3f4195ba6 100644 --- a/src/doc/reference/src/items.md +++ b/src/doc/reference/src/items.md @@ -5,7 +5,7 @@ nested set of [modules]. Every crate has a single "outermost" anonymous module; all further items within the crate have [paths] within the module tree of the crate. -[modules]: modules.html +[modules]: #modules [paths]: paths.html Items are entirely determined at compile-time, generally remain fixed during diff --git a/src/libcore/intrinsics.rs b/src/libcore/intrinsics.rs index 31a0cc68841..12410c08f39 100644 --- a/src/libcore/intrinsics.rs +++ b/src/libcore/intrinsics.rs @@ -687,7 +687,7 @@ extern "rust-intrinsic" { /// The [nomicon](../../nomicon/transmutes.html) has additional /// documentation. /// - /// [ub]: ../../reference.html#behavior-considered-undefined + /// [ub]: ../../reference/behavior-considered-undefined.html /// /// # Examples /// diff --git a/src/libcore/marker.rs b/src/libcore/marker.rs index ede22ccddc6..1e9eaaf5f32 100644 --- a/src/libcore/marker.rs +++ b/src/libcore/marker.rs @@ -36,7 +36,7 @@ use hash::Hasher; /// /// [`Rc`]: ../../std/rc/struct.Rc.html /// [arc]: ../../std/sync/struct.Arc.html -/// [ub]: ../../reference.html#behavior-considered-undefined +/// [ub]: ../../reference/behavior-considered-undefined.html #[stable(feature = "rust1", since = "1.0.0")] #[lang = "send"] #[rustc_on_unimplemented = "`{Self}` cannot be sent between threads safely"] @@ -338,7 +338,7 @@ pub trait Copy : Clone { /// [mutex]: ../../std/sync/struct.Mutex.html /// [rwlock]: ../../std/sync/struct.RwLock.html /// [unsafecell]: ../cell/struct.UnsafeCell.html -/// [ub]: ../../reference.html#behavior-considered-undefined +/// [ub]: ../../reference/behavior-considered-undefined.html /// [transmute]: ../../std/mem/fn.transmute.html #[stable(feature = "rust1", since = "1.0.0")] #[lang = "sync"] diff --git a/src/libcore/mem.rs b/src/libcore/mem.rs index 209107ef92c..f4ce4697d7c 100644 --- a/src/libcore/mem.rs +++ b/src/libcore/mem.rs @@ -167,7 +167,7 @@ pub use intrinsics::transmute; /// [FFI]: ../../book/ffi.html /// [box]: ../../std/boxed/struct.Box.html /// [into_raw]: ../../std/boxed/struct.Box.html#method.into_raw -/// [ub]: ../../reference.html#behavior-considered-undefined +/// [ub]: ../../reference/behavior-considered-undefined.html #[inline] #[stable(feature = "rust1", since = "1.0.0")] pub fn forget(t: T) { @@ -318,7 +318,7 @@ pub fn align_of_val(val: &T) -> usize { /// /// [uninit]: fn.uninitialized.html /// [FFI]: ../../book/ffi.html -/// [ub]: ../../reference.html#behavior-considered-undefined +/// [ub]: ../../reference/behavior-considered-undefined.html /// /// # Examples /// @@ -417,7 +417,7 @@ pub unsafe fn zeroed() -> T { /// [`Vec`]: ../../std/vec/struct.Vec.html /// [`vec!`]: ../../std/macro.vec.html /// [`Clone`]: ../../std/clone/trait.Clone.html -/// [ub]: ../../reference.html#behavior-considered-undefined +/// [ub]: ../../reference/behavior-considered-undefined.html /// [write]: ../ptr/fn.write.html /// [copy]: ../intrinsics/fn.copy.html /// [copy_no]: ../intrinsics/fn.copy_nonoverlapping.html @@ -626,7 +626,7 @@ pub fn drop(_x: T) { } /// same size. This function triggers [undefined behavior][ub] if `U` is larger than /// `T`. /// -/// [ub]: ../../reference.html#behavior-considered-undefined +/// [ub]: ../../reference/behavior-considered-undefined.html /// [size_of]: fn.size_of.html /// /// # Examples diff --git a/src/libstd/f32.rs b/src/libstd/f32.rs index 7a676c041ad..544f4f9ddbe 100644 --- a/src/libstd/f32.rs +++ b/src/libstd/f32.rs @@ -264,7 +264,7 @@ impl f32 { /// /// assert!(abs_difference <= f32::EPSILON); /// ``` - /// [floating-point]: ../reference.html#machine-types + /// [floating-point]: ../reference/types.html#machine-types #[unstable(feature = "float_extras", reason = "signature is undecided", issue = "27752")] #[rustc_deprecated(since = "1.11.0", diff --git a/src/libstd/f64.rs b/src/libstd/f64.rs index 67a1c302483..dd4bc253bed 100644 --- a/src/libstd/f64.rs +++ b/src/libstd/f64.rs @@ -206,7 +206,7 @@ impl f64 { /// /// assert!(abs_difference < 1e-10); /// ``` - /// [floating-point]: ../reference.html#machine-types + /// [floating-point]: ../reference/types.html#machine-types #[unstable(feature = "float_extras", reason = "signature is undecided", issue = "27752")] #[rustc_deprecated(since = "1.11.0", diff --git a/src/libstd/macros.rs b/src/libstd/macros.rs index d79a9a202d9..a1f092621cb 100644 --- a/src/libstd/macros.rs +++ b/src/libstd/macros.rs @@ -441,7 +441,7 @@ pub mod builtin { /// leads to less duplicated code. /// /// The syntax given to this macro is the same syntax as [the `cfg` - /// attribute](../reference.html#conditional-compilation). + /// attribute](../book/conditional-compilation.html). /// /// # Examples ///