rust/tests/ui/issues/issue-11267.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

20 lines
345 B
Rust
Raw Normal View History

//@ run-pass
// 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>;
}
impl T<isize> for Empty {
fn next(&mut self) -> Option<isize> { None }
}
2019-05-28 18:47:21 +00:00
fn do_something_with(a : &mut dyn T<isize>) {
println!("{:?}", a.next())
}
pub fn main() {
do_something_with(&mut Empty);
}