diff options
Diffstat (limited to '')
-rw-r--r-- | src/test/ui/issues/issue-26205.rs | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/test/ui/issues/issue-26205.rs b/src/test/ui/issues/issue-26205.rs new file mode 100644 index 000000000..f5f39ded0 --- /dev/null +++ b/src/test/ui/issues/issue-26205.rs @@ -0,0 +1,31 @@ +// check-pass +#![allow(dead_code)] +use std::ops::{Deref, DerefMut}; + +struct Foo; + +impl Foo { + fn foo_mut(&mut self) {} +} + +struct Bar(Foo); + +impl Deref for Bar { + type Target = Foo; + + fn deref(&self) -> &Foo { + &self.0 + } +} + +impl DerefMut for Bar { + fn deref_mut(&mut self) -> &mut Foo { + &mut self.0 + } +} + +fn test(mut bar: Box<Bar>) { + bar.foo_mut(); +} + +fn main() {} |