diff options
Diffstat (limited to '')
-rw-r--r-- | src/test/ui/issues/issue-11267.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/test/ui/issues/issue-11267.rs b/src/test/ui/issues/issue-11267.rs new file mode 100644 index 000000000..848ed6ac7 --- /dev/null +++ b/src/test/ui/issues/issue-11267.rs @@ -0,0 +1,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); +} |