Auto merge of #94088 - oli-obk:revert, r=jackh726
Revert #91403 fixes #94004 r? `@pnkfelix` `@cjgillot`
This commit is contained in:
commit
feac2ecf1c
34 changed files with 281 additions and 227 deletions
|
|
@ -585,12 +585,7 @@ fn clean_ty_generics(
|
|||
.params
|
||||
.iter()
|
||||
.filter_map(|param| match param.kind {
|
||||
ty::GenericParamDefKind::Lifetime => {
|
||||
if param.name == kw::UnderscoreLifetime {
|
||||
return None;
|
||||
}
|
||||
Some(param.clean(cx))
|
||||
}
|
||||
ty::GenericParamDefKind::Lifetime => Some(param.clean(cx)),
|
||||
ty::GenericParamDefKind::Type { synthetic, .. } => {
|
||||
if param.name == kw::SelfUpper {
|
||||
assert_eq!(param.index, 0);
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ pub struct Foo<'a> {
|
|||
|
||||
impl<'a> Foo<'a> {
|
||||
pub async fn new(_bar: &'a i32) -> Self {
|
||||
//~^ ERROR `async fn` return type cannot contain a projection or `Self` that references lifetimes from a parent scope
|
||||
Foo {
|
||||
bar: &22
|
||||
}
|
||||
|
|
@ -18,7 +19,6 @@ async fn foo() {
|
|||
let x = {
|
||||
let bar = 22;
|
||||
Foo::new(&bar).await
|
||||
//~^ ERROR `bar` does not live long enough [E0597]
|
||||
};
|
||||
drop(x);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,15 +1,9 @@
|
|||
error[E0597]: `bar` does not live long enough
|
||||
--> $DIR/issue-61949-self-return-type.rs:20:18
|
||||
error[E0760]: `async fn` return type cannot contain a projection or `Self` that references lifetimes from a parent scope
|
||||
--> $DIR/issue-61949-self-return-type.rs:10:40
|
||||
|
|
||||
LL | let x = {
|
||||
| - borrow later stored here
|
||||
LL | let bar = 22;
|
||||
LL | Foo::new(&bar).await
|
||||
| ^^^^ borrowed value does not live long enough
|
||||
LL |
|
||||
LL | };
|
||||
| - `bar` dropped here while still borrowed
|
||||
LL | pub async fn new(_bar: &'a i32) -> Self {
|
||||
| ^^^^ help: consider spelling out the type instead: `Foo<'a>`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0597`.
|
||||
For more information about this error, try `rustc --explain E0760`.
|
||||
|
|
|
|||
|
|
@ -1,10 +1,14 @@
|
|||
error[E0506]: cannot assign to `*x` because it is borrowed
|
||||
--> $DIR/issue-74072-lifetime-name-annotations.rs:9:5
|
||||
|
|
||||
LL | pub async fn async_fn(x: &mut i32) -> &i32 {
|
||||
| - let's call the lifetime of this reference `'1`
|
||||
LL | let y = &*x;
|
||||
| --- borrow of `*x` occurs here
|
||||
LL | *x += 1;
|
||||
| ^^^^^^^ assignment to borrowed `*x` occurs here
|
||||
LL | y
|
||||
| - returning this value requires that `*x` is borrowed for `'1`
|
||||
|
||||
error[E0506]: cannot assign to `*x` because it is borrowed
|
||||
--> $DIR/issue-74072-lifetime-name-annotations.rs:16:9
|
||||
|
|
|
|||
|
|
@ -1,10 +1,14 @@
|
|||
error[E0506]: cannot assign to `*x` because it is borrowed
|
||||
--> $DIR/issue-75785-confusing-named-region.rs:9:5
|
||||
|
|
||||
LL | pub async fn async_fn(x: &mut i32) -> (&i32, &i32) {
|
||||
| - let's call the lifetime of this reference `'1`
|
||||
LL | let y = &*x;
|
||||
| --- borrow of `*x` occurs here
|
||||
LL | *x += 1;
|
||||
| ^^^^^^^ assignment to borrowed `*x` occurs here
|
||||
LL | (&32, y)
|
||||
| -------- returning this value requires that `*x` is borrowed for `'1`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -2,10 +2,12 @@ error[E0623]: lifetime mismatch
|
|||
--> $DIR/issue-63388-1.rs:14:9
|
||||
|
|
||||
LL | &'a self, foo: &dyn Foo
|
||||
| -------- -------- these two types are declared with different lifetimes...
|
||||
...
|
||||
| -------- this parameter and the return type are declared with different lifetimes...
|
||||
LL | ) -> &dyn Foo
|
||||
| --------
|
||||
LL | {
|
||||
LL | foo
|
||||
| ^^^ ...but data from `foo` flows into `self` here
|
||||
| ^^^ ...but data from `foo` is returned here
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
// check-pass
|
||||
// edition:2018
|
||||
|
||||
struct S<'a>(&'a i32);
|
||||
|
||||
impl<'a> S<'a> {
|
||||
async fn new(i: &'a i32) -> Result<Self, ()> {
|
||||
//~^ ERROR: `async fn`
|
||||
Ok(S(&22))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
11
src/test/ui/async-await/issues/issue-78600.stderr
Normal file
11
src/test/ui/async-await/issues/issue-78600.stderr
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
error[E0760]: `async fn` return type cannot contain a projection or `Self` that references lifetimes from a parent scope
|
||||
--> $DIR/issue-78600.rs:6:33
|
||||
|
|
||||
LL | async fn new(i: &'a i32) -> Result<Self, ()> {
|
||||
| ^^^^^^^----^^^^^
|
||||
| |
|
||||
| help: consider spelling out the type instead: `S<'a>`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0760`.
|
||||
|
|
@ -1,13 +1,15 @@
|
|||
error: lifetime may not live long enough
|
||||
--> $DIR/ret-impl-trait-one.rs:12:5
|
||||
--> $DIR/ret-impl-trait-one.rs:10:85
|
||||
|
|
||||
LL | async fn async_ret_impl_trait3<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a> + 'b {
|
||||
| -- -- lifetime `'b` defined here
|
||||
| |
|
||||
| lifetime `'a` defined here
|
||||
LL |
|
||||
LL | (a, b)
|
||||
| ^^^^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
|
||||
LL | async fn async_ret_impl_trait3<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a> + 'b {
|
||||
| ________________________________--__--_______________________________________________^
|
||||
| | | |
|
||||
| | | lifetime `'b` defined here
|
||||
| | lifetime `'a` defined here
|
||||
LL | |
|
||||
LL | | (a, b)
|
||||
LL | | }
|
||||
| |_^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
|
||||
|
|
||||
= help: consider adding the following bound: `'a: 'b`
|
||||
|
||||
|
|
|
|||
|
|
@ -2,9 +2,10 @@ error[E0623]: lifetime mismatch
|
|||
--> $DIR/ret-impl-trait-one.rs:10:65
|
||||
|
|
||||
LL | async fn async_ret_impl_trait3<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a> + 'b {
|
||||
| ------ ------ ^^^^^^^^^^^^^^^^^^^ ...but data from `a` flows into `b` here
|
||||
| |
|
||||
| these two types are declared with different lifetimes...
|
||||
| ------ ^^^^^^^^^^^^^^^^^^^
|
||||
| | |
|
||||
| | ...but data from `a` is returned here
|
||||
| this parameter and the return type are declared with different lifetimes...
|
||||
|
||||
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
|
||||
--> $DIR/ret-impl-trait-one.rs:16:65
|
||||
|
|
|
|||
|
|
@ -10,13 +10,10 @@
|
|||
// Even wrong cases don't cause errors because async functions are desugared with all lifetimes
|
||||
// involved in the signature. So, we cannot predict what lifetimes are unused in async function.
|
||||
async fn async_wrong_without_args<'a>() {}
|
||||
//~^ ERROR lifetime parameter `'a` never used [unused_lifetimes]
|
||||
|
||||
async fn async_wrong_1_lifetime<'a>(_: &i32) {}
|
||||
//~^ ERROR lifetime parameter `'a` never used [unused_lifetimes]
|
||||
|
||||
async fn async_wrong_2_lifetimes<'a, 'b>(_: &'a i32, _: &i32) {}
|
||||
//~^ ERROR lifetime parameter `'b` never used [unused_lifetimes]
|
||||
|
||||
async fn async_right_1_lifetime<'a>(_: &'a i32) {}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
error: lifetime parameter `'a` never used
|
||||
--> $DIR/unused-lifetime.rs:12:35
|
||||
--> $DIR/unused-lifetime.rs:31:23
|
||||
|
|
||||
LL | async fn async_wrong_without_args<'a>() {}
|
||||
| -^^- help: elide the unused lifetime
|
||||
LL | fn wrong_without_args<'a>() {}
|
||||
| -^^- help: elide the unused lifetime
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/unused-lifetime.rs:5:9
|
||||
|
|
@ -11,40 +11,18 @@ LL | #![deny(unused_lifetimes)]
|
|||
| ^^^^^^^^^^^^^^^^
|
||||
|
||||
error: lifetime parameter `'a` never used
|
||||
--> $DIR/unused-lifetime.rs:15:33
|
||||
|
|
||||
LL | async fn async_wrong_1_lifetime<'a>(_: &i32) {}
|
||||
| ^^-----
|
||||
| |
|
||||
| help: elide the unused lifetime
|
||||
|
||||
error: lifetime parameter `'b` never used
|
||||
--> $DIR/unused-lifetime.rs:18:38
|
||||
|
|
||||
LL | async fn async_wrong_2_lifetimes<'a, 'b>(_: &'a i32, _: &i32) {}
|
||||
| ^^-----------------
|
||||
| |
|
||||
| help: elide the unused lifetime
|
||||
|
||||
error: lifetime parameter `'a` never used
|
||||
--> $DIR/unused-lifetime.rs:34:23
|
||||
|
|
||||
LL | fn wrong_without_args<'a>() {}
|
||||
| -^^- help: elide the unused lifetime
|
||||
|
||||
error: lifetime parameter `'a` never used
|
||||
--> $DIR/unused-lifetime.rs:36:21
|
||||
--> $DIR/unused-lifetime.rs:33:21
|
||||
|
|
||||
LL | fn wrong_1_lifetime<'a>(_: &i32) {}
|
||||
| -^^- help: elide the unused lifetime
|
||||
|
||||
error: lifetime parameter `'b` never used
|
||||
--> $DIR/unused-lifetime.rs:38:26
|
||||
--> $DIR/unused-lifetime.rs:35:26
|
||||
|
|
||||
LL | fn wrong_2_lifetimes<'a, 'b>(_: &'a i32, _: &i32) {}
|
||||
| --^^
|
||||
| |
|
||||
| help: elide the unused lifetime
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
error[E0515]: cannot return value referencing local variable `raw_lines`
|
||||
--> $DIR/drop-with-active-borrows-2.rs:3:30
|
||||
--> $DIR/drop-with-active-borrows-2.rs:3:5
|
||||
|
|
||||
LL | raw_lines.iter().map(|l| l.trim()).collect()
|
||||
| ---------------- ^^^^^^^^ returns a value referencing data owned by the current function
|
||||
| ----------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
| |
|
||||
| returns a value referencing data owned by the current function
|
||||
| `raw_lines` is borrowed here
|
||||
|
||||
error: aborting due to previous error
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
fn read_lines_borrowed<'a>() -> Vec<&'a str> {
|
||||
let rawLines: Vec<String> = vec!["foo ".to_string(), " bar".to_string()];
|
||||
rawLines.iter().map(|l| l.trim()).collect()
|
||||
//~^ ERROR cannot return value referencing local variable `rawLines`
|
||||
rawLines //~ ERROR cannot return value referencing local variable `rawLines`
|
||||
.iter().map(|l| l.trim()).collect()
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,14 @@
|
|||
error[E0515]: cannot return value referencing local variable `rawLines`
|
||||
--> $DIR/issue-13497-2.rs:3:29
|
||||
--> $DIR/issue-13497-2.rs:3:5
|
||||
|
|
||||
LL | rawLines.iter().map(|l| l.trim()).collect()
|
||||
| --------------- ^^^^^^^^ returns a value referencing data owned by the current function
|
||||
| |
|
||||
| `rawLines` is borrowed here
|
||||
LL | rawLines
|
||||
| _____^
|
||||
| |_____|
|
||||
| ||
|
||||
LL | || .iter().map(|l| l.trim()).collect()
|
||||
| ||_______________-___________________________^ returns a value referencing data owned by the current function
|
||||
| |________________|
|
||||
| `rawLines` is borrowed here
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -20,8 +20,9 @@ error: lifetime may not live long enough
|
|||
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:17:64
|
||||
|
|
||||
LL | async fn bar<'a>(self: Alias<&Self>, arg: &'a ()) -> &() { arg }
|
||||
| -- ---- has type `Pin<&'1 Foo>` ^^^ associated function was supposed to return data with lifetime `'1` but it is returning data with lifetime `'a`
|
||||
| |
|
||||
| -- - ^^^ associated function was supposed to return data with lifetime `'1` but it is returning data with lifetime `'a`
|
||||
| | |
|
||||
| | let's call the lifetime of this reference `'1`
|
||||
| lifetime `'a` defined here
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
|
|
|||
|
|
@ -2,25 +2,25 @@ error[E0623]: lifetime mismatch
|
|||
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:8:52
|
||||
|
|
||||
LL | async fn a(self: Pin<&Foo>, f: &Foo) -> &Foo { f }
|
||||
| ---- ---- ^ ...but data from `f` flows into `self` here
|
||||
| ---- ---- ^ ...but data from `f` is returned here
|
||||
| |
|
||||
| these two types are declared with different lifetimes...
|
||||
| this parameter and the return type are declared with different lifetimes...
|
||||
|
||||
error[E0623]: lifetime mismatch
|
||||
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:11:82
|
||||
|
|
||||
LL | async fn c(self: Pin<&Self>, f: &Foo, g: &Foo) -> (Pin<&Foo>, &Foo) { (self, f) }
|
||||
| ----- ---- ^ ...but data from `f` flows into `self` here
|
||||
| ---- ----------------- ^ ...but data from `f` is returned here
|
||||
| |
|
||||
| these two types are declared with different lifetimes...
|
||||
| this parameter and the return type are declared with different lifetimes...
|
||||
|
||||
error[E0623]: lifetime mismatch
|
||||
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:17:64
|
||||
|
|
||||
LL | async fn bar<'a>(self: Alias<&Self>, arg: &'a ()) -> &() { arg }
|
||||
| ----- ------ ^^^ ...but data from `arg` flows into `self` here
|
||||
| ------ --- ^^^ ...but data from `arg` is returned here
|
||||
| |
|
||||
| these two types are declared with different lifetimes...
|
||||
| this parameter and the return type are declared with different lifetimes...
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -2,49 +2,61 @@ error[E0623]: lifetime mismatch
|
|||
--> $DIR/lt-ref-self-async.rs:13:9
|
||||
|
|
||||
LL | async fn ref_self(&self, f: &u32) -> &u32 {
|
||||
| ----- ---- these two types are declared with different lifetimes...
|
||||
| ---- ----
|
||||
| |
|
||||
| this parameter and the return type are declared with different lifetimes...
|
||||
LL | f
|
||||
| ^ ...but data from `f` flows into `self` here
|
||||
| ^ ...but data from `f` is returned here
|
||||
|
||||
error[E0623]: lifetime mismatch
|
||||
--> $DIR/lt-ref-self-async.rs:19:9
|
||||
|
|
||||
LL | async fn ref_Self(self: &Self, f: &u32) -> &u32 {
|
||||
| ----- ---- these two types are declared with different lifetimes...
|
||||
| ---- ----
|
||||
| |
|
||||
| this parameter and the return type are declared with different lifetimes...
|
||||
LL | f
|
||||
| ^ ...but data from `f` flows into `self` here
|
||||
| ^ ...but data from `f` is returned here
|
||||
|
||||
error[E0623]: lifetime mismatch
|
||||
--> $DIR/lt-ref-self-async.rs:23:9
|
||||
|
|
||||
LL | async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 {
|
||||
| ----- ---- these two types are declared with different lifetimes...
|
||||
| ---- ----
|
||||
| |
|
||||
| this parameter and the return type are declared with different lifetimes...
|
||||
LL | f
|
||||
| ^ ...but data from `f` flows into `self` here
|
||||
| ^ ...but data from `f` is returned here
|
||||
|
||||
error[E0623]: lifetime mismatch
|
||||
--> $DIR/lt-ref-self-async.rs:27:9
|
||||
|
|
||||
LL | async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 {
|
||||
| ----- ---- these two types are declared with different lifetimes...
|
||||
| ---- ----
|
||||
| |
|
||||
| this parameter and the return type are declared with different lifetimes...
|
||||
LL | f
|
||||
| ^ ...but data from `f` flows into `self` here
|
||||
| ^ ...but data from `f` is returned here
|
||||
|
||||
error[E0623]: lifetime mismatch
|
||||
--> $DIR/lt-ref-self-async.rs:31:9
|
||||
|
|
||||
LL | async fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 {
|
||||
| ----- ---- these two types are declared with different lifetimes...
|
||||
| ---- ----
|
||||
| |
|
||||
| this parameter and the return type are declared with different lifetimes...
|
||||
LL | f
|
||||
| ^ ...but data from `f` flows into `self` here
|
||||
| ^ ...but data from `f` is returned here
|
||||
|
||||
error[E0623]: lifetime mismatch
|
||||
--> $DIR/lt-ref-self-async.rs:35:9
|
||||
|
|
||||
LL | async fn box_pin_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 {
|
||||
| ----- ---- these two types are declared with different lifetimes...
|
||||
| ---- ----
|
||||
| |
|
||||
| this parameter and the return type are declared with different lifetimes...
|
||||
LL | f
|
||||
| ^ ...but data from `f` flows into `self` here
|
||||
| ^ ...but data from `f` is returned here
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -2,49 +2,61 @@ error[E0623]: lifetime mismatch
|
|||
--> $DIR/ref-mut-self-async.rs:13:9
|
||||
|
|
||||
LL | async fn ref_self(&mut self, f: &u32) -> &u32 {
|
||||
| --------- ---- these two types are declared with different lifetimes...
|
||||
| ---- ----
|
||||
| |
|
||||
| this parameter and the return type are declared with different lifetimes...
|
||||
LL | f
|
||||
| ^ ...but data from `f` flows into `self` here
|
||||
| ^ ...but data from `f` is returned here
|
||||
|
||||
error[E0623]: lifetime mismatch
|
||||
--> $DIR/ref-mut-self-async.rs:19:9
|
||||
|
|
||||
LL | async fn ref_Self(self: &mut Self, f: &u32) -> &u32 {
|
||||
| --------- ---- these two types are declared with different lifetimes...
|
||||
| ---- ----
|
||||
| |
|
||||
| this parameter and the return type are declared with different lifetimes...
|
||||
LL | f
|
||||
| ^ ...but data from `f` flows into `self` here
|
||||
| ^ ...but data from `f` is returned here
|
||||
|
||||
error[E0623]: lifetime mismatch
|
||||
--> $DIR/ref-mut-self-async.rs:23:9
|
||||
|
|
||||
LL | async fn box_ref_Self(self: Box<&mut Self>, f: &u32) -> &u32 {
|
||||
| --------- ---- these two types are declared with different lifetimes...
|
||||
| ---- ----
|
||||
| |
|
||||
| this parameter and the return type are declared with different lifetimes...
|
||||
LL | f
|
||||
| ^ ...but data from `f` flows into `self` here
|
||||
| ^ ...but data from `f` is returned here
|
||||
|
||||
error[E0623]: lifetime mismatch
|
||||
--> $DIR/ref-mut-self-async.rs:27:9
|
||||
|
|
||||
LL | async fn pin_ref_Self(self: Pin<&mut Self>, f: &u32) -> &u32 {
|
||||
| --------- ---- these two types are declared with different lifetimes...
|
||||
| ---- ----
|
||||
| |
|
||||
| this parameter and the return type are declared with different lifetimes...
|
||||
LL | f
|
||||
| ^ ...but data from `f` flows into `self` here
|
||||
| ^ ...but data from `f` is returned here
|
||||
|
||||
error[E0623]: lifetime mismatch
|
||||
--> $DIR/ref-mut-self-async.rs:31:9
|
||||
|
|
||||
LL | async fn box_box_ref_Self(self: Box<Box<&mut Self>>, f: &u32) -> &u32 {
|
||||
| --------- ---- these two types are declared with different lifetimes...
|
||||
| ---- ----
|
||||
| |
|
||||
| this parameter and the return type are declared with different lifetimes...
|
||||
LL | f
|
||||
| ^ ...but data from `f` flows into `self` here
|
||||
| ^ ...but data from `f` is returned here
|
||||
|
||||
error[E0623]: lifetime mismatch
|
||||
--> $DIR/ref-mut-self-async.rs:35:9
|
||||
|
|
||||
LL | async fn box_pin_ref_Self(self: Box<Pin<&mut Self>>, f: &u32) -> &u32 {
|
||||
| --------- ---- these two types are declared with different lifetimes...
|
||||
| ---- ----
|
||||
| |
|
||||
| this parameter and the return type are declared with different lifetimes...
|
||||
LL | f
|
||||
| ^ ...but data from `f` flows into `self` here
|
||||
| ^ ...but data from `f` is returned here
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -2,41 +2,51 @@ error[E0623]: lifetime mismatch
|
|||
--> $DIR/ref-mut-struct-async.rs:13:9
|
||||
|
|
||||
LL | async fn ref_Struct(self: &mut Struct, f: &u32) -> &u32 {
|
||||
| ----------- ---- these two types are declared with different lifetimes...
|
||||
| ---- ----
|
||||
| |
|
||||
| this parameter and the return type are declared with different lifetimes...
|
||||
LL | f
|
||||
| ^ ...but data from `f` flows into `self` here
|
||||
| ^ ...but data from `f` is returned here
|
||||
|
||||
error[E0623]: lifetime mismatch
|
||||
--> $DIR/ref-mut-struct-async.rs:17:9
|
||||
|
|
||||
LL | async fn box_ref_Struct(self: Box<&mut Struct>, f: &u32) -> &u32 {
|
||||
| ----------- ---- these two types are declared with different lifetimes...
|
||||
| ---- ----
|
||||
| |
|
||||
| this parameter and the return type are declared with different lifetimes...
|
||||
LL | f
|
||||
| ^ ...but data from `f` flows into `self` here
|
||||
| ^ ...but data from `f` is returned here
|
||||
|
||||
error[E0623]: lifetime mismatch
|
||||
--> $DIR/ref-mut-struct-async.rs:21:9
|
||||
|
|
||||
LL | async fn pin_ref_Struct(self: Pin<&mut Struct>, f: &u32) -> &u32 {
|
||||
| ----------- ---- these two types are declared with different lifetimes...
|
||||
| ---- ----
|
||||
| |
|
||||
| this parameter and the return type are declared with different lifetimes...
|
||||
LL | f
|
||||
| ^ ...but data from `f` flows into `self` here
|
||||
| ^ ...but data from `f` is returned here
|
||||
|
||||
error[E0623]: lifetime mismatch
|
||||
--> $DIR/ref-mut-struct-async.rs:25:9
|
||||
|
|
||||
LL | async fn box_box_ref_Struct(self: Box<Box<&mut Struct>>, f: &u32) -> &u32 {
|
||||
| ----------- ---- these two types are declared with different lifetimes...
|
||||
| ---- ----
|
||||
| |
|
||||
| this parameter and the return type are declared with different lifetimes...
|
||||
LL | f
|
||||
| ^ ...but data from `f` flows into `self` here
|
||||
| ^ ...but data from `f` is returned here
|
||||
|
||||
error[E0623]: lifetime mismatch
|
||||
--> $DIR/ref-mut-struct-async.rs:29:9
|
||||
|
|
||||
LL | async fn box_pin_ref_Struct(self: Box<Pin<&mut Struct>>, f: &u32) -> &u32 {
|
||||
| ----------- ---- these two types are declared with different lifetimes...
|
||||
| ---- ----
|
||||
| |
|
||||
| this parameter and the return type are declared with different lifetimes...
|
||||
LL | f
|
||||
| ^ ...but data from `f` flows into `self` here
|
||||
| ^ ...but data from `f` is returned here
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -2,57 +2,71 @@ error[E0623]: lifetime mismatch
|
|||
--> $DIR/ref-self-async.rs:23:9
|
||||
|
|
||||
LL | async fn ref_self(&self, f: &u32) -> &u32 {
|
||||
| ----- ---- these two types are declared with different lifetimes...
|
||||
| ---- ----
|
||||
| |
|
||||
| this parameter and the return type are declared with different lifetimes...
|
||||
LL | f
|
||||
| ^ ...but data from `f` flows into `self` here
|
||||
| ^ ...but data from `f` is returned here
|
||||
|
||||
error[E0623]: lifetime mismatch
|
||||
--> $DIR/ref-self-async.rs:29:9
|
||||
|
|
||||
LL | async fn ref_Self(self: &Self, f: &u32) -> &u32 {
|
||||
| ----- ---- these two types are declared with different lifetimes...
|
||||
| ---- ----
|
||||
| |
|
||||
| this parameter and the return type are declared with different lifetimes...
|
||||
LL | f
|
||||
| ^ ...but data from `f` flows into `self` here
|
||||
| ^ ...but data from `f` is returned here
|
||||
|
||||
error[E0623]: lifetime mismatch
|
||||
--> $DIR/ref-self-async.rs:33:9
|
||||
|
|
||||
LL | async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 {
|
||||
| ----- ---- these two types are declared with different lifetimes...
|
||||
| ---- ----
|
||||
| |
|
||||
| this parameter and the return type are declared with different lifetimes...
|
||||
LL | f
|
||||
| ^ ...but data from `f` flows into `self` here
|
||||
| ^ ...but data from `f` is returned here
|
||||
|
||||
error[E0623]: lifetime mismatch
|
||||
--> $DIR/ref-self-async.rs:37:9
|
||||
|
|
||||
LL | async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 {
|
||||
| ----- ---- these two types are declared with different lifetimes...
|
||||
| ---- ----
|
||||
| |
|
||||
| this parameter and the return type are declared with different lifetimes...
|
||||
LL | f
|
||||
| ^ ...but data from `f` flows into `self` here
|
||||
| ^ ...but data from `f` is returned here
|
||||
|
||||
error[E0623]: lifetime mismatch
|
||||
--> $DIR/ref-self-async.rs:41:9
|
||||
|
|
||||
LL | async fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 {
|
||||
| ----- ---- these two types are declared with different lifetimes...
|
||||
| ---- ----
|
||||
| |
|
||||
| this parameter and the return type are declared with different lifetimes...
|
||||
LL | f
|
||||
| ^ ...but data from `f` flows into `self` here
|
||||
| ^ ...but data from `f` is returned here
|
||||
|
||||
error[E0623]: lifetime mismatch
|
||||
--> $DIR/ref-self-async.rs:45:9
|
||||
|
|
||||
LL | async fn box_pin_ref_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 {
|
||||
| ----- ---- these two types are declared with different lifetimes...
|
||||
| ---- ----
|
||||
| |
|
||||
| this parameter and the return type are declared with different lifetimes...
|
||||
LL | f
|
||||
| ^ ...but data from `f` flows into `self` here
|
||||
| ^ ...but data from `f` is returned here
|
||||
|
||||
error[E0623]: lifetime mismatch
|
||||
--> $DIR/ref-self-async.rs:49:9
|
||||
|
|
||||
LL | async fn wrap_ref_Self_Self(self: Wrap<&Self, Self>, f: &u8) -> &u8 {
|
||||
| ----- --- these two types are declared with different lifetimes...
|
||||
| --- ---
|
||||
| |
|
||||
| this parameter and the return type are declared with different lifetimes...
|
||||
LL | f
|
||||
| ^ ...but data from `f` flows into `self` here
|
||||
| ^ ...but data from `f` is returned here
|
||||
|
||||
error: aborting due to 7 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -2,41 +2,51 @@ error[E0623]: lifetime mismatch
|
|||
--> $DIR/ref-struct-async.rs:13:9
|
||||
|
|
||||
LL | async fn ref_Struct(self: &Struct, f: &u32) -> &u32 {
|
||||
| ------- ---- these two types are declared with different lifetimes...
|
||||
| ---- ----
|
||||
| |
|
||||
| this parameter and the return type are declared with different lifetimes...
|
||||
LL | f
|
||||
| ^ ...but data from `f` flows into `self` here
|
||||
| ^ ...but data from `f` is returned here
|
||||
|
||||
error[E0623]: lifetime mismatch
|
||||
--> $DIR/ref-struct-async.rs:17:9
|
||||
|
|
||||
LL | async fn box_ref_Struct(self: Box<&Struct>, f: &u32) -> &u32 {
|
||||
| ------- ---- these two types are declared with different lifetimes...
|
||||
| ---- ----
|
||||
| |
|
||||
| this parameter and the return type are declared with different lifetimes...
|
||||
LL | f
|
||||
| ^ ...but data from `f` flows into `self` here
|
||||
| ^ ...but data from `f` is returned here
|
||||
|
||||
error[E0623]: lifetime mismatch
|
||||
--> $DIR/ref-struct-async.rs:21:9
|
||||
|
|
||||
LL | async fn pin_ref_Struct(self: Pin<&Struct>, f: &u32) -> &u32 {
|
||||
| ------- ---- these two types are declared with different lifetimes...
|
||||
| ---- ----
|
||||
| |
|
||||
| this parameter and the return type are declared with different lifetimes...
|
||||
LL | f
|
||||
| ^ ...but data from `f` flows into `self` here
|
||||
| ^ ...but data from `f` is returned here
|
||||
|
||||
error[E0623]: lifetime mismatch
|
||||
--> $DIR/ref-struct-async.rs:25:9
|
||||
|
|
||||
LL | async fn box_box_ref_Struct(self: Box<Box<&Struct>>, f: &u32) -> &u32 {
|
||||
| ------- ---- these two types are declared with different lifetimes...
|
||||
| ---- ----
|
||||
| |
|
||||
| this parameter and the return type are declared with different lifetimes...
|
||||
LL | f
|
||||
| ^ ...but data from `f` flows into `self` here
|
||||
| ^ ...but data from `f` is returned here
|
||||
|
||||
error[E0623]: lifetime mismatch
|
||||
--> $DIR/ref-struct-async.rs:29:9
|
||||
|
|
||||
LL | async fn box_pin_Struct(self: Box<Pin<&Struct>>, f: &u32) -> &u32 {
|
||||
| ------- ---- these two types are declared with different lifetimes...
|
||||
| ---- ----
|
||||
| |
|
||||
| this parameter and the return type are declared with different lifetimes...
|
||||
LL | f
|
||||
| ^ ...but data from `f` flows into `self` here
|
||||
| ^ ...but data from `f` is returned here
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -80,7 +80,6 @@ fn elided_not_bound(_: &i32) -> impl Future<Output = i32> {
|
|||
async { 42 }
|
||||
}
|
||||
|
||||
#[allow(clippy::needless_lifetimes)]
|
||||
async fn explicit<'a, 'b>(_: &'a i32, _: &'b i32) -> i32 { 42 }
|
||||
|
||||
// should be ignored
|
||||
|
|
|
|||
|
|
@ -98,7 +98,6 @@ fn elided_not_bound(_: &i32) -> impl Future<Output = i32> {
|
|||
async { 42 }
|
||||
}
|
||||
|
||||
#[allow(clippy::needless_lifetimes)]
|
||||
fn explicit<'a, 'b>(_: &'a i32, _: &'b i32) -> impl Future<Output = i32> + 'a + 'b {
|
||||
async { 42 }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ LL | fn elided(_: &i32) -> impl Future<Output = i32> + '_ { 42 }
|
|||
| ~~~~~~
|
||||
|
||||
error: this function can be simplified using the `async fn` syntax
|
||||
--> $DIR/manual_async_fn.rs:102:1
|
||||
--> $DIR/manual_async_fn.rs:101:1
|
||||
|
|
||||
LL | fn explicit<'a, 'b>(_: &'a i32, _: &'b i32) -> impl Future<Output = i32> + 'a + 'b {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
|
|||
|
|
@ -18,12 +18,6 @@ error: explicit lifetimes given in parameter types where they could be elided (o
|
|||
LL | fn in_and_out<'a>(x: &'a u8, _y: u8) -> &'a u8 {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
|
||||
--> $DIR/needless_lifetimes.rs:37:1
|
||||
|
|
||||
LL | async fn func<'a>(args: &[&'a str]) -> Option<&'a str> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
|
||||
--> $DIR/needless_lifetimes.rs:56:1
|
||||
|
|
||||
|
|
@ -198,5 +192,5 @@ error: explicit lifetimes given in parameter types where they could be elided (o
|
|||
LL | fn lifetime_elsewhere_provided<'a>(self: Box<Self>, here: &'a ()) -> &'a () {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 33 previous errors
|
||||
error: aborting due to 32 previous errors
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue