select considers the trait object type Foo+Copy to implement the trait Copy, and therefore its supertraits Clone and Sized. This is totally bogus, as the trait object type is not Sized.
For example:
use std::{fmt, mem};
fn size_of_copy<T: Copy+?Sized>() -> usize { mem::size_of::<T>() }
fn main() {
println!("{}", size_of_copy::<fmt::Debug+Copy>());
}
This obviously should not compile, but it does (and prints 16, because of the size_of unsized hack).
selectconsiders the trait object typeFoo+Copyto implement the traitCopy, and therefore its supertraitsCloneandSized. This is totally bogus, as the trait object type is not Sized.For example:
This obviously should not compile, but it does (and prints 16, because of the
size_ofunsized hack).