diff options
| author | bors <bors@rust-lang.org> | 2018-02-06 07:02:25 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2018-02-06 07:02:25 +0000 |
| commit | b224fc84e3438117b218ec6b57fdc3ea8a3d1c2e (patch) | |
| tree | fdea43c93e46ce70ebc3a9f102a0bfa37cd6e69b /src/doc | |
| parent | 6c04c41034c46730fba97bfe9cfa2dd0687c2a5f (diff) | |
| parent | 0553dc81d38cf7bd81334477b0338ef46da50e18 (diff) | |
Auto merge of #48017 - kennytm:rollup, r=kennytm
Rollup of 10 pull requests - Successful merges: #46030, #47496, #47543, #47704, #47753, #47807, #47948, #47959, #48003, #48007 - Failed merges:
Diffstat (limited to 'src/doc')
| m--------- | src/doc/book | 0 | ||||
| m--------- | src/doc/reference | 0 | ||||
| -rw-r--r-- | src/doc/unstable-book/src/language-features/use-nested-groups.md | 90 |
3 files changed, 0 insertions, 90 deletions
diff --git a/src/doc/book b/src/doc/book -Subproject 194eb8d5f1753fb5f4501011cebdc1b58571247 +Subproject a645960fe48946153936dd5628df4a90bd83798 diff --git a/src/doc/reference b/src/doc/reference -Subproject 1d791b55b23ec5389fbd5b3cee80db3f8bbdd16 +Subproject e6a5d5d10aa2fde0baed7b29bf672bd9f3af896 diff --git a/src/doc/unstable-book/src/language-features/use-nested-groups.md b/src/doc/unstable-book/src/language-features/use-nested-groups.md deleted file mode 100644 index 47b635bad73..00000000000 --- a/src/doc/unstable-book/src/language-features/use-nested-groups.md +++ /dev/null @@ -1,90 +0,0 @@ -# `use_nested_groups` - -The tracking issue for this feature is: [#44494] - -[#44494]: https://github.com/rust-lang/rust/issues/44494 - ------------------------- - -The `use_nested_groups` feature allows you to import multiple items from a -complex module tree easily, by nesting different imports in the same -declaration. For example: - -```rust -#![feature(use_nested_groups)] -# #![allow(unused_imports, dead_code)] -# -# mod foo { -# pub mod bar { -# pub type Foo = (); -# } -# pub mod baz { -# pub mod quux { -# pub type Bar = (); -# } -# } -# } - -use foo::{ - bar::{self, Foo}, - baz::{*, quux::Bar}, -}; -# -# fn main() {} -``` - -## Snippet for the book's new features appendix - -When stabilizing, add this to -`src/doc/book/second-edition/src/appendix-07-newest-features.md`: - -### Nested groups in `use` declarations - -If you have a complex module tree with many different submodules and you need -to import a few items from each one, it might be useful to group all the -imports in the same declaration to keep your code clean and avoid repeating the -base modules' name. - -The `use` declaration supports nesting to help you in those cases, both with -simple imports and glob ones. For example this snippets imports `bar`, `Foo`, -all the items in `baz` and `Bar`: - -```rust -# #![feature(use_nested_groups)] -# #![allow(unused_imports, dead_code)] -# -# mod foo { -# pub mod bar { -# pub type Foo = (); -# } -# pub mod baz { -# pub mod quux { -# pub type Bar = (); -# } -# } -# } -# -use foo::{ - bar::{self, Foo}, - baz::{*, quux::Bar}, -}; -# -# fn main() {} -``` - -## Updated reference - -When stabilizing, replace the shortcut list in -`src/doc/reference/src/items/use-declarations.md` with this updated one: - -* Simultaneously binding a list of paths with a common prefix, using the - glob-like brace syntax `use a::b::{c, d, e::f, g::h::i};` -* Simultaneously binding a list of paths with a common prefix and their common - parent module, using the `self` keyword, such as `use a::b::{self, c, d::e};` -* Rebinding the target name as a new local name, using the syntax `use p::q::r - as x;`. This can also be used with the last two features: - `use a::b::{self as ab, c as abc}`. -* Binding all paths matching a given prefix, using the asterisk wildcard syntax - `use a::b::*;`. -* Nesting groups of the previous features multiple times, such as - `use a::b::{self as ab, c d::{*, e::f}};` |
