diff options
| author | Stein Somers <git@steinsomers.be> | 2019-01-09 15:15:18 +0100 |
|---|---|---|
| committer | Stein Somers <git@steinsomers.be> | 2019-01-09 15:15:18 +0100 |
| commit | ccba43df81d5bda37c9e4d231ad4443e6f3a7e44 (patch) | |
| tree | efe674e2d5ae721f38fa8558385e0a2f12997227 /src/doc | |
| parent | f9f71cc32497ee4e3cbc7d9795bcf358a9268c13 (diff) | |
| parent | 664c7797f6bfddf9f5e67474c2fd8017f91d7110 (diff) | |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'src/doc')
| -rw-r--r-- | src/doc/index.md | 6 | ||||
| -rw-r--r-- | src/doc/rust.css | 12 | ||||
| -rw-r--r-- | src/doc/rustc/src/lints/listing/warn-by-default.md | 26 | ||||
| -rw-r--r-- | src/doc/rustc/src/what-is-rustc.md | 4 | ||||
| -rw-r--r-- | src/doc/rustdoc/src/documentation-tests.md | 2 | ||||
| -rw-r--r-- | src/doc/rustdoc/src/unstable-features.md | 15 | ||||
| -rw-r--r-- | src/doc/unstable-book/src/language-features/cfg-attr-multi.md | 20 | ||||
| -rw-r--r-- | src/doc/unstable-book/src/language-features/non-ascii-idents.md | 4 | ||||
| -rw-r--r-- | src/doc/unstable-book/src/language-features/re-rebalance-coherence.md | 23 | ||||
| -rw-r--r-- | src/doc/unstable-book/src/language-features/repr-packed.md | 8 | ||||
| -rw-r--r-- | src/doc/unstable-book/src/language-features/type-alias-enum-variants.md | 36 |
11 files changed, 98 insertions, 58 deletions
diff --git a/src/doc/index.md b/src/doc/index.md index b79a349a453..55897e5a3e9 100644 --- a/src/doc/index.md +++ b/src/doc/index.md @@ -107,3 +107,9 @@ Rust. It's also sometimes called "the 'nomicon." ## The Unstable Book [The Unstable Book](unstable-book/index.html) has documentation for unstable features. + +## The `rustc` Contribution Guide + +[The `rustc` Guide](https://rust-lang.github.io/rustc-guide/) documents how +the compiler works and how to contribute to it. This is useful if you want to build +or modify the Rust compiler from source (e.g. to target something non-standard). diff --git a/src/doc/rust.css b/src/doc/rust.css index 5f216169efe..631f64a11db 100644 --- a/src/doc/rust.css +++ b/src/doc/rust.css @@ -1,15 +1,3 @@ -/** - * Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT - * file at the top-level directory of this distribution and at - * http://rust-lang.org/COPYRIGHT. - * With elements taken from Bootstrap v3.0.2 (MIT licensed). - * - * Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or - * http://www.apache.org/licenses/LICENSE-2.0> or the MIT license - * <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your - * option. This file may not be copied, modified, or distributed - * except according to those terms. - */ @font-face { font-family: 'Fira Sans'; font-style: normal; diff --git a/src/doc/rustc/src/lints/listing/warn-by-default.md b/src/doc/rustc/src/lints/listing/warn-by-default.md index b01aed0915d..7fbbe686b5b 100644 --- a/src/doc/rustc/src/lints/listing/warn-by-default.md +++ b/src/doc/rustc/src/lints/listing/warn-by-default.md @@ -24,7 +24,7 @@ warning: attempt to add with overflow ## dead-code -This lint detects detect unused, unexported items. Some +This lint detects unused, unexported items. Some example code that triggers this lint: ```rust @@ -44,7 +44,7 @@ warning: function is never used: `foo` ## deprecated -This lint detects detects use of deprecated items. Some +This lint detects use of deprecated items. Some example code that triggers this lint: ```rust @@ -119,7 +119,7 @@ warning: found struct without foreign-function-safe representation annotation in ## late-bound-lifetime-arguments -This lint detects detects generic lifetime arguments in path segments with +This lint detects generic lifetime arguments in path segments with late bound lifetime parameters. Some example code that triggers this lint: ```rust @@ -381,7 +381,7 @@ extern crate macro_crate_test; ## private-in-public -This lint detects detect private items in public interfaces not caught by the old implementation. Some +This lint detects private items in public interfaces not caught by the old implementation. Some example code that triggers this lint: ```rust,ignore @@ -659,7 +659,7 @@ warning: unknown lint: `not_a_real_lint` ## unreachable-code -This lint detects detects unreachable code paths. Some example code that +This lint detects unreachable code paths. Some example code that triggers this lint: ```rust,no_run @@ -681,7 +681,7 @@ warning: unreachable statement ## unreachable-patterns -This lint detects detects unreachable patterns. Some +This lint detects unreachable patterns. Some example code that triggers this lint: ```rust @@ -716,11 +716,11 @@ annotations now. ## unused-allocation -This lint detects detects unnecessary allocations that can be eliminated. +This lint detects unnecessary allocations that can be eliminated. ## unused-assignments -This lint detects detect assignments that will never be read. Some +This lint detects assignments that will never be read. Some example code that triggers this lint: ```rust @@ -741,7 +741,7 @@ warning: value assigned to `x` is never read ## unused-attributes -This lint detects detects attributes that were not used by the compiler. Some +This lint detects attributes that were not used by the compiler. Some example code that triggers this lint: ```rust @@ -785,7 +785,7 @@ warning: comparison is useless due to type limits ## unused-doc-comment -This lint detects detects doc comments that aren't used by rustdoc. Some +This lint detects doc comments that aren't used by rustdoc. Some example code that triggers this lint: ```rust @@ -831,7 +831,7 @@ warning: unused import: `std::collections::HashMap` ## unused-macros -This lint detects detects macros that were not used. Some example code that +This lint detects macros that were not used. Some example code that triggers this lint: ```rust @@ -884,7 +884,7 @@ warning: unused `std::result::Result` that must be used ## unused-mut -This lint detects detect mut variables which don't need to be mutable. Some +This lint detects mut variables which don't need to be mutable. Some example code that triggers this lint: ```rust @@ -946,7 +946,7 @@ warning: unnecessary `unsafe` block ## unused-variables -This lint detects detect variables which are not used in any way. Some +This lint detects variables which are not used in any way. Some example code that triggers this lint: ```rust diff --git a/src/doc/rustc/src/what-is-rustc.md b/src/doc/rustc/src/what-is-rustc.md index bed1b71c24e..9dcc9f7daa9 100644 --- a/src/doc/rustc/src/what-is-rustc.md +++ b/src/doc/rustc/src/what-is-rustc.md @@ -50,7 +50,7 @@ fn main() { And a `foo.rs` that had this: ```rust,ignore -fn hello() { +pub fn hello() { println!("Hello, world!"); } ``` @@ -65,4 +65,4 @@ No need to tell `rustc` about `foo.rs`; the `mod` statements give it everything that it needs. This is different than how you would use a C compiler, where you invoke the compiler on each file, and then link everything together. In other words, the *crate* is a translation unit, not a -particular module. \ No newline at end of file +particular module. diff --git a/src/doc/rustdoc/src/documentation-tests.md b/src/doc/rustdoc/src/documentation-tests.md index dd8dcb7ff9b..dcc13f53493 100644 --- a/src/doc/rustdoc/src/documentation-tests.md +++ b/src/doc/rustdoc/src/documentation-tests.md @@ -171,7 +171,7 @@ compiles, while only showing the parts that are relevant to that part of your explanation. The `#`-hiding of lines can be prevented by using two consecutive hashes -`##`. This only needs to be done with with the first `#` which would've +`##`. This only needs to be done with the first `#` which would've otherwise caused hiding. If we have a string literal like the following, which has a line that starts with a `#`: diff --git a/src/doc/rustdoc/src/unstable-features.md b/src/doc/rustdoc/src/unstable-features.md index 43cdab27e9d..905b0646534 100644 --- a/src/doc/rustdoc/src/unstable-features.md +++ b/src/doc/rustdoc/src/unstable-features.md @@ -402,3 +402,18 @@ Using `index-page` option enables `enable-index-page` option as well. ### `--enable-index-page`: generate a default index page for docs This feature allows the generation of a default index-page which lists the generated crates. + +### `--static-root-path`: control how static files are loaded in HTML output + +Using this flag looks like this: + +```bash +$ rustdoc src/lib.rs -Z unstable-options --static-root-path '/cache/' +``` + +This flag controls how rustdoc links to its static files on HTML pages. If you're hosting a lot of +crates' docs generated by the same version of rustdoc, you can use this flag to cache rustdoc's CSS, +JavaScript, and font files in a single location, rather than duplicating it once per "doc root" +(grouping of crate docs generated into the same output directory, like with `cargo doc`). Per-crate +files like the search index will still load from the documentation root, but anything that gets +renamed with `--resource-suffix` will load from the given path. diff --git a/src/doc/unstable-book/src/language-features/cfg-attr-multi.md b/src/doc/unstable-book/src/language-features/cfg-attr-multi.md deleted file mode 100644 index 6365d3e71c6..00000000000 --- a/src/doc/unstable-book/src/language-features/cfg-attr-multi.md +++ /dev/null @@ -1,20 +0,0 @@ -# `cfg_attr_multi` - -The tracking issue for this feature is: [#54881] -The RFC for this feature is: [#2539] - -[#54881]: https://github.com/rust-lang/rust/issues/54881 -[#2539]: https://github.com/rust-lang/rfcs/pull/2539 - ------------------------- - -This feature flag lets you put multiple attributes into a `cfg_attr` attribute. - -Example: - -```rust,ignore -#[cfg_attr(all(), must_use, optimize)] -``` - -Because `cfg_attr` resolves before procedural macros, this does not affect -macro resolution at all. \ No newline at end of file diff --git a/src/doc/unstable-book/src/language-features/non-ascii-idents.md b/src/doc/unstable-book/src/language-features/non-ascii-idents.md index efb5495fe26..46957c00bf9 100644 --- a/src/doc/unstable-book/src/language-features/non-ascii-idents.md +++ b/src/doc/unstable-book/src/language-features/non-ascii-idents.md @@ -1,8 +1,8 @@ # `non_ascii_idents` -The tracking issue for this feature is: [#28979] +The tracking issue for this feature is: [#55467] -[#28979]: https://github.com/rust-lang/rust/issues/28979 +[#55467]: https://github.com/rust-lang/rust/issues/55467 ------------------------ diff --git a/src/doc/unstable-book/src/language-features/re-rebalance-coherence.md b/src/doc/unstable-book/src/language-features/re-rebalance-coherence.md new file mode 100644 index 00000000000..1e74652a890 --- /dev/null +++ b/src/doc/unstable-book/src/language-features/re-rebalance-coherence.md @@ -0,0 +1,23 @@ +# `re_rebalance_coherence` + +The tracking issue for this feature is: [#55437] + +[#55437]: https://github.com/rust-lang/rust/issues/55437 + +------------------------ + +The `re_rebalance_coherence` feature tweaks the rules regarding which trait +impls are allowed in crates. +The following rule is used: + +Given `impl<P1..=Pn> Trait<T1..=Tn> for T0`, an impl is valid only if at +least one of the following is true: +- `Trait` is a local trait +- All of + - At least one of the types `T0..=Tn` must be a local type. Let `Ti` be the + first such type. + - No uncovered type parameters `P1..=Pn` may appear in `T0..Ti` (excluding + `Ti`) + + +See the [RFC](https://github.com/rust-lang/rfcs/blob/master/text/2451-re-rebalancing-coherence.md) for details. diff --git a/src/doc/unstable-book/src/language-features/repr-packed.md b/src/doc/unstable-book/src/language-features/repr-packed.md deleted file mode 100644 index 2dd763d04b0..00000000000 --- a/src/doc/unstable-book/src/language-features/repr-packed.md +++ /dev/null @@ -1,8 +0,0 @@ -# `repr_packed` - -The tracking issue for this feature is [#33158] - -[#33158]: https://github.com/rust-lang/rust/issues/33158 - ------------------------- - diff --git a/src/doc/unstable-book/src/language-features/type-alias-enum-variants.md b/src/doc/unstable-book/src/language-features/type-alias-enum-variants.md new file mode 100644 index 00000000000..bcdeafc4b11 --- /dev/null +++ b/src/doc/unstable-book/src/language-features/type-alias-enum-variants.md @@ -0,0 +1,36 @@ +# `type_alias_enum_variants` + +The tracking issue for this feature is: [#49683] + +[#49683]: https://github.com/rust-lang/rust/issues/49683 + +------------------------ + +The `type_alias_enum_variants` feature enables the use of variants on type +aliases that refer to enums, as both a constructor and a pattern. That is, +it allows for the syntax `EnumAlias::Variant`, which behaves exactly the same +as `Enum::Variant` (assuming that `EnumAlias` is an alias for some enum type +`Enum`). + +Note that since `Self` exists as a type alias, this feature also enables the +use of the syntax `Self::Variant` within an impl block for an enum type. + +```rust +#![feature(type_alias_enum_variants)] + +enum Foo { + Bar(i32), + Baz { i: i32 }, +} + +type Alias = Foo; + +fn main() { + let t = Alias::Bar(0); + let t = Alias::Baz { i: 0 }; + match t { + Alias::Bar(_i) => {} + Alias::Baz { i: _i } => {} + } +} +``` |
