Skip to content

Commit f219728

Browse files
committed
Elide lifetimes in Pin<&mut Self>
1 parent e91a3f1 commit f219728

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+86
-88
lines changed

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ matrix:
3939
# This is the minimum Rust version supported by `async-await` feature.
4040
# When updating this, the reminder to update the minimum required version of `async-await` feature in README.md.
4141
- name: cargo +nightly build (minimum required version)
42-
rust: nightly-2019-05-09
42+
rust: nightly-2019-07-29
4343
script:
4444
- cargo run --manifest-path ci/remove-dev-dependencies/Cargo.toml */Cargo.toml
4545
- cargo build --all --all-features

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ prevent it from compiling. To use futures-rs with async/await, use:
6767
futures-preview = { version = "=0.3.0-alpha.17", features = ["async-await", "nightly"] }
6868
```
6969

70-
The current `async-await` feature requires Rust nightly 2019-05-09 or later.
70+
The current `async-await` feature requires Rust nightly 2019-07-29 or later.
7171

7272
# License
7373

futures-io/src/lib.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -319,8 +319,8 @@ mod if_std {
319319
/// `Interrupted`. Implementations must convert `WouldBlock` into
320320
/// `Poll::Pending` and either internally retry or convert
321321
/// `Interrupted` into another error kind.
322-
fn poll_fill_buf<'a>(self: Pin<&'a mut Self>, cx: &mut Context<'_>)
323-
-> Poll<Result<&'a [u8]>>;
322+
fn poll_fill_buf(self: Pin<&mut Self>, cx: &mut Context<'_>)
323+
-> Poll<Result<&[u8]>>;
324324

325325
/// Tells this buffer that `amt` bytes have been consumed from the buffer,
326326
/// so they should no longer be returned in calls to [`poll_read`].
@@ -597,8 +597,8 @@ mod if_std {
597597

598598
macro_rules! deref_async_buf_read {
599599
() => {
600-
fn poll_fill_buf<'a>(self: Pin<&'a mut Self>, cx: &mut Context<'_>)
601-
-> Poll<Result<&'a [u8]>>
600+
fn poll_fill_buf(self: Pin<&mut Self>, cx: &mut Context<'_>)
601+
-> Poll<Result<&[u8]>>
602602
{
603603
Pin::new(&mut **self.get_mut()).poll_fill_buf(cx)
604604
}
@@ -622,8 +622,8 @@ mod if_std {
622622
P: DerefMut + Unpin,
623623
P::Target: AsyncBufRead,
624624
{
625-
fn poll_fill_buf<'a>(self: Pin<&'a mut Self>, cx: &mut Context<'_>)
626-
-> Poll<Result<&'a [u8]>>
625+
fn poll_fill_buf(self: Pin<&mut Self>, cx: &mut Context<'_>)
626+
-> Poll<Result<&[u8]>>
627627
{
628628
self.get_mut().as_mut().poll_fill_buf(cx)
629629
}
@@ -635,8 +635,8 @@ mod if_std {
635635

636636
macro_rules! delegate_async_buf_read_to_stdio {
637637
() => {
638-
fn poll_fill_buf<'a>(self: Pin<&'a mut Self>, _: &mut Context<'_>)
639-
-> Poll<Result<&'a [u8]>>
638+
fn poll_fill_buf(self: Pin<&mut Self>, _: &mut Context<'_>)
639+
-> Poll<Result<&[u8]>>
640640
{
641641
Poll::Ready(io::BufRead::fill_buf(self.get_mut()))
642642
}

futures-test/src/interleave_pending.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ impl<T> InterleavePending<T> {
4747

4848
/// Acquires a pinned mutable reference to the underlying I/O object that
4949
/// this adaptor is wrapping.
50-
pub fn get_pin_mut<'a>(self: Pin<&'a mut Self>) -> Pin<&'a mut T> {
50+
pub fn get_pin_mut(self: Pin<&mut Self>) -> Pin<&mut T> {
5151
self.project().0
5252
}
5353

@@ -56,7 +56,7 @@ impl<T> InterleavePending<T> {
5656
self.inner
5757
}
5858

59-
fn project<'a>(self: Pin<&'a mut Self>) -> (Pin<&'a mut T>, &'a mut bool) {
59+
fn project(self: Pin<&mut Self>) -> (Pin<&mut T>, &mut bool) {
6060
unsafe {
6161
let this = self.get_unchecked_mut();
6262
(Pin::new_unchecked(&mut this.inner), &mut this.pended)
@@ -185,10 +185,10 @@ impl<R: AsyncRead> AsyncRead for InterleavePending<R> {
185185
}
186186

187187
impl<R: AsyncBufRead> AsyncBufRead for InterleavePending<R> {
188-
fn poll_fill_buf<'a>(
189-
self: Pin<&'a mut Self>,
188+
fn poll_fill_buf(
189+
self: Pin<&mut Self>,
190190
cx: &mut Context<'_>,
191-
) -> Poll<io::Result<&'a [u8]>> {
191+
) -> Poll<io::Result<&[u8]>> {
192192
let (reader, pended) = self.project();
193193
if *pended {
194194
let next = reader.poll_fill_buf(cx);

futures-test/src/io/limited.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ impl<Io> Limited<Io> {
4242

4343
/// Acquires a pinned mutable reference to the underlying I/O object that
4444
/// this adaptor is wrapping.
45-
pub fn get_pin_mut<'a>(self: Pin<&'a mut Self>) -> Pin<&'a mut Io> {
45+
pub fn get_pin_mut(self: Pin<&mut Self>) -> Pin<&mut Io> {
4646
self.io()
4747
}
4848

@@ -89,10 +89,10 @@ impl<R: AsyncRead> AsyncRead for Limited<R> {
8989
}
9090

9191
impl<R: AsyncBufRead> AsyncBufRead for Limited<R> {
92-
fn poll_fill_buf<'a>(
93-
self: Pin<&'a mut Self>,
92+
fn poll_fill_buf(
93+
self: Pin<&mut Self>,
9494
cx: &mut Context<'_>,
95-
) -> Poll<io::Result<&'a [u8]>> {
95+
) -> Poll<io::Result<&[u8]>> {
9696
self.io().poll_fill_buf(cx)
9797
}
9898

futures-util/src/future/either.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -278,10 +278,10 @@ mod if_std {
278278
A: AsyncBufRead,
279279
B: AsyncBufRead,
280280
{
281-
fn poll_fill_buf<'a>(
282-
self: Pin<&'a mut Self>,
281+
fn poll_fill_buf(
282+
self: Pin<&mut Self>,
283283
cx: &mut Context<'_>,
284-
) -> Poll<Result<&'a [u8]>> {
284+
) -> Poll<Result<&[u8]>> {
285285
unsafe {
286286
match self.get_unchecked_mut() {
287287
Either::Left(x) => Pin::new_unchecked(x).poll_fill_buf(cx),

futures-util/src/future/flatten_stream.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ enum State<Fut, St> {
4141
}
4242

4343
impl<Fut, St> State<Fut, St> {
44-
fn get_pin_mut<'a>(self: Pin<&'a mut Self>) -> State<Pin<&'a mut Fut>, Pin<&'a mut St>> {
44+
fn get_pin_mut(self: Pin<&mut Self>) -> State<Pin<&mut Fut>, Pin<&mut St>> {
4545
// safety: data is never moved via the resulting &mut reference
4646
match unsafe { self.get_unchecked_mut() } {
4747
// safety: the future we're re-pinning here will never be moved;

futures-util/src/future/join_all.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ impl<F> ElemState<F>
2323
where
2424
F: Future,
2525
{
26-
fn pending_pin_mut<'a>(self: Pin<&'a mut Self>) -> Option<Pin<&'a mut F>> {
26+
fn pending_pin_mut(self: Pin<&mut Self>) -> Option<Pin<&mut F>> {
2727
// Safety: Basic enum pin projection, no drop + optionally Unpin based
2828
// on the type of this variant
2929
match unsafe { self.get_unchecked_mut() } {

futures-util/src/future/maybe_done.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ impl<Fut: Future> MaybeDone<Fut> {
5050
/// future has been completed and [`take_output`](MaybeDone::take_output)
5151
/// has not yet been called.
5252
#[inline]
53-
pub fn output_mut<'a>(self: Pin<&'a mut Self>) -> Option<&'a mut Fut::Output> {
53+
pub fn output_mut(self: Pin<&mut Self>) -> Option<&mut Fut::Output> {
5454
unsafe {
5555
let this = self.get_unchecked_mut();
5656
match this {

futures-util/src/io/allow_std.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,8 @@ impl<T> io::BufRead for AllowStdIo<T> where T: io::BufRead {
157157
}
158158

159159
impl<T> AsyncBufRead for AllowStdIo<T> where T: io::BufRead {
160-
fn poll_fill_buf<'a>(mut self: Pin<&'a mut Self>, _: &mut Context<'_>)
161-
-> Poll<io::Result<&'a [u8]>>
160+
fn poll_fill_buf(mut self: Pin<&mut Self>, _: &mut Context<'_>)
161+
-> Poll<io::Result<&[u8]>>
162162
{
163163
let this: *mut Self = &mut *self as *mut _;
164164
Poll::Ready(Ok(try_with_interrupt!(unsafe { &mut *this }.0.fill_buf())))

futures-util/src/io/buf_reader.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ impl<R: AsyncRead> BufReader<R> {
7575
/// Gets a pinned mutable reference to the underlying reader.
7676
///
7777
/// It is inadvisable to directly read from the underlying reader.
78-
pub fn get_pin_mut<'a>(self: Pin<&'a mut Self>) -> Pin<&'a mut R> {
78+
pub fn get_pin_mut(self: Pin<&mut Self>) -> Pin<&mut R> {
7979
self.inner()
8080
}
8181

@@ -172,10 +172,10 @@ impl<R: AsyncRead> AsyncRead for BufReader<R> {
172172
}
173173

174174
impl<R: AsyncRead> AsyncBufRead for BufReader<R> {
175-
fn poll_fill_buf<'a>(
176-
self: Pin<&'a mut Self>,
175+
fn poll_fill_buf(
176+
self: Pin<&mut Self>,
177177
cx: &mut Context<'_>,
178-
) -> Poll<io::Result<&'a [u8]>> {
178+
) -> Poll<io::Result<&[u8]>> {
179179
let Self { inner, buf, cap, pos } = unsafe { self.get_unchecked_mut() };
180180
let mut inner = unsafe { Pin::new_unchecked(inner) };
181181

futures-util/src/io/buf_writer.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ impl<W: AsyncWrite> BufWriter<W> {
9696
/// Gets a pinned mutable reference to the underlying writer.
9797
///
9898
/// It is inadvisable to directly write to the underlying writer.
99-
pub fn get_pin_mut<'a>(self: Pin<&'a mut Self>) -> Pin<&'a mut W> {
99+
pub fn get_pin_mut(self: Pin<&mut Self>) -> Pin<&mut W> {
100100
self.inner()
101101
}
102102

futures-util/src/io/copy_buf_into.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ impl<R, W: ?Sized> CopyBufInto<'_, R, W> {
2626
}
2727

2828
impl<R, W: Unpin + ?Sized> CopyBufInto<'_, R, W> {
29-
fn project<'b>(self: Pin<&'b mut Self>) -> (Pin<&'b mut R>, Pin<&'b mut W>, &'b mut u64) {
29+
fn project(self: Pin<&mut Self>) -> (Pin<&mut R>, Pin<&mut W>, &mut u64) {
3030
unsafe {
3131
let this = self.get_unchecked_mut();
3232
(Pin::new_unchecked(&mut this.reader), Pin::new(&mut *this.writer), &mut this.amt)

futures-util/src/io/into_sink.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ impl<W: AsyncWrite, Item: AsRef<[u8]>> IntoSink<W, Item> {
3232
IntoSink { writer, buffer: None }
3333
}
3434

35-
fn project<'a>(self: Pin<&'a mut Self>) -> (Pin<&'a mut W>, &'a mut Option<Block<Item>>) {
35+
fn project(self: Pin<&mut Self>) -> (Pin<&mut W>, &mut Option<Block<Item>>) {
3636
unsafe {
3737
let this = self.get_unchecked_mut();
3838
(Pin::new_unchecked(&mut this.writer), &mut this.buffer)

futures-util/src/sink/buffer.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ impl<Si: Sink<Item>, Item> Buffer<Si, Item> {
4242
}
4343

4444
/// Get a pinned mutable reference to the inner sink.
45-
pub fn get_pin_mut<'a>(self: Pin<&'a mut Self>) -> Pin<&'a mut Si> {
45+
pub fn get_pin_mut(self: Pin<&mut Self>) -> Pin<&mut Si> {
4646
self.sink()
4747
}
4848

futures-util/src/sink/err_into.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ impl<Si, E, Item> SinkErrInto<Si, Item, E>
3535
}
3636

3737
/// Get a pinned mutable reference to the inner sink.
38-
pub fn get_pin_mut<'a>(self: Pin<&'a mut Self>) -> Pin<&'a mut Si> {
38+
pub fn get_pin_mut(self: Pin<&mut Self>) -> Pin<&mut Si> {
3939
self.sink().get_pin_mut()
4040
}
4141

futures-util/src/sink/fanout.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ impl<Si1, Si2> Fanout<Si1, Si2> {
3333
}
3434

3535
/// Get a pinned mutable reference to the inner sinks.
36-
pub fn get_pin_mut<'a>(self: Pin<&'a mut Self>) -> (Pin<&'a mut Si1>, Pin<&'a mut Si2>)
36+
pub fn get_pin_mut(self: Pin<&mut Self>) -> (Pin<&mut Si1>, Pin<&mut Si2>)
3737
where Si1: Unpin, Si2: Unpin,
3838
{
3939
let Self { sink1, sink2 } = self.get_mut();

futures-util/src/sink/map_err.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ impl<Si, F> SinkMapErr<Si, F> {
3333
}
3434

3535
/// Get a pinned mutable reference to the inner sink.
36-
pub fn get_pin_mut<'a>(self: Pin<&'a mut Self>) -> Pin<&'a mut Si> {
36+
pub fn get_pin_mut(self: Pin<&mut Self>) -> Pin<&mut Si> {
3737
self.sink()
3838
}
3939

futures-util/src/sink/with.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,7 @@ enum State<Fut, T> {
6969

7070
impl<Fut, T> State<Fut, T> {
7171
#[allow(clippy::wrong_self_convention)]
72-
fn as_pin_mut<'a>(
73-
self: Pin<&'a mut Self>,
74-
) -> State<Pin<&'a mut Fut>, Pin<&'a mut T>> {
72+
fn as_pin_mut(self: Pin<&mut Self>) -> State<Pin<&mut Fut>, Pin<&mut T>> {
7573
unsafe {
7674
match self.get_unchecked_mut() {
7775
State::Empty =>
@@ -118,7 +116,7 @@ impl<Si, Item, U, Fut, F, E> With<Si, Item, U, Fut, F>
118116
}
119117

120118
/// Get a pinned mutable reference to the inner sink.
121-
pub fn get_pin_mut<'a>(self: Pin<&'a mut Self>) -> Pin<&'a mut Si> {
119+
pub fn get_pin_mut(self: Pin<&mut Self>) -> Pin<&mut Si> {
122120
self.sink()
123121
}
124122

futures-util/src/sink/with_flat_map.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ where
7171
}
7272

7373
/// Get a pinned mutable reference to the inner sink.
74-
pub fn get_pin_mut<'a>(self: Pin<&'a mut Self>) -> Pin<&'a mut Si> {
74+
pub fn get_pin_mut(self: Pin<&mut Self>) -> Pin<&mut Si> {
7575
self.sink()
7676
}
7777

futures-util/src/stream/buffer_unordered.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ where
8181
///
8282
/// Note that care must be taken to avoid tampering with the state of the
8383
/// stream which may otherwise confuse this combinator.
84-
pub fn get_pin_mut<'a>(self: Pin<&'a mut Self>) -> Pin<&'a mut St> {
84+
pub fn get_pin_mut(self: Pin<&mut Self>) -> Pin<&mut St> {
8585
self.stream().get_pin_mut()
8686
}
8787

futures-util/src/stream/buffered.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ where
7676
///
7777
/// Note that care must be taken to avoid tampering with the state of the
7878
/// stream which may otherwise confuse this combinator.
79-
pub fn get_pin_mut<'a>(self: Pin<&'a mut Self>) -> Pin<&'a mut St> {
79+
pub fn get_pin_mut(self: Pin<&mut Self>) -> Pin<&mut St> {
8080
self.stream().get_pin_mut()
8181
}
8282

futures-util/src/stream/chunks.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ impl<St: Stream> Chunks<St> where St: Stream {
5858
///
5959
/// Note that care must be taken to avoid tampering with the state of the
6060
/// stream which may otherwise confuse this combinator.
61-
pub fn get_pin_mut<'a>(self: Pin<&'a mut Self>) -> Pin<&'a mut St> {
61+
pub fn get_pin_mut(self: Pin<&mut Self>) -> Pin<&mut St> {
6262
self.stream().get_pin_mut()
6363
}
6464

futures-util/src/stream/enumerate.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ impl<St: Stream> Enumerate<St> {
4646
///
4747
/// Note that care must be taken to avoid tampering with the state of the
4848
/// stream which may otherwise confuse this combinator.
49-
pub fn get_pin_mut<'a>(self: Pin<&'a mut Self>) -> Pin<&'a mut St> {
49+
pub fn get_pin_mut(self: Pin<&mut Self>) -> Pin<&mut St> {
5050
self.stream()
5151
}
5252

futures-util/src/stream/filter.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ where St: Stream,
7878
///
7979
/// Note that care must be taken to avoid tampering with the state of the
8080
/// stream which may otherwise confuse this combinator.
81-
pub fn get_pin_mut<'a>(self: Pin<&'a mut Self>) -> Pin<&'a mut St> {
81+
pub fn get_pin_mut(self: Pin<&mut Self>) -> Pin<&mut St> {
8282
self.stream()
8383
}
8484

futures-util/src/stream/filter_map.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ impl<St, Fut, F> FilterMap<St, Fut, F>
6767
///
6868
/// Note that care must be taken to avoid tampering with the state of the
6969
/// stream which may otherwise confuse this combinator.
70-
pub fn get_pin_mut<'a>(self: Pin<&'a mut Self>) -> Pin<&'a mut St> {
70+
pub fn get_pin_mut(self: Pin<&mut Self>) -> Pin<&mut St> {
7171
self.stream()
7272
}
7373

futures-util/src/stream/flatten.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ where
6060
///
6161
/// Note that care must be taken to avoid tampering with the state of the
6262
/// stream which may otherwise confuse this combinator.
63-
pub fn get_pin_mut<'a>(self: Pin<&'a mut Self>) -> Pin<&'a mut St> {
63+
pub fn get_pin_mut(self: Pin<&mut Self>) -> Pin<&mut St> {
6464
self.stream()
6565
}
6666

futures-util/src/stream/fuse.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ impl<St> Fuse<St> {
5252
///
5353
/// Note that care must be taken to avoid tampering with the state of the
5454
/// stream which may otherwise confuse this combinator.
55-
pub fn get_pin_mut<'a>(self: Pin<&'a mut Self>) -> Pin<&'a mut St> {
55+
pub fn get_pin_mut(self: Pin<&mut Self>) -> Pin<&mut St> {
5656
self.stream()
5757
}
5858

futures-util/src/stream/futures_unordered/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ impl<Fut> FuturesUnordered<Fut> {
200200
}
201201

202202
/// Returns an iterator that allows modifying each future in the set.
203-
pub fn iter_pin_mut<'a>(self: Pin<&'a mut Self>) -> IterPinMut<'a, Fut> {
203+
pub fn iter_pin_mut(self: Pin<&mut Self>) -> IterPinMut<'_, Fut> {
204204
IterPinMut {
205205
task: self.head_all,
206206
len: self.len(),

futures-util/src/stream/inspect.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ impl<St, F> Inspect<St, F>
5757
///
5858
/// Note that care must be taken to avoid tampering with the state of the
5959
/// stream which may otherwise confuse this combinator.
60-
pub fn get_pin_mut<'a>(self: Pin<&'a mut Self>) -> Pin<&'a mut St> {
60+
pub fn get_pin_mut(self: Pin<&mut Self>) -> Pin<&mut St> {
6161
self.stream()
6262
}
6363

futures-util/src/stream/into_future.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ impl<St: Stream + Unpin> StreamFuture<St> {
5353
/// implementation of `Future::poll` consumes the underlying stream during polling
5454
/// in order to return it to the caller of `Future::poll` if the stream yielded
5555
/// an element.
56-
pub fn get_pin_mut<'a>(self: Pin<&'a mut Self>) -> Option<Pin<&'a mut St>> {
56+
pub fn get_pin_mut(self: Pin<&mut Self>) -> Option<Pin<&mut St>> {
5757
Pin::new(&mut self.get_mut().stream).as_pin_mut()
5858
}
5959

futures-util/src/stream/map.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ impl<St, T, F> Map<St, F>
5757
///
5858
/// Note that care must be taken to avoid tampering with the state of the
5959
/// stream which may otherwise confuse this combinator.
60-
pub fn get_pin_mut<'a>(self: Pin<&'a mut Self>) -> Pin<&'a mut St> {
60+
pub fn get_pin_mut(self: Pin<&mut Self>) -> Pin<&mut St> {
6161
self.stream()
6262
}
6363

0 commit comments

Comments
 (0)