Skip to content

Commit

Permalink
libstd: deny(elided_lifetimes_in_paths), fixes in sgx
Browse files Browse the repository at this point in the history
  • Loading branch information
Centril committed Mar 31, 2019
1 parent c5d6091 commit 351a20c
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 19 deletions.
4 changes: 2 additions & 2 deletions src/libstd/sys/sgx/abi/tls.rs
Expand Up @@ -84,7 +84,7 @@ impl Tls {
Tls { data: dup!((* * * * * * *) (Cell::new(ptr::null_mut()))) }
}

pub unsafe fn activate(&self) -> ActiveTls {
pub unsafe fn activate(&self) -> ActiveTls<'_> {
set_tls_ptr(self as *const Tls as _);
ActiveTls { tls: self }
}
Expand Down Expand Up @@ -141,7 +141,7 @@ mod sync_bitset {
}

/// Not atomic.
pub fn iter(&self) -> SyncBitsetIter {
pub fn iter(&self) -> SyncBitsetIter<'_> {
SyncBitsetIter {
iter: self.0.iter().enumerate().peekable(),
elem_idx: 0,
Expand Down
4 changes: 2 additions & 2 deletions src/libstd/sys/sgx/abi/usercalls/alloc.rs
Expand Up @@ -429,7 +429,7 @@ impl<T> UserRef<[T]> where [T]: UserSafe {
}

/// Returns an iterator over the slice.
pub fn iter(&self) -> Iter<T>
pub fn iter(&self) -> Iter<'_, T>
where T: UserSafe // FIXME: should be implied by [T]: UserSafe?
{
unsafe {
Expand All @@ -438,7 +438,7 @@ impl<T> UserRef<[T]> where [T]: UserSafe {
}

/// Returns an iterator that allows modifying each value.
pub fn iter_mut(&mut self) -> IterMut<T>
pub fn iter_mut(&mut self) -> IterMut<'_, T>
where T: UserSafe // FIXME: should be implied by [T]: UserSafe?
{
unsafe {
Expand Down
5 changes: 3 additions & 2 deletions src/libstd/sys/sgx/backtrace.rs
Expand Up @@ -31,8 +31,9 @@ impl fmt::Display for UnwindError {
#[inline(never)] // this function call can be skipped it when tracing.
pub fn unwind_backtrace(frames: &mut [Frame]) -> io::Result<(usize, BacktraceContext)> {
let mut cx = Context { idx: 0, frames };
let result_unwind =
unsafe { uw::_Unwind_Backtrace(trace_fn, &mut cx as *mut Context as *mut libc::c_void) };
let result_unwind = unsafe {
uw::_Unwind_Backtrace(trace_fn, &mut cx as *mut Context<'_> as *mut libc::c_void)
};
// See libunwind:src/unwind/Backtrace.c for the return values.
// No, there is no doc.
let res = match result_unwind {
Expand Down
4 changes: 2 additions & 2 deletions src/libstd/sys/sgx/net.rs
Expand Up @@ -48,7 +48,7 @@ pub struct TcpStream {
}

impl fmt::Debug for TcpStream {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let mut res = f.debug_struct("TcpStream");

if let Some(ref addr) = self.inner.local_addr {
Expand Down Expand Up @@ -213,7 +213,7 @@ pub struct TcpListener {
}

impl fmt::Debug for TcpListener {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let mut res = f.debug_struct("TcpListener");

if let Some(ref addr) = self.inner.local_addr {
Expand Down
8 changes: 4 additions & 4 deletions src/libstd/sys/sgx/rwlock.rs
Expand Up @@ -93,8 +93,8 @@ impl RWLock {
#[inline]
unsafe fn __read_unlock(
&self,
mut rguard: SpinMutexGuard<WaitVariable<Option<NonZeroUsize>>>,
wguard: SpinMutexGuard<WaitVariable<bool>>,
mut rguard: SpinMutexGuard<'_, WaitVariable<Option<NonZeroUsize>>>,
wguard: SpinMutexGuard<'_, WaitVariable<bool>>,
) {
*rguard.lock_var_mut() = NonZeroUsize::new(rguard.lock_var().unwrap().get() - 1);
if rguard.lock_var().is_some() {
Expand All @@ -120,8 +120,8 @@ impl RWLock {
#[inline]
unsafe fn __write_unlock(
&self,
rguard: SpinMutexGuard<WaitVariable<Option<NonZeroUsize>>>,
wguard: SpinMutexGuard<WaitVariable<bool>>,
rguard: SpinMutexGuard<'_, WaitVariable<Option<NonZeroUsize>>>,
wguard: SpinMutexGuard<'_, WaitVariable<bool>>,
) {
if let Err(mut wguard) = WaitQueue::notify_one(wguard) {
// No writers waiting, release the write lock
Expand Down
14 changes: 7 additions & 7 deletions src/libstd/sys/sgx/waitqueue.rs
Expand Up @@ -140,7 +140,7 @@ impl WaitQueue {
/// until a wakeup event.
///
/// This function does not return until this thread has been awoken.
pub fn wait<T>(mut guard: SpinMutexGuard<WaitVariable<T>>) {
pub fn wait<T>(mut guard: SpinMutexGuard<'_, WaitVariable<T>>) {
unsafe {
let mut entry = UnsafeListEntry::new(SpinMutex::new(WaitEntry {
tcs: thread::current(),
Expand All @@ -162,8 +162,8 @@ impl WaitQueue {
///
/// If a waiter is found, a `WaitGuard` is returned which will notify the
/// waiter when it is dropped.
pub fn notify_one<T>(mut guard: SpinMutexGuard<WaitVariable<T>>)
-> Result<WaitGuard<T>, SpinMutexGuard<WaitVariable<T>>>
pub fn notify_one<T>(mut guard: SpinMutexGuard<'_, WaitVariable<T>>)
-> Result<WaitGuard<'_, T>, SpinMutexGuard<'_, WaitVariable<T>>>
{
unsafe {
if let Some(entry) = guard.queue.inner.pop() {
Expand All @@ -186,8 +186,8 @@ impl WaitQueue {
///
/// If at least one waiter is found, a `WaitGuard` is returned which will
/// notify all waiters when it is dropped.
pub fn notify_all<T>(mut guard: SpinMutexGuard<WaitVariable<T>>)
-> Result<WaitGuard<T>, SpinMutexGuard<WaitVariable<T>>>
pub fn notify_all<T>(mut guard: SpinMutexGuard<'_, WaitVariable<T>>)
-> Result<WaitGuard<'_, T>, SpinMutexGuard<'_, WaitVariable<T>>>
{
unsafe {
let mut count = 0;
Expand Down Expand Up @@ -433,7 +433,7 @@ mod spin_mutex {
}

#[inline(always)]
pub fn lock(&self) -> SpinMutexGuard<T> {
pub fn lock(&self) -> SpinMutexGuard<'_, T> {
loop {
match self.try_lock() {
None => while self.lock.load(Ordering::Relaxed) {
Expand All @@ -445,7 +445,7 @@ mod spin_mutex {
}

#[inline(always)]
pub fn try_lock(&self) -> Option<SpinMutexGuard<T>> {
pub fn try_lock(&self) -> Option<SpinMutexGuard<'_, T>> {
if !self.lock.compare_and_swap(false, true, Ordering::Acquire) {
Some(SpinMutexGuard {
mutex: self,
Expand Down

0 comments on commit 351a20c

Please sign in to comment.