Fix mutability #119

This commit is contained in:
2026-07-14 07:15:17 +02:00
parent 93ba0e97da
commit 70ec348f4d
2 changed files with 3 additions and 1 deletions
+1 -1
View File
@@ -593,7 +593,7 @@ pub fn gen_method_point(method: &FunctionDecl, ctx: &mut Context, cg: &mut RustC
cg.addln(" = core::mem::transmute(func_ptr);");
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 {
cg.add_indented("func(self as *const Self as *const core::ffi::c_void");
}
+2
View File
@@ -22,6 +22,8 @@ pub class Animal
"Unknown".to_string()
}
pub virtual void speak_mut(&mut self){}
pub void test_speak<'a>(&'a self)
{
assert_eq!(self.speak(), "Woof!");