Fix mutability #119
This commit is contained in:
@@ -593,7 +593,7 @@ pub fn gen_method_point(method: &FunctionDecl, ctx: &mut Context, cg: &mut RustC
|
|||||||
cg.addln(" = core::mem::transmute(func_ptr);");
|
cg.addln(" = core::mem::transmute(func_ptr);");
|
||||||
|
|
||||||
if mutable_self {
|
if mutable_self {
|
||||||
cg.add_indented("func(self as *mut Self as *const core::ffi::c_void");
|
cg.add_indented("func(self as *mut Self as *mut core::ffi::c_void");
|
||||||
} else {
|
} else {
|
||||||
cg.add_indented("func(self as *const Self as *const core::ffi::c_void");
|
cg.add_indented("func(self as *const Self as *const core::ffi::c_void");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ pub class Animal
|
|||||||
"Unknown".to_string()
|
"Unknown".to_string()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub virtual void speak_mut(&mut self){}
|
||||||
|
|
||||||
pub void test_speak<'a>(&'a self)
|
pub void test_speak<'a>(&'a self)
|
||||||
{
|
{
|
||||||
assert_eq!(self.speak(), "Woof!");
|
assert_eq!(self.speak(), "Woof!");
|
||||||
|
|||||||
Reference in New Issue
Block a user