rust/tests/ui/traits/issue-18400.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

27 lines
457 B
Rust
Raw Normal View History

2014-12-07 15:22:06 +00:00
trait Set<T> {
fn contains(&self, _: T) -> bool;
fn set(&mut self, _: T);
2014-12-07 15:22:06 +00:00
}
impl<'a, T, S> Set<&'a [T]> for S where
T: Copy,
S: Set<T>,
{
fn contains(&self, bits: &[T]) -> bool {
bits.iter().all(|&bit| self.contains(bit))
}
fn set(&mut self, bits: &[T]) {
2015-01-31 17:20:46 +00:00
for &bit in bits {
2014-12-07 15:22:06 +00:00
self.set(bit)
}
}
}
fn main() {
let bits: &[_] = &[0, 1];
0.contains(bits);
//~^ ERROR overflow
2014-12-07 15:22:06 +00:00
}