Skip to content

Commit

Permalink
Merge #1806
Browse files Browse the repository at this point in the history
1806: Remove MSRV-related workaround for doc aliases r=asomers a=rtzoeller

Remove the MSRV-related workaround added by #1693, since we now can use doc aliases in all supported versions of Rust.

Closes #1674.

Co-authored-by: Ryan Zoeller <rtzoeller@rtzoeller.com>
  • Loading branch information
bors[bot] and rtzoeller authored Aug 21, 2022
2 parents 82fe82a + e479e8f commit 9cbb7eb
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 31 deletions.
3 changes: 0 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ pin-utils = { version = "0.1.0", optional = true }
[target.'cfg(not(target_os = "redox"))'.dependencies]
memoffset = { version = "0.6.3", optional = true }

[build-dependencies]
autocfg = "1.1.0"

[features]
default = [
"acct", "aio", "dir", "env", "event", "feature", "fs",
Expand Down
7 changes: 0 additions & 7 deletions build.rs

This file was deleted.

2 changes: 1 addition & 1 deletion src/dir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ impl Dir {
}

/// Converts from a file descriptor, closing it on success or failure.
#[cfg_attr(has_doc_alias, doc(alias("fdopendir")))]
#[doc(alias("fdopendir"))]
pub fn from_fd(fd: RawFd) -> Result<Self> {
let d = ptr::NonNull::new(unsafe { libc::fdopendir(fd) }).ok_or_else(|| {
let e = Error::last();
Expand Down
12 changes: 6 additions & 6 deletions src/sys/signal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ pub struct SigSet {

impl SigSet {
/// Initialize to include all signals.
#[cfg_attr(has_doc_alias, doc(alias("sigfillset")))]
#[doc(alias("sigfillset"))]
pub fn all() -> SigSet {
let mut sigset = mem::MaybeUninit::uninit();
let _ = unsafe { libc::sigfillset(sigset.as_mut_ptr()) };
Expand All @@ -484,7 +484,7 @@ impl SigSet {
}

/// Initialize to include nothing.
#[cfg_attr(has_doc_alias, doc(alias("sigemptyset")))]
#[doc(alias("sigemptyset"))]
pub fn empty() -> SigSet {
let mut sigset = mem::MaybeUninit::uninit();
let _ = unsafe { libc::sigemptyset(sigset.as_mut_ptr()) };
Expand All @@ -493,25 +493,25 @@ impl SigSet {
}

/// Add the specified signal to the set.
#[cfg_attr(has_doc_alias, doc(alias("sigaddset")))]
#[doc(alias("sigaddset"))]
pub fn add(&mut self, signal: Signal) {
unsafe { libc::sigaddset(&mut self.sigset as *mut libc::sigset_t, signal as libc::c_int) };
}

/// Remove all signals from this set.
#[cfg_attr(has_doc_alias, doc(alias("sigemptyset")))]
#[doc(alias("sigemptyset"))]
pub fn clear(&mut self) {
unsafe { libc::sigemptyset(&mut self.sigset as *mut libc::sigset_t) };
}

/// Remove the specified signal from this set.
#[cfg_attr(has_doc_alias, doc(alias("sigdelset")))]
#[doc(alias("sigdelset"))]
pub fn remove(&mut self, signal: Signal) {
unsafe { libc::sigdelset(&mut self.sigset as *mut libc::sigset_t, signal as libc::c_int) };
}

/// Return whether this set includes the specified signal.
#[cfg_attr(has_doc_alias, doc(alias("sigismember")))]
#[doc(alias("sigismember"))]
pub fn contains(&self, signal: Signal) -> bool {
let res = unsafe { libc::sigismember(&self.sigset as *const libc::sigset_t, signal as libc::c_int) };

Expand Down
8 changes: 4 additions & 4 deletions src/sys/timer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ pub struct Timer(libc::timer_t);
impl Timer {
/// Creates a new timer based on the clock defined by `clockid`. The details
/// of the signal and its handler are defined by the passed `sigevent`.
#[cfg_attr(has_doc_alias, doc(alias("timer_create")))]
#[doc(alias("timer_create"))]
pub fn new(clockid: ClockId, mut sigevent: SigEvent) -> Result<Self> {
let mut timer_id: mem::MaybeUninit<libc::timer_t> = mem::MaybeUninit::uninit();
Errno::result(unsafe {
Expand Down Expand Up @@ -123,7 +123,7 @@ impl Timer {
///
/// Note: Setting a one shot alarm with a 0s TimeSpec disable the alarm
/// altogether.
#[cfg_attr(has_doc_alias, doc(alias("timer_settime")))]
#[doc(alias("timer_settime"))]
pub fn set(&mut self, expiration: Expiration, flags: TimerSetTimeFlags) -> Result<()> {
let timerspec: TimerSpec = expiration.into();
Errno::result(unsafe {
Expand All @@ -138,7 +138,7 @@ impl Timer {
}

/// Get the parameters for the alarm currently set, if any.
#[cfg_attr(has_doc_alias, doc(alias("timer_gettime")))]
#[doc(alias("timer_gettime"))]
pub fn get(&self) -> Result<Option<Expiration>> {
let mut timerspec = TimerSpec::none();
Errno::result(unsafe { libc::timer_gettime(self.0, timerspec.as_mut()) }).map(|_| {
Expand All @@ -161,7 +161,7 @@ impl Timer {
/// 'overrun'. This function returns how many times that has happened to
/// this timer, up to `libc::DELAYTIMER_MAX`. If more than the maximum
/// number of overruns have happened the return is capped to the maximum.
#[cfg_attr(has_doc_alias, doc(alias("timer_getoverrun")))]
#[doc(alias("timer_getoverrun"))]
pub fn overruns(&self) -> i32 {
unsafe { libc::timer_getoverrun(self.0) }
}
Expand Down
8 changes: 4 additions & 4 deletions src/sys/timerfd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ impl TimerFd {
/// Creates a new timer based on the clock defined by `clockid`. The
/// underlying fd can be assigned specific flags with `flags` (CLOEXEC,
/// NONBLOCK). The underlying fd will be closed on drop.
#[cfg_attr(has_doc_alias, doc(alias("timerfd_create")))]
#[doc(alias("timerfd_create"))]
pub fn new(clockid: ClockId, flags: TimerFlags) -> Result<Self> {
Errno::result(unsafe { libc::timerfd_create(clockid as i32, flags.bits()) })
.map(|fd| Self { fd })
Expand Down Expand Up @@ -134,7 +134,7 @@ impl TimerFd {
///
/// Note: Setting a one shot alarm with a 0s TimeSpec disables the alarm
/// altogether.
#[cfg_attr(has_doc_alias, doc(alias("timerfd_settime")))]
#[doc(alias("timerfd_settime"))]
pub fn set(&self, expiration: Expiration, flags: TimerSetTimeFlags) -> Result<()> {
let timerspec: TimerSpec = expiration.into();
Errno::result(unsafe {
Expand All @@ -149,7 +149,7 @@ impl TimerFd {
}

/// Get the parameters for the alarm currently set, if any.
#[cfg_attr(has_doc_alias, doc(alias("timerfd_gettime")))]
#[doc(alias("timerfd_gettime"))]
pub fn get(&self) -> Result<Option<Expiration>> {
let mut timerspec = TimerSpec::none();
Errno::result(unsafe { libc::timerfd_gettime(self.fd, timerspec.as_mut()) }).map(|_| {
Expand All @@ -166,7 +166,7 @@ impl TimerFd {
}

/// Remove the alarm if any is set.
#[cfg_attr(has_doc_alias, doc(alias("timerfd_settime")))]
#[doc(alias("timerfd_settime"))]
pub fn unset(&self) -> Result<()> {
Errno::result(unsafe {
libc::timerfd_settime(
Expand Down
12 changes: 6 additions & 6 deletions src/unistd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,13 @@ impl Uid {
}

/// Returns Uid of calling process. This is practically a more Rusty alias for `getuid`.
#[cfg_attr(has_doc_alias, doc(alias("getuid")))]
#[doc(alias("getuid"))]
pub fn current() -> Self {
getuid()
}

/// Returns effective Uid of calling process. This is practically a more Rusty alias for `geteuid`.
#[cfg_attr(has_doc_alias, doc(alias("geteuid")))]
#[doc(alias("geteuid"))]
pub fn effective() -> Self {
geteuid()
}
Expand Down Expand Up @@ -136,13 +136,13 @@ impl Gid {
}

/// Returns Gid of calling process. This is practically a more Rusty alias for `getgid`.
#[cfg_attr(has_doc_alias, doc(alias("getgid")))]
#[doc(alias("getgid"))]
pub fn current() -> Self {
getgid()
}

/// Returns effective Gid of calling process. This is practically a more Rusty alias for `getegid`.
#[cfg_attr(has_doc_alias, doc(alias("getegid")))]
#[doc(alias("getegid"))]
pub fn effective() -> Self {
getegid()
}
Expand Down Expand Up @@ -188,13 +188,13 @@ impl Pid {
}

/// Returns PID of calling process
#[cfg_attr(has_doc_alias, doc(alias("getpid")))]
#[doc(alias("getpid"))]
pub fn this() -> Self {
getpid()
}

/// Returns PID of parent of calling process
#[cfg_attr(has_doc_alias, doc(alias("getppid")))]
#[doc(alias("getppid"))]
pub fn parent() -> Self {
getppid()
}
Expand Down

0 comments on commit 9cbb7eb

Please sign in to comment.