rust/src/test/run-pass/issues/issue-11267.rs

20 lines
340 B
Rust
Raw Normal View History

// run-pass
// Tests that unary structs can be mutably borrowed.
struct Empty;
2014-10-01 01:31:21 -05:00
trait T<U> {
fn next(&mut self) -> Option<U>;
}
impl T<isize> for Empty {
fn next(&mut self) -> Option<isize> { None }
}
fn do_something_with(a : &mut T<isize>) {
println!("{:?}", a.next())
}
pub fn main() {
do_something_with(&mut Empty);
}