summary refs log tree commit diff
path: root/tests/ui/issues/issue-11267.rs
blob: 036ad1d54edcd6e4cf362eeb9a80a6cbecd92594 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
//@ run-pass
// Tests that unary structs can be mutably borrowed.

struct Empty;

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 dyn T<isize>) {
    println!("{:?}", a.next())
}

pub fn main() {
    do_something_with(&mut Empty);
}