Skip to content

Commit 351a20c

Browse files
committed
libstd: deny(elided_lifetimes_in_paths), fixes in sgx
1 parent c5d6091 commit 351a20c

File tree

6 files changed

+20
-19
lines changed

6 files changed

+20
-19
lines changed

src/libstd/sys/sgx/abi/tls.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ impl Tls {
8484
Tls { data: dup!((* * * * * * *) (Cell::new(ptr::null_mut()))) }
8585
}
8686

87-
pub unsafe fn activate(&self) -> ActiveTls {
87+
pub unsafe fn activate(&self) -> ActiveTls<'_> {
8888
set_tls_ptr(self as *const Tls as _);
8989
ActiveTls { tls: self }
9090
}
@@ -141,7 +141,7 @@ mod sync_bitset {
141141
}
142142

143143
/// Not atomic.
144-
pub fn iter(&self) -> SyncBitsetIter {
144+
pub fn iter(&self) -> SyncBitsetIter<'_> {
145145
SyncBitsetIter {
146146
iter: self.0.iter().enumerate().peekable(),
147147
elem_idx: 0,

src/libstd/sys/sgx/abi/usercalls/alloc.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ impl<T> UserRef<[T]> where [T]: UserSafe {
429429
}
430430

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

440440
/// Returns an iterator that allows modifying each value.
441-
pub fn iter_mut(&mut self) -> IterMut<T>
441+
pub fn iter_mut(&mut self) -> IterMut<'_, T>
442442
where T: UserSafe // FIXME: should be implied by [T]: UserSafe?
443443
{
444444
unsafe {

src/libstd/sys/sgx/backtrace.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@ impl fmt::Display for UnwindError {
3131
#[inline(never)] // this function call can be skipped it when tracing.
3232
pub fn unwind_backtrace(frames: &mut [Frame]) -> io::Result<(usize, BacktraceContext)> {
3333
let mut cx = Context { idx: 0, frames };
34-
let result_unwind =
35-
unsafe { uw::_Unwind_Backtrace(trace_fn, &mut cx as *mut Context as *mut libc::c_void) };
34+
let result_unwind = unsafe {
35+
uw::_Unwind_Backtrace(trace_fn, &mut cx as *mut Context<'_> as *mut libc::c_void)
36+
};
3637
// See libunwind:src/unwind/Backtrace.c for the return values.
3738
// No, there is no doc.
3839
let res = match result_unwind {

src/libstd/sys/sgx/net.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ pub struct TcpStream {
4848
}
4949

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

5454
if let Some(ref addr) = self.inner.local_addr {
@@ -213,7 +213,7 @@ pub struct TcpListener {
213213
}
214214

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

219219
if let Some(ref addr) = self.inner.local_addr {

src/libstd/sys/sgx/rwlock.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ impl RWLock {
9393
#[inline]
9494
unsafe fn __read_unlock(
9595
&self,
96-
mut rguard: SpinMutexGuard<WaitVariable<Option<NonZeroUsize>>>,
97-
wguard: SpinMutexGuard<WaitVariable<bool>>,
96+
mut rguard: SpinMutexGuard<'_, WaitVariable<Option<NonZeroUsize>>>,
97+
wguard: SpinMutexGuard<'_, WaitVariable<bool>>,
9898
) {
9999
*rguard.lock_var_mut() = NonZeroUsize::new(rguard.lock_var().unwrap().get() - 1);
100100
if rguard.lock_var().is_some() {
@@ -120,8 +120,8 @@ impl RWLock {
120120
#[inline]
121121
unsafe fn __write_unlock(
122122
&self,
123-
rguard: SpinMutexGuard<WaitVariable<Option<NonZeroUsize>>>,
124-
wguard: SpinMutexGuard<WaitVariable<bool>>,
123+
rguard: SpinMutexGuard<'_, WaitVariable<Option<NonZeroUsize>>>,
124+
wguard: SpinMutexGuard<'_, WaitVariable<bool>>,
125125
) {
126126
if let Err(mut wguard) = WaitQueue::notify_one(wguard) {
127127
// No writers waiting, release the write lock

src/libstd/sys/sgx/waitqueue.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ impl WaitQueue {
140140
/// until a wakeup event.
141141
///
142142
/// This function does not return until this thread has been awoken.
143-
pub fn wait<T>(mut guard: SpinMutexGuard<WaitVariable<T>>) {
143+
pub fn wait<T>(mut guard: SpinMutexGuard<'_, WaitVariable<T>>) {
144144
unsafe {
145145
let mut entry = UnsafeListEntry::new(SpinMutex::new(WaitEntry {
146146
tcs: thread::current(),
@@ -162,8 +162,8 @@ impl WaitQueue {
162162
///
163163
/// If a waiter is found, a `WaitGuard` is returned which will notify the
164164
/// waiter when it is dropped.
165-
pub fn notify_one<T>(mut guard: SpinMutexGuard<WaitVariable<T>>)
166-
-> Result<WaitGuard<T>, SpinMutexGuard<WaitVariable<T>>>
165+
pub fn notify_one<T>(mut guard: SpinMutexGuard<'_, WaitVariable<T>>)
166+
-> Result<WaitGuard<'_, T>, SpinMutexGuard<'_, WaitVariable<T>>>
167167
{
168168
unsafe {
169169
if let Some(entry) = guard.queue.inner.pop() {
@@ -186,8 +186,8 @@ impl WaitQueue {
186186
///
187187
/// If at least one waiter is found, a `WaitGuard` is returned which will
188188
/// notify all waiters when it is dropped.
189-
pub fn notify_all<T>(mut guard: SpinMutexGuard<WaitVariable<T>>)
190-
-> Result<WaitGuard<T>, SpinMutexGuard<WaitVariable<T>>>
189+
pub fn notify_all<T>(mut guard: SpinMutexGuard<'_, WaitVariable<T>>)
190+
-> Result<WaitGuard<'_, T>, SpinMutexGuard<'_, WaitVariable<T>>>
191191
{
192192
unsafe {
193193
let mut count = 0;
@@ -433,7 +433,7 @@ mod spin_mutex {
433433
}
434434

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

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

0 commit comments

Comments
 (0)