22
33use std:: cell:: Cell ;
44use std:: mem;
5- use std:: ops:: { Deref , DerefMut } ;
65
76/// Type lambda application, with a lifetime.
87#[ allow( unused_lifetimes) ]
@@ -15,23 +14,6 @@ pub trait LambdaL: for<'a> ApplyL<'a> {}
1514
1615impl < T : for < ' a > ApplyL < ' a > > LambdaL for T { }
1716
18- // HACK(eddyb) work around projection limitations with a newtype
19- // FIXME(#52812) replace with `&'a mut <T as ApplyL<'b>>::Out`
20- pub struct RefMutL < ' a , ' b , T : LambdaL > ( & ' a mut <T as ApplyL < ' b > >:: Out ) ;
21-
22- impl < ' a , ' b , T : LambdaL > Deref for RefMutL < ' a , ' b , T > {
23- type Target = <T as ApplyL < ' b > >:: Out ;
24- fn deref ( & self ) -> & Self :: Target {
25- self . 0
26- }
27- }
28-
29- impl < ' a , ' b , T : LambdaL > DerefMut for RefMutL < ' a , ' b , T > {
30- fn deref_mut ( & mut self ) -> & mut Self :: Target {
31- self . 0
32- }
33- }
34-
3517pub struct ScopedCell < T : LambdaL > ( Cell < <T as ApplyL < ' static > >:: Out > ) ;
3618
3719impl < T : LambdaL > ScopedCell < T > {
@@ -46,7 +28,7 @@ impl<T: LambdaL> ScopedCell<T> {
4628 pub fn replace < ' a , R > (
4729 & self ,
4830 replacement : <T as ApplyL < ' a > >:: Out ,
49- f : impl for <' b , ' c > FnOnce ( RefMutL < ' b , ' c , T > ) -> R ,
31+ f : impl for <' b , ' c > FnOnce ( & ' b mut < T as ApplyL < ' c > > :: Out ) -> R ,
5032 ) -> R {
5133 /// Wrapper that ensures that the cell always gets filled
5234 /// (with the original state, optionally changed by `f`),
@@ -71,7 +53,7 @@ impl<T: LambdaL> ScopedCell<T> {
7153 } ) ) ,
7254 } ;
7355
74- f ( RefMutL ( put_back_on_drop. value . as_mut ( ) . unwrap ( ) ) )
56+ f ( put_back_on_drop. value . as_mut ( ) . unwrap ( ) )
7557 }
7658
7759 /// Sets the value in `self` to `value` while running `f`.
0 commit comments