diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:13 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:13 +0000 |
commit | 218caa410aa38c29984be31a5229b9fa717560ee (patch) | |
tree | c54bd55eeb6e4c508940a30e94c0032fbd45d677 /src/test/ui/self/elision | |
parent | Releasing progress-linux version 1.67.1+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-218caa410aa38c29984be31a5229b9fa717560ee.tar.xz rustc-218caa410aa38c29984be31a5229b9fa717560ee.zip |
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/ui/self/elision')
45 files changed, 0 insertions, 2341 deletions
diff --git a/src/test/ui/self/elision/README.md b/src/test/ui/self/elision/README.md deleted file mode 100644 index 3bd7a6c00..000000000 --- a/src/test/ui/self/elision/README.md +++ /dev/null @@ -1,75 +0,0 @@ -Test cases intended to document behavior and try to exhaustively -explore the combinations. - -## Confidence - -These tests are not yet considered 100% normative, in that some -aspects of the current behavior are not desirable. This is expressed -in the "confidence" field in the following table. Values: - -| Confidence | Interpretation | -| --- | --- | -| 100% | this will remain recommended behavior | -| 75% | unclear whether we will continue to accept this | -| 50% | this will likely be deprecated but remain valid | -| 25% | this could change in the future | -| 0% | this is definitely bogus and will likely change in the future in *some* way | - -## Tests - -| Test file | `Self` type | Pattern | Current elision behavior | Confidence | -| --- | --- | --- | --- | --- | -| `self.rs` | `Struct` | `Self` | ignore `self` parameter | 100% | -| `struct.rs` | `Struct` | `Struct` | ignore `self` parameter | 100% | -| `alias.rs` | `Struct` | `Alias` | ignore `self` parameter | 100% | -| `ref-self.rs` | `Struct` | `&Self` | take lifetime from `&Self` | 100% | -| `ref-mut-self.rs` | `Struct` | `&mut Self` | take lifetime from `&mut Self` | 100% | -| `ref-struct.rs` | `Struct` | `&Struct` | take lifetime from `&Self` | 50% | -| `ref-mut-struct.rs` | `Struct` | `&mut Struct` | take lifetime from `&mut Self` | 50% | -| `ref-alias.rs` | `Struct` | `&Alias` | ignore `Alias` | 0% | -| `ref-mut-alias.rs` | `Struct` | `&mut Alias` | ignore `Alias` | 0% | -| `lt-self.rs` | `Struct<'a>` | `Self` | ignore `Self` (and hence `'a`) | 25% | -| `lt-struct.rs` | `Struct<'a>` | `Self` | ignore `Self` (and hence `'a`) | 0% | -| `lt-alias.rs` | `Alias<'a>` | `Self` | ignore `Self` (and hence `'a`) | 0% | -| `lt-ref-self.rs` | `Struct<'a>` | `&Self` | take lifetime from `&Self` | 75% | - -In each case, we test the following patterns: - -- `self: XXX` -- `self: Box<XXX>` -- `self: Pin<XXX>` -- `self: Box<Box<XXX>>` -- `self: Box<Pin<XXX>>` - -In the non-reference cases, `Pin` causes errors so we substitute `Rc`. - -### `async fn` - -For each of the tests above we also check that `async fn` behaves as an `fn` would. -These tests are in files named `*-async.rs`. - -Legends: -- ✓ ⟹ Yes / Pass -- X ⟹ No -- α ⟹ lifetime mismatch -- β ⟹ cannot infer an appropriate lifetime -- γ ⟹ missing lifetime specifier - -| `async` file | Pass? | Conforms to `fn`? | How does it diverge? <br/> `fn` ⟶ `async fn` | -| --- | --- | --- | --- | -| `self-async.rs` | ✓ | ✓ | N/A | -| `struct-async.rs`| ✓ | ✓ | N/A | -| `alias-async.rs`| ✓ | ✓ | N/A | -| `assoc-async.rs`| ✓ | ✓ | N/A | -| `ref-self-async.rs` | X | ✓ | N/A | -| `ref-mut-self-async.rs` | X | ✓ | N/A | -| `ref-struct-async.rs` | X | ✓ | N/A | -| `ref-mut-struct-async.rs` | X | ✓ | N/A | -| `ref-alias-async.rs` | ✓ | ✓ | N/A | -| `ref-assoc-async.rs` | ✓ | ✓ | N/A | -| `ref-mut-alias-async.rs` | ✓ | ✓ | N/A | -| `lt-self-async.rs` | ✓ | ✓ | N/A -| `lt-struct-async.rs` | ✓ | ✓ | N/A -| `lt-alias-async.rs` | ✓ | ✓ | N/A -| `lt-assoc-async.rs` | ✓ | ✓ | N/A -| `lt-ref-self-async.rs` | X | ✓ | N/A | diff --git a/src/test/ui/self/elision/alias-async.rs b/src/test/ui/self/elision/alias-async.rs deleted file mode 100644 index 7c0dd0686..000000000 --- a/src/test/ui/self/elision/alias-async.rs +++ /dev/null @@ -1,36 +0,0 @@ -// check-pass -// edition:2018 - -#![allow(non_snake_case)] - -use std::rc::Rc; - -struct Struct { } - -type Alias = Struct; - -impl Struct { - // Test using an alias for `Struct`: - - async fn alias(self: Alias, f: &u32) -> &u32 { - f - } - - async fn box_Alias(self: Box<Alias>, f: &u32) -> &u32 { - f - } - - async fn rc_Alias(self: Rc<Alias>, f: &u32) -> &u32 { - f - } - - async fn box_box_Alias(self: Box<Box<Alias>>, f: &u32) -> &u32 { - f - } - - async fn box_rc_Alias(self: Box<Rc<Alias>>, f: &u32) -> &u32 { - f - } -} - -fn main() { } diff --git a/src/test/ui/self/elision/alias.rs b/src/test/ui/self/elision/alias.rs deleted file mode 100644 index 0c801d702..000000000 --- a/src/test/ui/self/elision/alias.rs +++ /dev/null @@ -1,35 +0,0 @@ -// check-pass - -#![allow(non_snake_case)] - -use std::rc::Rc; - -struct Struct { } - -type Alias = Struct; - -impl Struct { - // Test using an alias for `Struct`: - - fn alias(self: Alias, f: &u32) -> &u32 { - f - } - - fn box_Alias(self: Box<Alias>, f: &u32) -> &u32 { - f - } - - fn rc_Alias(self: Rc<Alias>, f: &u32) -> &u32 { - f - } - - fn box_box_Alias(self: Box<Box<Alias>>, f: &u32) -> &u32 { - f - } - - fn box_rc_Alias(self: Box<Rc<Alias>>, f: &u32) -> &u32 { - f - } -} - -fn main() { } diff --git a/src/test/ui/self/elision/assoc-async.rs b/src/test/ui/self/elision/assoc-async.rs deleted file mode 100644 index 363b7fc2a..000000000 --- a/src/test/ui/self/elision/assoc-async.rs +++ /dev/null @@ -1,40 +0,0 @@ -// check-pass -// edition:2018 - -#![allow(non_snake_case)] - -use std::rc::Rc; - -trait Trait { - type AssocType; -} - -struct Struct { } - -impl Trait for Struct { - type AssocType = Self; -} - -impl Struct { - async fn assoc(self: <Struct as Trait>::AssocType, f: &u32) -> &u32 { - f - } - - async fn box_AssocType(self: Box<<Struct as Trait>::AssocType>, f: &u32) -> &u32 { - f - } - - async fn rc_AssocType(self: Rc<<Struct as Trait>::AssocType>, f: &u32) -> &u32 { - f - } - - async fn box_box_AssocType(self: Box<Box<<Struct as Trait>::AssocType>>, f: &u32) -> &u32 { - f - } - - async fn box_rc_AssocType(self: Box<Rc<<Struct as Trait>::AssocType>>, f: &u32) -> &u32 { - f - } -} - -fn main() { } diff --git a/src/test/ui/self/elision/assoc.rs b/src/test/ui/self/elision/assoc.rs deleted file mode 100644 index fa39a2b47..000000000 --- a/src/test/ui/self/elision/assoc.rs +++ /dev/null @@ -1,39 +0,0 @@ -// check-pass - -#![allow(non_snake_case)] - -use std::rc::Rc; - -trait Trait { - type AssocType; -} - -struct Struct { } - -impl Trait for Struct { - type AssocType = Self; -} - -impl Struct { - fn assoc(self: <Struct as Trait>::AssocType, f: &u32) -> &u32 { - f - } - - fn box_AssocType(self: Box<<Struct as Trait>::AssocType>, f: &u32) -> &u32 { - f - } - - fn rc_AssocType(self: Rc<<Struct as Trait>::AssocType>, f: &u32) -> &u32 { - f - } - - fn box_box_AssocType(self: Box<Box<<Struct as Trait>::AssocType>>, f: &u32) -> &u32 { - f - } - - fn box_rc_AssocType(self: Box<Rc<<Struct as Trait>::AssocType>>, f: &u32) -> &u32 { - f - } -} - -fn main() { } diff --git a/src/test/ui/self/elision/lt-alias-async.rs b/src/test/ui/self/elision/lt-alias-async.rs deleted file mode 100644 index 3a6f8471e..000000000 --- a/src/test/ui/self/elision/lt-alias-async.rs +++ /dev/null @@ -1,38 +0,0 @@ -// check-pass -// edition:2018 - -#![allow(non_snake_case)] - -use std::rc::Rc; - -struct Struct<'a> { x: &'a u32 } - -type Alias<'a> = Struct<'a>; - -impl<'a> Alias<'a> { - async fn take_self(self, f: &u32) -> &u32 { - f - } - - async fn take_Alias(self: Alias<'a>, f: &u32) -> &u32 { - f - } - - async fn take_Box_Alias(self: Box<Alias<'a>>, f: &u32) -> &u32 { - f - } - - async fn take_Box_Box_Alias(self: Box<Box<Alias<'a>>>, f: &u32) -> &u32 { - f - } - - async fn take_Rc_Alias(self: Rc<Alias<'a>>, f: &u32) -> &u32 { - f - } - - async fn take_Box_Rc_Alias(self: Box<Rc<Alias<'a>>>, f: &u32) -> &u32 { - f - } -} - -fn main() { } diff --git a/src/test/ui/self/elision/lt-alias.rs b/src/test/ui/self/elision/lt-alias.rs deleted file mode 100644 index bbba88e4e..000000000 --- a/src/test/ui/self/elision/lt-alias.rs +++ /dev/null @@ -1,37 +0,0 @@ -// check-pass - -#![allow(non_snake_case)] - -use std::rc::Rc; - -struct Struct<'a> { x: &'a u32 } - -type Alias<'a> = Struct<'a>; - -impl<'a> Alias<'a> { - fn take_self(self, f: &u32) -> &u32 { - f - } - - fn take_Alias(self: Alias<'a>, f: &u32) -> &u32 { - f - } - - fn take_Box_Alias(self: Box<Alias<'a>>, f: &u32) -> &u32 { - f - } - - fn take_Box_Box_Alias(self: Box<Box<Alias<'a>>>, f: &u32) -> &u32 { - f - } - - fn take_Rc_Alias(self: Rc<Alias<'a>>, f: &u32) -> &u32 { - f - } - - fn take_Box_Rc_Alias(self: Box<Rc<Alias<'a>>>, f: &u32) -> &u32 { - f - } -} - -fn main() { } diff --git a/src/test/ui/self/elision/lt-assoc-async.rs b/src/test/ui/self/elision/lt-assoc-async.rs deleted file mode 100644 index 0d3ff630d..000000000 --- a/src/test/ui/self/elision/lt-assoc-async.rs +++ /dev/null @@ -1,50 +0,0 @@ -// check-pass -// edition:2018 - -#![allow(non_snake_case)] - -use std::rc::Rc; - -trait Trait { - type AssocType; -} - -struct Struct<'a> { x: &'a u32 } - -impl<'a> Trait for Struct<'a> { - type AssocType = Self; -} - -impl<'a> Struct<'a> { - async fn take_self(self, f: &u32) -> &u32 { - f - } - - async fn take_AssocType(self: <Struct<'a> as Trait>::AssocType, f: &u32) -> &u32 { - f - } - - async fn take_Box_AssocType(self: Box<<Struct<'a> as Trait>::AssocType>, f: &u32) -> &u32 { - f - } - - async fn take_Box_Box_AssocType( - self: Box<Box<<Struct<'a> as Trait>::AssocType>>, - f: &u32 - ) -> &u32 { - f - } - - async fn take_Rc_AssocType(self: Rc<<Struct<'a> as Trait>::AssocType>, f: &u32) -> &u32 { - f - } - - async fn take_Box_Rc_AssocType( - self: Box<Rc<<Struct<'a> as Trait>::AssocType>>, - f: &u32 - ) -> &u32 { - f - } -} - -fn main() { } diff --git a/src/test/ui/self/elision/lt-assoc.rs b/src/test/ui/self/elision/lt-assoc.rs deleted file mode 100644 index 8f3543135..000000000 --- a/src/test/ui/self/elision/lt-assoc.rs +++ /dev/null @@ -1,43 +0,0 @@ -// check-pass - -#![allow(non_snake_case)] - -use std::rc::Rc; - -trait Trait { - type AssocType; -} - -struct Struct<'a> { x: &'a u32 } - -impl<'a> Trait for Struct<'a> { - type AssocType = Self; -} - -impl<'a> Struct<'a> { - fn take_self(self, f: &u32) -> &u32 { - f - } - - fn take_AssocType(self: <Struct<'a> as Trait>::AssocType, f: &u32) -> &u32 { - f - } - - fn take_Box_AssocType(self: Box<<Struct<'a> as Trait>::AssocType>, f: &u32) -> &u32 { - f - } - - fn take_Box_Box_AssocType(self: Box<Box<<Struct<'a> as Trait>::AssocType>>, f: &u32) -> &u32 { - f - } - - fn take_Rc_AssocType(self: Rc<<Struct<'a> as Trait>::AssocType>, f: &u32) -> &u32 { - f - } - - fn take_Box_Rc_AssocType(self: Box<Rc<<Struct<'a> as Trait>::AssocType>>, f: &u32) -> &u32 { - f - } -} - -fn main() { } diff --git a/src/test/ui/self/elision/lt-ref-self-async.rs b/src/test/ui/self/elision/lt-ref-self-async.rs deleted file mode 100644 index a2325ba7f..000000000 --- a/src/test/ui/self/elision/lt-ref-self-async.rs +++ /dev/null @@ -1,45 +0,0 @@ -// edition:2018 - -#![allow(non_snake_case)] - -use std::pin::Pin; - -struct Struct<'a> { data: &'a u32 } - -impl<'a> Struct<'a> { - // Test using `&self` sugar: - - async fn ref_self(&self, f: &u32) -> &u32 { - f - //~^ ERROR lifetime may not live long enough - } - - // Test using `&Self` explicitly: - - async fn ref_Self(self: &Self, f: &u32) -> &u32 { - f - //~^ ERROR lifetime may not live long enough - } - - async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 { - f - //~^ ERROR lifetime may not live long enough - } - - async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 { - f - //~^ ERROR lifetime may not live long enough - } - - async fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 { - f - //~^ ERROR lifetime may not live long enough - } - - async fn box_pin_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 { - f - //~^ ERROR lifetime may not live long enough - } -} - -fn main() { } diff --git a/src/test/ui/self/elision/lt-ref-self-async.stderr b/src/test/ui/self/elision/lt-ref-self-async.stderr deleted file mode 100644 index 787afd4dc..000000000 --- a/src/test/ui/self/elision/lt-ref-self-async.stderr +++ /dev/null @@ -1,92 +0,0 @@ -error: lifetime may not live long enough - --> $DIR/lt-ref-self-async.rs:13:9 - | -LL | async fn ref_self(&self, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` -LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` - | -help: consider introducing a named lifetime parameter and update trait if needed - | -LL | async fn ref_self<'a>(&'a self, f: &'a u32) -> &u32 { - | ++++ ++ ++ - -error: lifetime may not live long enough - --> $DIR/lt-ref-self-async.rs:20:9 - | -LL | async fn ref_Self(self: &Self, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` -LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` - | -help: consider introducing a named lifetime parameter and update trait if needed - | -LL | async fn ref_Self<'a>(self: &'a Self, f: &'a u32) -> &u32 { - | ++++ ++ ++ - -error: lifetime may not live long enough - --> $DIR/lt-ref-self-async.rs:25:9 - | -LL | async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` -LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` - | -help: consider introducing a named lifetime parameter and update trait if needed - | -LL | async fn box_ref_Self<'a>(self: Box<&'a Self>, f: &'a u32) -> &u32 { - | ++++ ++ ++ - -error: lifetime may not live long enough - --> $DIR/lt-ref-self-async.rs:30:9 - | -LL | async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` -LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` - | -help: consider introducing a named lifetime parameter and update trait if needed - | -LL | async fn pin_ref_Self<'a>(self: Pin<&'a Self>, f: &'a u32) -> &u32 { - | ++++ ++ ++ - -error: lifetime may not live long enough - --> $DIR/lt-ref-self-async.rs:35:9 - | -LL | async fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` -LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` - | -help: consider introducing a named lifetime parameter and update trait if needed - | -LL | async fn box_box_ref_Self<'a>(self: Box<Box<&'a Self>>, f: &'a u32) -> &u32 { - | ++++ ++ ++ - -error: lifetime may not live long enough - --> $DIR/lt-ref-self-async.rs:40:9 - | -LL | async fn box_pin_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` -LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` - | -help: consider introducing a named lifetime parameter and update trait if needed - | -LL | async fn box_pin_Self<'a>(self: Box<Pin<&'a Self>>, f: &'a u32) -> &u32 { - | ++++ ++ ++ - -error: aborting due to 6 previous errors - diff --git a/src/test/ui/self/elision/lt-ref-self.rs b/src/test/ui/self/elision/lt-ref-self.rs deleted file mode 100644 index d37ed5acb..000000000 --- a/src/test/ui/self/elision/lt-ref-self.rs +++ /dev/null @@ -1,43 +0,0 @@ -#![allow(non_snake_case)] - -use std::pin::Pin; - -struct Struct<'a> { data: &'a u32 } - -impl<'a> Struct<'a> { - // Test using `&self` sugar: - - fn ref_self(&self, f: &u32) -> &u32 { - f - //~^ ERROR lifetime may not live long enough - } - - // Test using `&Self` explicitly: - - fn ref_Self(self: &Self, f: &u32) -> &u32 { - f - //~^ ERROR lifetime may not live long enough - } - - fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 { - f - //~^ ERROR lifetime may not live long enough - } - - fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 { - f - //~^ ERROR lifetime may not live long enough - } - - fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 { - f - //~^ ERROR lifetime may not live long enough - } - - fn box_pin_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 { - f - //~^ ERROR lifetime may not live long enough - } -} - -fn main() { } diff --git a/src/test/ui/self/elision/lt-ref-self.stderr b/src/test/ui/self/elision/lt-ref-self.stderr deleted file mode 100644 index 49af638e4..000000000 --- a/src/test/ui/self/elision/lt-ref-self.stderr +++ /dev/null @@ -1,92 +0,0 @@ -error: lifetime may not live long enough - --> $DIR/lt-ref-self.rs:11:9 - | -LL | fn ref_self(&self, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` -LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` - | -help: consider introducing a named lifetime parameter and update trait if needed - | -LL | fn ref_self<'a>(&'a self, f: &'a u32) -> &u32 { - | ++++ ++ ++ - -error: lifetime may not live long enough - --> $DIR/lt-ref-self.rs:18:9 - | -LL | fn ref_Self(self: &Self, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` -LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` - | -help: consider introducing a named lifetime parameter and update trait if needed - | -LL | fn ref_Self<'a>(self: &'a Self, f: &'a u32) -> &u32 { - | ++++ ++ ++ - -error: lifetime may not live long enough - --> $DIR/lt-ref-self.rs:23:9 - | -LL | fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` -LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` - | -help: consider introducing a named lifetime parameter and update trait if needed - | -LL | fn box_ref_Self<'a>(self: Box<&'a Self>, f: &'a u32) -> &u32 { - | ++++ ++ ++ - -error: lifetime may not live long enough - --> $DIR/lt-ref-self.rs:28:9 - | -LL | fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` -LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` - | -help: consider introducing a named lifetime parameter and update trait if needed - | -LL | fn pin_ref_Self<'a>(self: Pin<&'a Self>, f: &'a u32) -> &u32 { - | ++++ ++ ++ - -error: lifetime may not live long enough - --> $DIR/lt-ref-self.rs:33:9 - | -LL | fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` -LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` - | -help: consider introducing a named lifetime parameter and update trait if needed - | -LL | fn box_box_ref_Self<'a>(self: Box<Box<&'a Self>>, f: &'a u32) -> &u32 { - | ++++ ++ ++ - -error: lifetime may not live long enough - --> $DIR/lt-ref-self.rs:38:9 - | -LL | fn box_pin_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` -LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` - | -help: consider introducing a named lifetime parameter and update trait if needed - | -LL | fn box_pin_Self<'a>(self: Box<Pin<&'a Self>>, f: &'a u32) -> &u32 { - | ++++ ++ ++ - -error: aborting due to 6 previous errors - diff --git a/src/test/ui/self/elision/lt-self-async.rs b/src/test/ui/self/elision/lt-self-async.rs deleted file mode 100644 index 4cedaf79d..000000000 --- a/src/test/ui/self/elision/lt-self-async.rs +++ /dev/null @@ -1,49 +0,0 @@ -// check-pass -// edition:2018 - -#![allow(non_snake_case)] - -use std::pin::Pin; -use std::rc::Rc; - -struct Struct<'a> { - x: &'a u32 -} - -impl<'a> Struct<'a> { - async fn take_self(self, f: &u32) -> &u32 { - f - } - - async fn take_Self(self: Self, f: &u32) -> &u32 { - f - } - - async fn take_Box_Self(self: Box<Self>, f: &u32) -> &u32 { - f - } - - async fn take_Box_Box_Self(self: Box<Box<Self>>, f: &u32) -> &u32 { - f - } - - async fn take_Rc_Self(self: Rc<Self>, f: &u32) -> &u32 { - f - } - - async fn take_Box_Rc_Self(self: Box<Rc<Self>>, f: &u32) -> &u32 { - f - } - - // N/A - //fn take_Pin_Self(self: Pin<Self>, f: &u32) -> &u32 { - // f - //} - - // N/A - //fn take_Box_Pin_Self(self: Box<Pin<Self>>, f: &u32) -> &u32 { - // f - //} -} - -fn main() { } diff --git a/src/test/ui/self/elision/lt-self.rs b/src/test/ui/self/elision/lt-self.rs deleted file mode 100644 index cf74f892b..000000000 --- a/src/test/ui/self/elision/lt-self.rs +++ /dev/null @@ -1,48 +0,0 @@ -// check-pass - -#![allow(non_snake_case)] - -use std::pin::Pin; -use std::rc::Rc; - -struct Struct<'a> { - x: &'a u32 -} - -impl<'a> Struct<'a> { - fn take_self(self, f: &u32) -> &u32 { - f - } - - fn take_Self(self: Self, f: &u32) -> &u32 { - f - } - - fn take_Box_Self(self: Box<Self>, f: &u32) -> &u32 { - f - } - - fn take_Box_Box_Self(self: Box<Box<Self>>, f: &u32) -> &u32 { - f - } - - fn take_Rc_Self(self: Rc<Self>, f: &u32) -> &u32 { - f - } - - fn take_Box_Rc_Self(self: Box<Rc<Self>>, f: &u32) -> &u32 { - f - } - - // N/A - //fn take_Pin_Self(self: Pin<Self>, f: &u32) -> &u32 { - // f - //} - - // N/A - //fn take_Box_Pin_Self(self: Box<Pin<Self>>, f: &u32) -> &u32 { - // f - //} -} - -fn main() { } diff --git a/src/test/ui/self/elision/lt-struct-async.rs b/src/test/ui/self/elision/lt-struct-async.rs deleted file mode 100644 index abbee7fdf..000000000 --- a/src/test/ui/self/elision/lt-struct-async.rs +++ /dev/null @@ -1,36 +0,0 @@ -// check-pass -// edition:2018 - -#![allow(non_snake_case)] - -use std::rc::Rc; - -struct Struct<'a> { x: &'a u32 } - -impl<'a> Struct<'a> { - async fn take_self(self, f: &u32) -> &u32 { - f - } - - async fn take_Struct(self: Struct<'a>, f: &u32) -> &u32 { - f - } - - async fn take_Box_Struct(self: Box<Struct<'a>>, f: &u32) -> &u32 { - f - } - - async fn take_Box_Box_Struct(self: Box<Box<Struct<'a>>>, f: &u32) -> &u32 { - f - } - - async fn take_Rc_Struct(self: Rc<Struct<'a>>, f: &u32) -> &u32 { - f - } - - async fn take_Box_Rc_Struct(self: Box<Rc<Struct<'a>>>, f: &u32) -> &u32 { - f - } -} - -fn main() { } diff --git a/src/test/ui/self/elision/lt-struct.rs b/src/test/ui/self/elision/lt-struct.rs deleted file mode 100644 index 799c6c079..000000000 --- a/src/test/ui/self/elision/lt-struct.rs +++ /dev/null @@ -1,35 +0,0 @@ -// check-pass - -#![allow(non_snake_case)] - -use std::rc::Rc; - -struct Struct<'a> { x: &'a u32 } - -impl<'a> Struct<'a> { - fn take_self(self, f: &u32) -> &u32 { - f - } - - fn take_Struct(self: Struct<'a>, f: &u32) -> &u32 { - f - } - - fn take_Box_Struct(self: Box<Struct<'a>>, f: &u32) -> &u32 { - f - } - - fn take_Box_Box_Struct(self: Box<Box<Struct<'a>>>, f: &u32) -> &u32 { - f - } - - fn take_Rc_Struct(self: Rc<Struct<'a>>, f: &u32) -> &u32 { - f - } - - fn take_Box_Rc_Struct(self: Box<Rc<Struct<'a>>>, f: &u32) -> &u32 { - f - } -} - -fn main() { } diff --git a/src/test/ui/self/elision/multiple-ref-self-async.rs b/src/test/ui/self/elision/multiple-ref-self-async.rs deleted file mode 100644 index be073c6ed..000000000 --- a/src/test/ui/self/elision/multiple-ref-self-async.rs +++ /dev/null @@ -1,44 +0,0 @@ -// check-pass -// edition:2018 - -#![feature(arbitrary_self_types)] -#![allow(non_snake_case)] - -use std::marker::PhantomData; -use std::ops::Deref; -use std::pin::Pin; - -struct Struct { } - -struct Wrap<T, P>(T, PhantomData<P>); - -impl<T, P> Deref for Wrap<T, P> { - type Target = T; - fn deref(&self) -> &T { &self.0 } -} - -impl Struct { - // Test using multiple `&Self`: - - async fn wrap_ref_Self_ref_Self(self: Wrap<&Self, &Self>, f: &u8) -> &u8 { - f - } - - async fn box_wrap_ref_Self_ref_Self(self: Box<Wrap<&Self, &Self>>, f: &u32) -> &u32 { - f - } - - async fn pin_wrap_ref_Self_ref_Self(self: Pin<Wrap<&Self, &Self>>, f: &u32) -> &u32 { - f - } - - async fn box_box_wrap_ref_Self_ref_Self(self: Box<Box<Wrap<&Self, &Self>>>, f: &u32) -> &u32 { - f - } - - async fn box_pin_wrap_ref_Self_ref_Self(self: Box<Pin<Wrap<&Self, &Self>>>, f: &u32) -> &u32 { - f - } -} - -fn main() { } diff --git a/src/test/ui/self/elision/multiple-ref-self.rs b/src/test/ui/self/elision/multiple-ref-self.rs deleted file mode 100644 index f39613d0c..000000000 --- a/src/test/ui/self/elision/multiple-ref-self.rs +++ /dev/null @@ -1,43 +0,0 @@ -// check-pass - -#![feature(arbitrary_self_types)] -#![allow(non_snake_case)] - -use std::marker::PhantomData; -use std::ops::Deref; -use std::pin::Pin; - -struct Struct { } - -struct Wrap<T, P>(T, PhantomData<P>); - -impl<T, P> Deref for Wrap<T, P> { - type Target = T; - fn deref(&self) -> &T { &self.0 } -} - -impl Struct { - // Test using multiple `&Self`: - - fn wrap_ref_Self_ref_Self(self: Wrap<&Self, &Self>, f: &u8) -> &u8 { - f - } - - fn box_wrap_ref_Self_ref_Self(self: Box<Wrap<&Self, &Self>>, f: &u32) -> &u32 { - f - } - - fn pin_wrap_ref_Self_ref_Self(self: Pin<Wrap<&Self, &Self>>, f: &u32) -> &u32 { - f - } - - fn box_box_wrap_ref_Self_ref_Self(self: Box<Box<Wrap<&Self, &Self>>>, f: &u32) -> &u32 { - f - } - - fn box_pin_wrap_ref_Self_ref_Self(self: Box<Pin<Wrap<&Self, &Self>>>, f: &u32) -> &u32 { - f - } -} - -fn main() { } diff --git a/src/test/ui/self/elision/ref-alias-async.rs b/src/test/ui/self/elision/ref-alias-async.rs deleted file mode 100644 index 15f16525b..000000000 --- a/src/test/ui/self/elision/ref-alias-async.rs +++ /dev/null @@ -1,39 +0,0 @@ -// edition:2018 -// check-pass - -#![allow(non_snake_case)] - -use std::pin::Pin; - -struct Struct { } - -type Alias = Struct; - -impl Struct { - // Test using an alias for `Struct`: - // - // FIXME. We currently fail to recognize this as the self type, which - // feels like a bug. - - async fn ref_Alias(self: &Alias, f: &u32) -> &u32 { - f - } - - async fn box_ref_Alias(self: Box<&Alias>, f: &u32) -> &u32 { - f - } - - async fn pin_ref_Alias(self: Pin<&Alias>, f: &u32) -> &u32 { - f - } - - async fn box_box_ref_Alias(self: Box<Box<&Alias>>, f: &u32) -> &u32 { - f - } - - async fn box_pin_ref_Alias(self: Box<Pin<&Alias>>, f: &u32) -> &u32 { - f - } -} - -fn main() { } diff --git a/src/test/ui/self/elision/ref-alias.rs b/src/test/ui/self/elision/ref-alias.rs deleted file mode 100644 index 341f5b52d..000000000 --- a/src/test/ui/self/elision/ref-alias.rs +++ /dev/null @@ -1,38 +0,0 @@ -// check-pass - -#![allow(non_snake_case)] - -use std::pin::Pin; - -struct Struct { } - -type Alias = Struct; - -impl Struct { - // Test using an alias for `Struct`: - // - // FIXME. We currently fail to recognize this as the self type, which - // feels like a bug. - - fn ref_Alias(self: &Alias, f: &u32) -> &u32 { - f - } - - fn box_ref_Alias(self: Box<&Alias>, f: &u32) -> &u32 { - f - } - - fn pin_ref_Alias(self: Pin<&Alias>, f: &u32) -> &u32 { - f - } - - fn box_box_ref_Alias(self: Box<Box<&Alias>>, f: &u32) -> &u32 { - f - } - - fn box_pin_ref_Alias(self: Box<Pin<&Alias>>, f: &u32) -> &u32 { - f - } -} - -fn main() { } diff --git a/src/test/ui/self/elision/ref-assoc-async.rs b/src/test/ui/self/elision/ref-assoc-async.rs deleted file mode 100644 index ad10d8ba4..000000000 --- a/src/test/ui/self/elision/ref-assoc-async.rs +++ /dev/null @@ -1,40 +0,0 @@ -// edition:2018 -// check-pass - -#![allow(non_snake_case)] - -use std::pin::Pin; - -trait Trait { - type AssocType; -} - -struct Struct { } - -impl Trait for Struct { - type AssocType = Self; -} - -impl Struct { - async fn ref_AssocType(self: &<Struct as Trait>::AssocType, f: &u32) -> &u32 { - f - } - - async fn box_ref_AssocType(self: Box<&<Struct as Trait>::AssocType>, f: &u32) -> &u32 { - f - } - - async fn pin_ref_AssocType(self: Pin<&<Struct as Trait>::AssocType>, f: &u32) -> &u32 { - f - } - - async fn box_box_ref_AssocType(self: Box<Box<&<Struct as Trait>::AssocType>>, f: &u32) -> &u32 { - f - } - - async fn box_pin_ref_AssocType(self: Box<Pin<&<Struct as Trait>::AssocType>>, f: &u32) -> &u32 { - f - } -} - -fn main() { } diff --git a/src/test/ui/self/elision/ref-assoc.rs b/src/test/ui/self/elision/ref-assoc.rs deleted file mode 100644 index 2f02cb5f3..000000000 --- a/src/test/ui/self/elision/ref-assoc.rs +++ /dev/null @@ -1,39 +0,0 @@ -// check-pass - -#![allow(non_snake_case)] - -use std::pin::Pin; - -trait Trait { - type AssocType; -} - -struct Struct { } - -impl Trait for Struct { - type AssocType = Self; -} - -impl Struct { - fn ref_AssocType(self: &<Struct as Trait>::AssocType, f: &u32) -> &u32 { - f - } - - fn box_ref_AssocType(self: Box<&<Struct as Trait>::AssocType>, f: &u32) -> &u32 { - f - } - - fn pin_ref_AssocType(self: Pin<&<Struct as Trait>::AssocType>, f: &u32) -> &u32 { - f - } - - fn box_box_ref_AssocType(self: Box<Box<&<Struct as Trait>::AssocType>>, f: &u32) -> &u32 { - f - } - - fn box_pin_ref_AssocType(self: Box<Pin<&<Struct as Trait>::AssocType>>, f: &u32) -> &u32 { - f - } -} - -fn main() { } diff --git a/src/test/ui/self/elision/ref-mut-alias-async.rs b/src/test/ui/self/elision/ref-mut-alias-async.rs deleted file mode 100644 index 2c3f971d2..000000000 --- a/src/test/ui/self/elision/ref-mut-alias-async.rs +++ /dev/null @@ -1,36 +0,0 @@ -// edition:2018 -// check-pass - -#![allow(non_snake_case)] - -use std::pin::Pin; - -struct Struct { } - -type Alias = Struct; - -impl Struct { - // Test using an alias for `Struct`: - - async fn ref_Alias(self: &mut Alias, f: &u32) -> &u32 { - f - } - - async fn box_ref_Alias(self: Box<&mut Alias>, f: &u32) -> &u32 { - f - } - - async fn pin_ref_Alias(self: Pin<&mut Alias>, f: &u32) -> &u32 { - f - } - - async fn box_box_ref_Alias(self: Box<Box<&mut Alias>>, f: &u32) -> &u32 { - f - } - - async fn box_pin_ref_Alias(self: Box<Pin<&mut Alias>>, f: &u32) -> &u32 { - f - } -} - -fn main() { } diff --git a/src/test/ui/self/elision/ref-mut-alias.rs b/src/test/ui/self/elision/ref-mut-alias.rs deleted file mode 100644 index ce1ab3ffc..000000000 --- a/src/test/ui/self/elision/ref-mut-alias.rs +++ /dev/null @@ -1,35 +0,0 @@ -// check-pass - -#![allow(non_snake_case)] - -use std::pin::Pin; - -struct Struct { } - -type Alias = Struct; - -impl Struct { - // Test using an alias for `Struct`: - - fn ref_Alias(self: &mut Alias, f: &u32) -> &u32 { - f - } - - fn box_ref_Alias(self: Box<&mut Alias>, f: &u32) -> &u32 { - f - } - - fn pin_ref_Alias(self: Pin<&mut Alias>, f: &u32) -> &u32 { - f - } - - fn box_box_ref_Alias(self: Box<Box<&mut Alias>>, f: &u32) -> &u32 { - f - } - - fn box_pin_ref_Alias(self: Box<Pin<&mut Alias>>, f: &u32) -> &u32 { - f - } -} - -fn main() { } diff --git a/src/test/ui/self/elision/ref-mut-self-async.rs b/src/test/ui/self/elision/ref-mut-self-async.rs deleted file mode 100644 index e07bc8564..000000000 --- a/src/test/ui/self/elision/ref-mut-self-async.rs +++ /dev/null @@ -1,45 +0,0 @@ -// edition:2018 - -#![allow(non_snake_case)] - -use std::pin::Pin; - -struct Struct { } - -impl Struct { - // Test using `&mut self` sugar: - - async fn ref_self(&mut self, f: &u32) -> &u32 { - f - //~^ ERROR lifetime may not live long enough - } - - // Test using `&mut Self` explicitly: - - async fn ref_Self(self: &mut Self, f: &u32) -> &u32 { - f - //~^ ERROR lifetime may not live long enough - } - - async fn box_ref_Self(self: Box<&mut Self>, f: &u32) -> &u32 { - f - //~^ ERROR lifetime may not live long enough - } - - async fn pin_ref_Self(self: Pin<&mut Self>, f: &u32) -> &u32 { - f - //~^ ERROR lifetime may not live long enough - } - - async fn box_box_ref_Self(self: Box<Box<&mut Self>>, f: &u32) -> &u32 { - f - //~^ ERROR lifetime may not live long enough - } - - async fn box_pin_ref_Self(self: Box<Pin<&mut Self>>, f: &u32) -> &u32 { - f - //~^ ERROR lifetime may not live long enough - } -} - -fn main() { } diff --git a/src/test/ui/self/elision/ref-mut-self-async.stderr b/src/test/ui/self/elision/ref-mut-self-async.stderr deleted file mode 100644 index dff50aee9..000000000 --- a/src/test/ui/self/elision/ref-mut-self-async.stderr +++ /dev/null @@ -1,92 +0,0 @@ -error: lifetime may not live long enough - --> $DIR/ref-mut-self-async.rs:13:9 - | -LL | async fn ref_self(&mut self, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` -LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` - | -help: consider introducing a named lifetime parameter and update trait if needed - | -LL | async fn ref_self<'a>(&'a mut self, f: &'a u32) -> &u32 { - | ++++ ++ ++ - -error: lifetime may not live long enough - --> $DIR/ref-mut-self-async.rs:20:9 - | -LL | async fn ref_Self(self: &mut Self, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` -LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` - | -help: consider introducing a named lifetime parameter and update trait if needed - | -LL | async fn ref_Self<'a>(self: &'a mut Self, f: &'a u32) -> &u32 { - | ++++ ++ ++ - -error: lifetime may not live long enough - --> $DIR/ref-mut-self-async.rs:25:9 - | -LL | async fn box_ref_Self(self: Box<&mut Self>, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` -LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` - | -help: consider introducing a named lifetime parameter and update trait if needed - | -LL | async fn box_ref_Self<'a>(self: Box<&'a mut Self>, f: &'a u32) -> &u32 { - | ++++ ++ ++ - -error: lifetime may not live long enough - --> $DIR/ref-mut-self-async.rs:30:9 - | -LL | async fn pin_ref_Self(self: Pin<&mut Self>, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` -LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` - | -help: consider introducing a named lifetime parameter and update trait if needed - | -LL | async fn pin_ref_Self<'a>(self: Pin<&'a mut Self>, f: &'a u32) -> &u32 { - | ++++ ++ ++ - -error: lifetime may not live long enough - --> $DIR/ref-mut-self-async.rs:35:9 - | -LL | async fn box_box_ref_Self(self: Box<Box<&mut Self>>, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` -LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` - | -help: consider introducing a named lifetime parameter and update trait if needed - | -LL | async fn box_box_ref_Self<'a>(self: Box<Box<&'a mut Self>>, f: &'a u32) -> &u32 { - | ++++ ++ ++ - -error: lifetime may not live long enough - --> $DIR/ref-mut-self-async.rs:40:9 - | -LL | async fn box_pin_ref_Self(self: Box<Pin<&mut Self>>, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` -LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` - | -help: consider introducing a named lifetime parameter and update trait if needed - | -LL | async fn box_pin_ref_Self<'a>(self: Box<Pin<&'a mut Self>>, f: &'a u32) -> &u32 { - | ++++ ++ ++ - -error: aborting due to 6 previous errors - diff --git a/src/test/ui/self/elision/ref-mut-self.rs b/src/test/ui/self/elision/ref-mut-self.rs deleted file mode 100644 index bb82e6be7..000000000 --- a/src/test/ui/self/elision/ref-mut-self.rs +++ /dev/null @@ -1,43 +0,0 @@ -#![allow(non_snake_case)] - -use std::pin::Pin; - -struct Struct { } - -impl Struct { - // Test using `&mut self` sugar: - - fn ref_self(&mut self, f: &u32) -> &u32 { - f - //~^ ERROR lifetime may not live long enough - } - - // Test using `&mut Self` explicitly: - - fn ref_Self(self: &mut Self, f: &u32) -> &u32 { - f - //~^ ERROR lifetime may not live long enough - } - - fn box_ref_Self(self: Box<&mut Self>, f: &u32) -> &u32 { - f - //~^ ERROR lifetime may not live long enough - } - - fn pin_ref_Self(self: Pin<&mut Self>, f: &u32) -> &u32 { - f - //~^ ERROR lifetime may not live long enough - } - - fn box_box_ref_Self(self: Box<Box<&mut Self>>, f: &u32) -> &u32 { - f - //~^ ERROR lifetime may not live long enough - } - - fn box_pin_ref_Self(self: Box<Pin<&mut Self>>, f: &u32) -> &u32 { - f - //~^ ERROR lifetime may not live long enough - } -} - -fn main() { } diff --git a/src/test/ui/self/elision/ref-mut-self.stderr b/src/test/ui/self/elision/ref-mut-self.stderr deleted file mode 100644 index ccf183016..000000000 --- a/src/test/ui/self/elision/ref-mut-self.stderr +++ /dev/null @@ -1,92 +0,0 @@ -error: lifetime may not live long enough - --> $DIR/ref-mut-self.rs:11:9 - | -LL | fn ref_self(&mut self, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` -LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` - | -help: consider introducing a named lifetime parameter and update trait if needed - | -LL | fn ref_self<'a>(&'a mut self, f: &'a u32) -> &u32 { - | ++++ ++ ++ - -error: lifetime may not live long enough - --> $DIR/ref-mut-self.rs:18:9 - | -LL | fn ref_Self(self: &mut Self, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` -LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` - | -help: consider introducing a named lifetime parameter and update trait if needed - | -LL | fn ref_Self<'a>(self: &'a mut Self, f: &'a u32) -> &u32 { - | ++++ ++ ++ - -error: lifetime may not live long enough - --> $DIR/ref-mut-self.rs:23:9 - | -LL | fn box_ref_Self(self: Box<&mut Self>, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` -LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` - | -help: consider introducing a named lifetime parameter and update trait if needed - | -LL | fn box_ref_Self<'a>(self: Box<&'a mut Self>, f: &'a u32) -> &u32 { - | ++++ ++ ++ - -error: lifetime may not live long enough - --> $DIR/ref-mut-self.rs:28:9 - | -LL | fn pin_ref_Self(self: Pin<&mut Self>, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` -LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` - | -help: consider introducing a named lifetime parameter and update trait if needed - | -LL | fn pin_ref_Self<'a>(self: Pin<&'a mut Self>, f: &'a u32) -> &u32 { - | ++++ ++ ++ - -error: lifetime may not live long enough - --> $DIR/ref-mut-self.rs:33:9 - | -LL | fn box_box_ref_Self(self: Box<Box<&mut Self>>, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` -LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` - | -help: consider introducing a named lifetime parameter and update trait if needed - | -LL | fn box_box_ref_Self<'a>(self: Box<Box<&'a mut Self>>, f: &'a u32) -> &u32 { - | ++++ ++ ++ - -error: lifetime may not live long enough - --> $DIR/ref-mut-self.rs:38:9 - | -LL | fn box_pin_ref_Self(self: Box<Pin<&mut Self>>, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` -LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` - | -help: consider introducing a named lifetime parameter and update trait if needed - | -LL | fn box_pin_ref_Self<'a>(self: Box<Pin<&'a mut Self>>, f: &'a u32) -> &u32 { - | ++++ ++ ++ - -error: aborting due to 6 previous errors - diff --git a/src/test/ui/self/elision/ref-mut-struct-async.rs b/src/test/ui/self/elision/ref-mut-struct-async.rs deleted file mode 100644 index 392bf1d6b..000000000 --- a/src/test/ui/self/elision/ref-mut-struct-async.rs +++ /dev/null @@ -1,38 +0,0 @@ -// edition:2018 - -#![allow(non_snake_case)] - -use std::pin::Pin; - -struct Struct { } - -impl Struct { - // Test using `&mut Struct` explicitly: - - async fn ref_Struct(self: &mut Struct, f: &u32) -> &u32 { - f - //~^ ERROR lifetime may not live long enough - } - - async fn box_ref_Struct(self: Box<&mut Struct>, f: &u32) -> &u32 { - f - //~^ ERROR lifetime may not live long enough - } - - async fn pin_ref_Struct(self: Pin<&mut Struct>, f: &u32) -> &u32 { - f - //~^ ERROR lifetime may not live long enough - } - - async fn box_box_ref_Struct(self: Box<Box<&mut Struct>>, f: &u32) -> &u32 { - f - //~^ ERROR lifetime may not live long enough - } - - async fn box_pin_ref_Struct(self: Box<Pin<&mut Struct>>, f: &u32) -> &u32 { - f - //~^ ERROR lifetime may not live long enough - } -} - -fn main() { } diff --git a/src/test/ui/self/elision/ref-mut-struct-async.stderr b/src/test/ui/self/elision/ref-mut-struct-async.stderr deleted file mode 100644 index 5b7ad026f..000000000 --- a/src/test/ui/self/elision/ref-mut-struct-async.stderr +++ /dev/null @@ -1,77 +0,0 @@ -error: lifetime may not live long enough - --> $DIR/ref-mut-struct-async.rs:13:9 - | -LL | async fn ref_Struct(self: &mut Struct, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` -LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` - | -help: consider introducing a named lifetime parameter and update trait if needed - | -LL | async fn ref_Struct<'a>(self: &'a mut Struct, f: &'a u32) -> &u32 { - | ++++ ++ ++ - -error: lifetime may not live long enough - --> $DIR/ref-mut-struct-async.rs:18:9 - | -LL | async fn box_ref_Struct(self: Box<&mut Struct>, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` -LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` - | -help: consider introducing a named lifetime parameter and update trait if needed - | -LL | async fn box_ref_Struct<'a>(self: Box<&'a mut Struct>, f: &'a u32) -> &u32 { - | ++++ ++ ++ - -error: lifetime may not live long enough - --> $DIR/ref-mut-struct-async.rs:23:9 - | -LL | async fn pin_ref_Struct(self: Pin<&mut Struct>, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` -LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` - | -help: consider introducing a named lifetime parameter and update trait if needed - | -LL | async fn pin_ref_Struct<'a>(self: Pin<&'a mut Struct>, f: &'a u32) -> &u32 { - | ++++ ++ ++ - -error: lifetime may not live long enough - --> $DIR/ref-mut-struct-async.rs:28:9 - | -LL | async fn box_box_ref_Struct(self: Box<Box<&mut Struct>>, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` -LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` - | -help: consider introducing a named lifetime parameter and update trait if needed - | -LL | async fn box_box_ref_Struct<'a>(self: Box<Box<&'a mut Struct>>, f: &'a u32) -> &u32 { - | ++++ ++ ++ - -error: lifetime may not live long enough - --> $DIR/ref-mut-struct-async.rs:33:9 - | -LL | async fn box_pin_ref_Struct(self: Box<Pin<&mut Struct>>, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` -LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` - | -help: consider introducing a named lifetime parameter and update trait if needed - | -LL | async fn box_pin_ref_Struct<'a>(self: Box<Pin<&'a mut Struct>>, f: &'a u32) -> &u32 { - | ++++ ++ ++ - -error: aborting due to 5 previous errors - diff --git a/src/test/ui/self/elision/ref-mut-struct.rs b/src/test/ui/self/elision/ref-mut-struct.rs deleted file mode 100644 index ca8bd8da1..000000000 --- a/src/test/ui/self/elision/ref-mut-struct.rs +++ /dev/null @@ -1,36 +0,0 @@ -#![allow(non_snake_case)] - -use std::pin::Pin; - -struct Struct { } - -impl Struct { - // Test using `&mut Struct` explicitly: - - fn ref_Struct(self: &mut Struct, f: &u32) -> &u32 { - f - //~^ ERROR lifetime may not live long enough - } - - fn box_ref_Struct(self: Box<&mut Struct>, f: &u32) -> &u32 { - f - //~^ ERROR lifetime may not live long enough - } - - fn pin_ref_Struct(self: Pin<&mut Struct>, f: &u32) -> &u32 { - f - //~^ ERROR lifetime may not live long enough - } - - fn box_box_ref_Struct(self: Box<Box<&mut Struct>>, f: &u32) -> &u32 { - f - //~^ ERROR lifetime may not live long enough - } - - fn box_pin_ref_Struct(self: Box<Pin<&mut Struct>>, f: &u32) -> &u32 { - f - //~^ ERROR lifetime may not live long enough - } -} - -fn main() { } diff --git a/src/test/ui/self/elision/ref-mut-struct.stderr b/src/test/ui/self/elision/ref-mut-struct.stderr deleted file mode 100644 index b9c71e843..000000000 --- a/src/test/ui/self/elision/ref-mut-struct.stderr +++ /dev/null @@ -1,77 +0,0 @@ -error: lifetime may not live long enough - --> $DIR/ref-mut-struct.rs:11:9 - | -LL | fn ref_Struct(self: &mut Struct, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` -LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` - | -help: consider introducing a named lifetime parameter and update trait if needed - | -LL | fn ref_Struct<'a>(self: &'a mut Struct, f: &'a u32) -> &u32 { - | ++++ ++ ++ - -error: lifetime may not live long enough - --> $DIR/ref-mut-struct.rs:16:9 - | -LL | fn box_ref_Struct(self: Box<&mut Struct>, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` -LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` - | -help: consider introducing a named lifetime parameter and update trait if needed - | -LL | fn box_ref_Struct<'a>(self: Box<&'a mut Struct>, f: &'a u32) -> &u32 { - | ++++ ++ ++ - -error: lifetime may not live long enough - --> $DIR/ref-mut-struct.rs:21:9 - | -LL | fn pin_ref_Struct(self: Pin<&mut Struct>, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` -LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` - | -help: consider introducing a named lifetime parameter and update trait if needed - | -LL | fn pin_ref_Struct<'a>(self: Pin<&'a mut Struct>, f: &'a u32) -> &u32 { - | ++++ ++ ++ - -error: lifetime may not live long enough - --> $DIR/ref-mut-struct.rs:26:9 - | -LL | fn box_box_ref_Struct(self: Box<Box<&mut Struct>>, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` -LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` - | -help: consider introducing a named lifetime parameter and update trait if needed - | -LL | fn box_box_ref_Struct<'a>(self: Box<Box<&'a mut Struct>>, f: &'a u32) -> &u32 { - | ++++ ++ ++ - -error: lifetime may not live long enough - --> $DIR/ref-mut-struct.rs:31:9 - | -LL | fn box_pin_ref_Struct(self: Box<Pin<&mut Struct>>, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` -LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` - | -help: consider introducing a named lifetime parameter and update trait if needed - | -LL | fn box_pin_ref_Struct<'a>(self: Box<Pin<&'a mut Struct>>, f: &'a u32) -> &u32 { - | ++++ ++ ++ - -error: aborting due to 5 previous errors - diff --git a/src/test/ui/self/elision/ref-self-async.rs b/src/test/ui/self/elision/ref-self-async.rs deleted file mode 100644 index b0133ec1b..000000000 --- a/src/test/ui/self/elision/ref-self-async.rs +++ /dev/null @@ -1,60 +0,0 @@ -// edition:2018 - -#![allow(non_snake_case)] -#![feature(arbitrary_self_types)] - -use std::marker::PhantomData; -use std::ops::Deref; -use std::pin::Pin; - -struct Struct { } - -struct Wrap<T, P>(T, PhantomData<P>); - -impl<T, P> Deref for Wrap<T, P> { - type Target = T; - fn deref(&self) -> &T { &self.0 } -} - -impl Struct { - // Test using `&self` sugar: - - async fn ref_self(&self, f: &u32) -> &u32 { - f - //~^ ERROR lifetime may not live long enough - } - - // Test using `&Self` explicitly: - - async fn ref_Self(self: &Self, f: &u32) -> &u32 { - f - //~^ ERROR lifetime may not live long enough - } - - async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 { - f - //~^ ERROR lifetime may not live long enough - } - - async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 { - f - //~^ ERROR lifetime may not live long enough - } - - async fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 { - f - //~^ ERROR lifetime may not live long enough - } - - async fn box_pin_ref_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 { - f - //~^ ERROR lifetime may not live long enough - } - - async fn wrap_ref_Self_Self(self: Wrap<&Self, Self>, f: &u8) -> &u8 { - f - //~^ ERROR lifetime may not live long enough - } -} - -fn main() { } diff --git a/src/test/ui/self/elision/ref-self-async.stderr b/src/test/ui/self/elision/ref-self-async.stderr deleted file mode 100644 index 26ef9779b..000000000 --- a/src/test/ui/self/elision/ref-self-async.stderr +++ /dev/null @@ -1,107 +0,0 @@ -error: lifetime may not live long enough - --> $DIR/ref-self-async.rs:23:9 - | -LL | async fn ref_self(&self, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` -LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` - | -help: consider introducing a named lifetime parameter and update trait if needed - | -LL | async fn ref_self<'a>(&'a self, f: &'a u32) -> &u32 { - | ++++ ++ ++ - -error: lifetime may not live long enough - --> $DIR/ref-self-async.rs:30:9 - | -LL | async fn ref_Self(self: &Self, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` -LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` - | -help: consider introducing a named lifetime parameter and update trait if needed - | -LL | async fn ref_Self<'a>(self: &'a Self, f: &'a u32) -> &u32 { - | ++++ ++ ++ - -error: lifetime may not live long enough - --> $DIR/ref-self-async.rs:35:9 - | -LL | async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` -LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` - | -help: consider introducing a named lifetime parameter and update trait if needed - | -LL | async fn box_ref_Self<'a>(self: Box<&'a Self>, f: &'a u32) -> &u32 { - | ++++ ++ ++ - -error: lifetime may not live long enough - --> $DIR/ref-self-async.rs:40:9 - | -LL | async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` -LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` - | -help: consider introducing a named lifetime parameter and update trait if needed - | -LL | async fn pin_ref_Self<'a>(self: Pin<&'a Self>, f: &'a u32) -> &u32 { - | ++++ ++ ++ - -error: lifetime may not live long enough - --> $DIR/ref-self-async.rs:45:9 - | -LL | async fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` -LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` - | -help: consider introducing a named lifetime parameter and update trait if needed - | -LL | async fn box_box_ref_Self<'a>(self: Box<Box<&'a Self>>, f: &'a u32) -> &u32 { - | ++++ ++ ++ - -error: lifetime may not live long enough - --> $DIR/ref-self-async.rs:50:9 - | -LL | async fn box_pin_ref_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` -LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` - | -help: consider introducing a named lifetime parameter and update trait if needed - | -LL | async fn box_pin_ref_Self<'a>(self: Box<Pin<&'a Self>>, f: &'a u32) -> &u32 { - | ++++ ++ ++ - -error: lifetime may not live long enough - --> $DIR/ref-self-async.rs:55:9 - | -LL | async fn wrap_ref_Self_Self(self: Wrap<&Self, Self>, f: &u8) -> &u8 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` -LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` - | -help: consider introducing a named lifetime parameter and update trait if needed - | -LL | async fn wrap_ref_Self_Self<'a>(self: Wrap<&'a Self, Self>, f: &'a u8) -> &u8 { - | ++++ ++ ++ - -error: aborting due to 7 previous errors - diff --git a/src/test/ui/self/elision/ref-self.rs b/src/test/ui/self/elision/ref-self.rs deleted file mode 100644 index dd07fe1b0..000000000 --- a/src/test/ui/self/elision/ref-self.rs +++ /dev/null @@ -1,58 +0,0 @@ -#![feature(arbitrary_self_types)] -#![allow(non_snake_case)] - -use std::marker::PhantomData; -use std::ops::Deref; -use std::pin::Pin; - -struct Struct { } - -struct Wrap<T, P>(T, PhantomData<P>); - -impl<T, P> Deref for Wrap<T, P> { - type Target = T; - fn deref(&self) -> &T { &self.0 } -} - -impl Struct { - // Test using `&self` sugar: - - fn ref_self(&self, f: &u32) -> &u32 { - f - //~^ ERROR lifetime may not live long enough - } - - // Test using `&Self` explicitly: - - fn ref_Self(self: &Self, f: &u32) -> &u32 { - f - //~^ ERROR lifetime may not live long enough - } - - fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 { - f - //~^ ERROR lifetime may not live long enough - } - - fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 { - f - //~^ ERROR lifetime may not live long enough - } - - fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 { - f - //~^ ERROR lifetime may not live long enough - } - - fn box_pin_ref_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 { - f - //~^ ERROR lifetime may not live long enough - } - - fn wrap_ref_Self_Self(self: Wrap<&Self, Self>, f: &u8) -> &u8 { - f - //~^ ERROR lifetime may not live long enough - } -} - -fn main() { } diff --git a/src/test/ui/self/elision/ref-self.stderr b/src/test/ui/self/elision/ref-self.stderr deleted file mode 100644 index 32448f3a6..000000000 --- a/src/test/ui/self/elision/ref-self.stderr +++ /dev/null @@ -1,107 +0,0 @@ -error: lifetime may not live long enough - --> $DIR/ref-self.rs:21:9 - | -LL | fn ref_self(&self, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` -LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` - | -help: consider introducing a named lifetime parameter and update trait if needed - | -LL | fn ref_self<'a>(&'a self, f: &'a u32) -> &u32 { - | ++++ ++ ++ - -error: lifetime may not live long enough - --> $DIR/ref-self.rs:28:9 - | -LL | fn ref_Self(self: &Self, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` -LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` - | -help: consider introducing a named lifetime parameter and update trait if needed - | -LL | fn ref_Self<'a>(self: &'a Self, f: &'a u32) -> &u32 { - | ++++ ++ ++ - -error: lifetime may not live long enough - --> $DIR/ref-self.rs:33:9 - | -LL | fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` -LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` - | -help: consider introducing a named lifetime parameter and update trait if needed - | -LL | fn box_ref_Self<'a>(self: Box<&'a Self>, f: &'a u32) -> &u32 { - | ++++ ++ ++ - -error: lifetime may not live long enough - --> $DIR/ref-self.rs:38:9 - | -LL | fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` -LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` - | -help: consider introducing a named lifetime parameter and update trait if needed - | -LL | fn pin_ref_Self<'a>(self: Pin<&'a Self>, f: &'a u32) -> &u32 { - | ++++ ++ ++ - -error: lifetime may not live long enough - --> $DIR/ref-self.rs:43:9 - | -LL | fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` -LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` - | -help: consider introducing a named lifetime parameter and update trait if needed - | -LL | fn box_box_ref_Self<'a>(self: Box<Box<&'a Self>>, f: &'a u32) -> &u32 { - | ++++ ++ ++ - -error: lifetime may not live long enough - --> $DIR/ref-self.rs:48:9 - | -LL | fn box_pin_ref_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` -LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` - | -help: consider introducing a named lifetime parameter and update trait if needed - | -LL | fn box_pin_ref_Self<'a>(self: Box<Pin<&'a Self>>, f: &'a u32) -> &u32 { - | ++++ ++ ++ - -error: lifetime may not live long enough - --> $DIR/ref-self.rs:53:9 - | -LL | fn wrap_ref_Self_Self(self: Wrap<&Self, Self>, f: &u8) -> &u8 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` -LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` - | -help: consider introducing a named lifetime parameter and update trait if needed - | -LL | fn wrap_ref_Self_Self<'a>(self: Wrap<&'a Self, Self>, f: &'a u8) -> &u8 { - | ++++ ++ ++ - -error: aborting due to 7 previous errors - diff --git a/src/test/ui/self/elision/ref-struct-async.rs b/src/test/ui/self/elision/ref-struct-async.rs deleted file mode 100644 index 0be748745..000000000 --- a/src/test/ui/self/elision/ref-struct-async.rs +++ /dev/null @@ -1,38 +0,0 @@ -// edition:2018 - -#![allow(non_snake_case)] - -use std::pin::Pin; - -struct Struct { } - -impl Struct { - // Test using `&Struct` explicitly: - - async fn ref_Struct(self: &Struct, f: &u32) -> &u32 { - f - //~^ ERROR lifetime may not live long enough - } - - async fn box_ref_Struct(self: Box<&Struct>, f: &u32) -> &u32 { - f - //~^ ERROR lifetime may not live long enough - } - - async fn pin_ref_Struct(self: Pin<&Struct>, f: &u32) -> &u32 { - f - //~^ ERROR lifetime may not live long enough - } - - async fn box_box_ref_Struct(self: Box<Box<&Struct>>, f: &u32) -> &u32 { - f - //~^ ERROR lifetime may not live long enough - } - - async fn box_pin_Struct(self: Box<Pin<&Struct>>, f: &u32) -> &u32 { - f - //~^ ERROR lifetime may not live long enough - } -} - -fn main() { } diff --git a/src/test/ui/self/elision/ref-struct-async.stderr b/src/test/ui/self/elision/ref-struct-async.stderr deleted file mode 100644 index edb5c54ab..000000000 --- a/src/test/ui/self/elision/ref-struct-async.stderr +++ /dev/null @@ -1,77 +0,0 @@ -error: lifetime may not live long enough - --> $DIR/ref-struct-async.rs:13:9 - | -LL | async fn ref_Struct(self: &Struct, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` -LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` - | -help: consider introducing a named lifetime parameter and update trait if needed - | -LL | async fn ref_Struct<'a>(self: &'a Struct, f: &'a u32) -> &u32 { - | ++++ ++ ++ - -error: lifetime may not live long enough - --> $DIR/ref-struct-async.rs:18:9 - | -LL | async fn box_ref_Struct(self: Box<&Struct>, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` -LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` - | -help: consider introducing a named lifetime parameter and update trait if needed - | -LL | async fn box_ref_Struct<'a>(self: Box<&'a Struct>, f: &'a u32) -> &u32 { - | ++++ ++ ++ - -error: lifetime may not live long enough - --> $DIR/ref-struct-async.rs:23:9 - | -LL | async fn pin_ref_Struct(self: Pin<&Struct>, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` -LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` - | -help: consider introducing a named lifetime parameter and update trait if needed - | -LL | async fn pin_ref_Struct<'a>(self: Pin<&'a Struct>, f: &'a u32) -> &u32 { - | ++++ ++ ++ - -error: lifetime may not live long enough - --> $DIR/ref-struct-async.rs:28:9 - | -LL | async fn box_box_ref_Struct(self: Box<Box<&Struct>>, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` -LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` - | -help: consider introducing a named lifetime parameter and update trait if needed - | -LL | async fn box_box_ref_Struct<'a>(self: Box<Box<&'a Struct>>, f: &'a u32) -> &u32 { - | ++++ ++ ++ - -error: lifetime may not live long enough - --> $DIR/ref-struct-async.rs:33:9 - | -LL | async fn box_pin_Struct(self: Box<Pin<&Struct>>, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` -LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` - | -help: consider introducing a named lifetime parameter and update trait if needed - | -LL | async fn box_pin_Struct<'a>(self: Box<Pin<&'a Struct>>, f: &'a u32) -> &u32 { - | ++++ ++ ++ - -error: aborting due to 5 previous errors - diff --git a/src/test/ui/self/elision/ref-struct.rs b/src/test/ui/self/elision/ref-struct.rs deleted file mode 100644 index 13a42cd1a..000000000 --- a/src/test/ui/self/elision/ref-struct.rs +++ /dev/null @@ -1,36 +0,0 @@ -#![allow(non_snake_case)] - -use std::pin::Pin; - -struct Struct { } - -impl Struct { - // Test using `&Struct` explicitly: - - fn ref_Struct(self: &Struct, f: &u32) -> &u32 { - f - //~^ ERROR lifetime may not live long enough - } - - fn box_ref_Struct(self: Box<&Struct>, f: &u32) -> &u32 { - f - //~^ ERROR lifetime may not live long enough - } - - fn pin_ref_Struct(self: Pin<&Struct>, f: &u32) -> &u32 { - f - //~^ ERROR lifetime may not live long enough - } - - fn box_box_ref_Struct(self: Box<Box<&Struct>>, f: &u32) -> &u32 { - f - //~^ ERROR lifetime may not live long enough - } - - fn box_pin_Struct(self: Box<Pin<&Struct>>, f: &u32) -> &u32 { - f - //~^ ERROR lifetime may not live long enough - } -} - -fn main() { } diff --git a/src/test/ui/self/elision/ref-struct.stderr b/src/test/ui/self/elision/ref-struct.stderr deleted file mode 100644 index 4492ed4aa..000000000 --- a/src/test/ui/self/elision/ref-struct.stderr +++ /dev/null @@ -1,77 +0,0 @@ -error: lifetime may not live long enough - --> $DIR/ref-struct.rs:11:9 - | -LL | fn ref_Struct(self: &Struct, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` -LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` - | -help: consider introducing a named lifetime parameter and update trait if needed - | -LL | fn ref_Struct<'a>(self: &'a Struct, f: &'a u32) -> &u32 { - | ++++ ++ ++ - -error: lifetime may not live long enough - --> $DIR/ref-struct.rs:16:9 - | -LL | fn box_ref_Struct(self: Box<&Struct>, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` -LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` - | -help: consider introducing a named lifetime parameter and update trait if needed - | -LL | fn box_ref_Struct<'a>(self: Box<&'a Struct>, f: &'a u32) -> &u32 { - | ++++ ++ ++ - -error: lifetime may not live long enough - --> $DIR/ref-struct.rs:21:9 - | -LL | fn pin_ref_Struct(self: Pin<&Struct>, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` -LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` - | -help: consider introducing a named lifetime parameter and update trait if needed - | -LL | fn pin_ref_Struct<'a>(self: Pin<&'a Struct>, f: &'a u32) -> &u32 { - | ++++ ++ ++ - -error: lifetime may not live long enough - --> $DIR/ref-struct.rs:26:9 - | -LL | fn box_box_ref_Struct(self: Box<Box<&Struct>>, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` -LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` - | -help: consider introducing a named lifetime parameter and update trait if needed - | -LL | fn box_box_ref_Struct<'a>(self: Box<Box<&'a Struct>>, f: &'a u32) -> &u32 { - | ++++ ++ ++ - -error: lifetime may not live long enough - --> $DIR/ref-struct.rs:31:9 - | -LL | fn box_pin_Struct(self: Box<Pin<&Struct>>, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` -LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` - | -help: consider introducing a named lifetime parameter and update trait if needed - | -LL | fn box_pin_Struct<'a>(self: Box<Pin<&'a Struct>>, f: &'a u32) -> &u32 { - | ++++ ++ ++ - -error: aborting due to 5 previous errors - diff --git a/src/test/ui/self/elision/self-async.rs b/src/test/ui/self/elision/self-async.rs deleted file mode 100644 index eb01cfc97..000000000 --- a/src/test/ui/self/elision/self-async.rs +++ /dev/null @@ -1,36 +0,0 @@ -// check-pass -// edition:2018 - -#![allow(non_snake_case)] - -use std::rc::Rc; - -struct Struct { } - -impl Struct { - async fn take_self(self, f: &u32) -> &u32 { - f - } - - async fn take_Self(self: Self, f: &u32) -> &u32 { - f - } - - async fn take_Box_Self(self: Box<Self>, f: &u32) -> &u32 { - f - } - - async fn take_Box_Box_Self(self: Box<Box<Self>>, f: &u32) -> &u32 { - f - } - - async fn take_Rc_Self(self: Rc<Self>, f: &u32) -> &u32 { - f - } - - async fn take_Box_Rc_Self(self: Box<Rc<Self>>, f: &u32) -> &u32 { - f - } -} - -fn main() { } diff --git a/src/test/ui/self/elision/self.rs b/src/test/ui/self/elision/self.rs deleted file mode 100644 index 574b7e7c9..000000000 --- a/src/test/ui/self/elision/self.rs +++ /dev/null @@ -1,35 +0,0 @@ -// check-pass - -#![allow(non_snake_case)] - -use std::rc::Rc; - -struct Struct { } - -impl Struct { - fn take_self(self, f: &u32) -> &u32 { - f - } - - fn take_Self(self: Self, f: &u32) -> &u32 { - f - } - - fn take_Box_Self(self: Box<Self>, f: &u32) -> &u32 { - f - } - - fn take_Box_Box_Self(self: Box<Box<Self>>, f: &u32) -> &u32 { - f - } - - fn take_Rc_Self(self: Rc<Self>, f: &u32) -> &u32 { - f - } - - fn take_Box_Rc_Self(self: Box<Rc<Self>>, f: &u32) -> &u32 { - f - } -} - -fn main() { } diff --git a/src/test/ui/self/elision/struct-async.rs b/src/test/ui/self/elision/struct-async.rs deleted file mode 100644 index e018e0daf..000000000 --- a/src/test/ui/self/elision/struct-async.rs +++ /dev/null @@ -1,32 +0,0 @@ -// check-pass -// edition:2018 - -#![allow(non_snake_case)] - -use std::rc::Rc; - -struct Struct { } - -impl Struct { - async fn ref_Struct(self: Struct, f: &u32) -> &u32 { - f - } - - async fn box_Struct(self: Box<Struct>, f: &u32) -> &u32 { - f - } - - async fn rc_Struct(self: Rc<Struct>, f: &u32) -> &u32 { - f - } - - async fn box_box_Struct(self: Box<Box<Struct>>, f: &u32) -> &u32 { - f - } - - async fn box_rc_Struct(self: Box<Rc<Struct>>, f: &u32) -> &u32 { - f - } -} - -fn main() { } diff --git a/src/test/ui/self/elision/struct.rs b/src/test/ui/self/elision/struct.rs deleted file mode 100644 index d1ac99d13..000000000 --- a/src/test/ui/self/elision/struct.rs +++ /dev/null @@ -1,31 +0,0 @@ -// check-pass - -#![allow(non_snake_case)] - -use std::rc::Rc; - -struct Struct { } - -impl Struct { - fn ref_Struct(self: Struct, f: &u32) -> &u32 { - f - } - - fn box_Struct(self: Box<Struct>, f: &u32) -> &u32 { - f - } - - fn rc_Struct(self: Rc<Struct>, f: &u32) -> &u32 { - f - } - - fn box_box_Struct(self: Box<Box<Struct>>, f: &u32) -> &u32 { - f - } - - fn box_rc_Struct(self: Box<Rc<Struct>>, f: &u32) -> &u32 { - f - } -} - -fn main() { } |