You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#[stabby::stabby]pubtraitIface{extern"C"fnset(&mutself,val:i32);}structImpl{cookie:i32,}implIfaceforImpl{extern"C"fnset(&mutself,val:i32){println!("set({:?}, {})",selfas*mut _, val);self.cookie = val;}}fnmain(){letmut val = Impl{cookie:42};println!("val is at {:?}",(&val)as*const _);letmut ptr: stabby::dynptr!(&'_ mut dyn Iface) = (&mut val).into();println!("ptr is at {:?}",(&ptr)as*const _);
ptr.set(13);drop(ptr);assert_eq!(val.cookie,13);}
The output is suspicious:
val is at 0x7fffd73e8f54
ptr is at 0x7fffd73e8fb0
set(0x7fffd73e8fb0, 13)
thread 'main' panicked at src/main.rs:24:5:
assertion `left == right` failed
left: 42
right: 13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Apparently somehow, pointer to ptr instead of its value is passed to set.
Versions
stabby 36.2.2
rustc 1.84.0 (9fc6b4312 2025-01-07)
The text was updated successfully, but these errors were encountered:
E.g. in this small example the assertion fails:
The output is suspicious:
Apparently somehow, pointer to
ptr
instead of its value is passed toset
.Versions
stabby 36.2.2
rustc 1.84.0 (9fc6b4312 2025-01-07)
The text was updated successfully, but these errors were encountered: