From 70ec348f4d92849e0853df4d562bf6d4ffda771c Mon Sep 17 00:00:00 2001 From: Klesti Selimaj Date: Tue, 14 Jul 2026 07:15:17 +0200 Subject: [PATCH] Fix mutability #119 --- crates/codegen/src/class_decl.rs | 2 +- mist-test/src/items/class_test.mist | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/codegen/src/class_decl.rs b/crates/codegen/src/class_decl.rs index e7bd747..902fbe2 100644 --- a/crates/codegen/src/class_decl.rs +++ b/crates/codegen/src/class_decl.rs @@ -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"); } diff --git a/mist-test/src/items/class_test.mist b/mist-test/src/items/class_test.mist index e6153cf..7562983 100644 --- a/mist-test/src/items/class_test.mist +++ b/mist-test/src/items/class_test.mist @@ -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!");