Skip to content

Commit

Permalink
Auto merge of rust-lang#131948 - matthiaskrgr:rollup-c9rvzu6, r=matth…
Browse files Browse the repository at this point in the history
…iaskrgr

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
  • Loading branch information
bors committed Oct 19, 2024
2 parents 5615efc + 7628c4f commit 362aec6
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 25 deletions.
23 changes: 7 additions & 16 deletions proc_macro/src/bridge/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,10 @@ macro_rules! define_client_handles {
$(pub(super) $ity: AtomicU32,)*
}

impl HandleCounters {
// FIXME(eddyb) use a reference to the `static COUNTERS`, instead of
// a wrapper `fn` pointer, once `const fn` can reference `static`s.
extern "C" fn get() -> &'static Self {
static COUNTERS: HandleCounters = HandleCounters {
$($oty: AtomicU32::new(1),)*
$($ity: AtomicU32::new(1),)*
};
&COUNTERS
}
}
static COUNTERS: HandleCounters = HandleCounters {
$($oty: AtomicU32::new(1),)*
$($ity: AtomicU32::new(1),)*
};

$(
pub(crate) struct $oty {
Expand Down Expand Up @@ -259,9 +252,7 @@ pub(crate) fn is_available() -> bool {
/// and forcing the use of APIs that take/return `S::TokenStream`, server-side.
#[repr(C)]
pub struct Client<I, O> {
// FIXME(eddyb) use a reference to the `static COUNTERS`, instead of
// a wrapper `fn` pointer, once `const fn` can reference `static`s.
pub(super) get_handle_counters: extern "C" fn() -> &'static HandleCounters,
pub(super) handle_counters: &'static HandleCounters,

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

Expand Down Expand Up @@ -346,7 +337,7 @@ fn run_client<A: for<'a, 's> DecodeMut<'a, 's, ()>, R: Encode<()>>(
impl Client<crate::TokenStream, crate::TokenStream> {
pub const fn expand1(f: impl Fn(crate::TokenStream) -> crate::TokenStream + Copy) -> Self {
Client {
get_handle_counters: HandleCounters::get,
handle_counters: &COUNTERS,
run: super::selfless_reify::reify_to_extern_c_fn_hrt_bridge(move |bridge| {
run_client(bridge, |input| f(crate::TokenStream(Some(input))).0)
}),
Expand All @@ -360,7 +351,7 @@ impl Client<(crate::TokenStream, crate::TokenStream), crate::TokenStream> {
f: impl Fn(crate::TokenStream, crate::TokenStream) -> crate::TokenStream + Copy,
) -> Self {
Client {
get_handle_counters: HandleCounters::get,
handle_counters: &COUNTERS,
run: super::selfless_reify::reify_to_extern_c_fn_hrt_bridge(move |bridge| {
run_client(bridge, |(input, input2)| {
f(crate::TokenStream(Some(input)), crate::TokenStream(Some(input2))).0
Expand Down
8 changes: 4 additions & 4 deletions proc_macro/src/bridge/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -400,10 +400,10 @@ impl client::Client<crate::TokenStream, crate::TokenStream> {
S: Server,
S::TokenStream: Default,
{
let client::Client { get_handle_counters, run, _marker } = *self;
let client::Client { handle_counters, run, _marker } = *self;
run_server(
strategy,
get_handle_counters(),
handle_counters,
server,
<MarkedTypes<S> as Types>::TokenStream::mark(input),
run,
Expand All @@ -426,10 +426,10 @@ impl client::Client<(crate::TokenStream, crate::TokenStream), crate::TokenStream
S: Server,
S::TokenStream: Default,
{
let client::Client { get_handle_counters, run, _marker } = *self;
let client::Client { handle_counters, run, _marker } = *self;
run_server(
strategy,
get_handle_counters(),
handle_counters,
server,
(
<MarkedTypes<S> as Types>::TokenStream::mark(input),
Expand Down
10 changes: 5 additions & 5 deletions std/src/sys/pal/unix/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ cfg_has_statx! {{
// See: https://github.com/rust-lang/rust/issues/65662
//
// FIXME what about transient conditions like `ENOMEM`?
let err2 = cvt(statx(0, ptr::null(), 0, libc::STATX_ALL, ptr::null_mut()))
let err2 = cvt(statx(0, ptr::null(), 0, libc::STATX_BASIC_STATS | libc::STATX_BTIME, ptr::null_mut()))
.err()
.and_then(|e| e.raw_os_error());
if err2 == Some(libc::EFAULT) {
Expand Down Expand Up @@ -910,7 +910,7 @@ impl DirEntry {
fd,
name,
libc::AT_SYMLINK_NOFOLLOW | libc::AT_STATX_SYNC_AS_STAT,
libc::STATX_ALL,
libc::STATX_BASIC_STATS | libc::STATX_BTIME,
) } {
return ret;
}
Expand Down Expand Up @@ -1194,7 +1194,7 @@ impl File {
fd,
c"".as_ptr() as *const c_char,
libc::AT_EMPTY_PATH | libc::AT_STATX_SYNC_AS_STAT,
libc::STATX_ALL,
libc::STATX_BASIC_STATS | libc::STATX_BTIME,
) } {
return ret;
}
Expand Down Expand Up @@ -1767,7 +1767,7 @@ pub fn stat(p: &Path) -> io::Result<FileAttr> {
libc::AT_FDCWD,
p.as_ptr(),
libc::AT_STATX_SYNC_AS_STAT,
libc::STATX_ALL,
libc::STATX_BASIC_STATS | libc::STATX_BTIME,
) } {
return ret;
}
Expand All @@ -1786,7 +1786,7 @@ pub fn lstat(p: &Path) -> io::Result<FileAttr> {
libc::AT_FDCWD,
p.as_ptr(),
libc::AT_SYMLINK_NOFOLLOW | libc::AT_STATX_SYNC_AS_STAT,
libc::STATX_ALL,
libc::STATX_BASIC_STATS | libc::STATX_BTIME,
) } {
return ret;
}
Expand Down

0 comments on commit 362aec6

Please sign in to comment.