mirror of
https://github.com/rust-lang/rust
synced 2024-11-05 20:45:15 +00:00
19 lines
344 B
Rust
19 lines
344 B
Rust
// 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);
|
|
}
|