@@ -3,7 +3,6 @@ use super::{Enter, Executor, SpawnError};
33use  futures:: { future,  Future } ; 
44
55use  std:: cell:: Cell ; 
6- use  std:: marker:: PhantomData ; 
76
87/// Executes futures on the default executor for the current execution context. 
98/// 
@@ -23,8 +22,8 @@ pub struct DefaultExecutor {
2322/// Ensures that the executor is removed from the thread-local context 
2423/// when leaving the scope. This handles cases that involve panicking. 
2524#[ derive( Debug ) ]  
26- pub  struct  DefaultGuard < ' a >  { 
27-     _lifetime :   PhantomData < & ' a   ( ) > , 
25+ pub  struct  DefaultGuard  { 
26+     _p :   ( ) , 
2827} 
2928
3029impl  DefaultExecutor  { 
@@ -183,6 +182,11 @@ where
183182    T :  Executor , 
184183    F :  FnOnce ( & mut  Enter )  -> R , 
185184{ 
185+     unsafe  fn  hide_lt < ' a > ( p :  * mut  ( dyn  Executor  + ' a ) )  -> * mut  ( dyn  Executor  + ' static )  { 
186+         use  std:: mem; 
187+         mem:: transmute ( p) 
188+     } 
189+ 
186190    EXECUTOR . with ( |cell| { 
187191        match  cell. get ( )  { 
188192            State :: Ready ( _)  | State :: Active  => { 
@@ -224,7 +228,7 @@ where
224228/// # Panics 
225229/// 
226230/// This function panics if there already is a default executor set. 
227- pub  fn  set_default < ' a ,   T > ( executor :  T )  -> DefaultGuard < ' a > 
231+ pub  fn  set_default < T > ( executor :  T )  -> DefaultGuard 
228232where 
229233    T :  Executor  + ' static , 
230234{ 
@@ -244,17 +248,10 @@ where
244248        cell. set ( State :: Ready ( Box :: into_raw ( executor) ) ) ; 
245249    } ) ; 
246250
247-     DefaultGuard  { 
248-         _lifetime :  PhantomData , 
249-     } 
250- } 
251- 
252- unsafe  fn  hide_lt < ' a > ( p :  * mut  ( dyn  Executor  + ' a ) )  -> * mut  ( dyn  Executor  + ' static )  { 
253-     use  std:: mem; 
254-     mem:: transmute ( p) 
251+     DefaultGuard  {  _p :  ( )  } 
255252} 
256253
257- impl < ' a >  Drop  for  DefaultGuard < ' a >  { 
254+ impl  Drop  for  DefaultGuard  { 
258255    fn  drop ( & mut  self )  { 
259256        let  _ = EXECUTOR . try_with ( |cell| { 
260257            if  let  State :: Ready ( prev)  = cell. replace ( State :: Empty )  { 
0 commit comments