Closed
Description
STR
trait Set<T> {
fn contains(&self, T) -> bool;
fn set(&mut self, T);
}
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]) {
for &bit in bits.iter() {
self.set(bit)
}
}
}
fn main() {
let bits: &[_] = &[0, 1];
0.contains(bits);
}
Output
overflow.rs:24:5: 24:21 error: overflow evaluating the trait `core::kinds::Sized` for the type `<generic #139>`
overflow.rs:24 0.contains(bits);
^~~~~~~~~~~~~~~~
overflow.rs:24:5: 24:21 error: overflow evaluating the trait `core::kinds::Copy` for the type `<generic #139>`
overflow.rs:24 0.contains(bits);
^~~~~~~~~~~~~~~~
overflow.rs:24:5: 24:21 error: overflow evaluating the trait `core::kinds::Sized` for the type `<generic integer #2>`
overflow.rs:24 0.contains(bits);
^~~~~~~~~~~~~~~~
overflow.rs:24:5: 24:21 error: overflow evaluating the trait `Set<<generic #139>>` for the type `<generic integer #2>`
overflow.rs:24 0.contains(bits);
^~~~~~~~~~~~~~~~
overflow.rs:24:16: 24:20 error: mismatched types: expected `&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[<generic #139>]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]`, found `&[<generic integer #0>]` (expected &-ptr, found integral variable)
overflow.rs:24 0.contains(bits);
^~~~
error: aborting due to 5 previous errors
Version
rustc 0.13.0-dev (9a778bc55 2014-10-28 10:11:51 +0000)
Compare it to the output of the playpen:
<anon>:24:5: 24:21 error: the trait `Set<<generic integer #0>>` is not implemented for the type `<generic integer #2>`
<anon>:24 0.contains(bits);
^~~~~~~~~~~~~~~~
error: aborting due to previous error
playpen: application terminated with error code 101
Program ended.
@thestinger Do you know what's the playpen current rustc
version?
According to rusti, the version is/was:
NOTICE: rustc 0.13.0-dev (2130f2221 2014-10-21 19:32:10 +0000)
EDIT Added playpen version