Auto merge of #131948 - matthiaskrgr:rollup-c9rvzu6, r=matthiaskrgr · qinheping/verify-rust-std@362aec6 (original) (raw)
`@@ -18,17 +18,10 @@ macro_rules! define_client_handles {
`
18
18
` (pub(super)(pub(super) (pub(super)ity: AtomicU32,)*
`
19
19
`}
`
20
20
``
21
``
`-
impl HandleCounters {
`
22
``
`` -
// FIXME(eddyb) use a reference to the static COUNTERS
, instead of
``
23
``
`` -
// a wrapper fn
pointer, once const fn
can reference static
s.
``
24
``
`-
extern "C" fn get() -> &'static Self {
`
25
``
`-
static COUNTERS: HandleCounters = HandleCounters {
`
26
``
`-
(((oty: AtomicU32::new(1),)*
`
27
``
`-
(((ity: AtomicU32::new(1),)*
`
28
``
`-
};
`
29
``
`-
&COUNTERS
`
30
``
`-
}
`
31
``
`-
}
`
``
21
`+
static COUNTERS: HandleCounters = HandleCounters {
`
``
22
`+
(((oty: AtomicU32::new(1),)*
`
``
23
`+
(((ity: AtomicU32::new(1),)*
`
``
24
`+
};
`
32
25
``
33
26
` $(
`
34
27
`pub(crate) struct $oty {
`
`@@ -259,9 +252,7 @@ pub(crate) fn is_available() -> bool {
`
259
252
`` /// and forcing the use of APIs that take/return S::TokenStream
, server-side.
``
260
253
`#[repr(C)]
`
261
254
`pub struct Client<I, O> {
`
262
``
`` -
// FIXME(eddyb) use a reference to the static COUNTERS
, instead of
``
263
``
`` -
// a wrapper fn
pointer, once const fn
can reference static
s.
``
264
``
`-
pub(super) get_handle_counters: extern "C" fn() -> &'static HandleCounters,
`
``
255
`+
pub(super) handle_counters: &'static HandleCounters,
`
265
256
``
266
257
`pub(super) run: extern "C" fn(BridgeConfig<'_>) -> Buffer,
`
267
258
``
`@@ -346,7 +337,7 @@ fn run_client<A: for<'a, 's> DecodeMut<'a, 's, ()>, R: Encode<()>>(
`
346
337
`impl Client<crate::TokenStream, crate::TokenStream> {
`
347
338
`pub const fn expand1(f: impl Fn(crate::TokenStream) -> crate::TokenStream + Copy) -> Self {
`
348
339
`Client {
`
349
``
`-
get_handle_counters: HandleCounters::get,
`
``
340
`+
handle_counters: &COUNTERS,
`
350
341
`run: super::selfless_reify::reify_to_extern_c_fn_hrt_bridge(move |bridge| {
`
351
342
`run_client(bridge, |input| f(crate::TokenStream(Some(input))).0)
`
352
343
`}),
`
`@@ -360,7 +351,7 @@ impl Client<(crate::TokenStream, crate::TokenStream), crate::TokenStream> {
`
360
351
`f: impl Fn(crate::TokenStream, crate::TokenStream) -> crate::TokenStream + Copy,
`
361
352
`) -> Self {
`
362
353
`Client {
`
363
``
`-
get_handle_counters: HandleCounters::get,
`
``
354
`+
handle_counters: &COUNTERS,
`
364
355
`run: super::selfless_reify::reify_to_extern_c_fn_hrt_bridge(move |bridge| {
`
365
356
`run_client(bridge, |(input, input2)| {
`
366
357
`f(crate::TokenStream(Some(input)), crate::TokenStream(Some(input2))).0
`