Skip to content

Commit

Permalink
Update build-test.md (MystenLabs#9724)
Browse files Browse the repository at this point in the history
## Description 

Describe the changes or additions included in this PR.

## Test Plan 

How did you test the new or updated feature?

---
If your changes are not user-facing and not a breaking change, you can
skip the following section. Otherwise, please indicate what changed, and
then add to the Release Notes section as highlighted during the release
process.

### Type of Change (Check all that apply)

- [ ] user-visible impact
- [ ] breaking change for a client SDKs
- [ ] breaking change for FNs (FN binary must upgrade)
- [ ] breaking change for validators or node operators (must upgrade
binaries)
- [ ] breaking change for on-chain data layout
- [ ] necessitate either a data wipe or data migration

### Release notes
  • Loading branch information
randall-Mysten authored Mar 22, 2023
1 parent 33fe37d commit c202ec4
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions doc/src/build/move/build-test.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,7 @@ error[E06001]: unused value without 'drop'
The error message contains all the necessary information to debug the code. The faulty code is meant to highlight one of the Move language's safety features.
The `Sword` struct represents a game asset that digitally mimicks a real-world item. Obviously, a real sword cannot simply disappear (though it can be explicitly
destroyed), but there is no such restriction on a digital one. In fact, this is exactly what's happening in the test function - you create an instance of a `Sword` struct that simply disappears at the end of the function call. If you saw something disappear before your eyes, you'd be dumbfounded, too.
The `Sword` struct represents a game asset that digitally mimics a real-world item. Obviously, a real sword cannot simply disappear (though it can be explicitly destroyed), but there is no such restriction on a digital one. In fact, this is exactly what's happening in the test function - you create an instance of a `Sword` struct that simply disappears at the end of the function call. If you saw something disappear before your eyes, you'd be dumbfounded, too.
One of the solutions (as suggested in the error message), is to add the `drop` ability to the definition of the `Sword` struct, which would allow instances of this struct to disappear (be *dropped*). The ability to drop a valuable asset is not a desirable asset property in this case, so another solution is needed. Another way to solve this problem is to transfer ownership of the sword.
Expand Down

0 comments on commit c202ec4

Please sign in to comment.