diff options
| author | Eduard-Mihai Burtescu <edy.burt@gmail.com> | 2019-10-28 19:55:25 +0200 |
|---|---|---|
| committer | Eduard-Mihai Burtescu <edy.burt@gmail.com> | 2019-10-28 19:55:25 +0200 |
| commit | b3f64946f9d89833c1f05bd010c464f54c3fb6b5 (patch) | |
| tree | 4987aa07e3cdffbab40dbbc9bda4c53ce0ab7234 /src/libproc_macro/bridge | |
| parent | 8d78bf6b273848d17da8f5c92162c6a6b9b10dfd (diff) | |
| download | rust-b3f64946f9d89833c1f05bd010c464f54c3fb6b5.tar.gz rust-b3f64946f9d89833c1f05bd010c464f54c3fb6b5.zip | |
proc_macro: remove now-unnecessary ICE workarounds from bridge::client.
Diffstat (limited to 'src/libproc_macro/bridge')
| -rw-r--r-- | src/libproc_macro/bridge/client.rs | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/libproc_macro/bridge/client.rs b/src/libproc_macro/bridge/client.rs index 5c543165bc2..cd33c4bc67e 100644 --- a/src/libproc_macro/bridge/client.rs +++ b/src/libproc_macro/bridge/client.rs @@ -15,8 +15,9 @@ macro_rules! define_handles { } impl HandleCounters { - // FIXME(#53451) public to work around `Cannot create local mono-item` ICE. - pub extern "C" fn get() -> &'static Self { + // FIXME(eddyb) use a reference to the `static COUNTERS`, intead of + // a wrapper `fn` pointer, once `const fn` can reference `static`s. + extern "C" fn get() -> &'static Self { static COUNTERS: HandleCounters = HandleCounters { $($oty: AtomicUsize::new(1),)* $($ity: AtomicUsize::new(1),)* @@ -333,14 +334,14 @@ impl Bridge<'_> { #[repr(C)] #[derive(Copy, Clone)] pub struct Client<F> { + // FIXME(eddyb) use a reference to the `static COUNTERS`, intead of + // a wrapper `fn` pointer, once `const fn` can reference `static`s. pub(super) get_handle_counters: extern "C" fn() -> &'static HandleCounters, pub(super) run: extern "C" fn(Bridge<'_>, F) -> Buffer<u8>, pub(super) f: F, } -// FIXME(#53451) public to work around `Cannot create local mono-item` ICE, -// affecting not only the function itself, but also the `BridgeState` `thread_local!`. -pub extern "C" fn __run_expand1( +extern "C" fn run_expand1( mut bridge: Bridge<'_>, f: fn(crate::TokenStream) -> crate::TokenStream, ) -> Buffer<u8> { @@ -385,15 +386,13 @@ impl Client<fn(crate::TokenStream) -> crate::TokenStream> { pub const fn expand1(f: fn(crate::TokenStream) -> crate::TokenStream) -> Self { Client { get_handle_counters: HandleCounters::get, - run: __run_expand1, + run: run_expand1, f, } } } -// FIXME(#53451) public to work around `Cannot create local mono-item` ICE, -// affecting not only the function itself, but also the `BridgeState` `thread_local!`. -pub extern "C" fn __run_expand2( +extern "C" fn run_expand2( mut bridge: Bridge<'_>, f: fn(crate::TokenStream, crate::TokenStream) -> crate::TokenStream, ) -> Buffer<u8> { @@ -441,7 +440,7 @@ impl Client<fn(crate::TokenStream, crate::TokenStream) -> crate::TokenStream> { ) -> Self { Client { get_handle_counters: HandleCounters::get, - run: __run_expand2, + run: run_expand2, f, } } |
