Skip to content

Commit f9324d0

Browse files
authored
Unrolled build for rust-lang#121302
Rollup merge of rust-lang#121302 - GrigorenkoPV:refmutl, r=bjorn3 Remove `RefMutL` hack in `proc_macro::bridge` From what I can tell, rust-lang#52812 is now fixed, so there is no longer any need to keep this hack around.
2 parents 2b43e75 + 5be3d4b commit f9324d0

File tree

2 files changed

+3
-26
lines changed

2 files changed

+3
-26
lines changed

library/proc_macro/src/bridge/client.rs

+1-6
Original file line numberDiff line numberDiff line change
@@ -296,12 +296,7 @@ impl BridgeState<'_> {
296296
/// N.B., while `f` is running, the thread-local state
297297
/// is `BridgeState::InUse`.
298298
fn with<R>(f: impl FnOnce(&mut BridgeState<'_>) -> R) -> R {
299-
BRIDGE_STATE.with(|state| {
300-
state.replace(BridgeState::InUse, |mut state| {
301-
// FIXME(#52812) pass `f` directly to `replace` when `RefMutL` is gone
302-
f(&mut *state)
303-
})
304-
})
299+
BRIDGE_STATE.with(|state| state.replace(BridgeState::InUse, f))
305300
}
306301
}
307302

library/proc_macro/src/bridge/scoped_cell.rs

+2-20
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
33
use std::cell::Cell;
44
use 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

1615
impl<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-
3517
pub struct ScopedCell<T: LambdaL>(Cell<<T as ApplyL<'static>>::Out>);
3618

3719
impl<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

Comments
 (0)