Skip to content

Commit 65f1df5

Browse files
authored
Rollup merge of #45574 - nzig:on_unimplemented_example, r=steveklabnik
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.
2 parents 55c4849 + 880200a commit 65f1df5

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/doc/unstable-book/src/language-features/on-unimplemented.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ For example:
1515
```rust,compile_fail
1616
#![feature(on_unimplemented)]
1717
18-
#[rustc_on_unimplemented="a collection of type `{Self}` cannot be built from an \
19-
iterator over elements of type `{A}`"]
18+
#[rustc_on_unimplemented="an iterator over elements of type `{A}` \
19+
cannot be built from a collection of type `{Self}`"]
2020
trait MyIterator<A> {
2121
fn next(&mut self) -> A;
2222
}
@@ -37,9 +37,9 @@ error[E0277]: the trait bound `&[{integer}]: MyIterator<char>` is not satisfied
3737
--> <anon>:14:5
3838
|
3939
14 | iterate_chars(&[1, 2, 3][..]);
40-
| ^^^^^^^^^^^^^ the trait `MyIterator<char>` is not implemented for `&[{integer}]`
40+
| ^^^^^^^^^^^^^ an iterator over elements of type `char` cannot be built from a collection of type `&[{integer}]`
4141
|
42-
= note: a collection of type `&[{integer}]` cannot be built from an iterator over elements of type `char`
42+
= help: the trait `MyIterator<char>` is not implemented for `&[{integer}]`
4343
= note: required by `iterate_chars`
4444
4545
error: aborting due to previous error

0 commit comments

Comments
 (0)