Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
32 lines (23 sloc) 439 Bytes
// build-pass (FIXME(62277): could be 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() {}
You can’t perform that action at this time.