Closed
Description
Example
struct Foo<T: ?Sized + Bar> {
a: u8,
b: T
}
trait Bar {
fn get(&self) -> usize;
}
struct BarImpl {
i: usize
}
impl Bar for BarImpl {
fn get(&self) -> usize {
self.i
}
}
fn main() {
let f = Foo { a:1, b: BarImpl { i: 5 } };
assert!(f.b.get() == 5); // succeeds
let f = &f as &Foo<Bar>;
assert!(f.b.get() == 5); // assert fails
}