Skip to content

Commit 9a8240e

Browse files
committed
Clarify some things
1 parent 7886d57 commit 9a8240e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

text/0000-immovable-types.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ Since generators can only move during suspend points we can require that referen
2020
# Detailed design
2121
[design]: #detailed-design
2222

23-
A new unsafe auto trait `Move` is introduced in `core::marker`. References, pointers, `core::ptr::Unique` and `core::ptr::Shared` implement this trait.
23+
A new unsafe auto trait `Move` is introduced in `core::marker`. Auto traits are implemented for all primitive types and for composite types where the elements also implement the trait. Users can opt-out to this for custom types. References, pointers, `core::ptr::Unique` and `core::ptr::Shared` explicitly implement this trait, since pointers are movable even if they point to immovable types.
2424

2525
All type parameters (including `Self` for traits), trait objects and associated types have a `Move` bound by default.
2626

2727
If you want to allow types which may not implement `Move`, you would use the `?Move` trait bound which means that the type may or may not implement `Move`.
2828

29-
You can freely move values which do not implement `Move` as long as you don't borrow them. Once we borrow such a value, we'd know its address and code should be able to rely on the address not changing. This is sound since the only way to observe the address of a value is to borrow it. Before the first borrow nothing can observe the address and the value can be moved around.
29+
You can freely move values which are known to implement `Move` after they are borrowed, however you cannot move types which aren't known to implement `Move` after they have been borrowed. Once we borrow an immovable type, we'd know its address and code should be able to rely on the address not changing. This is sound since the only way to observe the address of a value is to borrow it. Before the first borrow nothing can observe the address and the value can be moved around.
3030

3131
Static variables allow types which do not implement `Move`.
3232

0 commit comments

Comments
 (0)