about summary refs log tree commit diff
path: root/tests/ui/specialization/min_specialization/spec-iter.rs
blob: f579cd02ad6e75b323ab1b9f696e79c31f4af3cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// Check that we can specialize on a concrete iterator type. This requires us
// to consider which parameters in the parent impl are constrained.

//@ check-pass

#![feature(min_specialization)]

trait SpecFromIter<T> {
    fn f(&self);
}

impl<'a, T: 'a, I: Iterator<Item = &'a T>> SpecFromIter<T> for I {
    default fn f(&self) {}
}

impl<'a, T> SpecFromIter<T> for std::slice::Iter<'a, T> {
    fn f(&self) {}
}

fn main() {}