Skip to content

Commit

Permalink
Rollup merge of #45574 - nzig:on_unimplemented_example, r=steveklabnik
Browse files Browse the repository at this point in the history
Fixed rustc_on_unimplemented example in Unstable Book

I saw [this](https://doc.rust-lang.org/beta/unstable-book/language-features/on-unimplemented.html) example and it seemed wrong. This fixes the example to emit an error message that makes more sense.
  • Loading branch information
kennytm authored Oct 28, 2017
2 parents 55c4849 + 880200a commit 65f1df5
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ 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}`"]
#[rustc_on_unimplemented="an iterator over elements of type `{A}` \
cannot be built from a collection of type `{Self}`"]
trait MyIterator<A> {
fn next(&mut self) -> A;
}
Expand All @@ -37,9 +37,9 @@ 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}]`
| ^^^^^^^^^^^^^ an iterator over elements of type `char` cannot be built from a collection of type `&[{integer}]`
|
= note: a collection of type `&[{integer}]` cannot be built from an iterator over elements of type `char`
= help: the trait `MyIterator<char>` is not implemented for `&[{integer}]`
= note: required by `iterate_chars`
error: aborting due to previous error
Expand Down

0 comments on commit 65f1df5

Please sign in to comment.