1 // ignore-tidy-linelength
3 #![feature(rustc_attrs)]
6 #[rustc_on_unimplemented = "test error `{Self}` with `{Bar}` `{Baz}` `{Quux}` in `{Foo}`"]
7 pub trait Foo<Bar, Baz, Quux> {}
12 fn foobar<U: Clone, T: Foo<u8, U, u32>>() -> T {
16 #[rustc_on_unimplemented="a collection of type `{Self}` cannot be built from an iterator over elements of type `{A}`"]
17 trait MyFromIterator<A> {
18 /// Builds a container with elements from an external iterator.
19 fn my_from_iter<T: Iterator<Item=A>>(iterator: T) -> Self;
22 fn collect<A, I: Iterator<Item=A>, B: MyFromIterator<A>>(it: I) -> B {
23 MyFromIterator::my_from_iter(it)
27 let x = vec![1u8, 2, 3, 4];
28 let y: Option<Vec<u8>> = collect(x.iter()); // this should give approximately the same error for x.iter().collect()
31 let x: String = foobar(); //~ ERROR