-
Notifications
You must be signed in to change notification settings - Fork 137
Open
Description
"// a is not valid here" comment is incorrect or rather confusing. It's is not clear whether comment "// a is not valid here" is meant to be in the next line, or the taking ownership is not working as described in the example.
Adding test of variable availability and value invalidates assumption of ownership takeover and drop. Maybe taking ownership does not mean drop. If drop is not intended, than it's not clear what "valid" and "ownership" means in this context and what the example is trying to showcase.
#[test]
fun test_owner() {
let a = owner();
take_ownership(a);
// a is not valid here
// let's check
assert!(a == 10) // -> ALL GOOD
}damirka
Metadata
Metadata
Assignees
Labels
No labels