module 0xc0ffee::m {
inline fun inc(x: &mut u64): u64 {
*x = *x + 1;
*x
}
fun add(x: u64, y: u64): u64 {
x + y
}
public fun test(): u64 {
let x = 1;
x + inc(&mut x) + inc(&mut x)
}
}
When it is compiled with v1, we get a reference safety error ("invalid operation, could create dangling a reference"). When compiled with v2, there is no compiler error or runtime error.
Because this is a divergent behavior between the compiler, I am opening an issue to track it; we may decide this is not an actual bug, but that v2 just accepts more (safe) programs than v1.
🐛 Bug
Consider the following Move program:
When it is compiled with v1, we get a reference safety error ("invalid operation, could create dangling a reference"). When compiled with v2, there is no compiler error or runtime error.
Because this is a divergent behavior between the compiler, I am opening an issue to track it; we may decide this is not an actual bug, but that v2 just accepts more (safe) programs than v1.