File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Expand file tree Collapse file tree 1 file changed +6
-5
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 ,
@@ -77,11 +80,9 @@ pub struct Scope<'scope> {
77
80
/// latch to set when the counter drops to zero (and hence this scope is complete)
78
81
job_completed_latch : CountLatch ,
79
82
80
- /// You can think of a scope as containing a list of closures to execute,
81
- /// all of which outlive `'scope`. They're not actually required to be
82
- /// `Sync`, but it's still safe to let the `Scope` implement `Sync` because
83
- /// the closures are only *moved* across threads to be executed.
84
- marker : PhantomData < & ' scope ( ) > ,
83
+ /// This ensures 'scope is invariant, which is required for safety,
84
+ /// since otherwise you could shrink it as spawn closures which reference shorter data.
85
+ marker : PhantomData < & ' scope mut & ' scope ( ) > ,
85
86
86
87
/// The TLV at the scope's creation. Used to set the TLV for spawned jobs.
87
88
tlv : usize ,
You can’t perform that action at this time.
0 commit comments