Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 362aec6

Browse files
committedOct 19, 2024
Auto merge of rust-lang#131948 - matthiaskrgr:rollup-c9rvzu6, r=matthiaskrgr
Rollup of 12 pull requests Successful merges: - rust-lang#116863 (warn less about non-exhaustive in ffi) - rust-lang#127675 (Remove invalid help diagnostics for const pointer) - rust-lang#131772 (Remove `const_refs_to_static` TODO in proc_macro) - rust-lang#131789 (Make sure that outer opaques capture inner opaques's lifetimes even with precise capturing syntax) - rust-lang#131795 (Stop inverting expectation in normalization errors) - rust-lang#131920 (Add codegen test for branchy bool match) - rust-lang#131921 (replace STATX_ALL with (STATX_BASIC_STATS | STATX_BTIME) as former is deprecated) - rust-lang#131925 (Warn on redundant `--cfg` directive when revisions are used) - rust-lang#131931 (Remove unnecessary constness from `lower_generic_args_of_path`) - rust-lang#131932 (use tracked_path in rustc_fluent_macro) - rust-lang#131936 (feat(rustdoc-json-types): introduce rustc-hash feature) - rust-lang#131939 (Get rid of `OnlySelfBounds`) Failed merges: - rust-lang#131181 (Compiletest: Custom differ) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 5615efc + 7628c4f commit 362aec6

File tree

3 files changed

+16
-25
lines changed

3 files changed

+16
-25
lines changed
 

‎proc_macro/src/bridge/client.rs

+7-16
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,10 @@ macro_rules! define_client_handles {
1818
$(pub(super) $ity: AtomicU32,)*
1919
}
2020

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+
};
3225

3326
$(
3427
pub(crate) struct $oty {
@@ -259,9 +252,7 @@ pub(crate) fn is_available() -> bool {
259252
/// and forcing the use of APIs that take/return `S::TokenStream`, server-side.
260253
#[repr(C)]
261254
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,
265256

266257
pub(super) run: extern "C" fn(BridgeConfig<'_>) -> Buffer,
267258

@@ -346,7 +337,7 @@ fn run_client<A: for<'a, 's> DecodeMut<'a, 's, ()>, R: Encode<()>>(
346337
impl Client<crate::TokenStream, crate::TokenStream> {
347338
pub const fn expand1(f: impl Fn(crate::TokenStream) -> crate::TokenStream + Copy) -> Self {
348339
Client {
349-
get_handle_counters: HandleCounters::get,
340+
handle_counters: &COUNTERS,
350341
run: super::selfless_reify::reify_to_extern_c_fn_hrt_bridge(move |bridge| {
351342
run_client(bridge, |input| f(crate::TokenStream(Some(input))).0)
352343
}),
@@ -360,7 +351,7 @@ impl Client<(crate::TokenStream, crate::TokenStream), crate::TokenStream> {
360351
f: impl Fn(crate::TokenStream, crate::TokenStream) -> crate::TokenStream + Copy,
361352
) -> Self {
362353
Client {
363-
get_handle_counters: HandleCounters::get,
354+
handle_counters: &COUNTERS,
364355
run: super::selfless_reify::reify_to_extern_c_fn_hrt_bridge(move |bridge| {
365356
run_client(bridge, |(input, input2)| {
366357
f(crate::TokenStream(Some(input)), crate::TokenStream(Some(input2))).0

‎proc_macro/src/bridge/server.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -400,10 +400,10 @@ impl client::Client<crate::TokenStream, crate::TokenStream> {
400400
S: Server,
401401
S::TokenStream: Default,
402402
{
403-
let client::Client { get_handle_counters, run, _marker } = *self;
403+
let client::Client { handle_counters, run, _marker } = *self;
404404
run_server(
405405
strategy,
406-
get_handle_counters(),
406+
handle_counters,
407407
server,
408408
<MarkedTypes<S> as Types>::TokenStream::mark(input),
409409
run,
@@ -426,10 +426,10 @@ impl client::Client<(crate::TokenStream, crate::TokenStream), crate::TokenStream
426426
S: Server,
427427
S::TokenStream: Default,
428428
{
429-
let client::Client { get_handle_counters, run, _marker } = *self;
429+
let client::Client { handle_counters, run, _marker } = *self;
430430
run_server(
431431
strategy,
432-
get_handle_counters(),
432+
handle_counters,
433433
server,
434434
(
435435
<MarkedTypes<S> as Types>::TokenStream::mark(input),

‎std/src/sys/pal/unix/fs.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ cfg_has_statx! {{
189189
// See: https://github.com/rust-lang/rust/issues/65662
190190
//
191191
// FIXME what about transient conditions like `ENOMEM`?
192-
let err2 = cvt(statx(0, ptr::null(), 0, libc::STATX_ALL, ptr::null_mut()))
192+
let err2 = cvt(statx(0, ptr::null(), 0, libc::STATX_BASIC_STATS | libc::STATX_BTIME, ptr::null_mut()))
193193
.err()
194194
.and_then(|e| e.raw_os_error());
195195
if err2 == Some(libc::EFAULT) {
@@ -910,7 +910,7 @@ impl DirEntry {
910910
fd,
911911
name,
912912
libc::AT_SYMLINK_NOFOLLOW | libc::AT_STATX_SYNC_AS_STAT,
913-
libc::STATX_ALL,
913+
libc::STATX_BASIC_STATS | libc::STATX_BTIME,
914914
) } {
915915
return ret;
916916
}
@@ -1194,7 +1194,7 @@ impl File {
11941194
fd,
11951195
c"".as_ptr() as *const c_char,
11961196
libc::AT_EMPTY_PATH | libc::AT_STATX_SYNC_AS_STAT,
1197-
libc::STATX_ALL,
1197+
libc::STATX_BASIC_STATS | libc::STATX_BTIME,
11981198
) } {
11991199
return ret;
12001200
}
@@ -1767,7 +1767,7 @@ pub fn stat(p: &Path) -> io::Result<FileAttr> {
17671767
libc::AT_FDCWD,
17681768
p.as_ptr(),
17691769
libc::AT_STATX_SYNC_AS_STAT,
1770-
libc::STATX_ALL,
1770+
libc::STATX_BASIC_STATS | libc::STATX_BTIME,
17711771
) } {
17721772
return ret;
17731773
}
@@ -1786,7 +1786,7 @@ pub fn lstat(p: &Path) -> io::Result<FileAttr> {
17861786
libc::AT_FDCWD,
17871787
p.as_ptr(),
17881788
libc::AT_SYMLINK_NOFOLLOW | libc::AT_STATX_SYNC_AS_STAT,
1789-
libc::STATX_ALL,
1789+
libc::STATX_BASIC_STATS | libc::STATX_BTIME,
17901790
) } {
17911791
return ret;
17921792
}

0 commit comments

Comments
 (0)
Please sign in to comment.