Skip to content

Commit

Permalink
Fix some TODOs in the CI rules. (#1149)
Browse files Browse the repository at this point in the history
* Fix some TODOs in the CI rules.

* Fix warnings.
  • Loading branch information
sunfishcode authored Sep 3, 2024
1 parent eb9f634 commit b726837
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 29 deletions.
21 changes: 8 additions & 13 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,9 @@ jobs:
os: ubuntu-latest
rust: 1.63

# TODO: Reenable this once we can remove the redundant `Vec` imports.
#env:
# # -D warnings is commented out in our install-rust action; re-add it here.
# RUSTFLAGS: -D warnings -D elided-lifetimes-in-paths --cfg criterion
env:
# -D warnings is commented out in our install-rust action; re-add it here.
RUSTFLAGS: -D warnings -D elided-lifetimes-in-paths --cfg criterion
steps:
- uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -135,10 +134,9 @@ jobs:
os: ubuntu-latest
rust: nightly

# TODO: Reenable this once we can remove the redundant `Vec` imports.
#env:
# # -D warnings is commented out in our install-rust action; re-add it here.
# RUSTFLAGS: -D warnings -D elided-lifetimes-in-paths
env:
# -D warnings is commented out in our install-rust action; re-add it here.
RUSTFLAGS: -D warnings -D elided-lifetimes-in-paths
steps:
- uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -558,8 +556,7 @@ jobs:
qemu_target: arm-linux-user
env:
# -D warnings is commented out in our install-rust action; re-add it here.
# TODO: Reenable this once we can remove the redundant `Vec` imports.
#RUSTFLAGS: -D warnings -D elided-lifetimes-in-paths
RUSTFLAGS: -D warnings -D elided-lifetimes-in-paths
QEMU_BUILD_VERSION: 8.1.2
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -649,9 +646,7 @@ jobs:
qemu_target: ppc64le-linux-user
env:
# -D warnings is commented out in our install-rust action; re-add it here.
# TODO: Reenable this once we can remove the redundant `Vec` imports.
#RUSTFLAGS: --cfg rustix_use_experimental_asm -D warnings -D elided-lifetimes-in-paths
RUSTFLAGS: --cfg rustix_use_experimental_asm
RUSTFLAGS: --cfg rustix_use_experimental_asm -D warnings -D elided-lifetimes-in-paths
RUSTDOCFLAGS: --cfg rustix_use_experimental_asm
CARGO_TARGET_POWERPC64LE_UNKNOWN_LINUX_GNU_RUSTFLAGS: --cfg rustix_use_experimental_asm
QEMU_BUILD_VERSION: 8.1.2
Expand Down
30 changes: 28 additions & 2 deletions src/backend/libc/event/syscalls.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
//! libc syscalls supporting `rustix::event`.
use crate::backend::c;
#[cfg(any(linux_kernel, solarish, target_os = "redox"))]
use crate::backend::conv::ret;
use crate::backend::conv::ret_c_int;
#[cfg(feature = "alloc")]
#[cfg(any(linux_kernel, target_os = "redox"))]
use crate::backend::conv::ret_u32;
use crate::backend::conv::{borrowed_fd, ret, ret_c_int, ret_owned_fd};
#[cfg(solarish)]
use crate::event::port::Event;
#[cfg(any(
Expand All @@ -14,14 +17,36 @@ use crate::event::port::Event;
))]
use crate::event::EventfdFlags;
use crate::event::PollFd;
use crate::fd::{BorrowedFd, OwnedFd};
use crate::io;
#[cfg(solarish)]
use crate::utils::as_mut_ptr;
#[cfg(any(linux_kernel, target_os = "redox"))]
use crate::utils::as_ptr;
#[cfg(any(
all(feature = "alloc", bsd),
solarish,
all(feature = "alloc", any(linux_kernel, target_os = "redox")),
))]
use core::mem::MaybeUninit;
#[cfg(any(linux_kernel, solarish, target_os = "redox"))]
use core::ptr::null_mut;
#[cfg(any(
linux_kernel,
solarish,
target_os = "redox",
all(feature = "alloc", bsd)
))]
use {crate::backend::conv::borrowed_fd, crate::fd::BorrowedFd};
#[cfg(any(
linux_kernel,
solarish,
target_os = "freebsd",
target_os = "illumos",
target_os = "espidf",
target_os = "redox",
all(feature = "alloc", bsd)
))]
use {crate::backend::conv::ret_owned_fd, crate::fd::OwnedFd};
#[cfg(all(feature = "alloc", bsd))]
use {crate::event::kqueue::Event, crate::utils::as_ptr, core::ptr::null};

Expand Down Expand Up @@ -249,6 +274,7 @@ pub(crate) fn epoll_del(epoll: BorrowedFd<'_>, source: BorrowedFd<'_>) -> io::Re
}

#[inline]
#[cfg(feature = "alloc")]
#[cfg(any(linux_kernel, target_os = "redox"))]
pub(crate) fn epoll_wait(
epoll: BorrowedFd<'_>,
Expand Down
35 changes: 21 additions & 14 deletions src/backend/libc/thread/syscalls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@
use crate::backend::c;
use crate::backend::conv::ret;
use crate::io;
#[cfg(not(any(
apple,
freebsdlike,
target_os = "emscripten",
target_os = "espidf",
target_os = "haiku",
target_os = "openbsd",
target_os = "redox",
target_os = "vita",
target_os = "wasi",
)))]
use crate::thread::ClockId;
#[cfg(not(target_os = "redox"))]
use crate::thread::{NanosleepRelativeResult, Timespec};
#[cfg(all(target_env = "gnu", fix_y2038))]
Expand All @@ -24,18 +36,6 @@ use {
crate::thread::futex,
crate::utils::as_mut_ptr,
};
#[cfg(not(any(
apple,
freebsdlike,
target_os = "emscripten",
target_os = "espidf",
target_os = "haiku",
target_os = "openbsd",
target_os = "redox",
target_os = "vita",
target_os = "wasi",
)))]
use {crate::thread::ClockId, core::ptr::null_mut};

#[cfg(all(target_env = "gnu", fix_y2038))]
weak!(fn __clock_nanosleep_time64(c::clockid_t, c::c_int, *const LibcTimespec, *mut LibcTimespec) -> c::c_int);
Expand Down Expand Up @@ -173,7 +173,7 @@ pub(crate) fn clock_nanosleep_absolute(id: ClockId, request: &Timespec) -> io::R
id as c::clockid_t,
flags,
&request.clone().into(),
null_mut(),
core::ptr::null_mut(),
)
} {
0 => Ok(()),
Expand All @@ -190,7 +190,14 @@ pub(crate) fn clock_nanosleep_absolute(id: ClockId, request: &Timespec) -> io::R
{
let flags = c::TIMER_ABSTIME;

match unsafe { c::clock_nanosleep(id as c::clockid_t, flags as _, request, null_mut()) } {
match unsafe {
c::clock_nanosleep(
id as c::clockid_t,
flags as _,
request,
core::ptr::null_mut(),
)
} {
0 => Ok(()),
err => Err(io::Errno(err)),
}
Expand Down

0 comments on commit b726837

Please sign in to comment.