Skip to content

Commit 73ca560

Browse files
committed
(comments only) Mention unsafe TLS destructor use (#3039)
1 parent 3c731df commit 73ca560

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/libcore/task.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -945,8 +945,13 @@ fn spawn_raw(opts: task_opts, +f: fn~()) {
945945
* task-local data slot (and use class destructors, not code inside the
946946
* function, if specific teardown is needed). DO NOT use multiple
947947
* instantiations of a single polymorphic function to index data of different
948-
* types; arbitrary type coercion is possible this way. The interface is safe
949-
* as long as all key functions are monomorphic.
948+
* types; arbitrary type coercion is possible this way.
949+
*
950+
* One other exception is that this global state can be used in a destructor
951+
* context to create a circular @-box reference, which will crash during task
952+
* failure (see issue #3039).
953+
*
954+
* These two cases aside, the interface is safe.
950955
*/
951956
type local_data_key<T: owned> = fn@(+@T);
952957

0 commit comments

Comments
 (0)