]> git.lizzy.rs Git - rust.git/blob - tests/ui/traits/issue-18400.rs
Merge commit '598f0909568a51de8a2d1148f55a644fd8dffad0' into sync_cg_clif-2023-01-24
[rust.git] / tests / ui / traits / issue-18400.rs
1 trait Set<T> {
2     fn contains(&self, _: T) -> bool;
3     fn set(&mut self, _: T);
4 }
5
6 impl<'a, T, S> Set<&'a [T]> for S where
7     T: Copy,
8     S: Set<T>,
9 {
10     fn contains(&self, bits: &[T]) -> bool {
11         bits.iter().all(|&bit| self.contains(bit))
12     }
13
14     fn set(&mut self, bits: &[T]) {
15         for &bit in bits {
16             self.set(bit)
17         }
18     }
19 }
20
21 fn main() {
22     let bits: &[_] = &[0, 1];
23
24     0.contains(bits);
25     //~^ ERROR overflow
26 }