From 35a204e380bb4add3fe54084b04e1d901a1d180a Mon Sep 17 00:00:00 2001 From: Alexis Hunt Date: Tue, 7 Aug 2018 03:43:17 -0400 Subject: [PATCH 1/6] Move src/theme to theme mdbook 0.2.0 says that src/theme was accepted in error. --- book.toml | 2 +- {src/theme => theme}/header.hbs | 0 {src/theme => theme}/reference.css | 0 3 files changed, 1 insertion(+), 1 deletion(-) rename {src/theme => theme}/header.hbs (100%) rename {src/theme => theme}/reference.css (100%) diff --git a/book.toml b/book.toml index 5dd7556845..bfb49a4c07 100644 --- a/book.toml +++ b/book.toml @@ -4,5 +4,5 @@ title = "The Rust Reference" author = "The Rust Project Developers" [output.html] +additional-css = ["theme/reference.css"] -additional-css = ["src/theme/reference.css"] diff --git a/src/theme/header.hbs b/theme/header.hbs similarity index 100% rename from src/theme/header.hbs rename to theme/header.hbs diff --git a/src/theme/reference.css b/theme/reference.css similarity index 100% rename from src/theme/reference.css rename to theme/reference.css From c3f03b6475da6e90bb4b2bca392c46215a87398f Mon Sep 17 00:00:00 2001 From: Alexis Hunt Date: Tue, 7 Aug 2018 04:29:12 -0400 Subject: [PATCH 2/6] Update links in nested directories. --- src/expressions/array-expr.md | 39 ++++++++++---------- src/expressions/block-expr.md | 22 ++++++------ src/expressions/call-expr.md | 12 +++---- src/expressions/closure-expr.md | 45 +++++++++++------------ src/expressions/field-expr.md | 23 ++++++------ src/expressions/grouped-expr.md | 2 +- src/expressions/if-expr.md | 4 +-- src/expressions/literal-expr.md | 24 ++++++------- src/expressions/loop-expr.md | 55 ++++++++++++++++------------- src/expressions/match-expr.md | 22 ++++++------ src/expressions/method-call-expr.md | 21 +++++------ src/expressions/operator-expr.md | 28 +++++++-------- src/expressions/path-expr.md | 10 +++--- src/expressions/range-expr.md | 15 ++++---- src/expressions/return-expr.md | 2 +- src/expressions/struct-expr.md | 21 ++++++----- src/introduction.md | 2 +- src/items/associated-items.md | 39 ++++++++++---------- src/items/constant-items.md | 12 +++---- src/items/enumerations.md | 26 +++++++------- src/items/extern-crates.md | 3 +- src/items/external-blocks.md | 4 +-- src/items/functions.md | 16 ++++----- src/items/generics.md | 41 ++++++++++----------- src/items/implementations.md | 12 +++---- src/items/modules.md | 12 +++---- src/items/static-items.md | 14 ++++---- src/items/structs.md | 18 +++++----- src/items/traits.md | 27 +++++++------- src/items/type-aliases.md | 11 +++--- src/items/unions.md | 11 +++--- src/items/use-declarations.md | 16 ++++----- 32 files changed, 307 insertions(+), 302 deletions(-) diff --git a/src/expressions/array-expr.md b/src/expressions/array-expr.md index fa04ce2a69..3f06bddd18 100644 --- a/src/expressions/array-expr.md +++ b/src/expressions/array-expr.md @@ -8,19 +8,16 @@ >    | `[` [_Expression_] ( `,` [_Expression_] )\* `,`? `]`\ >    | `[` [_Expression_] `;` [_Expression_] `]` -An _[array](types.html#array-and-slice-types) expression_ can be written by -enclosing zero or more comma-separated expressions of uniform type in square -brackets. This produces and array containing each of these values in the -order they are written. +An _[array] expression_ can be written by enclosing zero or more comma-separated +expressions of uniform type in square brackets. This produces and array +containing each of these values in the order they are written. Alternatively there can be exactly two expressions inside the brackets, separated by a semi-colon. The expression after the `;` must be a have type -`usize` and be a [constant expression](expressions.html#constant-expressions), -such as a [literal](tokens.html#literals) or a [constant -item](items/constant-items.html). `[a; b]` creates an array containing `b` -copies of the value of `a`. If the expression after the semi-colon has a value -greater than 1 then this requires that the type of `a` is -[`Copy`](special-types-and-traits.html#copy). +`usize` and be a [constant expression], such as a [literal] or a [constant +item]. `[a; b]` creates an array containing `b` copies of the value of `a`. If +the expression after the semi-colon has a value greater than 1 then this +requires that the type of `a` is [`Copy`]. ```rust [1, 2, 3, 4]; @@ -34,9 +31,8 @@ greater than 1 then this requires that the type of `a` is > **Syntax**\ > _IndexExpression_ :\ ->    [_Expression_] `[` [_Expression_] `]` -[Array and slice](types.html#array-and-slice-types)-typed expressions can be +[Array and slice]-typed expressions can be indexed by writing a square-bracket-enclosed expression of type `usize` (the index) after them. When the array is mutable, the resulting [memory location] can be assigned to. @@ -71,10 +67,15 @@ arr[10]; // warning: index out of bounds ``` The array index expression can be implemented for types other than arrays and slices -by implementing the [Index] and [IndexMut] traits. - -[_Expression_]: expressions.html -[memory location]: expressions.html#place-expressions-and-value-expressions -[Index]: ../std/ops/trait.Index.html -[IndexMut]: ../std/ops/trait.IndexMut.html -[constant expression]: expressions.html#constant-expressions +by implementing the [`Index`] and [`IndexMut`] traits. + +[_Expression_]: /expressions.html +[memory location]: /expressions.html#place-expressions-and-value-expressions +[`Index`]: ../../std/ops/trait.Index.html +[`IndexMut`]: ../../std/ops/trait.IndexMut.html +[constant expression]: ../expressions.html#constant-expressions +[literal]: ../tokens.html#literals +[Array and slice]: ../types.html#array-and-slice-types +[constant item]: ../items/constant-items.htm +[`Copy`]: ../special-types-and-traits.html#copy +[array]: ../types.html#array-and-slice-types diff --git a/src/expressions/block-expr.md b/src/expressions/block-expr.md index 81d46b8d14..2dfff279ec 100644 --- a/src/expressions/block-expr.md +++ b/src/expressions/block-expr.md @@ -75,14 +75,14 @@ fn is_unix_platform() -> bool { } ``` -[_InnerAttribute_]: attributes.html -[_Statement_]: statements.html -[_Expression_]: expressions.html -[expression]: expressions.html -[statements]: statements.html -[value expressions]: expressions.html#place-expressions-and-value-expressions -[outer attributes]: attributes.html -[inner attributes]: attributes.html -[expression statement]: statements.html#expression-statements -[`cfg`]: attributes.html#conditional-compilation -[the lint check attributes]: attributes.html#lint-check-attributes +[_InnerAttribute_]: ../attributes.html +[_Statement_]: ../statements.html +[_Expression_]: ../expressions.html +[expression]: ../expressions.html +[statements]: ../statements.html +[value expressions]: ../expressions.html#place-expressions-and-value-expressions +[outer attributes]: ../attributes.html +[inner attributes]: ../attributes.html +[expression statement]: ../statements.html#expression-statements +[`cfg`]: ../attributes.html#conditional-compilation +[the lint check attributes]: ../attributes.html#lint-check-attributes diff --git a/src/expressions/call-expr.md b/src/expressions/call-expr.md index 8193b091f8..895ca31d0a 100644 --- a/src/expressions/call-expr.md +++ b/src/expressions/call-expr.md @@ -10,7 +10,7 @@ A _call expression_ consists of an expression followed by a parenthesized expression-list. It invokes a function, providing zero or more input variables. If the function eventually returns, then the expression completes. For -[non-function types](types.html#function-item-types), the expression f(...) uses +[non-function types], the expression `f(...)` uses the method on one of the [`std::ops::Fn`], [`std::ops::FnMut`] or [`std::ops::FnOnce`] traits, which differ in whether they take the type by reference, mutable reference, or take ownership respectively. An automatic @@ -93,9 +93,9 @@ fn main() { Refer to [RFC 132] for further details and motivations. -[`std::ops::Fn`]: ../std/ops/trait.Fn.html -[`std::ops::FnMut`]: ../std/ops/trait.FnMut.html -[`std::ops::FnOnce`]: ../std/ops/trait.FnOnce.html +[`std::ops::Fn`]: ../../std/ops/trait.Fn.html +[`std::ops::FnMut`]: ../../std/ops/trait.FnMut.html +[`std::ops::FnOnce`]: ../../std/ops/trait.FnOnce.html [RFC 132]: https://github.com/rust-lang/rfcs/blob/master/text/0132-ufcs.md - -[_Expression_]: expressions.html +[non-function types]: ../types.html#function-item-types +[_Expression_]: ../expressions.html diff --git a/src/expressions/closure-expr.md b/src/expressions/closure-expr.md index 2c02573e44..db465688e3 100644 --- a/src/expressions/closure-expr.md +++ b/src/expressions/closure-expr.md @@ -25,22 +25,20 @@ functions, as an abbreviation for defining and capturing a separate function. Significantly, closure expressions _capture their environment_, which regular [function definitions] do not. Without the `move` keyword, the closure expression -[infers how it captures each variable from its environment](types.html#capture-modes), -preferring to capture by shared reference, effectively borrowing -all outer variables mentioned inside the closure's body. If needed the compiler -will infer that instead mutable references should be taken, or that the values -should be moved or copied (depending on their type) from the environment. A -closure can be forced to capture its environment by copying or moving values by -prefixing it with the `move` keyword. This is often used to ensure that the -closure's type is `'static`. +[infers] how it captures each variable from its environment, preferring to +capture by shared reference, effectively borrowing all outer variables mentioned +inside the closure's body. If needed the compiler will infer that instead +mutable references should be taken, or that the values should be moved or copied +(depending on their type) from the environment. A closure can be forced to +capture its environment by copying or moving values by prefixing it with the +`move` keyword. This is often used to ensure that the closure's type is +`'static`. -The compiler will determine which of the [closure -traits](types.html#call-traits-and-coercions) the closure's type will implement by how it -acts on its captured variables. The closure will also implement -[`Send`](special-types-and-traits.html#send) and/or -[`Sync`](special-types-and-traits.html#sync) if all of its captured types do. -These traits allow functions to accept closures using generics, even though the -exact types can't be named. +The compiler will determine which of the [closure traits] the closure's type +will implement by how it acts on its captured variables. The closure will also +implement [`Send`] and/or [`Sync`] if all of its captured types do. These traits +allow functions to accept closures using generics, even though the exact types +can't be named. In this example, we define a function `ten_times` that takes a higher-order function argument, and we then call it with a closure expression as an argument, @@ -61,10 +59,13 @@ let word = "konnichiwa".to_owned(); ten_times(move |j| println!("{}, {}", word, j)); ``` -[block]: expressions/block-expr.html -[function definitions]: items/functions.html - -[_Expression_]: expressions.html -[_BlockExpression_]: expressions/block-expr.html -[_TypeNoBounds_]: types.html -[_FunctionParameters_]: items/functions.html +[block]: block-expr.html +[function definitions]: ../items/functions.html +[_Expression_]: ../expressions.html +[_BlockExpression_]: block-expr.html +[_TypeNoBounds_]: ../types.html +[_FunctionParameters_]: ../items/functions.html +[infers]: ../types.html#capture-modes +[closure traits]: ../types.html#call-traits-and-coercions +[`Send`]: ../special-types-and-traits.html#send +[`Sync`]: ../special-types-and-traits.html#sync diff --git a/src/expressions/field-expr.md b/src/expressions/field-expr.md index 043d7b4fb0..2da05e8ed6 100644 --- a/src/expressions/field-expr.md +++ b/src/expressions/field-expr.md @@ -26,10 +26,10 @@ automatically dereferenced as many times as necessary to make the field access possible. In cases of ambiguity, we prefer fewer autoderefs to more. Finally, the fields of a struct or a reference to a struct are treated as -separate entities when borrowing. If the struct does not implement -[`Drop`](special-types-and-traits.html#drop) and is stored in a local variable, -this also applies to moving out of each of its fields. This also does not apply -if automatic dereferencing is done though user defined types. +separate entities when borrowing. If the struct does not implement [`Drop`] and +is stored in a local variable, this also applies to moving out of each of its +fields. This also does not apply if automatic dereferencing is done though user +defined types. ```rust struct A { f1: String, f2: String, f3: String } @@ -45,10 +45,11 @@ let c: &String = &x.f2; // Can borrow again let d: String = x.f3; // Move out of x.f3 ``` -[_Expression_]: expressions.html -[IDENTIFIER]: identifiers.html -[method call expression]: expressions/method-call-expr.html -[struct]: items/structs.html -[union]: items/unions.html -[place expression]: expressions.html#place-expressions-and-value-expressions -[mutable]: expressions.html#mutability +[_Expression_]: ../expressions.html +[IDENTIFIER]: ../identifiers.html +[method call expression]: method-call-expr.html +[struct]: ../items/structs.html +[union]: ../items/unions.html +[place expression]: ../expressions.html#place-expressions-and-value-expressions +[mutable]: ../expressions.html#mutability +[`Drop`]: ../special-types-and-traits.html#drop diff --git a/src/expressions/grouped-expr.md b/src/expressions/grouped-expr.md index 6080fb58b9..afa98e2ada 100644 --- a/src/expressions/grouped-expr.md +++ b/src/expressions/grouped-expr.md @@ -35,4 +35,4 @@ assert_eq!( a.f (), "The method f"); assert_eq!((a.f)(), "The field f"); ``` -[_Expression_]: expressions.html +[_Expression_]: ../expressions.html diff --git a/src/expressions/if-expr.md b/src/expressions/if-expr.md index ec0bc05caf..e6d25f0ad5 100644 --- a/src/expressions/if-expr.md +++ b/src/expressions/if-expr.md @@ -92,5 +92,5 @@ let a = if let Some(1) = x { assert_eq!(a, 3); ``` -[_Expression_]: expressions.html -[_BlockExpression_]: expressions/block-expr.html +[_Expression_]: ../expressions.html +[_BlockExpression_]: block-expr.html diff --git a/src/expressions/literal-expr.md b/src/expressions/literal-expr.md index 26ccda81a6..f6b6b0f2a5 100644 --- a/src/expressions/literal-expr.md +++ b/src/expressions/literal-expr.md @@ -12,9 +12,8 @@ >    | [FLOAT_LITERAL]\ >    | [BOOLEAN_LITERAL] -A _literal expression_ consists of one of the [literal](tokens.html#literals) -forms described earlier. It directly describes a number, character, string, -or boolean value. +A _literal expression_ consists of one of the [literal] forms described earlier. +It directly describes a number, character, string, or boolean value. ```rust "hello"; // string type @@ -22,12 +21,13 @@ or boolean value. 5; // integer type ``` -[CHAR_LITERAL]: tokens.html#character-literals -[STRING_LITERAL]: tokens.html#string-literals -[RAW_STRING_LITERAL]: tokens.html#raw-string-literals -[BYTE_LITERAL]: tokens.html#byte-literals -[BYTE_STRING_LITERAL]: tokens.html#byte-string-literals -[RAW_BYTE_STRING_LITERAL]: tokens.html#raw-byte-string-literals -[INTEGER_LITERAL]: tokens.html#integer-literals -[FLOAT_LITERAL]: tokens.html#floating-point-literals -[BOOLEAN_LITERAL]: tokens.html#boolean-literals +[CHAR_LITERAL]: ../tokens.html#character-literals +[STRING_LITERAL]: ../tokens.html#string-literals +[RAW_STRING_LITERAL]: ../tokens.html#raw-string-literals +[BYTE_LITERAL]: ../tokens.html#byte-literals +[BYTE_STRING_LITERAL]: ../tokens.html#byte-string-literals +[RAW_BYTE_STRING_LITERAL]: ../tokens.html#raw-byte-string-literals +[INTEGER_LITERAL]: ../tokens.html#integer-literals +[FLOAT_LITERAL]: ../tokens.html#floating-point-literals +[BOOLEAN_LITERAL]: ../tokens.html#boolean-literals +[literal]: ../tokens.html#literals diff --git a/src/expressions/loop-expr.md b/src/expressions/loop-expr.md index c824464b7f..df7a6af22a 100644 --- a/src/expressions/loop-expr.md +++ b/src/expressions/loop-expr.md @@ -9,23 +9,17 @@ >       | [_IteratorLoopExpression_]\ >    ) -[_LoopLabel_]: #loop-labels -[_InfiniteLoopExpression_]: #infinite-loops -[_PredicateLoopExpression_]: #predicate-loops -[_PredicatePatternLoopExpression_]: #predicate-pattern-loops -[_IteratorLoopExpression_]: #iterator-loops - Rust supports four loop expressions: -* A [`loop` expression](#infinite-loops) denotes an infinite loop. -* A [`while` expression](#predicate-loops) loops until a predicate is false. -* A [`while let` expression](#predicate-pattern-loops) tests a refutable pattern. -* A [`for` expression](#iterator-loops) extracts values from an iterator, +* A [`loop` expression] denotes an infinite loop. +* A [`while` expression] loops until a predicate is false. +* A [`while let` expression] tests a refutable pattern. +* A [`for` expression] extracts values from an iterator, looping until the iterator is empty. -All four types of loop support [`break` expressions](#break-expressions), -[`continue` expressions](#continue-expressions), and [labels](#loop-labels). -Only `loop` supports [evaluation to non-trivial values](#break-and-loop-values). +All four types of loop support [`break` expressions], +[`continue` expressions], and [labels]. +Only `loop` supports [evaluation to non-trivial values][loop values]. ## Infinite loops @@ -37,8 +31,8 @@ A `loop` expression repeats execution of its body continuously: `loop { println!("I live."); }`. A `loop` expression without an associated `break` expression is diverging and -has type [`!`](types.html#never-type). A `loop` expression containing -associated [`break` expression(s)](#break-expressions) may terminate, and must +has type [`!`]. A `loop` expression containing +associated [`break` expression(s)][`break` expressions] may terminate, and must have type compatible with the value of the `break` expression(s). ## Predicate loops @@ -129,8 +123,7 @@ a lifetime preceding the loop expression, as in `'foo: loop { break 'foo; }`, `'bar: while false {}`, `'humbug: for _ in 0..0 {}`. If a label is present, then labeled `break` and `continue` expressions nested within this loop may exit out of this loop or return control to its head. -See [break expressions](#break-expressions) and [continue -expressions](#continue-expressions). +See [break expressions] and [continue expressions]. ## `break` expressions @@ -153,7 +146,7 @@ assert_eq!(last, 12); ``` A `break` expression is normally associated with the innermost `loop`, `for` or -`while` loop enclosing the `break` expression, but a [label](#loop-labels) can +`while` loop enclosing the `break` expression, but a [label][labels] can be used to specify which enclosing loop is affected. Example: ```rust @@ -165,7 +158,7 @@ be used to specify which enclosing loop is affected. Example: ``` A `break` expression is only permitted in the body of a loop, and has one of -the forms `break`, `break 'label` or ([see below](#break-and-loop-values)) +the forms `break`, `break 'label` or ([see below][loop values]) `break EXPR` or `break 'label EXPR`. ## `continue` expressions @@ -209,9 +202,21 @@ and the `loop` must have a type compatible with each `break` expression. `break` without an expression is considered identical to `break` with expression `()`. -[IDENTIFIER]: identifiers.html - -[_Expression_]: expressions.html -[_BlockExpression_]: expressions/block-expr.html - -[LIFETIME_OR_LABEL]: tokens.html#lifetimes-and-loop-labels +[IDENTIFIER]: ../identifiers.html +[_Expression_]: ../expressions.html +[_BlockExpression_]: block-expr.html +[LIFETIME_OR_LABEL]: ../tokens.html#lifetimes-and-loop-labels +[_LoopLabel_]: #loop-labels +[_InfiniteLoopExpression_]: #infinite-loops +[_PredicateLoopExpression_]: #predicate-loops +[_PredicatePatternLoopExpression_]: #predicate-pattern-loops +[_IteratorLoopExpression_]: #iterator-loops +[`loop` expression]: #infinite-loops +[`while` expression]: #predicate-loops +[`while let` expression`]: #predicate-pattern-loops +[`for` expression]: #iterator-loops +[`break` expressions]: #break-expressions +[`continue` expressions]: #continue-expressions +[labels]: #loop-labels +[loop values]: #break-and-loop-values +[`!`]: ../types.html#never-type diff --git a/src/expressions/match-expr.md b/src/expressions/match-expr.md index 3464c0ac21..b832b5d515 100644 --- a/src/expressions/match-expr.md +++ b/src/expressions/match-expr.md @@ -201,14 +201,14 @@ let message = match maybe_digit { Outer attributes are allowed on match arms. The only attributes that have meaning on match arms are [`cfg`], `cold`, and the [lint check attributes]. -[_Expression_]: expressions.html -[_BlockExpression_]: expressions/block-expr.html#block-expressions -[place expression]: expressions.html#place-expressions-and-value-expressions -[value expression]: expressions.html#place-expressions-and-value-expressions -[`char`]: types.html#textual-types -[numeric types]: types.html#numeric-types -[_InnerAttribute_]: attributes.html -[_OuterAttribute_]: attributes.html -[`cfg`]: attributes.html#conditional-compilation -[lint check attributes]: attributes.html#lint-check-attributes -[range]: expressions/range-expr.html +[_Expression_]: ../expressions.html +[_BlockExpression_]: block-expr.html#block-expressions +[place expression]: ../expressions.html#place-expressions-and-value-expressions +[value expression]: ../expressions.html#place-expressions-and-value-expressions +[`char`]: ../types.html#textual-types +[numeric types]: ../types.html#numeric-types +[_InnerAttribute_]: ../attributes.html +[_OuterAttribute_]: ../attributes.html +[`cfg`]: ../attributes.html#conditional-compilation +[lint check attributes]: ../attributes.html#lint-check-attributes +[range]: range-expr.html diff --git a/src/expressions/method-call-expr.md b/src/expressions/method-call-expr.md index 28ea5f5ef9..37f542eb45 100644 --- a/src/expressions/method-call-expr.md +++ b/src/expressions/method-call-expr.md @@ -5,7 +5,7 @@ dot, an [identifier], and a parenthesized expression-list. Method calls are resolved to associated [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](types.html#trait-objects). +[trait object]. ```rust let pi: Result = "3.14".parse(); @@ -93,12 +93,13 @@ method and you'll be fine. -[IDENTIFIER]: identifiers.html -[visible]: visibility-and-privacy.html -[array]: types.html#array-and-slice-types -[trait objects]: types.html#trait-objects -[disambiguate call]: expressions/call-expr.html#disambiguating-function-calls -[disambiguating function call syntax]: expressions/call-expr.html#disambiguating-function-calls -[dereference]: expressions/operator-expr.html#the-dereference-operator -[methods]: items/associated-items.html#methods -[unsized coercion]: type-coercions.html#unsized-coercions +[IDENTIFIER]: ../identifiers.html +[visible]: ../visibility-and-privacy.html +[array]: ../types.html#array-and-slice-types +[trait objects]: ../types.html#trait-objects +[disambiguate call]: call-expr.html#disambiguating-function-calls +[disambiguating function call syntax]: call-expr.html#disambiguating-function-calls +[dereference]: operator-expr.html#the-dereference-operator +[methods]: ../items/associated-items.html#methods +[unsized coercion]: ../type-coercions.html#unsized-coercions +[trait object]: ../types.html#trait-objects diff --git a/src/expressions/operator-expr.md b/src/expressions/operator-expr.md index 9749e86aac..dc452ff044 100644 --- a/src/expressions/operator-expr.md +++ b/src/expressions/operator-expr.md @@ -64,7 +64,7 @@ let mut array = [-2, 3, 9]; } ``` -Even though `&&` is a single token ([the lazy 'and' operator](#lazy-boolean-operators)), +Even though `&&` is a single token ([the lazy 'and' operator][lazy operators]), when used in the context of borrow expressions it works as two borrows: ```rust @@ -385,9 +385,6 @@ same trait object. * `u8` to `char` cast * Casts to the `char` with the corresponding code point. -[float-int]: https://github.com/rust-lang/rust/issues/10184 -[float-float]: https://github.com/rust-lang/rust/issues/15536 - ## Assignment expressions > **Syntax**\ @@ -398,9 +395,9 @@ An _assignment expression_ consists of a [place expression] followed by an equals sign (`=`) and a [value expression]. Such an expression always has the [`unit` type]. -Evaluating an assignment expression [drops](destructors.html) the left-hand +Evaluating an assignment expression [drops] the left-hand operand, unless it's an uninitialized local variable or field of a local variable, -and [either copies or moves](expressions.html#moved-and-copied-types) its +and [either copies or moves] its right-hand operand to its left-hand operand. The left-hand operand must be a place expression: using a value expression results in a compiler error, rather than promoting it to a temporary. @@ -441,13 +438,12 @@ x += 4; assert_eq!(x, 14); ``` -[place expression]: expressions.html#place-expressions-and-value-expressions -[value expression]: expressions.html#place-expressions-and-value-expressions -[temporary value]: expressions.html#temporary-lifetimes +[place expression]: ../expressions.html#place-expressions-and-value-expressions +[value expression]: ../expressions.html#place-expressions-and-value-expressions +[temporary value]: ../expressions.html#temporary-lifetimes [float-int]: https://github.com/rust-lang/rust/issues/10184 [float-float]: https://github.com/rust-lang/rust/issues/15536 -[`unit` type]: types.html#tuple-types - +[`unit` type]: ../types.html#tuple-types [_BorrowExpression_]: #borrow-operators [_DereferenceExpression_]: #the-dereference-operator [_ErrorPropagationExpression_]: #the-question-mark-operator @@ -458,6 +454,10 @@ assert_eq!(x, 14); [_TypeCastExpression_]: #type-cast-expressions [_AssignmentExpression_]: #assignment-expressions [_CompoundAssignmentExpression_]: #compound-assignment-expressions - -[_Expression_]: expressions.html -[_PathInExpression_]: paths.html +[_Expression_]: ../expressions.html +[_PathInExpression_]: ../paths.html +[lazy operators]: #lazy-boolean-operators +[drops]: ../destructors.html +[either copies or moves]: ../expressions.html#moved-and-copied-types +[float-int]: https://github.com/rust-lang/rust/issues/10184 +[float-float]: https://github.com/rust-lang/rust/issues/15536 diff --git a/src/expressions/path-expr.md b/src/expressions/path-expr.md index 83b9297440..9b748a686f 100644 --- a/src/expressions/path-expr.md +++ b/src/expressions/path-expr.md @@ -19,8 +19,8 @@ let push_integer = Vec::::push; let slice_reverse = <[i32]>::reverse; ``` -[place expressions]: expressions.html#place-expressions-and-value-expressions -[value expressions]: expressions.html#place-expressions-and-value-expressions -[path]: paths.html -[`static mut`]: items/static-items.html#mutable-statics -[`unsafe` block]: expressions/block-expr.html#unsafe-blocks \ No newline at end of file +[place expressions]: ../expressions.html#place-expressions-and-value-expressions +[value expressions]: ../expressions.html#place-expressions-and-value-expressions +[path]: ../paths.html +[`static mut`]: ../items/static-items.html#mutable-statics +[`unsafe` block]: block-expr.html#unsafe-blocks diff --git a/src/expressions/range-expr.md b/src/expressions/range-expr.md index 1d802ddf8b..fb8d75fb87 100644 --- a/src/expressions/range-expr.md +++ b/src/expressions/range-expr.md @@ -68,11 +68,10 @@ for i in 1..11 { } ``` -[_Expression_]: expressions.html - -[std::ops::Range]: https://doc.rust-lang.org/std/ops/struct.Range.html -[std::ops::RangeFrom]: https://doc.rust-lang.org/std/ops/struct.RangeFrom.html -[std::ops::RangeTo]: https://doc.rust-lang.org/std/ops/struct.RangeTo.html -[std::ops::RangeFull]: https://doc.rust-lang.org/std/ops/struct.RangeFull.html -[std::ops::RangeInclusive]: https://doc.rust-lang.org/std/ops/struct.RangeInclusive.html -[std::ops::RangeToInclusive]: https://doc.rust-lang.org/std/ops/struct.RangeToInclusive.html +[_Expression_]: ../expressions.html +[std::ops::Range]: ../../std/ops/struct.Range.html +[std::ops::RangeFrom]: ../../std/ops/struct.RangeFrom.html +[std::ops::RangeTo]: ../../std/ops/struct.RangeTo.html +[std::ops::RangeFull]: ../../std/ops/struct.RangeFull.html +[std::ops::RangeInclusive]: ../../std/ops/struct.RangeInclusive.html +[std::ops::RangeToInclusive]: ../../std/ops/struct.RangeToInclusive.html diff --git a/src/expressions/return-expr.md b/src/expressions/return-expr.md index 77cfb35940..ba6ac2c4d1 100644 --- a/src/expressions/return-expr.md +++ b/src/expressions/return-expr.md @@ -20,4 +20,4 @@ fn max(a: i32, b: i32) -> i32 { } ``` -[_Expression_]: expressions.html +[_Expression_]: ../expressions.html diff --git a/src/expressions/struct-expr.md b/src/expressions/struct-expr.md index 915120216c..a04b979049 100644 --- a/src/expressions/struct-expr.md +++ b/src/expressions/struct-expr.md @@ -1,14 +1,14 @@ # Struct expressions There are several forms of struct expressions. A _struct expression_ consists -of the [path] of a [struct item](items/structs.html), followed by a +of the [path] of a [struct item], 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. In the case of a tuple struct the field names are numbers corresponding to the position of the field. The numbers must be written in decimal, containing no underscores and with no leading zeros or integer suffix. A value -of a [union](items/unions.html) type can also be created using this syntax, +of a [union] type can also be created using this syntax, except that it must specify exactly one field. Struct expressions can't be used directly in the head of a [loop] @@ -48,7 +48,7 @@ entire expression denotes the result of constructing a new struct (with the same type as the base expression) with the given values for the fields that were explicitly specified and the values in the base expression for all other fields. Just as with all struct expressions, all of the fields of the struct -must be [visible](visibility-and-privacy.html), even those not explicitly +must be [visible], even those not explicitly named. ```rust @@ -74,9 +74,12 @@ Point3d { x: x, y: y_value, z: z }; Point3d { x, y: y_value, z }; ``` -[IDENTIFIER]: identifiers.html -[path]: paths.html -[loop]: expressions/loop-expr.html -[if]: expressions/if-expr.html#if-expressions -[if let]: expressions/if-expr.html#if-let-expressions -[match]: expressions/match-expr.html +[IDENTIFIER]: ../identifiers.html +[path]: ../paths.html +[loop]: loop-expr.html +[if]: if-expr.html#if-expressions +[if let]: if-expr.html#if-let-expressions +[match]: match-expr.html +[struct item]: ../items/structs.html +[visible]: ../visibility-and-privacy.html +[union]: ../items/unions.html diff --git a/src/introduction.md b/src/introduction.md index 9281e27b45..4f2e79e3bf 100644 --- a/src/introduction.md +++ b/src/introduction.md @@ -43,4 +43,4 @@ so check that out if you can't find something here. [grammar]: ../grammar.html [the Rust Reference repository]: https://github.com/rust-lang-nursery/reference/ [big issue]: https://github.com/rust-lang-nursery/reference/issues/9 -[Unstable Book]: https://doc.rust-lang.org/nightly/unstable-book/ \ No newline at end of file +[Unstable Book]: https://doc.rust-lang.org/nightly/unstable-book/ diff --git a/src/items/associated-items.md b/src/items/associated-items.md index 9b99037591..dd37c6013c 100644 --- a/src/items/associated-items.md +++ b/src/items/associated-items.md @@ -4,11 +4,7 @@ [implementations]. They are called this because they are defined on an associate type — the type in the implementation. They are a subset of the kinds of items you can declare in a module. Specifically, there are [associated -functions] (including methods), [associated types], and [associated constants]. - -[associated functions]: #associated-functions-and-methods -[associated types]: #associated-types -[associated constants]: #associated-constants +functions] \(including methods), [associated types], and [associated constants]. Associated items are useful when the associated item logically is related to the associating item. For example, the `is_some` method on `Option` is intrinsically @@ -268,18 +264,21 @@ fn main() { } ``` -[trait]: items/traits.html -[traits]: items/traits.html -[type aliases]: items/type-aliases.html -[inherent implementations]: items/implementations.html#inherent-implementations -[identifier]: identifiers.html -[trait object]: types.html#trait-objects -[implementations]: items/implementations.html -[type]: types.html -[constants]: items/constant-items.html -[constant item]: items/constant-items.html -[functions]: items/functions.html -[function item]: types.html#function-item-types -[method call operator]: expressions/method-call-expr.html -[block]: expressions/block-expr.html -[path]: paths.html +[trait]: traits.html +[traits]: traits.html +[type aliases]: type-aliases.html +[inherent implementations]: implementations.html#inherent-implementations +[identifier]: ../identifiers.html +[trait object]: ../types.html#trait-objects +[implementations]: implementations.html +[type]: ../types.html +[constants]: constant-items.html +[constant item]: constant-items.html +[functions]: functions.html +[function item]: ../types.html#function-item-types +[method call operator]: ../expressions/method-call-expr.html +[block]: ../expressions/block-expr.html +[path]: ../paths.html +[associated functions]: #associated-functions-and-methods +[associated types]: #associated-types +[associated constants]: #associated-constants diff --git a/src/items/constant-items.md b/src/items/constant-items.md index 4762082b01..02beabec54 100644 --- a/src/items/constant-items.md +++ b/src/items/constant-items.md @@ -60,9 +60,9 @@ fn create_and_drop_zero_with_destructor() { } ``` -[constant value]: expressions.html#constant-expressions -[static lifetime elision]: lifetime-elision.html#static-lifetime-elision -[`Drop`]: special-types-and-traits.html#drop -[IDENTIFIER]: identifiers.html -[_Type_]: types.html -[_Expression_]: expressions.html +[constant value]: ../expressions.html#constant-expressions +[static lifetime elision]: ../lifetime-elision.html#static-lifetime-elision +[`Drop`]: ../special-types-and-traits.html#drop +[IDENTIFIER]: ../identifiers.html +[_Type_]: ../types.html +[_Expression_]: ../expressions.html diff --git a/src/items/enumerations.md b/src/items/enumerations.md index aab6b4f50e..e34152f720 100644 --- a/src/items/enumerations.md +++ b/src/items/enumerations.md @@ -131,16 +131,16 @@ no valid values, they cannot be instantiated. enum ZeroVariants {} ``` -[IDENTIFIER]: identifiers.html -[_Generics_]: items/generics.html -[_WhereClause_]: items/generics.html#where-clauses -[_Expression_]: expressions.html -[_TupleFields_]: items/structs.html -[_StructFields_]: items/structs.html -[enumerated type]: types.html#enumerated-types -[`mem::discriminant`]: ../std/mem/fn.discriminant.html -[numeric cast]: expressions/operator-expr.html#semantics -[`repr` attribute]: attributes.html#ffi-attributes -[default representation]: type-layout.html#the-default-representation -[primitive representation]: type-layout.html#primitive-representations -[`C` representation]: type-layout.html#the-c-representation +[IDENTIFIER]: ../identifiers.html +[_Generics_]: generics.html +[_WhereClause_]: generics.html#where-clauses +[_Expression_]: ../expressions.html +[_TupleFields_]: structs.html +[_StructFields_]: structs.html +[enumerated type]: ../types.html#enumerated-types +[`mem::discriminant`]: ../../std/mem/fn.discriminant.html +[numeric cast]: ../expressions/operator-expr.html#semantics +[`repr` attribute]: ../attributes.html#ffi-attributes +[default representation]: ../type-layout.html#the-default-representation +[primitive representation]: ../type-layout.html#primitive-representations +[`C` representation]: ../type-layout.html#the-c-representation diff --git a/src/items/extern-crates.md b/src/items/extern-crates.md index 922e128c5b..a1fbde2d1b 100644 --- a/src/items/extern-crates.md +++ b/src/items/extern-crates.md @@ -39,5 +39,4 @@ extern crate hello_world; // hyphen replaced with an underscore ``` [RFC 940]: https://github.com/rust-lang/rfcs/blob/master/text/0940-hyphens-considered-harmful.md - -[IDENTIFIER]: identifiers.html +[IDENTIFIER]: ../identifiers.html diff --git a/src/items/external-blocks.md b/src/items/external-blocks.md index edbe3be89f..533639d7cc 100644 --- a/src/items/external-blocks.md +++ b/src/items/external-blocks.md @@ -23,8 +23,6 @@ extern { A number of [attributes] control the behavior of external blocks. -[attributes]: attributes.html#ffi-attributes - By default external blocks assume that the library they are calling uses the standard C ABI on the specific platform. Other ABIs may be specified using an `abi` string, as shown here: @@ -81,3 +79,5 @@ It is valid to add the `link` attribute on an empty extern block. You can use this to satisfy the linking requirements of extern blocks elsewhere in your code (including upstream crates) instead of adding the attribute to each extern block. + +[attributes]: ../attributes.html#ffi-attributes diff --git a/src/items/functions.md b/src/items/functions.md index a3252add2a..353c7008a7 100644 --- a/src/items/functions.md +++ b/src/items/functions.md @@ -130,11 +130,11 @@ fn test_only() { > Note: Except for lints, it is idiomatic to only use outer attributes on > function items. -[external blocks]: items/external-blocks.html -[path]: paths.html -[block]: expressions/block-expr.html -[variables]: variables.html -[type]: types.html -[*function item type*]: types.html#function-item-types -[Trait]: items/traits.html -[attributes]: attributes.html +[external blocks]: external-blocks.html +[path]: ../paths.html +[block]: ../expressions/block-expr.html +[variables]: ../variables.html +[type]: ../types.html +[*function item type*]: ../types.html#function-item-types +[Trait]: traits.html +[attributes]: ../attributes.html diff --git a/src/items/generics.md b/src/items/generics.md index 7f5a33cfaa..7f23b0e1b6 100644 --- a/src/items/generics.md +++ b/src/items/generics.md @@ -100,26 +100,23 @@ generic parameter. } ``` -[IDENTIFIER]: identifiers.html -[LIFETIME_OR_LABEL]: tokens.html#lifetimes-and-loop-labels - -[_LifetimeBounds_]: trait-bounds.html -[_Lifetime_]: trait-bounds.html -[_OuterAttribute_]: attributes.html -[_Type_]: types.html -[_TypeParamBounds_]: trait-bounds.html - -[arrays]: types.html#array-and-slice-types -[function pointers]: types.html#function-pointer-types -[references]: types.html#shared-references- -[raw pointers]: types.html#raw-pointers-const-and-mut -[`Clone`]: special-types-and-traits.html#clone -[`Copy`]: special-types-and-traits.html#copy -[`Sized`]: special-types-and-traits.html#sized -[tuples]: types.html#tuple-types -[trait object]: types.html#trait-objects -[attributes]: attributes.html - +[IDENTIFIER]: ../identifiers.html +[LIFETIME_OR_LABEL]: ../tokens.html#lifetimes-and-loop-labels +[_LifetimeBounds_]: ../trait-bounds.html +[_Lifetime_]: ../trait-bounds.html +[_OuterAttribute_]: ../attributes.html +[_Type_]: ../types.html +[_TypeParamBounds_]: ../trait-bounds.html +[arrays]: ../types.html#array-and-slice-types +[function pointers]: ../types.html#function-pointer-types +[references]: ../types.html#shared-references- +[raw pointers]: ../types.html#raw-pointers-const-and-mut +[`Clone`]: ../special-types-and-traits.html#clone +[`Copy`]: ../special-types-and-traits.html#copy +[`Sized`]: ../special-types-and-traits.html#sized +[tuples]: ../types.html#tuple-types +[trait object]: ../types.html#trait-objects +[attributes]: ../attributes.html [path]: ../paths.html -[Trait]: traits.html#trait-bounds -[_TypePath_]: paths.html +[Trait]: ../traits.html#trait-bounds +[_TypePath_]: ../paths.html diff --git a/src/items/implementations.md b/src/items/implementations.md index 2609ca8b20..3146ea2d8a 100644 --- a/src/items/implementations.md +++ b/src/items/implementations.md @@ -144,9 +144,9 @@ attributes must come before any associated items. That attributes that have meaning here are [`cfg`], [`deprecated`], [`doc`], and [the lint check attributes]. -[trait]: items/traits.html -[attributes]: attributes.html -[`cfg`]: attributes.html#conditional-compilation -[`deprecated`]: attributes.html#deprecation -[`doc`]: attributes.html#documentation -[the lint check attributes]: attributes.html#lint-check-attributes +[trait]: traits.html +[attributes]: ../attributes.html +[`cfg`]: ../attributes.html#conditional-compilation +[`deprecated`]: ../attributes.html#deprecation +[`doc`]: ../attributes.html#documentation +[the lint check attributes]: ../attributes.html#lint-check-attributes diff --git a/src/items/modules.md b/src/items/modules.md index c08b410710..0c47038743 100644 --- a/src/items/modules.md +++ b/src/items/modules.md @@ -68,10 +68,8 @@ mod thread { } ``` -[IDENTIFIER]: identifiers.html - -[_InnerAttribute_]: attributes.html -[_OuterAttribute_]: attributes.html - -[_Item_]: items.html -[items]: items.html +[IDENTIFIER]: ../identifiers.html +[_InnerAttribute_]: ../attributes.html +[_OuterAttribute_]: ../attributes.html +[_Item_]: ../items.html +[items]: ../items.html diff --git a/src/items/static-items.md b/src/items/static-items.md index a5427df1ee..d86abefca0 100644 --- a/src/items/static-items.md +++ b/src/items/static-items.md @@ -68,10 +68,10 @@ following are true: * The single-address property of statics is required. * Interior mutability is required. -[constant]: items/constant-items.html -[`drop`]: destructors.html -[constant expression]: expressions.html#constant-expressions -[interior mutable]: interior-mutability.html -[IDENTIFIER]: identifiers.html -[_Type_]: types.html -[_Expression_]: expressions.html +[constant]: ../items/constant-items.html +[`drop`]: ../destructors.html +[constant expression]: ../expressions.html#constant-expressions +[interior mutable]: ../interior-mutability.html +[IDENTIFIER]: ../identifiers.html +[_Type_]: ../types.html +[_Expression_]: ../expressions.html diff --git a/src/items/structs.md b/src/items/structs.md index 45e48bc65f..8f1449cdaf 100644 --- a/src/items/structs.md +++ b/src/items/structs.md @@ -49,9 +49,6 @@ let px: i32 = p.x; A _tuple struct_ is a nominal [tuple type], also defined with the keyword `struct`. For example: -[struct type]: types.html#struct-types -[tuple type]: types.html#tuple-types - ```rust struct Point(i32, i32); let p = Point(10, 11); @@ -78,11 +75,12 @@ let c = [Cookie, Cookie {}, Cookie, Cookie {}]; The precise memory layout of a struct is not specified. One can specify a particular layout using the [`repr` attribute]. -[`repr` attribute]: attributes.html#ffi-attributes - -[_OuterAttribute_]: attributes.html -[IDENTIFIER]: identifiers.html -[_Generics_]: items/generics.html +[`repr` attribute]: ../attributes.html#ffi-attributes +[_OuterAttribute_]: ../attributes.html +[IDENTIFIER]: ../identifiers.html +[_Generics_]: generics.html [_WhereClause_]: items/generics.html#where-clauses -[_Visibility_]: visibility-and-privacy.html -[_Type_]: types.html +[_Visibility_]: ../visibility-and-privacy.html +[_Type_]: ../types.html +[struct type]: ../types.html#struct-types +[tuple type]: ../types.html#tuple-types diff --git a/src/items/traits.md b/src/items/traits.md index 5e830a8c30..425f65768e 100644 --- a/src/items/traits.md +++ b/src/items/traits.md @@ -3,9 +3,9 @@ A _trait_ describes an abstract interface that types can implement. This interface consists of [associated items], which come in three varieties: -- [functions](items/associated-items.html#associated-functions-and-methods) -- [types](items/associated-items.html#associated-types) -- [constants](items/associated-items.html#associated-constants) +- [functions] +- [types] +- [constants] All traits define an implicit type parameter `Self` that refers to "the type that is implementing this interface". Traits may also contain additional type @@ -115,13 +115,16 @@ let circle = Box::new(circle) as Box; let nonsense = circle.radius() * circle.area(); ``` -[bounds]: trait-bounds.html -[trait object]: types.html#trait-objects -[explicit]: expressions/operator-expr.html#type-cast-expressions +[bounds]: ../trait-bounds.html +[trait object]: ../types.html#trait-objects +[explicit]: ../expressions/operator-expr.html#type-cast-expressions [RFC 255]: https://github.com/rust-lang/rfcs/blob/master/text/0255-object-safety.md -[associated items]: items/associated-items.html -[method]: items/associated-items.html#methods -[implementations]: items/implementations.html -[generics]: items/generics.html -[where clauses]: items/generics.html#where-clauses -[generic functions]: items/functions.html#generic-functions +[associated items]: associated-items.html +[method]: associated-items.html#methods +[implementations]: implementations.html +[generics]: generics.html +[where clauses]: generics.html#where-clauses +[generic functions]: functions.html#generic-functions +[functions]: associated-items.html#associated-functions-and-methods +[types]: associated-items.html#associated-types +[constants]: associated-items.html#associated-constants diff --git a/src/items/type-aliases.md b/src/items/type-aliases.md index f85493b686..66dfd3c711 100644 --- a/src/items/type-aliases.md +++ b/src/items/type-aliases.md @@ -10,8 +10,6 @@ declared with the keyword `type`. Every value has a single, specific type, but may implement several different traits, or be compatible with several different type constraints. -[type]: types.html - For example, the following defines the type `Point` as a synonym for the type `(u8, u8)`, the type of pairs of unsigned 8 bit integers: @@ -29,7 +27,8 @@ let _: F = E::A; // OK // let _: F = F::A; // Doesn't work ``` -[IDENTIFIER]: identifiers.html -[_Generics_]: items/generics.html -[_WhereClause_]: items/generics.html#where-clauses -[_Type_]: types.html +[type]: ../types.html +[IDENTIFIER]: ../identifiers.html +[_Generics_]: generics.html +[_WhereClause_]: html#where-clauses +[_Type_]: ../types.html diff --git a/src/items/unions.md b/src/items/unions.md index b51f17461b..f7f15a36d8 100644 --- a/src/items/unions.md +++ b/src/items/unions.md @@ -143,9 +143,10 @@ generics, trait implementations, inherent implementations, coherence, pattern checking, etc etc etc). More detailed specification for unions, including unstable bits, can be found -in [RFC 1897 "Unions v1.2"](https://github.com/rust-lang/rfcs/pull/1897). +in [RFC 1897 "Unions v1.2"]. -[IDENTIFIER]: identifiers.html -[_Generics_]: items/generics.html -[_WhereClause_]: items/generics.html#where-clauses -[_StructFields_]: items/structs.html +[RFC 1897 "Unions v1.2"]: https://github.com/rust-lang/rfcs/pull/1897 +[IDENTIFIER]: ../identifiers.html +[_Generics_]: html +[_WhereClause_]: html#where-clauses +[_StructFields_]: html diff --git a/src/items/use-declarations.md b/src/items/use-declarations.md index 945da84a39..0d5d285396 100644 --- a/src/items/use-declarations.md +++ b/src/items/use-declarations.md @@ -14,13 +14,9 @@ some other [path]. Usually a `use` declaration is used to shorten the path required to refer to a module item. These declarations may appear in [modules] and [blocks], usually at the top. -[path]: paths.html -[modules]: items/modules.html -[blocks]: expressions/block-expr.html - > **Note**: Unlike in many languages, `use` declarations in Rust do *not* > declare linkage dependency with external crates. Rather, [`extern crate` -> declarations](items/extern-crates.html) declare linkage dependencies. +> declarations] declare linkage dependencies. Use declarations support a number of convenient shortcuts: @@ -122,6 +118,10 @@ mod foo { fn main() {} ``` -[IDENTIFIER]: identifiers.html -[_SimplePath_]: paths.html -[_Visibility_]: visibility-and-privacy.html +[IDENTIFIER]: ../identifiers.html +[_SimplePath_]: ../paths.html +[_Visibility_]: ../visibility-and-privacy.html +[path]: ../paths.html +[modules]: modules.html +[blocks]: ../expressions/block-expr.html +[`extern crate` declarations]: extern-crates.html From f6bc1320e9d2beb092bc0fbf710460254022d8e4 Mon Sep 17 00:00:00 2001 From: Alexis Hunt Date: Tue, 7 Aug 2018 04:49:32 -0400 Subject: [PATCH 3/6] Move all links to bottom. --- src/crates-and-source-files.md | 6 +- src/expressions.md | 19 +++--- src/influences.md | 5 +- src/interior-mutability.md | 2 - src/items.md | 45 +++++++++----- src/keywords.md | 9 ++- src/lifetime-elision.md | 3 +- src/linkage.md | 7 +-- src/macros-by-example.md | 23 ++++--- src/paths.md | 1 + src/special-types-and-traits.md | 3 +- src/statements.md | 7 ++- src/tokens.md | 8 +-- src/trait-bounds.md | 1 - src/type-coercions.md | 8 +-- src/types.md | 107 +++++++++++++++++--------------- src/unsafety.md | 15 +++-- src/variables.md | 5 +- 18 files changed, 151 insertions(+), 123 deletions(-) diff --git a/src/crates-and-source-files.md b/src/crates-and-source-files.md index beffaba3c8..f4fb7ccea2 100644 --- a/src/crates-and-source-files.md +++ b/src/crates-and-source-files.md @@ -9,7 +9,7 @@ > **Lexer**\ > UTF8BOM : `\uFEFF`\ -> SHEBANG : `#!` ~[`[` `\n`] ~`\n`* +> SHEBANG : `#!` ~[`[` `\n`] ~`\n`\* > Note: Although Rust, like any other language, can be implemented by an @@ -78,11 +78,11 @@ type must be one of the following: > Note: The implementation of which return types are allowed is determined by > the unstable [`Termination`] trait. -The optional [_UTF8 byte order mark_] (UTF8BOM production) indicates that the +The optional [_UTF8 byte order mark_] \(UTF8BOM production) indicates that the file is encoded in UTF8. It can only occur at the beginning of the file and is ignored by the compiler. -A source file can have a [_shebang_] (SHEBANG production), which indicates +A source file can have a [_shebang_] \(SHEBANG production), which indicates to the operating system what program to use to execute this file. It serves essentially to treat the source file as an executable script. The shebang can only occur at the beginning of the file (but after the optional diff --git a/src/expressions.md b/src/expressions.md index 25b586076f..9e4539769f 100644 --- a/src/expressions.md +++ b/src/expressions.md @@ -87,7 +87,7 @@ A *value expression* is an expression that represents an actual value. The left operand of an [assignment][assign] or [compound assignment] expression is a place expression context, as is the single operand of a unary [borrow], and the operand of any [implicit borrow]. The discriminant or subject of a -[match expression][match] and right side of a [let statement] is also a place +[match expression][match] and right side of a [let statement][let] is also a place expression context. All other expression contexts are value expression contexts. > Note: Historically, place expressions were called *lvalues* and value @@ -102,7 +102,7 @@ the remaining situations if that type is [`Sized`], then it may be possible to move the value. Only the following place expressions may be moved out of: * [Variables] which are not currently borrowed. -* [Temporary values](#temporary-lifetimes). +* [Temporary values]. * [Fields][field] of a place expression which can be moved out of and doesn't implement [`Drop`]. * The result of [dereferencing] an expression with type [`Box`] and that can @@ -145,9 +145,9 @@ of a value expression to a `'static` slot occurs when the expression could be written in a constant, borrowed, and dereferencing that borrow where the expression was the originally written, without changing the runtime behavior. That is, the promoted expression can be evaluated at compile-time and the -resulting value does not contain [interior mutability] or [destructors] (these -properties are determined based on the value where possible, e.g. `&None` -always has the type `&'static Option<_>`, as it contains nothing disallowed). +resulting value does not contain [interior mutability] or [destructors] \(these +properties are determined based on the value where possible, e.g. `&None` always +has the type `&'static Option<_>`, as it contains nothing disallowed). Otherwise, the lifetime of temporary values is typically - the innermost enclosing statement; the tail expression of a block is @@ -233,9 +233,9 @@ Implicit borrows may be taken in the following expressions: Certain types of expressions can be evaluated at compile time. These are called _constant expressions_. Certain places, such as in -[constants](items/constant-items.html) and [statics](items/static-items.html), +[constants] and [statics](static variables), require a constant expression, and are always evaluated at compile time. In -other places, such as in [`let` statements](statements.html#let-statements), +other places, such as in [`let` statements][let], constant expressions may be evaluated at compile time. If errors, such as out of bounds [array indexing] or [overflow] occurs, then it is a compiler error if the value must be evaluated at compile time, @@ -246,7 +246,7 @@ also constant expressions and do not cause any [`Drop::drop`][destructors] calls to be ran. * [Literals]. -* [Paths] to [functions](items/functions.html) and constants. +* [Paths] to [functions] and constants. Recursively defining constants is not allowed. * [Tuple expressions]. * [Array expressions]. @@ -302,6 +302,8 @@ exist in `core::ops` and `core::cmp` with the same names. [negation]: expressions/operator-expr.html#negation-operators [overflow]: expressions/operator-expr.html#overflow +[functions]: items/functions.html +[constants]: items/constant-items.html [destructors]: destructors.html [interior mutability]: interior-mutability.html [`Box`]: ../std/boxed/struct.Box.html @@ -311,7 +313,6 @@ exist in `core::ops` and `core::cmp` with the same names. [implicit borrow]: #implicit-borrows [implicitly mutably borrowed]: #implicit-borrows [let]: statements.html#let-statements -[let statement]: statements.html#let-statements [Mutable `static` items]: items/static-items.html#mutable-statics [slice]: types.html#array-and-slice-types [static variables]: items/static-items.html diff --git a/src/influences.md b/src/influences.md index 46082bfc0b..e392d2f5a2 100644 --- a/src/influences.md +++ b/src/influences.md @@ -18,5 +18,6 @@ that have since been removed): * C#: attributes * Ruby: block syntax * NIL, Hermes: typestate -* [Unicode Annex #31](http://www.unicode.org/reports/tr31/): identifier and - pattern syntax +* [Unicode Annex #31]: identifier and pattern syntax + +[Unicode Annex #31]: http://www.unicode.org/reports/tr31/ diff --git a/src/interior-mutability.md b/src/interior-mutability.md index f10d3679c5..ae2ec76045 100644 --- a/src/interior-mutability.md +++ b/src/interior-mutability.md @@ -26,5 +26,3 @@ across threads. [`std::cell::UnsafeCell`]: ../std/cell/struct.UnsafeCell.html [`std::cell::RefCell`]: ../std/cell/struct.RefCell.html [`std::sync::atomic`]: ../std/sync/atomic/index.html - - diff --git a/src/items.md b/src/items.md index 4d10da30a3..9514704bbb 100644 --- a/src/items.md +++ b/src/items.md @@ -5,27 +5,24 @@ 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]: items/modules.html -[paths]: paths.html - Items are entirely determined at compile-time, generally remain fixed during execution, and may reside in read-only memory. There are several kinds of items: -* [modules](items/modules.html) -* [`extern crate` declarations](items/extern-crates.html) -* [`use` declarations](items/use-declarations.html) -* [function definitions](items/functions.html) -* [type definitions](items/type-aliases.html) -* [struct definitions](items/structs.html) -* [enumeration definitions](items/enumerations.html) -* [union definitions](items/unions.html) -* [constant items](items/constant-items.html) -* [static items](items/static-items.html) -* [trait definitions](items/traits.html) -* [implementations](items/implementations.html) -* [`extern` blocks](items/external-blocks.html) +* [modules] +* [`extern crate` declarations] +* [`use` declarations] +* [function definitions] +* [type definitions] +* [struct definitions] +* [enumeration definitions] +* [union definitions] +* [constant items] +* [static items] +* [trait definitions] +* [implementations] +* [`extern` blocks] Some items form an implicit scope for the declaration of sub-items. In other words, within a function or module, declarations of items can (in many cases) @@ -36,3 +33,19 @@ as if the item was declared outside the scope — it is still a static item qualified by the name of the enclosing item, or is private to the enclosing item (in the case of functions). The grammar specifies the exact locations in which sub-item declarations may appear. + +[modules]: items/modules.html +[paths]: paths.html +[modules]: items/modules.html +[`extern crate` declarations]: items/extern-crates.html +[`use` declarations]: items/use-declarations.html +[function definitions]: items/functions.html +[type definitions]: items/type-aliases.html +[struct definitions]: items/structs.html +[enumeration definitions]: items/enumerations.html +[union definitions]: items/unions.html +[constant items]: items/constant-items.html +[static items]: items/static-items.html +[trait definitions]: items/traits.html +[implementations]: items/implementations.html +[`extern` blocks]: items/external-blocks.html diff --git a/src/keywords.md b/src/keywords.md index 8cf55de20c..9b67b21aea 100644 --- a/src/keywords.md +++ b/src/keywords.md @@ -2,9 +2,9 @@ Rust divides keywords into three categories: -* [strict](#strict-keywords) -* [reserved](#reserved-keywords) -* [weak](#weak-keywords) +* [strict] +* [reserved] +* [weak] ## Strict keywords @@ -111,3 +111,6 @@ is possible to declare a variable or method with the name `union`. [union]: items/unions.html [variants]: items/enumerations.html [trait object]: types.html#trait-objects +[strict]: #strict-keywords +[reserved]: #reserved-keywords +[weak]: #weak-keywords diff --git a/src/lifetime-elision.md b/src/lifetime-elision.md index eb43bd66c5..8b4e139b6b 100644 --- a/src/lifetime-elision.md +++ b/src/lifetime-elision.md @@ -12,7 +12,7 @@ It is an error to elide lifetime parameters that cannot be inferred. The placeholder lifetime, `'_`, can also be used to have a lifetime inferred in the same way. For lifetimes in paths, using `'_` is preferred. Trait object lifetimes follow different rules discussed -[below](#default-trait-object-lifetimes). +[below][trait object lifetimes]. * Each elided lifetime in the parameters becomes a distinct lifetime parameter. * If there is exactly one lifetime used in the parameters (elided or not), that @@ -179,3 +179,4 @@ const RESOLVED_STATIC: &dyn Fn(&Foo, &Bar) -> &Baz = .. [static]: items/static-items.html [trait object]: types.html#trait-objects [type aliases]: items/type-aliases.html +[trait object lifetimes]: #default-trait-object-lifetimes diff --git a/src/linkage.md b/src/linkage.md index 3e004315a6..840ca5a93d 100644 --- a/src/linkage.md +++ b/src/linkage.md @@ -5,8 +5,6 @@ statically and dynamically. This section will explore the various methods to link Rust crates together, and more information about native libraries can be found in the [FFI section of the book][ffi]. -[ffi]: ../book/ffi.html - In one session of compilation, the compiler can generate multiple artifacts through the usage of either command line flags or the `crate_type` attribute. If one or more command line flags are specified, all `crate_type` attributes will @@ -196,8 +194,6 @@ fn main() { } ``` -[cargo]: http://doc.crates.io/environment-variables.html#environment-variables-cargo-sets-for-build-scripts - To use this feature locally, you typically will use the `RUSTFLAGS` environment variable to specify flags to the compiler through Cargo. For example to compile a statically linked binary on MSVC you would execute: @@ -205,3 +201,6 @@ a statically linked binary on MSVC you would execute: ```ignore,notrust RUSTFLAGS='-C target-feature=+crt-static' cargo build --target x86_64-pc-windows-msvc ``` + +[ffi]: ../book/ffi.html +[cargo]: http://doc.crates.io/environment-variables.html#environment-variables-cargo-sets-for-build-scripts diff --git a/src/macros-by-example.md b/src/macros-by-example.md index 26191aea37..a256db08d0 100644 --- a/src/macros-by-example.md +++ b/src/macros-by-example.md @@ -32,18 +32,6 @@ syntax named by _designator_. Valid designators are: * `meta`: the contents of an [attribute] * `lifetime`: a lifetime. Examples: `'static`, `'a`. -[item]: items.html -[block]: expressions/block-expr.html -[statement]: statements.html -[pattern]: expressions/match-expr.html -[expression]: expressions.html -[type]: types.html -[identifier]: identifiers.html -[keyword]: keywords.html -[path]: paths.html -[token]: tokens.html -[attribute]: attributes.html - In the transcriber, the designator is already known, and so only the name of a matched nonterminal comes after the dollar sign. @@ -88,3 +76,14 @@ Rust syntax is restricted in two ways: requiring a distinctive token in front can solve the problem. [RFC 550]: https://github.com/rust-lang/rfcs/blob/master/text/0550-macro-future-proofing.md +[item]: items.html +[block]: expressions/block-expr.html +[statement]: statements.html +[pattern]: expressions/match-expr.html +[expression]: expressions.html +[type]: types.html +[identifier]: identifiers.html +[keyword]: keywords.html +[path]: paths.html +[token]: tokens.html +[attribute]: attributes.html diff --git a/src/paths.md b/src/paths.md index c91535570a..47e8453526 100644 --- a/src/paths.md +++ b/src/paths.md @@ -164,6 +164,7 @@ mod without { // ::without # fn main() {} ``` + [item]: items.html [variable]: variables.html [identifiers]: identifiers.html diff --git a/src/special-types-and-traits.md b/src/special-types-and-traits.md index 90f36b2e1b..00240a7ab1 100644 --- a/src/special-types-and-traits.md +++ b/src/special-types-and-traits.md @@ -27,7 +27,7 @@ mutability aren't placed in memory marked as read only. [`std::marker::PhantomData`] is a zero-sized, minimum alignment, type that is considered to own a `T` for the purposes of [variance], [drop check] and -[auto traits](#auto-traits). +[auto traits]. ## Operator Traits @@ -165,3 +165,4 @@ compiler, not by [implementation items]. [Type parameters]: types.html#type-parameters [variance]: subtyping.html#variance [`!`]: types.html#never-type +[auto traits]: #auto-traits diff --git a/src/statements.md b/src/statements.md index bbe83d3752..aefc92c139 100644 --- a/src/statements.md +++ b/src/statements.md @@ -3,9 +3,8 @@ A *statement* is a component of a [block], which is in turn a component of an outer [expression] or [function]. -Rust has two kinds of statement: [declaration -statements](#declaration-statements) and [expression -statements](#expression-statements). +Rust has two kinds of statement: [declaration statements] and [expression +statements]. ## Declaration statements @@ -106,3 +105,5 @@ statement are [`cfg`], and [the lint check attributes]. [outer attributes]: attributes.html [`cfg`]: attributes.html#conditional-compilation [the lint check attributes]: attributes.html#lint-check-attributes +[declaration statements]: #declaration-statements +[expression statements]: #expression-statements diff --git a/src/tokens.md b/src/tokens.md index ef832bcfb0..d738c6dd92 100644 --- a/src/tokens.md +++ b/src/tokens.md @@ -483,8 +483,6 @@ to call a method named `f64` on `2`. The representation semantics of floating-point numbers are described in ["Machine Types"]. -["Machine Types"]: types.html#machine-types - ### Boolean literals > **Lexer**\ @@ -508,8 +506,6 @@ Lifetime parameters and [loop labels] use LIFETIME_OR_LABEL tokens. Any LIFETIME_TOKEN will be accepted by the lexer, and for example, can be used in macros. -[loop labels]: expressions/loop-expr.html - ## Punctuation Punctuation symbol tokens are listed here for completeness. Their individual @@ -577,6 +573,8 @@ them are referred to as "token trees" in [macros]. The three types of brackets [Operator expressions]: expressions/operator-expr.html +[unary operators]: expressions/operator-expr.html#borrow-operators +[binary operators]: expressions/operator-expr.html#arithmetic-and-logical-binary-operators [tokens]: #tokens [keywords]: keywords.html [identifier]: identifiers.html @@ -611,3 +609,5 @@ them are referred to as "token trees" in [macros]. The three types of brackets [extern]: items/external-blocks.html [struct expressions]: expressions/struct-expr.html [tuple index]: expressions/tuple-expr.html#tuple-indexing-expressions +[loop labels]: expressions/loop-expr.html +["Machine Types"]: types.html#machine-types diff --git a/src/trait-bounds.md b/src/trait-bounds.md index faa9843991..5da4536ba8 100644 --- a/src/trait-bounds.md +++ b/src/trait-bounds.md @@ -137,7 +137,6 @@ fn call_on_ref_zero(f: F) where F: for<'a> Fn(&'a i32) { [LIFETIME_OR_LABEL]: tokens.html#lifetimes-and-loop-labels [_TraitPath_]: paths.html [`Sized`]: special-types-and-traits.html#sized - [associated types]: items/associated-items.html#associated-types [supertraits]: items/traits.html#supertraits [generic]: items/generics.html diff --git a/src/type-coercions.md b/src/type-coercions.md index c8719aee4b..8d4acf5f8e 100644 --- a/src/type-coercions.md +++ b/src/type-coercions.md @@ -3,9 +3,6 @@ Coercions are defined in [RFC 401]. [RFC 1558] then expanded on that. A coercion is implicit and has no syntax. -[RFC 401]: https://github.com/rust-lang/rfcs/blob/master/text/0401-coercions.md -[RFC 1558]: https://github.com/rust-lang/rfcs/blob/master/text/1558-closure-to-fn-coercion.md - ## Coercion sites A coercion can only occur at certain coercion sites in a program; these are @@ -39,7 +36,7 @@ sites are: ``` For method calls, the receiver (`self` parameter) can only take advantage - of [unsized coercions](#unsized-coercions). + of [unsized coercions]. * Instantiations of struct or variant fields @@ -184,3 +181,6 @@ unsized coercion to `Foo`. [Unsize]: ../std/marker/trait.Unsize.html [CoerceUnsized]: ../std/ops/trait.CoerceUnsized.html +[RFC 401]: https://github.com/rust-lang/rfcs/blob/master/text/0401-coercions.md +[RFC 1558]: https://github.com/rust-lang/rfcs/blob/master/text/1558-closure-to-fn-coercion.md +[unsized coercions]: #unsized-coercions diff --git a/src/types.md b/src/types.md index 68c2988c9f..a018099b47 100644 --- a/src/types.md +++ b/src/types.md @@ -14,7 +14,7 @@ library, these are called _primitive types_. Some of these are individual types: * The boolean type `bool` with values `true` and `false`. -* The [machine types] (integer and floating-point). +* The [machine types] \(integer and floating-point). * The [machine-dependent integer types]. * The [textual types] `char` and `str`. * The [never type] `!` @@ -22,25 +22,12 @@ types: There are also some primitive constructs for generic types built in to the language: -* [Tuples] -* [Arrays] -* [Slices] -* [Function pointers] +* [Tuples][tuples] +* [Arrays][arrays] +* [Slices][arrays] +* [Function pointers][function pointers] * [References] -* [Pointers] - -[machine types]: #machine-types -[machine-dependent integer types]: #machine-dependent-integer-types -[textual types]: #textual-types -[never type]: #never-type -[Tuples]: #tuple-types -[Arrays]: #array-and-slice-types -[Slices]: #array-and-slice-types -[References]: #pointer-types -[Pointers]: #raw-pointers-const-and-mut -[Function pointers]: #function-pointer-types -[function]: #function-types -[closure]: #closure-types +* [Pointers][pointers] ## Numeric types @@ -75,11 +62,9 @@ within an object along with one byte past the end. The types `char` and `str` hold textual data. -A value of type `char` is a [Unicode scalar value]( -http://www.unicode.org/glossary/#unicode_scalar_value) (i.e. a code point that -is not a surrogate), represented as a 32-bit unsigned word in the 0x0000 to -0xD7FF or 0xE000 to 0x10FFFF range. A `[char]` is effectively a UCS-4 / UTF-32 -string. +A value of type `char` is a [Unicode scalar value] \(i.e. a code point that is +not a surrogate), represented as a 32-bit unsigned word in the 0x0000 to 0xD7FF +or 0xE000 to 0x10FFFF range. A `[char]` is effectively a UCS-4 / UTF-32 string. A value of type `str` is a Unicode string, represented as an array of 8-bit unsigned bytes holding a sequence of UTF-8 code points. Since `str` is a @@ -163,7 +148,7 @@ A `struct` *type* is a heterogeneous product of other types, called the *fields* of the type.[^structtype] New instances of a `struct` can be constructed with a [struct -expression](expressions/struct-expr.html). +expression]. The memory layout of a `struct` is undefined by default to allow for compiler optimizations like field reordering, but it can be fixed with the @@ -172,7 +157,7 @@ corresponding struct *expression*; the resulting `struct` value will always have the same memory layout. The fields of a `struct` may be qualified by [visibility -modifiers](visibility-and-privacy.html), to allow access to data in a struct +modifiers], to allow access to data in a struct outside a module. A _tuple struct_ type is just like a struct type, except that the fields are @@ -188,20 +173,20 @@ value that inhabits such a type. ## Enumerated types An *enumerated type* is a nominal, heterogeneous disjoint union type, denoted -by the name of an [`enum` item](items/enumerations.html). [^enumtype] +by the name of an [`enum` item]. [^enumtype] -An [`enum` item](items/enumerations.html) declares both the type and a number +An [`enum` item] declares both the type and a number of *variants*, each of which is independently named and has the syntax of a struct, tuple struct or unit-like struct. New instances of an `enum` can be constructed in an [enumeration variant -expression](expressions/enum-variant-expr.html). +expression]. Any `enum` value consumes as much memory as the largest variant for its corresponding `enum` type, as well as the size needed to store a discriminant. Enum types cannot be denoted *structurally* as types, but must be denoted by -named reference to an [`enum` item](items/enumerations.html). +named reference to an [`enum` item]. [^enumtype]: The `enum` type is analogous to a `data` constructor declaration in ML, or a *pick ADT* in Limbo. @@ -209,7 +194,7 @@ named reference to an [`enum` item](items/enumerations.html). ## Union types A *union type* is a nominal, heterogeneous C-like union, denoted by the name of -a [`union` item](items/unions.html). +a [`union` item]. A union contains the value of any one of its fields. Since the accessing the wrong field can cause unexpected or undefined behaviour, `unsafe` is required @@ -219,22 +204,19 @@ to read from a union field or to write to a field that doesn't implement The memory layout of a `union` is undefined by default, but the `#[repr(...)]` attribute can be used to fix a layout. -[`Copy`]: special-types-and-traits.html#copy - ## Recursive types -Nominal types — [structs](#struct-types), -[enumerations](#enumerated-types) and [unions](#union-types) — may be +Nominal types — [structs], [enumerations] and [unions] — may be recursive. That is, each `enum` variant or `struct` or `union` field may refer, directly or indirectly, to the enclosing `enum` or `struct` type itself. Such recursion has restrictions: * Recursive types must include a nominal type in the recursion (not mere [type - definitions](../grammar.html#type-definitions), or other structural types - such as [arrays](#array-and-slice-types) or [tuples](#tuple-types)). So + definitions], or other structural types + such as [arrays] or [tuples]). So `type Rec = &'static [Rec]` is not allowed. * The size of a recursive type must be finite; in other words the recursive - fields of the type must be [pointer types](#pointer-types). + fields of the type must be [pointer types][pointers]. * Recursive type definitions can cross module boundaries, but not module *visibility* boundaries, or crate boundaries (in order to simplify the module system and type checker). @@ -259,13 +241,13 @@ copied, stored into data structs, and returned from functions. These point to memory _owned by some other value_. When a shared reference to a value is created it prevents direct mutation of the value. [Interior -mutability](interior-mutability.html) provides an exception for this in certain +mutability] provides an exception for this in certain circumstances. As the name suggests, any number of shared references to a value may exit. A shared reference type is written `&type`, or `&'a type` when you need to specify an explicit lifetime. Copying a reference is a "shallow" operation: it involves only copying the pointer itself, that is, pointers are `Copy`. Releasing a reference has no effect on the value it points to, but -referencing of a [temporary value](expressions.html#temporary-lifetimes) will +referencing of a [temporary value] will keep it alive during the scope of the reference itself. ### Mutable references (`&mut`) @@ -280,14 +262,14 @@ Raw pointers are pointers without safety or liveness guarantees. Raw pointers are written as `*const T` or `*mut T`, for example `*const i32` means a raw pointer to a 32-bit integer. Copying or dropping a raw pointer has no effect on the lifecycle of any other value. Dereferencing a raw pointer is an [`unsafe` -operation](unsafe-functions.html), this can also be used to convert a raw +operation], this can also be used to convert a raw pointer to a reference by reborrowing it (`&*` or `&mut *`). Raw pointers are generally discouraged in Rust code; they exist to support interoperability with foreign code, and writing performance-critical or low-level functions. When comparing pointers they are compared by their address, rather than by what they point to. When comparing pointers to [dynamically sized -types](dynamically-sized-types.html) they also have their addition data +types] they also have their addition data compared. ### Smart Pointers @@ -320,12 +302,10 @@ let x = &mut foo::; ``` However, there is a [coercion] from function items to [function -pointers](#function-pointer-types) with the same signature, which is triggered +pointers] with the same signature, which is triggered not only when a function item is used when a function pointer is directly -expected, but also when different function item types with the same signature -meet in different arms of the same `if` or `match`: - -[coercion]: type-coercions.html +expected, but also when different function types with the same signature meet in +different arms of the same `if` or `match`: ```rust # let want_i32 = false; @@ -349,8 +329,8 @@ All function items implement [`Fn`], [`FnMut`], [`FnOnce`], [`Copy`], Function pointer types, written using the `fn` keyword, refer to a function whose identity is not necessarily known at compile-time. They can be created -via a coercion from both [function items](#function-item-types) and -non-capturing [closures](#closure-types). +via a coercion from both [function items][function] and non-capturing +[closures][closure]. A function pointer type consists of a possibly-empty set of function-type modifiers (such as `unsafe` or `extern`), a sequence of input types and an @@ -637,8 +617,6 @@ need to be expressed as part of the trait object. This lifetime is written as `Trait + 'a`. There are [defaults] that allow this lifetime to usually be inferred with a sensible choice. -[defaults]: lifetime-elision.html#default-trait-object-lifetimes - ## Type parameters Within the body of an item that has type parameter declarations, the names of @@ -742,3 +720,30 @@ impl Printable for String { [_PATH_]: paths.html [_LIFETIME_OR_LABEL_]: tokens.html#lifetimes-and-loop-labels [supertraits]: items/traits.html#supertraits +[machine types]: #machine-types +[machine-dependent integer types]: #machine-dependent-integer-types +[textual types]: #textual-types +[never type]: #never-type +[tuples]: #tuple-types +[arrays]: #array-and-slice-types +[References]: #pointer-types +[pointers]: #raw-pointers-const-and-mut +[function pointers]: #function-pointer-types +[closure]: #closure-types +[defaults]: lifetime-elision.html#default-trait-object-lifetimes +[Unicode scalar value]: http://www.unicode.org/glossary/#unicode_scalar_value +[struct expression]: expressions/struct-expr.html +[visibility modifiers]: visibility-and-privacy.html +[`enum` item]: items/enumerations.html +[enum variant expression]: expressions/enum-variant-expr.html +[coercion]: type-coercions.html +[`union` item]: items/unions.html +[function]: items/functions.html +[structs]: #struct-types +[enumerations]: #enumerated-types +[unions]: #union-types +[type definitions]: ../grammar.html#type-definitions +[interior mutability]: interior-mutability.html +[temporary value]: expressions.html#temporary-lifetimes +[`unsafe` operation]: unsafe-functions.html +[dynamically sized type]: dynamically-sized-types.html diff --git a/src/unsafety.md b/src/unsafety.md index 53cf7448fa..c3060c9b7d 100644 --- a/src/unsafety.md +++ b/src/unsafety.md @@ -6,9 +6,14 @@ guarantees of Rust's static semantics. The following language level features cannot be used in the safe subset of Rust: -- Dereferencing a [raw pointer](types.html#pointer-types). -- Reading or writing a [mutable static variable](items/static-items.html#mutable-statics). -- Reading a field of a [`union`](items/unions.html), or writing to a field of a - union that isn't [`Copy`](special-types-and-traits.html#copy). +- Dereferencing a [raw pointer]. +- Reading or writing a [mutable static variable]. +- Reading a field of a [`union`], or writing to a field of a union that isn't + [`Copy`]. - Calling an unsafe function (including an intrinsic or foreign function). -- Implementing an unsafe trait. \ No newline at end of file +- Implementing an unsafe trait. + +[raw pointer]: types.html#pointer-types +[mutable static variable]: items/static-items.html#mutable-statics +[`union`]: items/unions.html +[`Copy`]: special-types-and-traits.html#copy diff --git a/src/variables.md b/src/variables.md index a751098ceb..c8a1f37779 100644 --- a/src/variables.md +++ b/src/variables.md @@ -1,8 +1,7 @@ # Variables A _variable_ is a component of a stack frame, either a named function parameter, -an anonymous [temporary](expressions.html#temporary-lifetimes), or a named local -variable. +an anonymous [temporary], or a named local variable. A _local variable_ (or *stack-local* allocation) holds a value directly, allocated within the stack's memory. The value is a part of the stack frame. @@ -52,3 +51,5 @@ fn initialization_example() { // uninit_after_if; // err: use of possibly uninitialized `uninit_after_if` } ``` + +[temporary]: expressions.html#temporary-lifetimes From 9a535b60ddeaafa4c7724b88042d9334a290a597 Mon Sep 17 00:00:00 2001 From: Alexis Hunt Date: Tue, 7 Aug 2018 04:49:57 -0400 Subject: [PATCH 4/6] Add vim temporary files to gitignore. --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 7585238efe..79903517dd 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ book +*~ +.*.sw* From 062cbd2b31e07ea70b56fe74c6368fb9a958462f Mon Sep 17 00:00:00 2001 From: Alexis Hunt Date: Tue, 7 Aug 2018 04:55:58 -0400 Subject: [PATCH 5/6] Sort links. --- src/attributes.md | 40 ++++----- src/behavior-considered-undefined.md | 10 +-- src/crates-and-source-files.md | 12 +-- src/destructors.md | 22 ++--- src/dynamically-sized-types.md | 8 +- src/expressions.md | 130 +++++++++++++-------------- src/expressions/array-expr.md | 12 +-- src/expressions/block-expr.md | 12 +-- src/expressions/call-expr.md | 6 +- src/expressions/closure-expr.md | 12 +-- src/expressions/field-expr.md | 8 +- src/expressions/if-expr.md | 2 +- src/expressions/literal-expr.md | 12 +-- src/expressions/loop-expr.md | 18 ++-- src/expressions/match-expr.md | 10 +-- src/expressions/method-call-expr.md | 8 +- src/expressions/operator-expr.md | 28 +++--- src/expressions/path-expr.md | 6 +- src/expressions/range-expr.md | 4 +- src/expressions/struct-expr.md | 8 +- src/identifiers.md | 2 +- src/interior-mutability.md | 8 +- src/introduction.md | 6 +- src/items-and-attributes.md | 2 +- src/items.md | 20 ++--- src/items/associated-items.md | 28 +++--- src/items/constant-items.md | 8 +- src/items/enumerations.md | 12 +-- src/items/extern-crates.md | 2 +- src/items/functions.md | 10 +-- src/items/generics.md | 18 ++-- src/items/implementations.md | 4 +- src/items/modules.md | 2 +- src/items/static-items.md | 8 +- src/items/structs.md | 8 +- src/items/traits.md | 18 ++-- src/items/type-aliases.md | 4 +- src/items/unions.md | 4 +- src/items/use-declarations.md | 6 +- src/keywords.md | 18 ++-- src/lifetime-elision.md | 6 +- src/linkage.md | 2 +- src/macros-by-example.md | 10 +-- src/paths.md | 6 +- src/procedural-macros.md | 2 +- src/special-types-and-traits.md | 29 +++--- src/statements.md | 12 +-- src/subtyping.md | 2 +- src/tokens.md | 53 ++++++----- src/trait-bounds.md | 4 +- src/type-coercions.md | 4 +- src/type-layout.md | 10 +-- src/types.md | 66 +++++++------- src/undocumented.md | 8 +- src/unsafety.md | 6 +- 55 files changed, 384 insertions(+), 392 deletions(-) diff --git a/src/attributes.md b/src/attributes.md index 3cd1034962..c02df569be 100644 --- a/src/attributes.md +++ b/src/attributes.md @@ -473,30 +473,30 @@ impl PartialEq for Foo { You can implement `derive` for your own traits through [procedural macros]. [Doc comments]: comments.html#doc-comments +[ECMA-334]: https://www.ecma-international.org/publications/standards/Ecma-334.htm +[ECMA-335]: https://www.ecma-international.org/publications/standards/Ecma-335.htm [The Rustdoc Book]: ../rustdoc/the-doc-attribute.html -[procedural macros]: procedural-macros.html -[struct]: items/structs.html -[enum]: items/enumerations.html -[union]: items/unions.html -[functions]: items/functions.html -[expression]: expressions.html -[expression statement]: statements.html#expression-statements -[call expression]: expressions/call-expr.html +[`Drop`]: special-types-and-traits.html#drop [block expression]: expressions/block-expr.html [block expressions]: expressions/block-expr.html -[`Drop`]: special-types-and-traits.html#drop -[let statement]: statements.html#let-statements -[unstable book plugin]: ../unstable-book/language-features/plugin.html#lint-plugins -[zero-variant enum]: items/enumerations.html#zero-variant-enums -[ECMA-334]: https://www.ecma-international.org/publications/standards/Ecma-334.htm -[ECMA-335]: https://www.ecma-international.org/publications/standards/Ecma-335.htm -[item declarations]: items.html +[call expression]: expressions/call-expr.html +[conditional compilation]: conditional-compilation.html +[enum]: items/enumerations.html +[expression statement]: statements.html#expression-statements +[expression]: expressions.html +[external blocks]: items/external-blocks.html +[functions]: items/functions.html [generics]: items/generics.html [implementations]: items/implementations.html +[item declarations]: items.html +[items]: items.html +[let statement]: statements.html#let-statements +[match expressions]: expressions/match-expr.html [modules]: items/modules.html +[procedural macros]: procedural-macros.html [statements]: statements.html -[match expressions]: expressions/match-expr.html -[external blocks]: items/external-blocks.html -[items]: items.html -[conditional compilation]: conditional-compilation.html -[trait]: items/traits.html \ No newline at end of file +[struct]: items/structs.html +[trait]: items/traits.html +[union]: items/unions.html +[unstable book plugin]: ../unstable-book/language-features/plugin.html#lint-plugins +[zero-variant enum]: items/enumerations.html#zero-variant-enums diff --git a/src/behavior-considered-undefined.md b/src/behavior-considered-undefined.md index 612aac0c92..e552ff271e 100644 --- a/src/behavior-considered-undefined.md +++ b/src/behavior-considered-undefined.md @@ -39,12 +39,12 @@ code. * A value in a `char` which is a surrogate or above `char::MAX`. * Non-UTF-8 byte sequences in a `str`. -[noalias]: http://llvm.org/docs/LangRef.html#noalias -[pointer aliasing rules]: http://llvm.org/docs/LangRef.html#pointer-aliasing-rules -[undef]: http://llvm.org/docs/LangRef.html#undefined-values -[`offset`]: https://doc.rust-lang.org/std/primitive.pointer.html#method.offset -[`std::ptr::copy_nonoverlapping_memory`]: https://doc.rust-lang.org/std/ptr/fn.copy_nonoverlapping.html [`UnsafeCell`]: https://doc.rust-lang.org/std/cell/struct.UnsafeCell.html +[`offset`]: https://doc.rust-lang.org/std/primitive.pointer.html#method.offset [`read_unaligned`]: https://doc.rust-lang.org/std/ptr/fn.read_unaligned.html +[`std::ptr::copy_nonoverlapping_memory`]: https://doc.rust-lang.org/std/ptr/fn.copy_nonoverlapping.html [`write_unaligned`]: https://doc.rust-lang.org/std/ptr/fn.write_unaligned.html [Rustonomicon]: ../nomicon/index.html +[noalias]: http://llvm.org/docs/LangRef.html#noalias +[pointer aliasing rules]: http://llvm.org/docs/LangRef.html#pointer-aliasing-rules +[undef]: http://llvm.org/docs/LangRef.html#undefined-values diff --git a/src/crates-and-source-files.md b/src/crates-and-source-files.md index f4fb7ccea2..ebef67e99e 100644 --- a/src/crates-and-source-files.md +++ b/src/crates-and-source-files.md @@ -104,15 +104,15 @@ fn main() { ECMA-335 CLI model, a *library* in the SML/NJ Compilation Manager, a *unit* in the Owens and Flatt module system, or a *configuration* in Mesa. -[module]: items/modules.html -[module path]: paths.html -[attributes]: attributes.html -[unit]: types.html#tuple-types [_InnerAttribute_]: attributes.html [_Item_]: items.html [_shebang_]: https://en.wikipedia.org/wiki/Shebang_(Unix) [_utf8 byte order mark_]: https://en.wikipedia.org/wiki/Byte_order_mark#UTF-8 -[function]: items/functions.html [`Termination`]: ../std/process/trait.Termination.html -[where clauses]: items/generics.html#where-clauses +[attributes]: attributes.html +[function]: items/functions.html +[module path]: paths.html +[module]: items/modules.html [trait or lifetime bounds]: trait-bounds.html +[unit]: types.html#tuple-types +[where clauses]: items/generics.html#where-clauses diff --git a/src/destructors.md b/src/destructors.md index 263480ed36..26a6b7a155 100644 --- a/src/destructors.md +++ b/src/destructors.md @@ -76,18 +76,18 @@ Not running destructors in Rust is safe even if it has a type that isn't `'static`. [`std::mem::ManuallyDrop`] provides a wrapper to prevent a variable or field from being dropped automatically. -[initialized]: glossary.html#initialized -[variable]: variables.html -[temporary]: expressions.html#temporary-lifetimes [Assignment]: expressions/operator-expr.html#assignment-expressions -[`std::ops::Drop::drop`]: ../std/ops/trait.Drop.html [RFC 1857]: https://github.com/rust-lang/rfcs/blob/master/text/1857-stabilize-drop-order.md -[struct]: types.html#struct-types -[tuple]: types.html#tuple-types -[enum variant]: types.html#enumerated-types -[array]: types.html#array-and-slice-types -[closure]: types.html#closure-types [Trait objects]: types.html#trait-objects -[`std::ptr::drop_in_place`]: ../std/ptr/fn.drop_in_place.html -[`std::mem::forget`]: ../std/mem/fn.forget.html [`std::mem::ManuallyDrop`]: ../std/mem/struct.ManuallyDrop.html +[`std::mem::forget`]: ../std/mem/fn.forget.html +[`std::ops::Drop::drop`]: ../std/ops/trait.Drop.html +[`std::ptr::drop_in_place`]: ../std/ptr/fn.drop_in_place.html +[array]: types.html#array-and-slice-types +[closure]: types.html#closure-types +[enum variant]: types.html#enumerated-types +[initialized]: glossary.html#initialized +[struct]: types.html#struct-types +[temporary]: expressions.html#temporary-lifetimes +[tuple]: types.html#tuple-types +[variable]: variables.html diff --git a/src/dynamically-sized-types.md b/src/dynamically-sized-types.md index 6cc3911da5..c8f2607670 100644 --- a/src/dynamically-sized-types.md +++ b/src/dynamically-sized-types.md @@ -23,10 +23,10 @@ types">DSTs. Such types can only be used in certain cases: Notably: [variables], function parameters, [const] and [static] items must be `Sized`. -[sized]: special-types-and-traits.html#sized -[Slices]: types.html#array-and-slice-types -[trait objects]: types.html#trait-objects [Pointer types]: types.html#pointer-types -[variables]: variables.html +[Slices]: types.html#array-and-slice-types [const]: items/constant-items.html +[sized]: special-types-and-traits.html#sized [static]: items/static-items.html +[trait objects]: types.html#trait-objects +[variables]: variables.html diff --git a/src/expressions.md b/src/expressions.md index 9e4539769f..3d0e7018d4 100644 --- a/src/expressions.md +++ b/src/expressions.md @@ -272,73 +272,69 @@ Many of the following operators and expressions can also be overloaded for other types using traits in `std::ops` or `std::cmp`. These traits also exist in `core::ops` and `core::cmp` with the same names. -[block expressions]: expressions/block-expr.html -[call expressions]: expressions/call-expr.html -[closure expressions]: expressions/closure-expr.html -[enum variant]: expressions/enum-variant-expr.html -[field]: expressions/field-expr.html -[grouped]: expressions/grouped-expr.html -[literals]: expressions/literal-expr.html -[match]: expressions/match-expr.html -[method-call]: expressions/method-call-expr.html -[paths]: expressions/path-expr.html -[range expressions]: expressions/range-expr.html -[struct]: expressions/struct-expr.html -[tuple expressions]: expressions/tuple-expr.html - -[array expressions]: expressions/array-expr.html -[array indexing]: expressions/array-expr.html#array-and-slice-indexing-expressions - -[arithmetic, logical]: expressions/operator-expr.html#arithmetic-and-logical-binary-operators -[assign]: expressions/operator-expr.html#assignment-expressions -[borrow]: expressions/operator-expr.html#borrow-operators -[cast]: expressions/operator-expr.html#type-cast-expressions -[comparison]: expressions/operator-expr.html#comparison-operators -[compound assignment]: expressions/operator-expr.html#compound-assignment-expressions -[dereferences]: expressions/operator-expr.html#the-dereference-operator -[dereferencing]: expressions/operator-expr.html#the-dereference-operator +[Mutable `static` items]: items/static-items.html#mutable-statics +[Temporary values]: #temporary-lifetimes +[Variables]: variables.html +[_ArrayExpression_]: expressions/array-expr.html +[_BlockExpression_]: expressions/block-expr.html +[_BreakExpression_]: expressions/loop-expr.html#break-expressions +[_CallExpression_]: expressions/call-expr.html +[_ClosureExpression_]: expressions/closure-expr.html +[_ContinueExpression_]: expressions/loop-expr.html#continue-expressions +[_EnumerationVariantExpression_]: expressions/enum-variant-expr.html +[_FieldExpression_]: expressions/field-expr.html +[_GroupedExpression_]: expressions/grouped-expr.html +[_IfExpression_]: expressions/if-expr.html#if-expressions +[_IfLetExpression_]: expressions/if-expr.html#if-let-expressions +[_IndexExpression_]: expressions/array-expr.html#array-and-slice-indexing-expressions +[_LiteralExpression_]: expressions/literal-expr.html +[_LoopExpression_]: expressions/loop-expr.html +[_MatchExpression_]: expressions/match-expr.html +[_MethodCallExpression_]: expressions/method-call-expr.html +[_OperatorExpression_]: expressions/operator-expr.html +[_PathExpression_]: expressions/path-expr.html +[_RangeExpression_]: expressions/range-expr.html +[_ReturnExpression_]: expressions/return-expr.html +[_StructExpression_]: expressions/struct-expr.html +[_TupleExpression_]: expressions/tuple-expr.html +[_TupleIndexingExpression_]: expressions/tuple-expr.html#tuple-indexing-expressions +[`Box`]: ../std/boxed/struct.Box.html +[`Copy`]: special-types-and-traits.html#copy +[`Drop`]: special-types-and-traits.html#drop +[`Sized`]: special-types-and-traits.html#sized +[arithmetic, logical]: expressions/operator-expr.html#arithmetic-and-logical-binary-operators +[array expressions]: expressions/array-expr.html +[array indexing]: expressions/array-expr.html#array-and-slice-indexing-expressions +[assign]: expressions/operator-expr.html#assignment-expressions +[block expressions]: expressions/block-expr.html +[borrow]: expressions/operator-expr.html#borrow-operators +[call expressions]: expressions/call-expr.html +[cast]: expressions/operator-expr.html#type-cast-expressions +[closure expressions]: expressions/closure-expr.html +[comparison]: expressions/operator-expr.html#comparison-operators +[compound assignment]: expressions/operator-expr.html#compound-assignment-expressions +[constants]: items/constant-items.html [dereference operator]: expressions/operator-expr.html#the-dereference-operator -[lazy boolean]: expressions/operator-expr.html#lazy-boolean-operators -[negation]: expressions/operator-expr.html#negation-operators -[overflow]: expressions/operator-expr.html#overflow - +[dereferences]: expressions/operator-expr.html#the-dereference-operator +[dereferencing]: expressions/operator-expr.html#the-dereference-operator +[destructors]: destructors.html +[enum variant]: expressions/enum-variant-expr.html +[field]: expressions/field-expr.html [functions]: items/functions.html -[constants]: items/constant-items.html -[destructors]: destructors.html -[interior mutability]: interior-mutability.html -[`Box`]: ../std/boxed/struct.Box.html -[`Copy`]: special-types-and-traits.html#copy -[`Drop`]: special-types-and-traits.html#drop -[`Sized`]: special-types-and-traits.html#sized -[implicit borrow]: #implicit-borrows +[grouped]: expressions/grouped-expr.html +[implicit borrow]: #implicit-borrows [implicitly mutably borrowed]: #implicit-borrows -[let]: statements.html#let-statements -[Mutable `static` items]: items/static-items.html#mutable-statics -[slice]: types.html#array-and-slice-types -[static variables]: items/static-items.html -[Temporary values]: #temporary-lifetimes -[Variables]: variables.html - -[_ArrayExpression_]: expressions/array-expr.html -[_BlockExpression_]: expressions/block-expr.html -[_BreakExpression_]: expressions/loop-expr.html#break-expressions -[_CallExpression_]: expressions/call-expr.html -[_ClosureExpression_]: expressions/closure-expr.html -[_ContinueExpression_]: expressions/loop-expr.html#continue-expressions -[_EnumerationVariantExpression_]: expressions/enum-variant-expr.html -[_FieldExpression_]: expressions/field-expr.html -[_GroupedExpression_]: expressions/grouped-expr.html -[_IfExpression_]: expressions/if-expr.html#if-expressions -[_IfLetExpression_]: expressions/if-expr.html#if-let-expressions -[_IndexExpression_]: expressions/array-expr.html#array-and-slice-indexing-expressions -[_LiteralExpression_]: expressions/literal-expr.html -[_LoopExpression_]: expressions/loop-expr.html -[_MatchExpression_]: expressions/match-expr.html -[_MethodCallExpression_]: expressions/method-call-expr.html -[_OperatorExpression_]: expressions/operator-expr.html -[_PathExpression_]: expressions/path-expr.html -[_RangeExpression_]: expressions/range-expr.html -[_ReturnExpression_]: expressions/return-expr.html -[_StructExpression_]: expressions/struct-expr.html -[_TupleExpression_]: expressions/tuple-expr.html -[_TupleIndexingExpression_]: expressions/tuple-expr.html#tuple-indexing-expressions +[interior mutability]: interior-mutability.html +[lazy boolean]: expressions/operator-expr.html#lazy-boolean-operators +[let]: statements.html#let-statements +[literals]: expressions/literal-expr.html +[match]: expressions/match-expr.html +[method-call]: expressions/method-call-expr.html +[negation]: expressions/operator-expr.html#negation-operators +[overflow]: expressions/operator-expr.html#overflow +[paths]: expressions/path-expr.html +[range expressions]: expressions/range-expr.html +[slice]: types.html#array-and-slice-types +[static variables]: items/static-items.html +[struct]: expressions/struct-expr.html +[tuple expressions]: expressions/tuple-expr.html diff --git a/src/expressions/array-expr.md b/src/expressions/array-expr.md index 3f06bddd18..36c06e040d 100644 --- a/src/expressions/array-expr.md +++ b/src/expressions/array-expr.md @@ -69,13 +69,13 @@ arr[10]; // warning: index out of bounds The array index expression can be implemented for types other than arrays and slices by implementing the [`Index`] and [`IndexMut`] traits. +[Array and slice]: ../types.html#array-and-slice-types [_Expression_]: /expressions.html -[memory location]: /expressions.html#place-expressions-and-value-expressions -[`Index`]: ../../std/ops/trait.Index.html +[`Copy`]: ../special-types-and-traits.html#copy [`IndexMut`]: ../../std/ops/trait.IndexMut.html +[`Index`]: ../../std/ops/trait.Index.html +[array]: ../types.html#array-and-slice-types [constant expression]: ../expressions.html#constant-expressions -[literal]: ../tokens.html#literals -[Array and slice]: ../types.html#array-and-slice-types [constant item]: ../items/constant-items.htm -[`Copy`]: ../special-types-and-traits.html#copy -[array]: ../types.html#array-and-slice-types +[literal]: ../tokens.html#literals +[memory location]: /expressions.html#place-expressions-and-value-expressions diff --git a/src/expressions/block-expr.md b/src/expressions/block-expr.md index 2dfff279ec..2d4e37f648 100644 --- a/src/expressions/block-expr.md +++ b/src/expressions/block-expr.md @@ -75,14 +75,14 @@ fn is_unix_platform() -> bool { } ``` +[_Expression_]: ../expressions.html [_InnerAttribute_]: ../attributes.html [_Statement_]: ../statements.html -[_Expression_]: ../expressions.html +[`cfg`]: ../attributes.html#conditional-compilation +[expression statement]: ../statements.html#expression-statements [expression]: ../expressions.html -[statements]: ../statements.html -[value expressions]: ../expressions.html#place-expressions-and-value-expressions -[outer attributes]: ../attributes.html [inner attributes]: ../attributes.html -[expression statement]: ../statements.html#expression-statements -[`cfg`]: ../attributes.html#conditional-compilation +[outer attributes]: ../attributes.html +[statements]: ../statements.html [the lint check attributes]: ../attributes.html#lint-check-attributes +[value expressions]: ../expressions.html#place-expressions-and-value-expressions diff --git a/src/expressions/call-expr.md b/src/expressions/call-expr.md index 895ca31d0a..ace9341ab0 100644 --- a/src/expressions/call-expr.md +++ b/src/expressions/call-expr.md @@ -93,9 +93,9 @@ fn main() { Refer to [RFC 132] for further details and motivations. -[`std::ops::Fn`]: ../../std/ops/trait.Fn.html +[RFC 132]: https://github.com/rust-lang/rfcs/blob/master/text/0132-ufcs.md +[_Expression_]: ../expressions.html [`std::ops::FnMut`]: ../../std/ops/trait.FnMut.html [`std::ops::FnOnce`]: ../../std/ops/trait.FnOnce.html -[RFC 132]: https://github.com/rust-lang/rfcs/blob/master/text/0132-ufcs.md +[`std::ops::Fn`]: ../../std/ops/trait.Fn.html [non-function types]: ../types.html#function-item-types -[_Expression_]: ../expressions.html diff --git a/src/expressions/closure-expr.md b/src/expressions/closure-expr.md index db465688e3..e2c2867a46 100644 --- a/src/expressions/closure-expr.md +++ b/src/expressions/closure-expr.md @@ -59,13 +59,13 @@ let word = "konnichiwa".to_owned(); ten_times(move |j| println!("{}, {}", word, j)); ``` -[block]: block-expr.html -[function definitions]: ../items/functions.html -[_Expression_]: ../expressions.html [_BlockExpression_]: block-expr.html -[_TypeNoBounds_]: ../types.html +[_Expression_]: ../expressions.html [_FunctionParameters_]: ../items/functions.html -[infers]: ../types.html#capture-modes -[closure traits]: ../types.html#call-traits-and-coercions +[_TypeNoBounds_]: ../types.html [`Send`]: ../special-types-and-traits.html#send [`Sync`]: ../special-types-and-traits.html#sync +[block]: block-expr.html +[closure traits]: ../types.html#call-traits-and-coercions +[function definitions]: ../items/functions.html +[infers]: ../types.html#capture-modes diff --git a/src/expressions/field-expr.md b/src/expressions/field-expr.md index 2da05e8ed6..bf7ddc16bc 100644 --- a/src/expressions/field-expr.md +++ b/src/expressions/field-expr.md @@ -45,11 +45,11 @@ let c: &String = &x.f2; // Can borrow again let d: String = x.f3; // Move out of x.f3 ``` -[_Expression_]: ../expressions.html [IDENTIFIER]: ../identifiers.html +[_Expression_]: ../expressions.html +[`Drop`]: ../special-types-and-traits.html#drop [method call expression]: method-call-expr.html +[mutable]: ../expressions.html#mutability +[place expression]: ../expressions.html#place-expressions-and-value-expressions [struct]: ../items/structs.html [union]: ../items/unions.html -[place expression]: ../expressions.html#place-expressions-and-value-expressions -[mutable]: ../expressions.html#mutability -[`Drop`]: ../special-types-and-traits.html#drop diff --git a/src/expressions/if-expr.md b/src/expressions/if-expr.md index e6d25f0ad5..19ad60edff 100644 --- a/src/expressions/if-expr.md +++ b/src/expressions/if-expr.md @@ -92,5 +92,5 @@ let a = if let Some(1) = x { assert_eq!(a, 3); ``` -[_Expression_]: ../expressions.html [_BlockExpression_]: block-expr.html +[_Expression_]: ../expressions.html diff --git a/src/expressions/literal-expr.md b/src/expressions/literal-expr.md index f6b6b0f2a5..3924b4e138 100644 --- a/src/expressions/literal-expr.md +++ b/src/expressions/literal-expr.md @@ -21,13 +21,13 @@ It directly describes a number, character, string, or boolean value. 5; // integer type ``` -[CHAR_LITERAL]: ../tokens.html#character-literals -[STRING_LITERAL]: ../tokens.html#string-literals -[RAW_STRING_LITERAL]: ../tokens.html#raw-string-literals +[BOOLEAN_LITERAL]: ../tokens.html#boolean-literals [BYTE_LITERAL]: ../tokens.html#byte-literals [BYTE_STRING_LITERAL]: ../tokens.html#byte-string-literals -[RAW_BYTE_STRING_LITERAL]: ../tokens.html#raw-byte-string-literals -[INTEGER_LITERAL]: ../tokens.html#integer-literals +[CHAR_LITERAL]: ../tokens.html#character-literals [FLOAT_LITERAL]: ../tokens.html#floating-point-literals -[BOOLEAN_LITERAL]: ../tokens.html#boolean-literals +[INTEGER_LITERAL]: ../tokens.html#integer-literals +[RAW_BYTE_STRING_LITERAL]: ../tokens.html#raw-byte-string-literals +[RAW_STRING_LITERAL]: ../tokens.html#raw-string-literals +[STRING_LITERAL]: ../tokens.html#string-literals [literal]: ../tokens.html#literals diff --git a/src/expressions/loop-expr.md b/src/expressions/loop-expr.md index df7a6af22a..bf62caa425 100644 --- a/src/expressions/loop-expr.md +++ b/src/expressions/loop-expr.md @@ -203,20 +203,20 @@ and the `loop` must have a type compatible with each `break` expression. expression `()`. [IDENTIFIER]: ../identifiers.html -[_Expression_]: ../expressions.html -[_BlockExpression_]: block-expr.html [LIFETIME_OR_LABEL]: ../tokens.html#lifetimes-and-loop-labels -[_LoopLabel_]: #loop-labels +[_BlockExpression_]: block-expr.html +[_Expression_]: ../expressions.html [_InfiniteLoopExpression_]: #infinite-loops +[_IteratorLoopExpression_]: #iterator-loops +[_LoopLabel_]: #loop-labels [_PredicateLoopExpression_]: #predicate-loops [_PredicatePatternLoopExpression_]: #predicate-pattern-loops -[_IteratorLoopExpression_]: #iterator-loops -[`loop` expression]: #infinite-loops -[`while` expression]: #predicate-loops -[`while let` expression`]: #predicate-pattern-loops -[`for` expression]: #iterator-loops +[`!`]: ../types.html#never-type [`break` expressions]: #break-expressions [`continue` expressions]: #continue-expressions +[`for` expression]: #iterator-loops +[`loop` expression]: #infinite-loops +[`while let` expression`]: #predicate-pattern-loops +[`while` expression]: #predicate-loops [labels]: #loop-labels [loop values]: #break-and-loop-values -[`!`]: ../types.html#never-type diff --git a/src/expressions/match-expr.md b/src/expressions/match-expr.md index b832b5d515..b87c5bcbc4 100644 --- a/src/expressions/match-expr.md +++ b/src/expressions/match-expr.md @@ -201,14 +201,14 @@ let message = match maybe_digit { Outer attributes are allowed on match arms. The only attributes that have meaning on match arms are [`cfg`], `cold`, and the [lint check attributes]. -[_Expression_]: ../expressions.html [_BlockExpression_]: block-expr.html#block-expressions -[place expression]: ../expressions.html#place-expressions-and-value-expressions -[value expression]: ../expressions.html#place-expressions-and-value-expressions -[`char`]: ../types.html#textual-types -[numeric types]: ../types.html#numeric-types +[_Expression_]: ../expressions.html [_InnerAttribute_]: ../attributes.html [_OuterAttribute_]: ../attributes.html [`cfg`]: ../attributes.html#conditional-compilation +[`char`]: ../types.html#textual-types [lint check attributes]: ../attributes.html#lint-check-attributes +[numeric types]: ../types.html#numeric-types +[place expression]: ../expressions.html#place-expressions-and-value-expressions [range]: range-expr.html +[value expression]: ../expressions.html#place-expressions-and-value-expressions diff --git a/src/expressions/method-call-expr.md b/src/expressions/method-call-expr.md index 37f542eb45..54b52ed364 100644 --- a/src/expressions/method-call-expr.md +++ b/src/expressions/method-call-expr.md @@ -94,12 +94,12 @@ method and you'll be fine. [IDENTIFIER]: ../identifiers.html -[visible]: ../visibility-and-privacy.html [array]: ../types.html#array-and-slice-types -[trait objects]: ../types.html#trait-objects +[dereference]: operator-expr.html#the-dereference-operator [disambiguate call]: call-expr.html#disambiguating-function-calls [disambiguating function call syntax]: call-expr.html#disambiguating-function-calls -[dereference]: operator-expr.html#the-dereference-operator [methods]: ../items/associated-items.html#methods -[unsized coercion]: ../type-coercions.html#unsized-coercions [trait object]: ../types.html#trait-objects +[trait objects]: ../types.html#trait-objects +[unsized coercion]: ../type-coercions.html#unsized-coercions +[visible]: ../visibility-and-privacy.html diff --git a/src/expressions/operator-expr.md b/src/expressions/operator-expr.md index dc452ff044..711dfa7275 100644 --- a/src/expressions/operator-expr.md +++ b/src/expressions/operator-expr.md @@ -438,26 +438,24 @@ x += 4; assert_eq!(x, 14); ``` -[place expression]: ../expressions.html#place-expressions-and-value-expressions -[value expression]: ../expressions.html#place-expressions-and-value-expressions -[temporary value]: ../expressions.html#temporary-lifetimes -[float-int]: https://github.com/rust-lang/rust/issues/10184 -[float-float]: https://github.com/rust-lang/rust/issues/15536 -[`unit` type]: ../types.html#tuple-types -[_BorrowExpression_]: #borrow-operators -[_DereferenceExpression_]: #the-dereference-operator -[_ErrorPropagationExpression_]: #the-question-mark-operator -[_NegationExpression_]: #negation-operators [_ArithmeticOrLogicalExpression_]: #arithmetic-and-logical-binary-operators -[_ComparisonExpression_]: #comparison-operators -[_LazyBooleanExpression_]: #lazy-boolean-operators -[_TypeCastExpression_]: #type-cast-expressions [_AssignmentExpression_]: #assignment-expressions +[_BorrowExpression_]: #borrow-operators +[_ComparisonExpression_]: #comparison-operators [_CompoundAssignmentExpression_]: #compound-assignment-expressions +[_DereferenceExpression_]: #the-dereference-operator +[_ErrorPropagationExpression_]: #the-question-mark-operator [_Expression_]: ../expressions.html +[_LazyBooleanExpression_]: #lazy-boolean-operators +[_NegationExpression_]: #negation-operators [_PathInExpression_]: ../paths.html -[lazy operators]: #lazy-boolean-operators +[_TypeCastExpression_]: #type-cast-expressions +[`unit` type]: ../types.html#tuple-types [drops]: ../destructors.html [either copies or moves]: ../expressions.html#moved-and-copied-types -[float-int]: https://github.com/rust-lang/rust/issues/10184 [float-float]: https://github.com/rust-lang/rust/issues/15536 +[float-int]: https://github.com/rust-lang/rust/issues/10184 +[lazy operators]: #lazy-boolean-operators +[place expression]: ../expressions.html#place-expressions-and-value-expressions +[temporary value]: ../expressions.html#temporary-lifetimes +[value expression]: ../expressions.html#place-expressions-and-value-expressions diff --git a/src/expressions/path-expr.md b/src/expressions/path-expr.md index 9b748a686f..b23fd2cbaa 100644 --- a/src/expressions/path-expr.md +++ b/src/expressions/path-expr.md @@ -19,8 +19,8 @@ let push_integer = Vec::::push; let slice_reverse = <[i32]>::reverse; ``` -[place expressions]: ../expressions.html#place-expressions-and-value-expressions -[value expressions]: ../expressions.html#place-expressions-and-value-expressions -[path]: ../paths.html [`static mut`]: ../items/static-items.html#mutable-statics [`unsafe` block]: block-expr.html#unsafe-blocks +[path]: ../paths.html +[place expressions]: ../expressions.html#place-expressions-and-value-expressions +[value expressions]: ../expressions.html#place-expressions-and-value-expressions diff --git a/src/expressions/range-expr.md b/src/expressions/range-expr.md index fb8d75fb87..8e7cb0b7c0 100644 --- a/src/expressions/range-expr.md +++ b/src/expressions/range-expr.md @@ -69,9 +69,9 @@ for i in 1..11 { ``` [_Expression_]: ../expressions.html -[std::ops::Range]: ../../std/ops/struct.Range.html [std::ops::RangeFrom]: ../../std/ops/struct.RangeFrom.html -[std::ops::RangeTo]: ../../std/ops/struct.RangeTo.html [std::ops::RangeFull]: ../../std/ops/struct.RangeFull.html [std::ops::RangeInclusive]: ../../std/ops/struct.RangeInclusive.html [std::ops::RangeToInclusive]: ../../std/ops/struct.RangeToInclusive.html +[std::ops::RangeTo]: ../../std/ops/struct.RangeTo.html +[std::ops::Range]: ../../std/ops/struct.Range.html diff --git a/src/expressions/struct-expr.md b/src/expressions/struct-expr.md index a04b979049..579efba1a8 100644 --- a/src/expressions/struct-expr.md +++ b/src/expressions/struct-expr.md @@ -75,11 +75,11 @@ Point3d { x, y: y_value, z }; ``` [IDENTIFIER]: ../identifiers.html -[path]: ../paths.html -[loop]: loop-expr.html -[if]: if-expr.html#if-expressions [if let]: if-expr.html#if-let-expressions +[if]: if-expr.html#if-expressions +[loop]: loop-expr.html [match]: match-expr.html +[path]: ../paths.html [struct item]: ../items/structs.html -[visible]: ../visibility-and-privacy.html [union]: ../items/unions.html +[visible]: ../visibility-and-privacy.html diff --git a/src/identifiers.md b/src/identifiers.md index f9bddd2fa4..20969732a2 100644 --- a/src/identifiers.md +++ b/src/identifiers.md @@ -21,5 +21,5 @@ Or * The identifier is more than one character. `_` alone is not an identifier. * The remaining characters are alphanumeric or `_`. -[strict]: keywords.html#strict-keywords [reserved]: keywords.html#reserved-keywords +[strict]: keywords.html#strict-keywords diff --git a/src/interior-mutability.md b/src/interior-mutability.md index ae2ec76045..035b41db66 100644 --- a/src/interior-mutability.md +++ b/src/interior-mutability.md @@ -20,9 +20,9 @@ borrow checks to ensure the usual rules around multiple references. The accessed with atomic operations, allowing the value to be shared and mutated across threads. -[shared reference]: types.html#shared-references- -[ub]: behavior-considered-undefined.html -[`std::mem::transmute`]: ../std/mem/fn.transmute.html -[`std::cell::UnsafeCell`]: ../std/cell/struct.UnsafeCell.html [`std::cell::RefCell`]: ../std/cell/struct.RefCell.html +[`std::cell::UnsafeCell`]: ../std/cell/struct.UnsafeCell.html +[`std::mem::transmute`]: ../std/mem/fn.transmute.html [`std::sync::atomic`]: ../std/sync/atomic/index.html +[shared reference]: types.html#shared-references- +[ub]: behavior-considered-undefined.html diff --git a/src/introduction.md b/src/introduction.md index 4f2e79e3bf..20fe7d7bc9 100644 --- a/src/introduction.md +++ b/src/introduction.md @@ -38,9 +38,9 @@ N. B. This document may be incomplete. Documenting everything might take a while. We have a [big issue] to track documentation for every Rust feature, so check that out if you can't find something here. +[Unstable Book]: https://doc.rust-lang.org/nightly/unstable-book/ +[big issue]: https://github.com/rust-lang-nursery/reference/issues/9 [book]: ../book/index.html -[standard]: ../std/index.html [grammar]: ../grammar.html +[standard]: ../std/index.html [the Rust Reference repository]: https://github.com/rust-lang-nursery/reference/ -[big issue]: https://github.com/rust-lang-nursery/reference/issues/9 -[Unstable Book]: https://doc.rust-lang.org/nightly/unstable-book/ diff --git a/src/items-and-attributes.md b/src/items-and-attributes.md index bd5018d69c..2ad4ee8afe 100644 --- a/src/items-and-attributes.md +++ b/src/items-and-attributes.md @@ -3,5 +3,5 @@ Crates contain [items], each of which may have some number of [attributes] attached to it. -[items]: items.html [attributes]: attributes.html +[items]: items.html diff --git a/src/items.md b/src/items.md index 9514704bbb..0cbc33b431 100644 --- a/src/items.md +++ b/src/items.md @@ -34,18 +34,18 @@ qualified by the name of the enclosing item, or is private to the enclosing item (in the case of functions). The grammar specifies the exact locations in which sub-item declarations may appear. -[modules]: items/modules.html -[paths]: paths.html -[modules]: items/modules.html [`extern crate` declarations]: items/extern-crates.html +[`extern` blocks]: items/external-blocks.html [`use` declarations]: items/use-declarations.html -[function definitions]: items/functions.html -[type definitions]: items/type-aliases.html -[struct definitions]: items/structs.html -[enumeration definitions]: items/enumerations.html -[union definitions]: items/unions.html [constant items]: items/constant-items.html +[enumeration definitions]: items/enumerations.html +[function definitions]: items/functions.html +[implementations]: items/implementations.html +[modules]: items/modules.html +[modules]: items/modules.html +[paths]: paths.html [static items]: items/static-items.html +[struct definitions]: items/structs.html [trait definitions]: items/traits.html -[implementations]: items/implementations.html -[`extern` blocks]: items/external-blocks.html +[type definitions]: items/type-aliases.html +[union definitions]: items/unions.html diff --git a/src/items/associated-items.md b/src/items/associated-items.md index dd37c6013c..fe7e433cc4 100644 --- a/src/items/associated-items.md +++ b/src/items/associated-items.md @@ -264,21 +264,21 @@ fn main() { } ``` -[trait]: traits.html -[traits]: traits.html -[type aliases]: type-aliases.html -[inherent implementations]: implementations.html#inherent-implementations -[identifier]: ../identifiers.html -[trait object]: ../types.html#trait-objects -[implementations]: implementations.html -[type]: ../types.html -[constants]: constant-items.html +[associated constants]: #associated-constants +[associated functions]: #associated-functions-and-methods +[associated types]: #associated-types +[block]: ../expressions/block-expr.html [constant item]: constant-items.html -[functions]: functions.html +[constants]: constant-items.html [function item]: ../types.html#function-item-types +[functions]: functions.html +[identifier]: ../identifiers.html +[implementations]: implementations.html +[inherent implementations]: implementations.html#inherent-implementations [method call operator]: ../expressions/method-call-expr.html -[block]: ../expressions/block-expr.html [path]: ../paths.html -[associated functions]: #associated-functions-and-methods -[associated types]: #associated-types -[associated constants]: #associated-constants +[trait object]: ../types.html#trait-objects +[trait]: traits.html +[traits]: traits.html +[type aliases]: type-aliases.html +[type]: ../types.html diff --git a/src/items/constant-items.md b/src/items/constant-items.md index 02beabec54..bdc7044186 100644 --- a/src/items/constant-items.md +++ b/src/items/constant-items.md @@ -60,9 +60,9 @@ fn create_and_drop_zero_with_destructor() { } ``` -[constant value]: ../expressions.html#constant-expressions -[static lifetime elision]: ../lifetime-elision.html#static-lifetime-elision -[`Drop`]: ../special-types-and-traits.html#drop [IDENTIFIER]: ../identifiers.html -[_Type_]: ../types.html [_Expression_]: ../expressions.html +[_Type_]: ../types.html +[`Drop`]: ../special-types-and-traits.html#drop +[constant value]: ../expressions.html#constant-expressions +[static lifetime elision]: ../lifetime-elision.html#static-lifetime-elision diff --git a/src/items/enumerations.md b/src/items/enumerations.md index e34152f720..d1b4e0b164 100644 --- a/src/items/enumerations.md +++ b/src/items/enumerations.md @@ -132,15 +132,15 @@ enum ZeroVariants {} ``` [IDENTIFIER]: ../identifiers.html -[_Generics_]: generics.html -[_WhereClause_]: generics.html#where-clauses [_Expression_]: ../expressions.html -[_TupleFields_]: structs.html +[_Generics_]: generics.html [_StructFields_]: structs.html -[enumerated type]: ../types.html#enumerated-types +[_TupleFields_]: structs.html +[_WhereClause_]: generics.html#where-clauses +[`C` representation]: ../type-layout.html#the-c-representation [`mem::discriminant`]: ../../std/mem/fn.discriminant.html -[numeric cast]: ../expressions/operator-expr.html#semantics [`repr` attribute]: ../attributes.html#ffi-attributes [default representation]: ../type-layout.html#the-default-representation +[enumerated type]: ../types.html#enumerated-types +[numeric cast]: ../expressions/operator-expr.html#semantics [primitive representation]: ../type-layout.html#primitive-representations -[`C` representation]: ../type-layout.html#the-c-representation diff --git a/src/items/extern-crates.md b/src/items/extern-crates.md index a1fbde2d1b..8bd6f34c88 100644 --- a/src/items/extern-crates.md +++ b/src/items/extern-crates.md @@ -38,5 +38,5 @@ Here is an example: extern crate hello_world; // hyphen replaced with an underscore ``` -[RFC 940]: https://github.com/rust-lang/rfcs/blob/master/text/0940-hyphens-considered-harmful.md [IDENTIFIER]: ../identifiers.html +[RFC 940]: https://github.com/rust-lang/rfcs/blob/master/text/0940-hyphens-considered-harmful.md diff --git a/src/items/functions.md b/src/items/functions.md index 353c7008a7..c323966e74 100644 --- a/src/items/functions.md +++ b/src/items/functions.md @@ -130,11 +130,11 @@ fn test_only() { > Note: Except for lints, it is idiomatic to only use outer attributes on > function items. -[external blocks]: external-blocks.html -[path]: ../paths.html -[block]: ../expressions/block-expr.html -[variables]: ../variables.html -[type]: ../types.html [*function item type*]: ../types.html#function-item-types [Trait]: traits.html [attributes]: ../attributes.html +[block]: ../expressions/block-expr.html +[external blocks]: external-blocks.html +[path]: ../paths.html +[type]: ../types.html +[variables]: ../variables.html diff --git a/src/items/generics.md b/src/items/generics.md index 7f23b0e1b6..080acef4ec 100644 --- a/src/items/generics.md +++ b/src/items/generics.md @@ -102,21 +102,21 @@ generic parameter. [IDENTIFIER]: ../identifiers.html [LIFETIME_OR_LABEL]: ../tokens.html#lifetimes-and-loop-labels +[Trait]: ../traits.html#trait-bounds [_LifetimeBounds_]: ../trait-bounds.html [_Lifetime_]: ../trait-bounds.html [_OuterAttribute_]: ../attributes.html -[_Type_]: ../types.html [_TypeParamBounds_]: ../trait-bounds.html -[arrays]: ../types.html#array-and-slice-types -[function pointers]: ../types.html#function-pointer-types -[references]: ../types.html#shared-references- -[raw pointers]: ../types.html#raw-pointers-const-and-mut +[_TypePath_]: ../paths.html +[_Type_]: ../types.html [`Clone`]: ../special-types-and-traits.html#clone [`Copy`]: ../special-types-and-traits.html#copy [`Sized`]: ../special-types-and-traits.html#sized -[tuples]: ../types.html#tuple-types -[trait object]: ../types.html#trait-objects +[arrays]: ../types.html#array-and-slice-types [attributes]: ../attributes.html +[function pointers]: ../types.html#function-pointer-types [path]: ../paths.html -[Trait]: ../traits.html#trait-bounds -[_TypePath_]: ../paths.html +[raw pointers]: ../types.html#raw-pointers-const-and-mut +[references]: ../types.html#shared-references- +[trait object]: ../types.html#trait-objects +[tuples]: ../types.html#tuple-types diff --git a/src/items/implementations.md b/src/items/implementations.md index 3146ea2d8a..2cb9b09c07 100644 --- a/src/items/implementations.md +++ b/src/items/implementations.md @@ -144,9 +144,9 @@ attributes must come before any associated items. That attributes that have meaning here are [`cfg`], [`deprecated`], [`doc`], and [the lint check attributes]. -[trait]: traits.html -[attributes]: ../attributes.html [`cfg`]: ../attributes.html#conditional-compilation [`deprecated`]: ../attributes.html#deprecation [`doc`]: ../attributes.html#documentation +[attributes]: ../attributes.html [the lint check attributes]: ../attributes.html#lint-check-attributes +[trait]: traits.html diff --git a/src/items/modules.md b/src/items/modules.md index 0c47038743..ea2930fae6 100644 --- a/src/items/modules.md +++ b/src/items/modules.md @@ -70,6 +70,6 @@ mod thread { [IDENTIFIER]: ../identifiers.html [_InnerAttribute_]: ../attributes.html -[_OuterAttribute_]: ../attributes.html [_Item_]: ../items.html +[_OuterAttribute_]: ../attributes.html [items]: ../items.html diff --git a/src/items/static-items.md b/src/items/static-items.md index d86abefca0..126fdd2920 100644 --- a/src/items/static-items.md +++ b/src/items/static-items.md @@ -68,10 +68,10 @@ following are true: * The single-address property of statics is required. * Interior mutability is required. -[constant]: ../items/constant-items.html +[IDENTIFIER]: ../identifiers.html +[_Expression_]: ../expressions.html +[_Type_]: ../types.html [`drop`]: ../destructors.html [constant expression]: ../expressions.html#constant-expressions +[constant]: ../items/constant-items.html [interior mutable]: ../interior-mutability.html -[IDENTIFIER]: ../identifiers.html -[_Type_]: ../types.html -[_Expression_]: ../expressions.html diff --git a/src/items/structs.md b/src/items/structs.md index 8f1449cdaf..23bb6aa909 100644 --- a/src/items/structs.md +++ b/src/items/structs.md @@ -75,12 +75,12 @@ let c = [Cookie, Cookie {}, Cookie, Cookie {}]; The precise memory layout of a struct is not specified. One can specify a particular layout using the [`repr` attribute]. -[`repr` attribute]: ../attributes.html#ffi-attributes -[_OuterAttribute_]: ../attributes.html [IDENTIFIER]: ../identifiers.html [_Generics_]: generics.html -[_WhereClause_]: items/generics.html#where-clauses -[_Visibility_]: ../visibility-and-privacy.html +[_OuterAttribute_]: ../attributes.html [_Type_]: ../types.html +[_Visibility_]: ../visibility-and-privacy.html +[_WhereClause_]: items/generics.html#where-clauses +[`repr` attribute]: ../attributes.html#ffi-attributes [struct type]: ../types.html#struct-types [tuple type]: ../types.html#tuple-types diff --git a/src/items/traits.md b/src/items/traits.md index 425f65768e..a3b6d584f3 100644 --- a/src/items/traits.md +++ b/src/items/traits.md @@ -115,16 +115,16 @@ let circle = Box::new(circle) as Box; let nonsense = circle.radius() * circle.area(); ``` -[bounds]: ../trait-bounds.html -[trait object]: ../types.html#trait-objects -[explicit]: ../expressions/operator-expr.html#type-cast-expressions [RFC 255]: https://github.com/rust-lang/rfcs/blob/master/text/0255-object-safety.md [associated items]: associated-items.html -[method]: associated-items.html#methods -[implementations]: implementations.html -[generics]: generics.html -[where clauses]: generics.html#where-clauses -[generic functions]: functions.html#generic-functions +[bounds]: ../trait-bounds.html +[constants]: associated-items.html#associated-constants +[explicit]: ../expressions/operator-expr.html#type-cast-expressions [functions]: associated-items.html#associated-functions-and-methods +[generic functions]: functions.html#generic-functions +[generics]: generics.html +[implementations]: implementations.html +[method]: associated-items.html#methods +[trait object]: ../types.html#trait-objects [types]: associated-items.html#associated-types -[constants]: associated-items.html#associated-constants +[where clauses]: generics.html#where-clauses diff --git a/src/items/type-aliases.md b/src/items/type-aliases.md index 66dfd3c711..0d942ef300 100644 --- a/src/items/type-aliases.md +++ b/src/items/type-aliases.md @@ -27,8 +27,8 @@ let _: F = E::A; // OK // let _: F = F::A; // Doesn't work ``` -[type]: ../types.html [IDENTIFIER]: ../identifiers.html [_Generics_]: generics.html -[_WhereClause_]: html#where-clauses [_Type_]: ../types.html +[_WhereClause_]: html#where-clauses +[type]: ../types.html diff --git a/src/items/unions.md b/src/items/unions.md index f7f15a36d8..929b7638b5 100644 --- a/src/items/unions.md +++ b/src/items/unions.md @@ -145,8 +145,8 @@ checking, etc etc etc). More detailed specification for unions, including unstable bits, can be found in [RFC 1897 "Unions v1.2"]. -[RFC 1897 "Unions v1.2"]: https://github.com/rust-lang/rfcs/pull/1897 [IDENTIFIER]: ../identifiers.html +[RFC 1897 "Unions v1.2"]: https://github.com/rust-lang/rfcs/pull/1897 [_Generics_]: html -[_WhereClause_]: html#where-clauses [_StructFields_]: html +[_WhereClause_]: html#where-clauses diff --git a/src/items/use-declarations.md b/src/items/use-declarations.md index 0d5d285396..dabde5fc52 100644 --- a/src/items/use-declarations.md +++ b/src/items/use-declarations.md @@ -121,7 +121,7 @@ fn main() {} [IDENTIFIER]: ../identifiers.html [_SimplePath_]: ../paths.html [_Visibility_]: ../visibility-and-privacy.html -[path]: ../paths.html -[modules]: modules.html -[blocks]: ../expressions/block-expr.html [`extern crate` declarations]: extern-crates.html +[blocks]: ../expressions/block-expr.html +[modules]: modules.html +[path]: ../paths.html diff --git a/src/keywords.md b/src/keywords.md index 9b67b21aea..573f39a36d 100644 --- a/src/keywords.md +++ b/src/keywords.md @@ -100,17 +100,17 @@ is possible to declare a variable or method with the name `union`. > KW_STATICLIFETIME : `'static`\ > KW_DYN : `dyn` -[items]: items.html -[Variables]: variables.html -[Type parameters]: types.html#type-parameters -[loop labels]: expressions/loop-expr.html#loop-labels +[Crates]: crates-and-source-files.html +[Macro placeholders]: macros-by-example.html [Macros]: macros.html +[Type parameters]: types.html#type-parameters +[Variables]: variables.html [attributes]: attributes.html -[Macro placeholders]: macros-by-example.html -[Crates]: crates-and-source-files.html +[items]: items.html +[loop labels]: expressions/loop-expr.html#loop-labels +[reserved]: #reserved-keywords +[strict]: #strict-keywords +[trait object]: types.html#trait-objects [union]: items/unions.html [variants]: items/enumerations.html -[trait object]: types.html#trait-objects -[strict]: #strict-keywords -[reserved]: #reserved-keywords [weak]: #weak-keywords diff --git a/src/lifetime-elision.md b/src/lifetime-elision.md index 8b4e139b6b..e5f584604c 100644 --- a/src/lifetime-elision.md +++ b/src/lifetime-elision.md @@ -169,14 +169,14 @@ const RESOLVED_MULTIPLE: &dyn Fn(&Foo, &Bar, &Baz) -> usize = .. const RESOLVED_STATIC: &dyn Fn(&Foo, &Bar) -> &Baz = .. ``` +[RFC 1156]: https://github.com/rust-lang/rfcs/blob/master/text/1156-adjust-default-object-bounds.md +[RFC 599]: https://github.com/rust-lang/rfcs/blob/master/text/0599-default-object-bound.md [closure trait]: types.html#closure-types [constant]: items/constant-items.html [function item]: types.html#function-item-types [function pointer]: types.html#function-pointer-types [implementation]: items/implementations.html -[RFC 599]: https://github.com/rust-lang/rfcs/blob/master/text/0599-default-object-bound.md -[RFC 1156]: https://github.com/rust-lang/rfcs/blob/master/text/1156-adjust-default-object-bounds.md [static]: items/static-items.html +[trait object lifetimes]: #default-trait-object-lifetimes [trait object]: types.html#trait-objects [type aliases]: items/type-aliases.html -[trait object lifetimes]: #default-trait-object-lifetimes diff --git a/src/linkage.md b/src/linkage.md index 840ca5a93d..ea87d08a54 100644 --- a/src/linkage.md +++ b/src/linkage.md @@ -202,5 +202,5 @@ a statically linked binary on MSVC you would execute: RUSTFLAGS='-C target-feature=+crt-static' cargo build --target x86_64-pc-windows-msvc ``` -[ffi]: ../book/ffi.html [cargo]: http://doc.crates.io/environment-variables.html#environment-variables-cargo-sets-for-build-scripts +[ffi]: ../book/ffi.html diff --git a/src/macros-by-example.md b/src/macros-by-example.md index a256db08d0..2d93ba4555 100644 --- a/src/macros-by-example.md +++ b/src/macros-by-example.md @@ -76,14 +76,14 @@ Rust syntax is restricted in two ways: requiring a distinctive token in front can solve the problem. [RFC 550]: https://github.com/rust-lang/rfcs/blob/master/text/0550-macro-future-proofing.md -[item]: items.html +[attribute]: attributes.html [block]: expressions/block-expr.html -[statement]: statements.html -[pattern]: expressions/match-expr.html [expression]: expressions.html -[type]: types.html [identifier]: identifiers.html +[item]: items.html [keyword]: keywords.html [path]: paths.html +[pattern]: expressions/match-expr.html +[statement]: statements.html [token]: tokens.html -[attribute]: attributes.html +[type]: types.html diff --git a/src/paths.md b/src/paths.md index 47e8453526..7d68f140cb 100644 --- a/src/paths.md +++ b/src/paths.md @@ -165,10 +165,10 @@ mod without { // ::without # fn main() {} ``` -[item]: items.html -[variable]: variables.html -[identifiers]: identifiers.html [expression]: expressions.html +[identifiers]: identifiers.html [implementations]: items/implementations.html +[item]: items.html [modules]: items/modules.html [use declarations]: items/use-declarations.html +[variable]: variables.html diff --git a/src/procedural-macros.md b/src/procedural-macros.md index 993bd0e445..668c1696a2 100644 --- a/src/procedural-macros.md +++ b/src/procedural-macros.md @@ -21,4 +21,4 @@ Finally, procedural macros must be in their own crate, with the `proc-macro` crate type. [derive]: attributes.html#derive -[procedural macros]: ../book/first-edition/procedural-macros.html \ No newline at end of file +[procedural macros]: ../book/first-edition/procedural-macros.html diff --git a/src/special-types-and-traits.md b/src/special-types-and-traits.md index 00240a7ab1..900ffec1c6 100644 --- a/src/special-types-and-traits.md +++ b/src/special-types-and-traits.md @@ -123,46 +123,45 @@ compile-time; that is, it's not a [dynamically sized type]. [Type parameters] are `Sized` by default. `Sized` is always implemented automatically by the compiler, not by [implementation items]. +[Arrays]: types.html#array-and-slice-types +[Function pointers]: types.html#function-pointer-types +[Methods]: items/associated-items.html#associated-functions-and-methods +[Numeric types]: types.html#numeric-types +[Raw pointers]: types.html#raw-pointers-const-and-mut +[Shared references]: types.html#shared-references- +[Tuples]: types.html#tuple-types +[Type parameters]: types.html#type-parameters +[`!`]: types.html#never-type [`Box`]: ../std/boxed/struct.Box.html [`Clone`]: ../std/clone/trait.Clone.html [`Copy`]: ../std/marker/trait.Copy.html -[`Deref`]: ../std/ops/trait.Deref.html [`DerefMut`]: ../std/ops/trait.DerefMut.html +[`Deref`]: ../std/ops/trait.Deref.html [`Drop`]: ../std/ops/trait.Drop.html [`RefUnwindSafe`]: ../std/panic/trait.RefUnwindSafe.html [`Send`]: ../std/marker/trait.Send.html [`Sized`]: ../std/marker/trait.Sized.html +[`Sync`]: ../std/marker/trait.Sync.html +[`UnwindSafe`]: ../std/panic/trait.UnwindSafe.html +[`static` items]: items/static-items.html [`std::cell::UnsafeCell`]: ../std/cell/struct.UnsafeCell.html [`std::cmp`]: ../std/cmp/index.html [`std::marker::PhantomData`]: ../std/marker/struct.PhantomData.html [`std::ops`]: ../std/ops/index.html -[`UnwindSafe`]: ../std/panic/trait.UnwindSafe.html -[`Sync`]: ../std/marker/trait.Sync.html - -[Arrays]: types.html#array-and-slice-types +[auto traits]: #auto-traits [call expressions]: expressions/call-expr.html [deref coercions]: type-coercions.html#coercion-types [dereference operator]: expressions/operator-expr.html#the-dereference-operator [destructor]: destructors.html [drop check]: ../nomicon/dropck.html [dynamically sized type]: dynamically-sized-types.html -[Function pointers]: types.html#function-pointer-types [function item types]: types.html#function-item-types [implementation items]: items/implementations.html [indexing expressions]: expressions/array-expr.html#array-and-slice-indexing-expressions [interior mutability]: interior-mutability.html -[Numeric types]: types.html#numeric-types -[Methods]: items/associated-items.html#associated-functions-and-methods [method resolution]: expressions/method-call-expr.html [operators]: expressions/operator-expr.html [orphan rules]: items/implementations.html#trait-implementation-coherence -[Raw pointers]: types.html#raw-pointers-const-and-mut -[`static` items]: items/static-items.html -[Shared references]: types.html#shared-references- [the standard library]: ../std/index.html [trait object]: types.html#trait-objects -[Tuples]: types.html#tuple-types -[Type parameters]: types.html#type-parameters [variance]: subtyping.html#variance -[`!`]: types.html#never-type -[auto traits]: #auto-traits diff --git a/src/statements.md b/src/statements.md index aefc92c139..41a00dcde8 100644 --- a/src/statements.md +++ b/src/statements.md @@ -94,16 +94,16 @@ if true { Statements accept [outer attributes]. The attributes that have meaning on a statement are [`cfg`], and [the lint check attributes]. +[`cfg`]: attributes.html#conditional-compilation [block]: expressions/block-expr.html +[canonical path]: paths.html#canonical-paths +[declaration statements]: #declaration-statements +[expression statements]: #expression-statements [expression]: expressions.html [function]: items/functions.html +[implementations]: items/implementations.html [item]: items.html [module]: items/modules.html -[canonical path]: paths.html#canonical-paths -[implementations]: items/implementations.html -[variables]: variables.html [outer attributes]: attributes.html -[`cfg`]: attributes.html#conditional-compilation [the lint check attributes]: attributes.html#lint-check-attributes -[declaration statements]: #declaration-statements -[expression statements]: #expression-statements +[variables]: variables.html diff --git a/src/subtyping.md b/src/subtyping.md index 1d42a83c81..e942263e86 100644 --- a/src/subtyping.md +++ b/src/subtyping.md @@ -82,8 +82,8 @@ struct Variance<'a, 'b, T, U: 'a> { } ``` +[Higher-ranked]: ../nomicon/hrtb.html [coercions]: type-coercions.html [function pointers]: types.html#function-pointer-types -[Higher-ranked]: ../nomicon/hrtb.html [lifetime bound]: types.html#trait-object-lifetime-bounds [trait objects]: types.html#trait-objects diff --git a/src/tokens.md b/src/tokens.md index d738c6dd92..6caacb0cb2 100644 --- a/src/tokens.md +++ b/src/tokens.md @@ -506,6 +506,7 @@ Lifetime parameters and [loop labels] use LIFETIME_OR_LABEL tokens. Any LIFETIME_TOKEN will be accepted by the lexer, and for example, can be used in macros. +<<<<<<< HEAD ## Punctuation Punctuation symbol tokens are listed here for completeness. Their individual @@ -572,42 +573,40 @@ them are referred to as "token trees" in [macros]. The three types of brackets | `(` `)` | Parentheses | +["Machine Types"]: types.html#machine-types [Operator expressions]: expressions/operator-expr.html -[unary operators]: expressions/operator-expr.html#borrow-operators -[binary operators]: expressions/operator-expr.html#arithmetic-and-logical-binary-operators -[tokens]: #tokens -[keywords]: keywords.html -[identifier]: identifiers.html -[tuples]: types.html#tuple-types -[tuple structs]: items/structs.html -[tuple variants]: items/enumerations.html [arith]: expressions/operator-expr.html#arithmetic-and-logical-binary-operators -[negation]: expressions/operator-expr.html#negation-operators -[lazy-bool]: expressions/operator-expr.html#lazy-boolean-operators -[compound]: expressions/operator-expr.html#compound-assignment-expressions -[comparison]: expressions/operator-expr.html#comparison-operators -[match]: expressions/match-expr.html -[field]: expressions/field-expr.html -[range]: expressions/range-expr.html -[trait bounds]: trait-bounds.html -[dereference]: expressions/operator-expr.html#the-dereference-operator -[raw pointers]: types.html#raw-pointers-const-and-mut -[macros]: macros-by-example.html +[array types]: types.html#array-and-slice-types +[assignment]: expressions/operator-expr.html#assignment-expressions [attributes]: attributes.html -[never type]: types.html#never-type +[binary operators]: expressions/operator-expr.html#arithmetic-and-logical-binary-operators [borrow]: expressions/operator-expr.html#borrow-operators -[references]: types.html#pointer-types [closures]: expressions/closure-expr.html -[assignment]: expressions/operator-expr.html#assignment-expressions +[comparison]: expressions/operator-expr.html#comparison-operators +[compound]: expressions/operator-expr.html#compound-assignment-expressions [constant items]: items/constant-items.html +[dereference]: expressions/operator-expr.html#the-dereference-operator +[extern]: items/external-blocks.html +[field]: expressions/field-expr.html +[functions]: items/functions.html [generics]: items/generics.html +[identifier]: identifiers.html +[keywords]: keywords.html +[lazy-bool]: expressions/operator-expr.html#lazy-boolean-operators +[loop labels]: expressions/loop-expr.html +[macros]: macros-by-example.html +[match]: expressions/match-expr.html +[never type]: types.html#never-type [paths]: paths.html -[array types]: types.html#array-and-slice-types -[functions]: items/functions.html [question]: expressions/operator-expr.html#the-question-mark-operator +[range]: expressions/range-expr.html +[raw pointers]: types.html#raw-pointers-const-and-mut +[references]: types.html#pointer-types [sized]: trait-bounds.html#sized -[extern]: items/external-blocks.html [struct expressions]: expressions/struct-expr.html +[tokens]: #tokens [tuple index]: expressions/tuple-expr.html#tuple-indexing-expressions -[loop labels]: expressions/loop-expr.html -["Machine Types"]: types.html#machine-types +[tuple structs]: items/structs.html +[tuple variants]: items/enumerations.html +[tuples]: types.html#tuple-types +[unary operators]: expressions/operator-expr.html#borrow-operators diff --git a/src/trait-bounds.md b/src/trait-bounds.md index 5da4536ba8..70c44d57ff 100644 --- a/src/trait-bounds.md +++ b/src/trait-bounds.md @@ -135,11 +135,11 @@ fn call_on_ref_zero(f: F) where F: for<'a> Fn(&'a i32) { ``` [LIFETIME_OR_LABEL]: tokens.html#lifetimes-and-loop-labels +[Trait]: items/traits.html#trait-bounds [_TraitPath_]: paths.html [`Sized`]: special-types-and-traits.html#sized [associated types]: items/associated-items.html#associated-types -[supertraits]: items/traits.html#supertraits [generic]: items/generics.html -[Trait]: items/traits.html#trait-bounds +[supertraits]: items/traits.html#supertraits [trait objects]: types.html#trait-objects [where clause]: items/generics.html#where-clauses diff --git a/src/type-coercions.md b/src/type-coercions.md index 8d4acf5f8e..888503df2c 100644 --- a/src/type-coercions.md +++ b/src/type-coercions.md @@ -179,8 +179,8 @@ unsized coercion to `Foo`. > has been stabilized, the traits themselves are not yet stable and therefore > can't be used directly in stable Rust. -[Unsize]: ../std/marker/trait.Unsize.html [CoerceUnsized]: ../std/ops/trait.CoerceUnsized.html -[RFC 401]: https://github.com/rust-lang/rfcs/blob/master/text/0401-coercions.md [RFC 1558]: https://github.com/rust-lang/rfcs/blob/master/text/1558-closure-to-fn-coercion.md +[RFC 401]: https://github.com/rust-lang/rfcs/blob/master/text/0401-coercions.md +[Unsize]: ../std/marker/trait.Unsize.html [unsized coercions]: #unsized-coercions diff --git a/src/type-layout.md b/src/type-layout.md index f9e2f8badf..c625abce3b 100644 --- a/src/type-layout.md +++ b/src/type-layout.md @@ -302,13 +302,13 @@ Like all ways to create undefined behavior in safe Rust, this is a bug. +[27060]: https://github.com/rust-lang/rust/issues/27060 +[C-like enumerations]: items/enumerations.html#custom-discriminant-values-for-field-less-enumerations +[`Sized`]: ../std/marker/trait.Sized.html [`align_of_val`]: ../std/mem/fn.align_of_val.html -[`size_of_val`]: ../std/mem/fn.size_of_val.html [`align_of`]: ../std/mem/fn.align_of.html +[`size_of_val`]: ../std/mem/fn.size_of_val.html [`size_of`]: ../std/mem/fn.size_of.html -[`Sized`]: ../std/marker/trait.Sized.html [dynamically sized types]: dynamically-sized-types.html -[C-like enumerations]: items/enumerations.html#custom-discriminant-values-for-field-less-enumerations -[zero-variant enumerations]: items/enumerations.html#zero-variant-enums [undefined behavior]: behavior-considered-undefined.html -[27060]: https://github.com/rust-lang/rust/issues/27060 +[zero-variant enumerations]: items/enumerations.html#zero-variant-enums diff --git a/src/types.md b/src/types.md index a018099b47..988d4ef5d5 100644 --- a/src/types.md +++ b/src/types.md @@ -699,51 +699,51 @@ impl Printable for String { > Note: The notation `&self` is a shorthand for `self: &Self`. -[`Fn`]: ../std/ops/trait.Fn.html +[References]: #pointer-types +[Unicode scalar value]: http://www.unicode.org/glossary/#unicode_scalar_value +[_LIFETIME_OR_LABEL_]: tokens.html#lifetimes-and-loop-labels +[_PATH_]: paths.html +[`Clone`]: special-types-and-traits.html#clone +[`Copy`]: special-types-and-traits.html#copy [`FnMut`]: ../std/ops/trait.FnMut.html [`FnOnce`]: ../std/ops/trait.FnOnce.html -[`Copy`]: special-types-and-traits.html#copy -[`Clone`]: special-types-and-traits.html#clone +[`Fn`]: ../std/ops/trait.Fn.html [`Send`]: special-types-and-traits.html#send -[`Sync`]: special-types-and-traits.html#sync [`Sized`]: special-types-and-traits.html#sized -[derive]: attributes.html#derive +[`Sync`]: special-types-and-traits.html#sync [`Vec`]: ../std/vec/struct.Vec.html +[`enum` item]: items/enumerations.html +[`union` item]: items/unions.html +[`unsafe` operation]: unsafe-functions.html +[arrays]: #array-and-slice-types +[auto traits]: special-types-and-traits.html#auto-traits +[closure expression]: expressions/closure-expr.html +[closure]: #closure-types +[coercion]: type-coercions.html +[defaults]: lifetime-elision.html#default-trait-object-lifetimes +[derive]: attributes.html#derive +[dynamically sized type]: dynamically-sized-types.html [dynamically sized type]: dynamically-sized-types.html [dynamically sized types]: dynamically-sized-types.html -[struct expression]: expressions/struct-expr.html -[closure expression]: expressions/closure-expr.html -[auto traits]: special-types-and-traits.html#auto-traits -[object safe]: items/traits.html#object-safety -[issue 47010]: https://github.com/rust-lang/rust/issues/47010 +[enum variant expression]: expressions/enum-variant-expr.html +[enumerations]: #enumerated-types +[function pointers]: #function-pointer-types +[function]: items/functions.html +[interior mutability]: interior-mutability.html [issue 33140]: https://github.com/rust-lang/rust/issues/33140 -[_PATH_]: paths.html -[_LIFETIME_OR_LABEL_]: tokens.html#lifetimes-and-loop-labels -[supertraits]: items/traits.html#supertraits +[issue 47010]: https://github.com/rust-lang/rust/issues/47010 [machine types]: #machine-types [machine-dependent integer types]: #machine-dependent-integer-types -[textual types]: #textual-types [never type]: #never-type -[tuples]: #tuple-types -[arrays]: #array-and-slice-types -[References]: #pointer-types +[object safe]: items/traits.html#object-safety [pointers]: #raw-pointers-const-and-mut -[function pointers]: #function-pointer-types -[closure]: #closure-types -[defaults]: lifetime-elision.html#default-trait-object-lifetimes -[Unicode scalar value]: http://www.unicode.org/glossary/#unicode_scalar_value [struct expression]: expressions/struct-expr.html -[visibility modifiers]: visibility-and-privacy.html -[`enum` item]: items/enumerations.html -[enum variant expression]: expressions/enum-variant-expr.html -[coercion]: type-coercions.html -[`union` item]: items/unions.html -[function]: items/functions.html +[struct expression]: expressions/struct-expr.html [structs]: #struct-types -[enumerations]: #enumerated-types -[unions]: #union-types -[type definitions]: ../grammar.html#type-definitions -[interior mutability]: interior-mutability.html +[supertraits]: items/traits.html#supertraits [temporary value]: expressions.html#temporary-lifetimes -[`unsafe` operation]: unsafe-functions.html -[dynamically sized type]: dynamically-sized-types.html +[textual types]: #textual-types +[tuples]: #tuple-types +[type definitions]: ../grammar.html#type-definitions +[unions]: #union-types +[visibility modifiers]: visibility-and-privacy.html diff --git a/src/undocumented.md b/src/undocumented.md index 6cac6f8c7a..315345521f 100644 --- a/src/undocumented.md +++ b/src/undocumented.md @@ -15,13 +15,13 @@ to shrink! - [define `crt_link`] - `impl Trait` -[`libstd` facade]: https://github.com/rust-lang/rfcs/pull/40 -[Trait reform]: https://github.com/rust-lang/rfcs/pull/48 [Attributes on `match` arms]: https://github.com/rust-lang/rfcs/pull/49 [Attributes]: attributes.html -[Flexible target specification]: https://github.com/rust-lang/rfcs/pull/131 [Conditional compilation]: attributes.html#conditional-compilation +[FFI attributes]: attributes.html#ffi-attributes +[Flexible target specification]: https://github.com/rust-lang/rfcs/pull/131 [Integer overflow not `unsafe`]: https://github.com/rust-lang/rfcs/pull/560 +[Trait reform]: https://github.com/rust-lang/rfcs/pull/48 [`dllimport`]: https://github.com/rust-lang/rfcs/pull/1717 -[FFI attributes]: attributes.html#ffi-attributes +[`libstd` facade]: https://github.com/rust-lang/rfcs/pull/40 [define `crt_link`]: https://github.com/rust-lang/rfcs/pull/1721 diff --git a/src/unsafety.md b/src/unsafety.md index c3060c9b7d..b32eac0b27 100644 --- a/src/unsafety.md +++ b/src/unsafety.md @@ -13,7 +13,7 @@ Rust: - Calling an unsafe function (including an intrinsic or foreign function). - Implementing an unsafe trait. -[raw pointer]: types.html#pointer-types -[mutable static variable]: items/static-items.html#mutable-statics -[`union`]: items/unions.html [`Copy`]: special-types-and-traits.html#copy +[`union`]: items/unions.html +[mutable static variable]: items/static-items.html#mutable-statics +[raw pointer]: types.html#pointer-types From 7d3afced99ba6eb20df693aa7f3e7dce1da63936 Mon Sep 17 00:00:00 2001 From: "Havvy (Ryan Scheel)" Date: Sun, 19 Aug 2018 19:36:42 -0700 Subject: [PATCH 6/6] Fix review comments --- src/expressions.md | 2 +- src/expressions/array-expr.md | 2 +- src/items.md | 1 - src/items/traits.md | 12 ++++++------ src/items/type-aliases.md | 2 +- src/items/unions.md | 6 +++--- 6 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/expressions.md b/src/expressions.md index 3d0e7018d4..ab61006946 100644 --- a/src/expressions.md +++ b/src/expressions.md @@ -233,7 +233,7 @@ Implicit borrows may be taken in the following expressions: Certain types of expressions can be evaluated at compile time. These are called _constant expressions_. Certain places, such as in -[constants] and [statics](static variables), +[constants] and [statics][static variables], require a constant expression, and are always evaluated at compile time. In other places, such as in [`let` statements][let], constant expressions may be evaluated at compile time. If errors, such as out diff --git a/src/expressions/array-expr.md b/src/expressions/array-expr.md index 36c06e040d..3c8f21393f 100644 --- a/src/expressions/array-expr.md +++ b/src/expressions/array-expr.md @@ -70,7 +70,7 @@ The array index expression can be implemented for types other than arrays and sl by implementing the [`Index`] and [`IndexMut`] traits. [Array and slice]: ../types.html#array-and-slice-types -[_Expression_]: /expressions.html +[_Expression_]: ../expressions.html [`Copy`]: ../special-types-and-traits.html#copy [`IndexMut`]: ../../std/ops/trait.IndexMut.html [`Index`]: ../../std/ops/trait.Index.html diff --git a/src/items.md b/src/items.md index 0cbc33b431..f14a15dd33 100644 --- a/src/items.md +++ b/src/items.md @@ -42,7 +42,6 @@ which sub-item declarations may appear. [function definitions]: items/functions.html [implementations]: items/implementations.html [modules]: items/modules.html -[modules]: items/modules.html [paths]: paths.html [static items]: items/static-items.html [struct definitions]: items/structs.html diff --git a/src/items/traits.md b/src/items/traits.md index a3b6d584f3..8c671703ce 100644 --- a/src/items/traits.md +++ b/src/items/traits.md @@ -3,9 +3,9 @@ A _trait_ describes an abstract interface that types can implement. This interface consists of [associated items], which come in three varieties: -- [functions] -- [types] -- [constants] +- [functions][associated functions] +- [types][associated types] +- [constants][associated constants] All traits define an implicit type parameter `Self` that refers to "the type that is implementing this interface". Traits may also contain additional type @@ -116,15 +116,15 @@ let nonsense = circle.radius() * circle.area(); ``` [RFC 255]: https://github.com/rust-lang/rfcs/blob/master/text/0255-object-safety.md +[associated constants]: associated-items.html#associated-constants [associated items]: associated-items.html +[associated functions]: associated-items.html#associated-functions-and-methods +[associated types]: associated-items.html#associated-types [bounds]: ../trait-bounds.html -[constants]: associated-items.html#associated-constants [explicit]: ../expressions/operator-expr.html#type-cast-expressions -[functions]: associated-items.html#associated-functions-and-methods [generic functions]: functions.html#generic-functions [generics]: generics.html [implementations]: implementations.html [method]: associated-items.html#methods [trait object]: ../types.html#trait-objects -[types]: associated-items.html#associated-types [where clauses]: generics.html#where-clauses diff --git a/src/items/type-aliases.md b/src/items/type-aliases.md index 0d942ef300..53ead0c41c 100644 --- a/src/items/type-aliases.md +++ b/src/items/type-aliases.md @@ -30,5 +30,5 @@ let _: F = E::A; // OK [IDENTIFIER]: ../identifiers.html [_Generics_]: generics.html [_Type_]: ../types.html -[_WhereClause_]: html#where-clauses +[_WhereClause_]: generics.html#where-clauses [type]: ../types.html diff --git a/src/items/unions.md b/src/items/unions.md index 929b7638b5..2b7c111b17 100644 --- a/src/items/unions.md +++ b/src/items/unions.md @@ -147,6 +147,6 @@ in [RFC 1897 "Unions v1.2"]. [IDENTIFIER]: ../identifiers.html [RFC 1897 "Unions v1.2"]: https://github.com/rust-lang/rfcs/pull/1897 -[_Generics_]: html -[_StructFields_]: html -[_WhereClause_]: html#where-clauses +[_Generics_]: generics.html +[_StructFields_]: structs.html +[_WhereClause_]: generics.html#where-clauses