about summary refs log tree commit diff
path: root/tests/ui/on-unimplemented/use_self_no_underscore.rs
blob: 045ef1a5d3ff02963712e64417f9f49061d9422d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#![feature(rustc_attrs)]

#[rustc_on_unimplemented(on(
    all(A = "{integer}", any(Self = "[{integral}; _]",)),
    message = "an array of type `{Self}` cannot be built directly from an iterator",
))]
pub trait FromIterator<A>: Sized {
    fn from_iter<T: IntoIterator<Item = A>>(iter: T) -> Self;
}
fn main() {
    let iter = 0..42_8;
    let x: [u8; 8] = FromIterator::from_iter(iter);
    //~^ ERROR an array of type `[u8; 8]` cannot be built directly from an iterator
}