2018-08-30 12:18:55 +00:00
|
|
|
//@ run-pass
|
2014-03-12 15:54:43 +00:00
|
|
|
// Tests that unary structs can be mutably borrowed.
|
|
|
|
|
|
|
|
struct Empty;
|
|
|
|
|
2014-10-01 06:31:21 +00:00
|
|
|
trait T<U> {
|
|
|
|
fn next(&mut self) -> Option<U>;
|
|
|
|
}
|
2015-03-26 00:06:52 +00:00
|
|
|
impl T<isize> for Empty {
|
|
|
|
fn next(&mut self) -> Option<isize> { None }
|
2014-03-12 15:54:43 +00:00
|
|
|
}
|
|
|
|
|
2019-05-28 18:47:21 +00:00
|
|
|
fn do_something_with(a : &mut dyn T<isize>) {
|
2014-12-20 08:09:35 +00:00
|
|
|
println!("{:?}", a.next())
|
2014-03-12 15:54:43 +00:00
|
|
|
}
|
|
|
|
|
2014-03-12 17:31:52 +00:00
|
|
|
pub fn main() {
|
2014-03-12 15:54:43 +00:00
|
|
|
do_something_with(&mut Empty);
|
2014-03-12 17:31:52 +00:00
|
|
|
}
|