Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port the reference to mdbook #39855

Merged
merged 25 commits into from
Feb 22, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/doc/book/src/attributes.md
Original file line number Diff line number Diff line change
@@ -67,4 +67,4 @@ Rust attributes are used for a number of different things. There is a full list
of attributes [in the reference][reference]. Currently, you are not allowed to
create your own attributes, the Rust compiler defines them.

[reference]: ../reference.html#attributes
[reference]: ../reference/attributes.html
13 changes: 7 additions & 6 deletions src/doc/book/src/compiler-plugins.md
Original file line number Diff line number Diff line change
@@ -119,7 +119,7 @@ The advantages over a simple `fn(&str) -> u32` are:
a way to define new literal syntax for any data type.

In addition to procedural macros, you can define new
[`derive`](../reference.html#derive)-like attributes and other kinds of
[`derive`](../reference/attributes.html#derive)-like attributes and other kinds of
extensions. See `Registry::register_syntax_extension` and the `SyntaxExtension`
enum. For a more involved macro example, see
[`regex_macros`](https://github.com/rust-lang/regex/blob/master/regex_macros/src/lib.rs).
@@ -165,8 +165,8 @@ quasiquote as an ordinary plugin library.
# Lint plugins

Plugins can extend [Rust's lint
infrastructure](../reference.html#lint-check-attributes) with additional checks for
code style, safety, etc. Now let's write a plugin
infrastructure](../reference/attributes.html#lint-check-attributes) with
additional checks for code style, safety, etc. Now let's write a plugin
[`lint_plugin_test.rs`](https://github.com/rust-lang/rust/blob/master/src/test/run-pass-fulldeps/auxiliary/lint_plugin_test.rs)
that warns about any item named `lintme`.

@@ -244,9 +244,10 @@ mostly use the same infrastructure as lint plugins, and provide examples of how
to access type information.

Lints defined by plugins are controlled by the usual [attributes and compiler
flags](../reference.html#lint-check-attributes), e.g. `#[allow(test_lint)]` or
`-A test-lint`. These identifiers are derived from the first argument to
`declare_lint!`, with appropriate case and punctuation conversion.
flags](../reference/attributes.html#lint-check-attributes), e.g.
`#[allow(test_lint)]` or `-A test-lint`. These identifiers are derived from the
first argument to `declare_lint!`, with appropriate case and punctuation
conversion.

You can run `rustc -W help foo.rs` to see a list of lints known to `rustc`,
including those provided by plugins loaded by `foo.rs`.
8 changes: 4 additions & 4 deletions src/doc/book/src/macros.md
Original file line number Diff line number Diff line change
@@ -101,7 +101,7 @@ trees, at compile time. The semicolon is optional on the last (here, only)
case. The "pattern" on the left-hand side of `=>` is known as a ‘matcher’.
These have [their own little grammar] within the language.

[their own little grammar]: ../reference.html#macros
[their own little grammar]: ../reference/macros.html

The matcher `$x:expr` will match any Rust expression, binding that syntax tree
to the ‘metavariable’ `$x`. The identifier `expr` is a ‘fragment specifier’;
@@ -363,7 +363,7 @@ fn main() {
}
```

[items]: ../reference.html#items
[items]: ../reference/items.html

# Recursive macros

@@ -490,7 +490,7 @@ be forced to choose between parsing `$i` and parsing `$e`. Changing the
invocation syntax to put a distinctive token in front can solve the problem. In
this case, you can write `$(I $i:ident)* E $e:expr`.

[item]: ../reference.html#items
[item]: ../reference/items.html

# Scoping and macro import/export

@@ -565,7 +565,7 @@ When this library is loaded with `#[macro_use] extern crate`, only `m2` will
be imported.

The Rust Reference has a [listing of macro-related
attributes](../reference.html#macro-related-attributes).
attributes](../reference/attributes.html#macro-related-attributes).

# The variable `$crate`

8 changes: 4 additions & 4 deletions src/doc/book/src/syntax-index.md
Original file line number Diff line number Diff line change
@@ -235,10 +235,10 @@
[Primitive Types (Tuple Indexing)]: primitive-types.html#tuple-indexing
[Primitive Types (Tuples)]: primitive-types.html#tuples
[Raw Pointers]: raw-pointers.html
[Reference (Byte String Literals)]: ../reference.html#byte-string-literals
[Reference (Integer literals)]: ../reference.html#integer-literals
[Reference (Raw Byte String Literals)]: ../reference.html#raw-byte-string-literals
[Reference (Raw String Literals)]: ../reference.html#raw-string-literals
[Reference (Byte String Literals)]: ../reference/tokens.html/#byte-string-literals
[Reference (Integer literals)]: ../reference/tokens.html#integer-literals
[Reference (Raw Byte String Literals)]: ../reference/tokens.html#raw-byte-string-literals
[Reference (Raw String Literals)]: ../reference/tokens.html#raw-string-literals
[References and Borrowing]: references-and-borrowing.html
[Strings]: strings.html
[Structs (Update syntax)]: structs.html#update-syntax
2 changes: 1 addition & 1 deletion src/doc/grammar.md
Original file line number Diff line number Diff line change
@@ -187,7 +187,7 @@ literal : [ string_lit | char_lit | byte_string_lit | byte_lit | num_lit | bool_
The optional `lit_suffix` production is only used for certain numeric literals,
but is reserved for future extension. That is, the above gives the lexical
grammar, but a Rust parser will reject everything but the 12 special cases
mentioned in [Number literals](reference.html#number-literals) in the
mentioned in [Number literals](reference/tokens.html#number-literals) in the
reference.

#### Character and string literals
21 changes: 11 additions & 10 deletions src/doc/reference/src/attributes.md
Original file line number Diff line number Diff line change
@@ -46,7 +46,7 @@ type int8_t = i8;
## Crate-only attributes

- `crate_name` - specify the crate's crate name.
- `crate_type` - see [linkage](#linkage).
- `crate_type` - see [linkage](linkage.html).
- `feature` - see [compiler features](#compiler-features).
- `no_builtins` - disable optimizing certain code patterns to invocations of
library functions that are assumed to exist
@@ -106,7 +106,7 @@ On an `extern` block, the following attributes are interpreted:
- `link` - indicate that a native library should be linked to for the
declarations in this block to be linked correctly. `link` supports an optional
`kind` key with three possible values: `dylib`, `static`, and `framework`. See
[external blocks](#external-blocks) for more about external blocks. Two
[external blocks](items.html#external-blocks) for more about external blocks. Two
examples: `#[link(name = "readline")]` and
`#[link(name = "CoreFoundation", kind = "framework")]`.
- `linked_from` - indicates what native library this block of FFI items is
@@ -149,7 +149,7 @@ On `struct`s:
list of names `#[macro_use(foo, bar)]` restricts the import to just those
macros named. The `extern crate` must appear at the crate root, not inside
`mod`, which ensures proper function of the [`$crate` macro
variable](book/macros.html#The%20variable%20%24crate).
variable](../book/macros.html#the-variable-crate).

- `macro_reexport` on an `extern crate` — re-export the named macros.

@@ -159,7 +159,7 @@ On `struct`s:
link it into the output.

See the [macros section of the
book](book/macros.html#Scoping%20and%20macro%20import%2Fexport) for more information on
book](../book/macros.html#scoping-and-macro-importexport) for more information on
macro scope.

## Miscellaneous attributes
@@ -317,7 +317,8 @@ For any lint check `C`:

The lint checks supported by the compiler can be found via `rustc -W help`,
along with their default settings. [Compiler
plugins](book/compiler-plugins.html#lint-plugins) can provide additional lint checks.
plugins](../book/compiler-plugins.html#lint-plugins) can provide additional
lint checks.

```{.ignore}
pub mod m1 {
@@ -442,7 +443,7 @@ impl<T: PartialEq> PartialEq for Foo<T> {
```

You can implement `derive` for your own type through [procedural
macros](#procedural-macros).
macros](procedural-macros.html).

### Compiler Features

@@ -464,10 +465,10 @@ considered off, and using the features will result in a compiler error.

The currently implemented features of the reference compiler are:

* `advanced_slice_patterns` - See the [match expressions](#match-expressions)
section for discussion; the exact semantics of
slice patterns are subject to change, so some types
are still unstable.
* `advanced_slice_patterns` - See the [match
expressions](expressions.html#match-expressions)
section for discussion; the exact semantics of
slice patterns are subject to change, so some types are still unstable.

* `slice_patterns` - OK, actually, slice patterns are just scary and
completely unstable.
13 changes: 7 additions & 6 deletions src/doc/reference/src/expressions.md
Original file line number Diff line number Diff line change
@@ -85,7 +85,7 @@ be copied if its type implements `Copy`. All others are moved.

## Literal expressions

A _literal expression_ consists of one of the [literal](tokens.md#literals) forms
A _literal expression_ consists of one of the [literal](tokens.html#literals) forms
described earlier. It directly describes a number, character, string, boolean
value, or the unit value.

@@ -124,19 +124,19 @@ comma:
## Struct expressions

There are several forms of struct expressions. A _struct expression_
consists of the [path](#paths) of a [struct item](items.html#structs), followed
consists of the [path](paths.html) of a [struct item](items.html#structs), followed
by a brace-enclosed list of zero or more comma-separated name-value pairs,
providing the field values of a new instance of the struct. A field name can be
any identifier, and is separated from its value expression by a colon. The
location denoted by a struct field is mutable if and only if the enclosing
struct is mutable.

A _tuple struct expression_ consists of the [path](#paths) of a [struct
A _tuple struct expression_ consists of the [path](paths.html) of a [struct
item](items.html#structs), followed by a parenthesized list of one or more
comma-separated expressions (in other words, the path of a struct item followed
by a tuple expression). The struct item must be a tuple struct item.

A _unit-like struct expression_ consists only of the [path](#paths) of a
A _unit-like struct expression_ consists only of the [path](paths.html) of a
[struct item](items.html#structs).

The following are examples of struct expressions:
@@ -217,7 +217,8 @@ A _method call_ consists of an expression followed by a single dot, an
identifier, and a parenthesized expression-list. Method calls are resolved to
methods on specific traits, either statically dispatching to a method if the
exact `self`-type of the left-hand-side is known, or dynamically dispatching if
the left-hand-side expression is an indirect [trait object](trait-objects.html).
the left-hand-side expression is an indirect [trait
object](types.html#trait-objects).

## Field expressions

@@ -504,7 +505,7 @@ The `+`, `-`, `*`, `/`, `%`, `&`, `|`, `^`, `<<`, and `>>` operators may be
composed with the `=` operator. The expression `lval OP= val` is equivalent to
`lval = lval OP val`. For example, `x = x + 1` may be written as `x += 1`.

Any such expression always has the [`unit`](#tuple-types) type.
Any such expression always has the [`unit`](types.html#tuple-types) type.

### Operator precedence

6 changes: 3 additions & 3 deletions src/doc/reference/src/identifiers.md
Original file line number Diff line number Diff line change
@@ -13,12 +13,12 @@ Or
* The identifier is more than one character, `_` alone is not an identifier
* The remaining characters have property `XID_continue`

that does _not_ occur in the set of [keywords][keywords].
that does _not_ occur in the set of [keywords].

> **Note**: `XID_start` and `XID_continue` as character properties cover the
> character ranges used to form the more familiar C and Java language-family
> identifiers.

keywords: ../grammar.html#keywords
[keywords]: ../grammar.html#keywords
[^non_ascii_idents]: Non-ASCII characters in identifiers are currently feature
gated. This is expected to improve soon.
gated. This is expected to improve soon.
2 changes: 1 addition & 1 deletion src/doc/reference/src/items.md
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@ nested set of [modules]. Every crate has a single "outermost"
anonymous module; all further items within the crate have [paths]
within the module tree of the crate.

[modules]: modules.html
[modules]: #modules
[paths]: paths.html

Items are entirely determined at compile-time, generally remain fixed during
2 changes: 1 addition & 1 deletion src/libcore/intrinsics.rs
Original file line number Diff line number Diff line change
@@ -687,7 +687,7 @@ extern "rust-intrinsic" {
/// The [nomicon](../../nomicon/transmutes.html) has additional
/// documentation.
///
/// [ub]: ../../reference.html#behavior-considered-undefined
/// [ub]: ../../reference/behavior-considered-undefined.html
///
/// # Examples
///
4 changes: 2 additions & 2 deletions src/libcore/marker.rs
Original file line number Diff line number Diff line change
@@ -36,7 +36,7 @@ use hash::Hasher;
///
/// [`Rc`]: ../../std/rc/struct.Rc.html
/// [arc]: ../../std/sync/struct.Arc.html
/// [ub]: ../../reference.html#behavior-considered-undefined
/// [ub]: ../../reference/behavior-considered-undefined.html
#[stable(feature = "rust1", since = "1.0.0")]
#[lang = "send"]
#[rustc_on_unimplemented = "`{Self}` cannot be sent between threads safely"]
@@ -338,7 +338,7 @@ pub trait Copy : Clone {
/// [mutex]: ../../std/sync/struct.Mutex.html
/// [rwlock]: ../../std/sync/struct.RwLock.html
/// [unsafecell]: ../cell/struct.UnsafeCell.html
/// [ub]: ../../reference.html#behavior-considered-undefined
/// [ub]: ../../reference/behavior-considered-undefined.html
/// [transmute]: ../../std/mem/fn.transmute.html
#[stable(feature = "rust1", since = "1.0.0")]
#[lang = "sync"]
8 changes: 4 additions & 4 deletions src/libcore/mem.rs
Original file line number Diff line number Diff line change
@@ -167,7 +167,7 @@ pub use intrinsics::transmute;
/// [FFI]: ../../book/ffi.html
/// [box]: ../../std/boxed/struct.Box.html
/// [into_raw]: ../../std/boxed/struct.Box.html#method.into_raw
/// [ub]: ../../reference.html#behavior-considered-undefined
/// [ub]: ../../reference/behavior-considered-undefined.html
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
pub fn forget<T>(t: T) {
@@ -318,7 +318,7 @@ pub fn align_of_val<T: ?Sized>(val: &T) -> usize {
///
/// [uninit]: fn.uninitialized.html
/// [FFI]: ../../book/ffi.html
/// [ub]: ../../reference.html#behavior-considered-undefined
/// [ub]: ../../reference/behavior-considered-undefined.html
///
/// # Examples
///
@@ -417,7 +417,7 @@ pub unsafe fn zeroed<T>() -> T {
/// [`Vec`]: ../../std/vec/struct.Vec.html
/// [`vec!`]: ../../std/macro.vec.html
/// [`Clone`]: ../../std/clone/trait.Clone.html
/// [ub]: ../../reference.html#behavior-considered-undefined
/// [ub]: ../../reference/behavior-considered-undefined.html
/// [write]: ../ptr/fn.write.html
/// [copy]: ../intrinsics/fn.copy.html
/// [copy_no]: ../intrinsics/fn.copy_nonoverlapping.html
@@ -626,7 +626,7 @@ pub fn drop<T>(_x: T) { }
/// same size. This function triggers [undefined behavior][ub] if `U` is larger than
/// `T`.
///
/// [ub]: ../../reference.html#behavior-considered-undefined
/// [ub]: ../../reference/behavior-considered-undefined.html
/// [size_of]: fn.size_of.html
///
/// # Examples
2 changes: 1 addition & 1 deletion src/libstd/f32.rs
Original file line number Diff line number Diff line change
@@ -264,7 +264,7 @@ impl f32 {
///
/// assert!(abs_difference <= f32::EPSILON);
/// ```
/// [floating-point]: ../reference.html#machine-types
/// [floating-point]: ../reference/types.html#machine-types
#[unstable(feature = "float_extras", reason = "signature is undecided",
issue = "27752")]
#[rustc_deprecated(since = "1.11.0",
2 changes: 1 addition & 1 deletion src/libstd/f64.rs
Original file line number Diff line number Diff line change
@@ -206,7 +206,7 @@ impl f64 {
///
/// assert!(abs_difference < 1e-10);
/// ```
/// [floating-point]: ../reference.html#machine-types
/// [floating-point]: ../reference/types.html#machine-types
#[unstable(feature = "float_extras", reason = "signature is undecided",
issue = "27752")]
#[rustc_deprecated(since = "1.11.0",
2 changes: 1 addition & 1 deletion src/libstd/macros.rs
Original file line number Diff line number Diff line change
@@ -441,7 +441,7 @@ pub mod builtin {
/// leads to less duplicated code.
///
/// The syntax given to this macro is the same syntax as [the `cfg`
/// attribute](../reference.html#conditional-compilation).
/// attribute](../book/conditional-compilation.html).
///
/// # Examples
///