File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,9 @@ impl<'scope> ScopeBuilder<'scope> {
33
33
}
34
34
}
35
35
36
+ // FIXME: &'scope Scope<'scope> means that we can spawn scopes during `scope` and after it.
37
+ // and before it.
38
+ // FIXME: Scopes spawned outside this function must not have access to `tlv`
36
39
pub fn scope < OP , R > ( & ' scope mut self , op : OP ) -> R
37
40
where
38
41
OP : FnOnce ( & ' scope Scope < ' scope > ) -> R + ' scope ,
@@ -81,7 +84,9 @@ pub struct Scope<'scope> {
81
84
/// all of which outlive `'scope`. They're not actually required to be
82
85
/// `Sync`, but it's still safe to let the `Scope` implement `Sync` because
83
86
/// the closures are only *moved* across threads to be executed.
84
- marker : PhantomData < & ' scope ( ) > ,
87
+ /// This also ensures 'scope is invariant, which is required for safety,
88
+ /// since otherwise you could shrink it as spawn closures which reference shorter data.
89
+ marker : PhantomData < Box < FnOnce ( & Scope < ' scope > ) + Send + Sync + ' scope > > ,
85
90
86
91
/// The TLV at the scope's creation. Used to set the TLV for spawned jobs.
87
92
tlv : usize ,
You can’t perform that action at this time.
0 commit comments