diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2017-07-05 08:42:13 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2017-07-05 08:42:13 -0700 |
| commit | fd95db25b367d5d61ee9bc86b928c529747b3622 (patch) | |
| tree | f93755558c3f91addb568e1f5aa4f2a4799589f5 /src/doc | |
| parent | d316874c87e25669895c306658e15aa3746d66ab (diff) | |
| parent | 692b5722363be2de18a27b46db59950124a5101d (diff) | |
| download | rust-fd95db25b367d5d61ee9bc86b928c529747b3622.tar.gz rust-fd95db25b367d5d61ee9bc86b928c529747b3622.zip | |
Merge remote-tracking branch 'origin/master' into proc_macro_api
Diffstat (limited to 'src/doc')
6 files changed, 49 insertions, 54 deletions
diff --git a/src/doc/unstable-book/src/language-features/compile-error.md b/src/doc/unstable-book/src/language-features/compile-error.md index 1b25eeda3f6..4b24c0a6a0d 100644 --- a/src/doc/unstable-book/src/language-features/compile-error.md +++ b/src/doc/unstable-book/src/language-features/compile-error.md @@ -2,7 +2,7 @@ The tracking issue for this feature is: [#40872] -[#29599]: https://github.com/rust-lang/rust/issues/40872 +[#40872]: https://github.com/rust-lang/rust/issues/40872 ------------------------ diff --git a/src/doc/unstable-book/src/language-features/lang-items.md b/src/doc/unstable-book/src/language-features/lang-items.md index 375b8bd6b82..a2368ee5f4a 100644 --- a/src/doc/unstable-book/src/language-features/lang-items.md +++ b/src/doc/unstable-book/src/language-features/lang-items.md @@ -143,7 +143,8 @@ pub extern fn rust_eh_unwind_resume() { #[no_mangle] pub extern fn rust_begin_panic(_msg: core::fmt::Arguments, _file: &'static str, - _line: u32) -> ! { + _line: u32, + _column: u32) -> ! { unsafe { intrinsics::abort() } } ``` @@ -187,7 +188,8 @@ pub extern fn rust_eh_unwind_resume() { #[no_mangle] pub extern fn rust_begin_panic(_msg: core::fmt::Arguments, _file: &'static str, - _line: u32) -> ! { + _line: u32, + _column: u32) -> ! { unsafe { intrinsics::abort() } } ``` diff --git a/src/doc/unstable-book/src/language-features/unsized-tuple-coercion.md b/src/doc/unstable-book/src/language-features/unsized-tuple-coercion.md new file mode 100644 index 00000000000..200a9c19462 --- /dev/null +++ b/src/doc/unstable-book/src/language-features/unsized-tuple-coercion.md @@ -0,0 +1,27 @@ +# `unsized_tuple_coercion` + +The tracking issue for this feature is: [#42877] + +[#42877]: https://github.com/rust-lang/rust/issues/42877 + +------------------------ + +This is a part of [RFC0401]. According to the RFC, there should be an implementation like this: + +```rust +impl<..., T, U: ?Sized> Unsized<(..., U)> for (..., T) where T: Unsized<U> {} +``` + +This implementation is currently gated behind `#[feature(unsized_tuple_coercion)]` to avoid insta-stability. Therefore you can use it like this: + +```rust +#![feature(unsized_tuple_coercion)] + +fn main() { + let x : ([i32; 3], [i32; 3]) = ([1, 2, 3], [4, 5, 6]); + let y : &([i32; 3], [i32]) = &x; + assert_eq!(y.1[0], 4); +} +``` + +[RFC0401]: https://github.com/rust-lang/rfcs/blob/master/text/0401-coercions.md diff --git a/src/doc/unstable-book/src/library-features/iterator-for-each.md b/src/doc/unstable-book/src/library-features/iterator-for-each.md new file mode 100644 index 00000000000..ebeb5f6a1de --- /dev/null +++ b/src/doc/unstable-book/src/library-features/iterator-for-each.md @@ -0,0 +1,17 @@ +# `iterator_for_each` + +The tracking issue for this feature is: [#42986] + +[#42986]: https://github.com/rust-lang/rust/issues/42986 + +------------------------ + +To call a closure on each element of an iterator, you can use `for_each`: + +```rust +#![feature(iterator_for_each)] + +fn main() { + (0..10).for_each(|i| println!("{}", i)); +} +``` diff --git a/src/doc/unstable-book/src/library-features/more-io-inner-methods.md b/src/doc/unstable-book/src/library-features/more-io-inner-methods.md deleted file mode 100644 index c84f40e7ee5..00000000000 --- a/src/doc/unstable-book/src/library-features/more-io-inner-methods.md +++ /dev/null @@ -1,11 +0,0 @@ -# `more_io_inner_methods` - -The tracking issue for this feature is: [#41519] - -[#41519]: https://github.com/rust-lang/rust/issues/41519 - ------------------------- - -This feature enables several internal accessor methods on structures in -`std::io` including `Take::{get_ref, get_mut}` and `Chain::{into_inner, get_ref, -get_mut}`. diff --git a/src/doc/unstable-book/src/library-features/sort-unstable.md b/src/doc/unstable-book/src/library-features/sort-unstable.md deleted file mode 100644 index 9effcfc774c..00000000000 --- a/src/doc/unstable-book/src/library-features/sort-unstable.md +++ /dev/null @@ -1,40 +0,0 @@ -# `sort_unstable` - -The tracking issue for this feature is: [#40585] - -[#40585]: https://github.com/rust-lang/rust/issues/40585 - ------------------------- - -The default `sort` method on slices is stable. In other words, it guarantees -that the original order of equal elements is preserved after sorting. The -method has several undesirable characteristics: - -1. It allocates a sizable chunk of memory. -2. If you don't need stability, it is not as performant as it could be. - -An alternative is the new `sort_unstable` feature, which includes these -methods for sorting slices: - -1. `sort_unstable` -2. `sort_unstable_by` -3. `sort_unstable_by_key` - -Unstable sorting is generally faster and makes no allocations. The majority -of real-world sorting needs doesn't require stability, so these methods can -very often come in handy. - -Another important difference is that `sort` lives in `libstd` and -`sort_unstable` lives in `libcore`. The reason is that the former makes -allocations and the latter doesn't. - -A simple example: - -```rust -#![feature(sort_unstable)] - -let mut v = [-5, 4, 1, -3, 2]; - -v.sort_unstable(); -assert!(v == [-5, -3, 1, 2, 4]); -``` |
