@@ -1025,9 +1025,9 @@ fn kill_taskgroup(state: taskgroup_inner, me: *rust_task, is_main: bool) {
1025
1025
1026
1026
// FIXME (#2912): Work around core-vs-coretest function duplication. Can't use
1027
1027
// a proper closure because the #[test]s won't understand. Have to fake it.
1028
- unsafe fn taskgroup_key( ) -> local_data_key<tcb> {
1028
+ macro_rules! taskgroup_key {
1029
1029
// Use a "code pointer" value that will never be a real code pointer.
1030
- unsafe :: transmute( ( -2 as uint, 0 u) )
1030
+ { } => ( unsafe :: transmute( ( -2 as uint, 0 u) ) )
1031
1031
}
1032
1032
1033
1033
fn gen_child_taskgroup( linked: bool , supervised: bool )
@@ -1036,7 +1036,8 @@ fn gen_child_taskgroup(linked: bool, supervised: bool)
1036
1036
/*######################################################################*
1037
1037
* Step 1. Get spawner's taskgroup info.
1038
1038
*######################################################################*/
1039
- let spawner_group = match unsafe { local_get( spawner, taskgroup_key( ) ) } {
1039
+ let spawner_group = match unsafe { local_get( spawner,
1040
+ taskgroup_key!( ) ) } {
1040
1041
none => {
1041
1042
// Main task, doing first spawn ever. Lazily initialise here.
1042
1043
let mut members = new_taskset( ) ;
@@ -1047,7 +1048,7 @@ fn gen_child_taskgroup(linked: bool, supervised: bool)
1047
1048
// Main task/group has no ancestors, no notifier, etc.
1048
1049
let group =
1049
1050
@tcb( spawner, tasks, ancestor_list( none) , true, none) ;
1050
- unsafe { local_set( spawner, taskgroup_key( ) , group) ; }
1051
+ unsafe { local_set( spawner, taskgroup_key! ( ) , group) ; }
1051
1052
group
1052
1053
}
1053
1054
some( group) => group
@@ -1162,7 +1163,7 @@ fn spawn_raw(+opts: task_opts, +f: fn~()) {
1162
1163
if enlist_many( child, child_arc, & mut ancestors) {
1163
1164
let group = @tcb( child, child_arc, ancestors,
1164
1165
is_main, notifier) ;
1165
- unsafe { local_set( child, taskgroup_key( ) , group) ; }
1166
+ unsafe { local_set( child, taskgroup_key! ( ) , group) ; }
1166
1167
// Run the child's body.
1167
1168
f( ) ;
1168
1169
// TLS cleanup code will exit the taskgroup.
@@ -1261,7 +1262,7 @@ fn spawn_raw(+opts: task_opts, +f: fn~()) {
1261
1262
*
1262
1263
* These two cases aside, the interface is safe.
1263
1264
*/
1264
- type local_data_key<T : owned> = fn @ ( +@T ) ;
1265
+ type local_data_key<T : owned> = & fn ( +@T ) ;
1265
1266
1266
1267
trait local_data { }
1267
1268
impl <T : owned> @T : local_data { }
0 commit comments