3 The tracking issue for this feature is: [#29628]
5 [#29628]: https://github.com/rust-lang/rust/issues/29628
7 ------------------------
9 The `on_unimplemented` feature provides the `#[rustc_on_unimplemented]`
10 attribute, which allows trait definitions to add specialized notes to error
11 messages when an implementation was expected but not found.
16 #![feature(on_unimplemented)]
18 #[rustc_on_unimplemented="an iterator over elements of type `{A}` \
19 cannot be built from a collection of type `{Self}`"]
21 fn next(&mut self) -> A;
24 fn iterate_chars<I: MyIterator<char>>(i: I) {
29 iterate_chars(&[1, 2, 3][..]);
33 When the user compiles this, they will see the following;
36 error[E0277]: the trait bound `&[{integer}]: MyIterator<char>` is not satisfied
39 14 | iterate_chars(&[1, 2, 3][..]);
40 | ^^^^^^^^^^^^^ an iterator over elements of type `char` cannot be built from a collection of type `&[{integer}]`
42 = help: the trait `MyIterator<char>` is not implemented for `&[{integer}]`
43 = note: required by `iterate_chars`
45 error: aborting due to previous error