Skip to content

Commit a371f82

Browse files
committedOct 27, 2022
Clarify that user1 can't be used as a whole instance. Fixes #2978.
1 parent d339373 commit a371f82

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed
 

‎src/ch05-01-defining-structs.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -148,13 +148,13 @@ the struct’s definition.
148148
Note that the struct update syntax uses `=` like an assignment; this is because
149149
it moves the data, just as we saw in the [“Variables and Data Interacting with
150150
Move”][move]<!-- ignore --> section. In this example, we can no longer use
151-
`user1` after creating `user2` because the `String` in the `username` field of
152-
`user1` was moved into `user2`. If we had given `user2` new `String` values for
153-
both `email` and `username`, and thus only used the `active` and
154-
`sign_in_count` values from `user1`, then `user1` would still be valid after
155-
creating `user2`. Both `active` and `sign_in_count` are types that implement
156-
the `Copy` trait, so the behavior we discussed in the [“Stack-Only Data:
157-
Copy”][copy]<!-- ignore --> section would apply.
151+
`user1` as a whole after creating `user2` because the `String` in the
152+
`username` field of `user1` was moved into `user2`. If we had given `user2` new
153+
`String` values for both `email` and `username`, and thus only used the
154+
`active` and `sign_in_count` values from `user1`, then `user1` would still be
155+
valid after creating `user2`. Both `active` and `sign_in_count` are types that
156+
implement the `Copy` trait, so the behavior we discussed in the [“Stack-Only
157+
Data: Copy”][copy]<!-- ignore --> section would apply.
158158

159159
### Using Tuple Structs Without Named Fields to Create Different Types
160160

0 commit comments

Comments
 (0)
Please sign in to comment.