@@ -63,7 +63,7 @@ impl Task {
6363 pub fn run( & mut self , f : & fn ( ) ) {
6464 // This is just an assertion that `run` was called unsafely
6565 // and this instance of Task is still accessible.
66- do borrow_local_task |task| {
66+ do Local :: borrow :: < Task > |task| {
6767 assert ! ( ptr:: ref_eq( task, self ) ) ;
6868 }
6969
@@ -88,7 +88,7 @@ impl Task {
8888 fn destroy ( & mut self ) {
8989 // This is just an assertion that `destroy` was called unsafely
9090 // and this instance of Task is still accessible.
91- do borrow_local_task |task| {
91+ do Local :: borrow :: < Task > |task| {
9292 assert ! ( ptr:: ref_eq( task, self ) ) ;
9393 }
9494 match self . storage {
@@ -150,42 +150,6 @@ impl Unwinder {
150150 }
151151}
152152
153- /// Borrow a pointer to the installed local services.
154- /// Fails (likely aborting the process) if local services are not available.
155- pub fn borrow_local_task ( f : & fn ( & mut Task ) ) {
156- do Local :: borrow :: < Scheduler > |sched| {
157- match sched. current_task {
158- Some ( ~ref mut task) => {
159- f ( & mut * task. task )
160- }
161- None => {
162- fail ! ( "no local services for schedulers yet" )
163- }
164- }
165- }
166- }
167-
168- pub unsafe fn unsafe_borrow_local_task ( ) -> * mut Task {
169- match ( * Local :: unsafe_borrow :: < Scheduler > ( ) ) . current_task {
170- Some ( ~ref mut task) => {
171- let s: * mut Task = & mut * task. task ;
172- return s;
173- }
174- None => {
175- // Don't fail. Infinite recursion
176- abort ! ( "no local services for schedulers yet" )
177- }
178- }
179- }
180-
181- pub unsafe fn unsafe_try_borrow_local_task ( ) -> Option < * mut Task > {
182- if Local :: exists :: < Scheduler > ( ) {
183- Some ( unsafe_borrow_local_task ( ) )
184- } else {
185- None
186- }
187- }
188-
189153#[ cfg( test) ]
190154mod test {
191155 use rt:: test:: * ;
0 commit comments