Skip to content

Rollup of 8 pull requests #42165

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

Merged
merged 19 commits into from
May 23, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
93c1f24
Stabilize the loop_break_value feature
pietroalbini May 15, 2017
0c97d6c
Add basic Unstable Book entry for `on_unimplemented`.
frewsxcv May 20, 2017
d1f4993
Add basic Unstable Book entry for `catch_expr`.
frewsxcv May 20, 2017
2d3438d
Add basic Unstable Book entry for `attr_literals`.
frewsxcv May 20, 2017
9111d07
make ui test output patch compatible #41948
cengiz-io May 21, 2017
0cb6a1f
rustdoc: Fix names of items in cross crate reexported modules
ollie27 May 22, 2017
78bdda1
Mention Vec::into_boxed_slice in docs for [T]::into_vec.
Wallacoloo May 22, 2017
819acb5
Add missing links for CStr and CString
GuillaumeGomez May 22, 2017
d2ef70f
regression test for #38821
venkatagiri May 22, 2017
6e8e5c9
Slice::into_vec: Don't link to Vec::into_boxed_slice
Wallacoloo May 22, 2017
6e27bd8
Adding links to option::Option
projektir May 23, 2017
e38d5d5
Rollup merge of #42016 - pietroalbini:stabilize/loop_break_value, r=n…
frewsxcv May 23, 2017
7a7e236
Rollup merge of #42122 - rust-lang:frewsxcv/unstable-book, r=stevekla…
frewsxcv May 23, 2017
9739e8d
Rollup merge of #42144 - cengizIO:master, r=nikomatsakis
frewsxcv May 23, 2017
b2c7423
Rollup merge of #42145 - ollie27:rustdoc_inline_renamed, r=steveklabnik
frewsxcv May 23, 2017
951eb55
Rollup merge of #42151 - Wallacoloo:docfix_into_vec, r=frewsxcv
frewsxcv May 23, 2017
2cc6839
Rollup merge of #42152 - GuillaumeGomez:cstr-docs, r=frewsxcv
frewsxcv May 23, 2017
f37b34d
Rollup merge of #42160 - venkatagiri:issue_38821, r=Mark-Simulacrum
frewsxcv May 23, 2017
aa7762f
Rollup merge of #42163 - projektir:option_links, r=frewsxcv
frewsxcv May 23, 2017
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
1 change: 0 additions & 1 deletion src/doc/unstable-book/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
- [link_llvm_intrinsics](language-features/link-llvm-intrinsics.md)
- [linkage](language-features/linkage.md)
- [log_syntax](language-features/log-syntax.md)
- [loop_break_value](language-features/loop-break-value.md)
- [macro_reexport](language-features/macro-reexport.md)
- [macro_vis_matcher](language-features/macro-vis-matcher.md)
- [main](language-features/main.md)
Expand Down
20 changes: 20 additions & 0 deletions src/doc/unstable-book/src/language-features/attr-literals.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,25 @@ The tracking issue for this feature is: [#34981]

------------------------

At present, literals are only accepted as the value of a key-value pair in
attributes. What's more, only _string_ literals are accepted. This means that
literals can only appear in forms of `#[attr(name = "value")]` or
`#[attr = "value"]`.

The `attr_literals` unstable feature allows other types of literals to be used
in attributes. Here are some examples of attributes that can now be used with
this feature enabled:

+```rust,ignore
+#[attr]
+#[attr(true)]
+#[attr(ident)]
+#[attr(ident, 100, true, "true", ident = 100, ident = "hello", ident(100))]
+#[attr(100)]
+#[attr(enabled = true)]
+#[enabled(true)]
+#[attr("hello")]
+#[repr(C, align = 4)]
+#[repr(C, align(4))]
+```

23 changes: 23 additions & 0 deletions src/doc/unstable-book/src/language-features/catch-expr.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,26 @@ The tracking issue for this feature is: [#31436]
[#31436]: https://github.com/rust-lang/rust/issues/31436

------------------------

The `catch_expr` feature adds support for a `catch` expression. The `catch`
expression creates a new scope one can use the `?` operator in.

```rust
#![feature(catch_expr)]

use std::num::ParseIntError;

let result: Result<i32, ParseIntError> = do catch {
Ok("1".parse::<i32>()?
+ "2".parse::<i32>()?
+ "3".parse::<i32>()?)
};
assert_eq!(result, Ok(6));

let result: Result<i32, ParseIntError> = do catch {
Ok("1".parse::<i32>()?
+ "foo".parse::<i32>()?
+ "3".parse::<i32>()?)
};
assert!(result.is_err());
```
83 changes: 0 additions & 83 deletions src/doc/unstable-book/src/language-features/loop-break-value.md

This file was deleted.

37 changes: 37 additions & 0 deletions src/doc/unstable-book/src/language-features/on-unimplemented.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,42 @@ The tracking issue for this feature is: [#29628]

------------------------

The `on_unimplemented` feature provides the `#[rustc_on_unimplemented]`
attribute, which allows trait definitions to add specialized notes to error
messages when an implementation was expected but not found.

For example:

```rust,compile_fail
#![feature(on_unimplemented)]

#[rustc_on_unimplemented="a collection of type `{Self}` cannot be built from an \
iterator over elements of type `{A}`"]
trait MyIterator<A> {
fn next(&mut self) -> A;
}

fn iterate_chars<I: MyIterator<char>>(i: I) {
// ...
}

fn main() {
iterate_chars(&[1, 2, 3][..]);
}
```

When the user compiles this, they will see the following;

```txt
error[E0277]: the trait bound `&[{integer}]: MyIterator<char>` is not satisfied
--> <anon>:14:5
|
14 | iterate_chars(&[1, 2, 3][..]);
| ^^^^^^^^^^^^^ the trait `MyIterator<char>` is not implemented for `&[{integer}]`
|
= note: a collection of type `&[{integer}]` cannot be built from an iterator over elements of type `char`
= note: required by `iterate_chars`

error: aborting due to previous error
```

3 changes: 3 additions & 0 deletions src/libcollections/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1410,6 +1410,9 @@ impl<T> [T] {

/// Converts `self` into a vector without clones or allocation.
///
/// The resulting vector can be converted back into a box via
/// `Vec<T>`'s `into_boxed_slice` method.
///
/// # Examples
///
/// ```
Expand Down
Loading