Rollup merge of #71235 - estebank:lt-sugg-2, r=ecstatic-morse
Tweak `'static` suggestion code Fix #71196.
This commit is contained in:
commit
7d8a3ad128
25 changed files with 573 additions and 171 deletions
|
|
@ -2,9 +2,13 @@ error[E0106]: missing lifetime specifier
|
|||
--> $DIR/bound-lifetime-in-binding-only.rs:52:23
|
||||
|
|
||||
LL | fn elision<T: Fn() -> &i32>() {
|
||||
| ^ help: consider giving it a 'static lifetime: `&'static`
|
||||
| ^ expected named lifetime parameter
|
||||
|
|
||||
= help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
|
||||
help: consider using the `'static` lifetime
|
||||
|
|
||||
LL | fn elision<T: Fn() -> &'static i32>() {
|
||||
| ^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -2,9 +2,13 @@ error[E0106]: missing lifetime specifier
|
|||
--> $DIR/bound-lifetime-in-return-only.rs:34:23
|
||||
|
|
||||
LL | fn elision(_: fn() -> &i32) {
|
||||
| ^ help: consider giving it a 'static lifetime: `&'static`
|
||||
| ^ expected named lifetime parameter
|
||||
|
|
||||
= help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
|
||||
help: consider using the `'static` lifetime
|
||||
|
|
||||
LL | fn elision(_: fn() -> &'static i32) {
|
||||
| ^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -4,9 +4,13 @@ error[E0106]: missing lifetime specifier
|
|||
LL | foo: &dyn Foo, bar: &'a dyn Foo
|
||||
| -------- -----------
|
||||
LL | ) -> &dyn Foo
|
||||
| ^ help: consider using the named lifetime: `&'a`
|
||||
| ^ expected named lifetime parameter
|
||||
|
|
||||
= help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from `foo` or `bar`
|
||||
help: consider using the `'a` lifetime
|
||||
|
|
||||
LL | ) -> &'a dyn Foo
|
||||
| ^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -2,9 +2,13 @@ error[E0106]: missing lifetime specifier
|
|||
--> $DIR/variadic-ffi-6.rs:7:6
|
||||
|
|
||||
LL | ) -> &usize {
|
||||
| ^ help: consider giving it an explicit bounded or 'static lifetime: `&'static`
|
||||
| ^ expected named lifetime parameter
|
||||
|
|
||||
= help: this function's return type contains a borrowed value with an elided lifetime, but the lifetime cannot be derived from the arguments
|
||||
help: consider using the `'static` lifetime
|
||||
|
|
||||
LL | ) -> &'static usize {
|
||||
| ^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -2,9 +2,13 @@ error[E0106]: missing lifetime specifier
|
|||
--> $DIR/foreign-fn-return-lifetime.rs:5:19
|
||||
|
|
||||
LL | pub fn f() -> &u8;
|
||||
| ^ help: consider giving it a 'static lifetime: `&'static`
|
||||
| ^ expected named lifetime parameter
|
||||
|
|
||||
= help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
|
||||
help: consider using the `'static` lifetime
|
||||
|
|
||||
LL | pub fn f() -> &'static u8;
|
||||
| ^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -5,16 +5,33 @@ LL | fn should_error<T>() where T : Into<&u32> {}
|
|||
| ^ explicit lifetime name needed here
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/issue-65285-incorrect-explicit-lifetime-name-needed.rs:9:19
|
||||
--> $DIR/issue-65285-incorrect-explicit-lifetime-name-needed.rs:9:21
|
||||
|
|
||||
LL | fn foo<'b, L: X<&'b Nested<K>>>();
|
||||
| ^^^^^^^^^^^^^^^^ expected lifetime parameter
|
||||
| ^ expected named lifetime parameter
|
||||
|
|
||||
note: these named lifetimes are available to use
|
||||
--> $DIR/issue-65285-incorrect-explicit-lifetime-name-needed.rs:8:9
|
||||
|
|
||||
LL | trait X<'a, K: 'a> {
|
||||
| ^^
|
||||
LL | fn foo<'b, L: X<&'b Nested<K>>>();
|
||||
| ^^
|
||||
help: consider using one of the available lifetimes here
|
||||
|
|
||||
LL | fn foo<'b, L: X<'lifetime, &'b Nested<K>>>();
|
||||
| ^^^^^^^^^^
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/issue-65285-incorrect-explicit-lifetime-name-needed.rs:13:15
|
||||
--> $DIR/issue-65285-incorrect-explicit-lifetime-name-needed.rs:13:17
|
||||
|
|
||||
LL | fn bar<'b, L: X<&'b Nested<i32>>>(){}
|
||||
| ^^^^^^^^^^^^^^^^^^ expected lifetime parameter
|
||||
| ^ expected named lifetime parameter
|
||||
|
|
||||
help: consider using the `'b` lifetime
|
||||
|
|
||||
LL | fn bar<'b, L: X<'b, &'b Nested<i32>>>(){}
|
||||
| ^^^
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -2,9 +2,13 @@ error[E0106]: missing lifetime specifier
|
|||
--> $DIR/issue-13497.rs:2:5
|
||||
|
|
||||
LL | &str
|
||||
| ^ help: consider giving it a 'static lifetime: `&'static`
|
||||
| ^ expected named lifetime parameter
|
||||
|
|
||||
= help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
|
||||
help: consider using the `'static` lifetime
|
||||
|
|
||||
LL | &'static str
|
||||
| ^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -14,17 +14,25 @@ error[E0106]: missing lifetime specifier
|
|||
--> $DIR/issue-26638.rs:4:40
|
||||
|
|
||||
LL | fn parse_type_2(iter: fn(&u8)->&u8) -> &str { iter() }
|
||||
| ^ help: consider giving it an explicit bounded or 'static lifetime: `&'static`
|
||||
| ^ expected named lifetime parameter
|
||||
|
|
||||
= help: this function's return type contains a borrowed value with an elided lifetime, but the lifetime cannot be derived from the arguments
|
||||
help: consider using the `'static` lifetime
|
||||
|
|
||||
LL | fn parse_type_2(iter: fn(&u8)->&u8) -> &'static str { iter() }
|
||||
| ^^^^^^^^
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/issue-26638.rs:7:22
|
||||
|
|
||||
LL | fn parse_type_3() -> &str { unimplemented!() }
|
||||
| ^ help: consider giving it a 'static lifetime: `&'static`
|
||||
| ^ expected named lifetime parameter
|
||||
|
|
||||
= help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
|
||||
help: consider using the `'static` lifetime
|
||||
|
|
||||
LL | fn parse_type_3() -> &'static str { unimplemented!() }
|
||||
| ^^^^^^^^
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -2,9 +2,13 @@ error[E0106]: missing lifetime specifier
|
|||
--> $DIR/lifetime-elision-return-type-requires-explicit-lifetime.rs:2:11
|
||||
|
|
||||
LL | fn f() -> &isize {
|
||||
| ^ help: consider giving it a 'static lifetime: `&'static`
|
||||
| ^ expected named lifetime parameter
|
||||
|
|
||||
= help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
|
||||
help: consider using the `'static` lifetime
|
||||
|
|
||||
LL | fn f() -> &'static isize {
|
||||
| ^^^^^^^^
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/lifetime-elision-return-type-requires-explicit-lifetime.rs:7:33
|
||||
|
|
@ -34,25 +38,37 @@ error[E0106]: missing lifetime specifier
|
|||
--> $DIR/lifetime-elision-return-type-requires-explicit-lifetime.rs:21:20
|
||||
|
|
||||
LL | fn i(_x: isize) -> &isize {
|
||||
| ^ help: consider giving it an explicit bounded or 'static lifetime: `&'static`
|
||||
| ^ expected named lifetime parameter
|
||||
|
|
||||
= help: this function's return type contains a borrowed value with an elided lifetime, but the lifetime cannot be derived from the arguments
|
||||
help: consider using the `'static` lifetime
|
||||
|
|
||||
LL | fn i(_x: isize) -> &'static isize {
|
||||
| ^^^^^^^^
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/lifetime-elision-return-type-requires-explicit-lifetime.rs:34:24
|
||||
|
|
||||
LL | fn j(_x: StaticStr) -> &isize {
|
||||
| ^ help: consider giving it an explicit bounded or 'static lifetime: `&'static`
|
||||
| ^ expected named lifetime parameter
|
||||
|
|
||||
= help: this function's return type contains a borrowed value with an elided lifetime, but the lifetime cannot be derived from the arguments
|
||||
help: consider using the `'static` lifetime
|
||||
|
|
||||
LL | fn j(_x: StaticStr) -> &'static isize {
|
||||
| ^^^^^^^^
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/lifetime-elision-return-type-requires-explicit-lifetime.rs:40:49
|
||||
|
|
||||
LL | fn k<'a, T: WithLifetime<'a>>(_x: T::Output) -> &isize {
|
||||
| ^ help: consider giving it an explicit bounded or 'static lifetime: `&'static`
|
||||
| ^ expected named lifetime parameter
|
||||
|
|
||||
= help: this function's return type contains a borrowed value with an elided lifetime, but the lifetime cannot be derived from the arguments
|
||||
help: consider using the `'a` lifetime
|
||||
|
|
||||
LL | fn k<'a, T: WithLifetime<'a>>(_x: T::Output) -> &'a isize {
|
||||
| ^^^
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -25,13 +25,13 @@ LL | default impl !Send for Z {}
|
|||
| default because of this
|
||||
|
||||
error[E0750]: negative impls cannot be default impls
|
||||
--> $DIR/validation.rs:10:14
|
||||
--> $DIR/validation.rs:10:1
|
||||
|
|
||||
LL | default impl !Send for Z {}
|
||||
| ^^^^^^^ ^
|
||||
|
||||
error[E0750]: negative impls cannot be default impls
|
||||
--> $DIR/validation.rs:14:14
|
||||
--> $DIR/validation.rs:14:1
|
||||
|
|
||||
LL | default impl !Tr for S {}
|
||||
| ^^^^^^^ ^
|
||||
|
|
|
|||
65
src/test/ui/suggestions/missing-lifetime-specifier.rs
Normal file
65
src/test/ui/suggestions/missing-lifetime-specifier.rs
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
#![allow(bare_trait_objects)]
|
||||
use std::collections::HashMap;
|
||||
use std::cell::RefCell;
|
||||
|
||||
pub union Foo<'t, 'k> {
|
||||
i: &'t i64,
|
||||
f: &'k f64,
|
||||
}
|
||||
trait Bar<'t, 'k> {}
|
||||
|
||||
pub union Qux<'t, 'k, I> {
|
||||
i: &'t I,
|
||||
f: &'k I,
|
||||
}
|
||||
trait Tar<'t, 'k, I> {}
|
||||
|
||||
thread_local! {
|
||||
static a: RefCell<HashMap<i32, Vec<Vec<Foo>>>> = RefCell::new(HashMap::new());
|
||||
//~^ ERROR missing lifetime specifier
|
||||
//~| ERROR missing lifetime specifier
|
||||
}
|
||||
thread_local! {
|
||||
static b: RefCell<HashMap<i32, Vec<Vec<&Bar>>>> = RefCell::new(HashMap::new());
|
||||
//~^ ERROR missing lifetime specifier
|
||||
//~| ERROR missing lifetime specifier
|
||||
//~| ERROR missing lifetime specifier
|
||||
//~| ERROR missing lifetime specifier
|
||||
//~| ERROR the lifetime bound for this object type cannot be deduced from context
|
||||
//~| ERROR the lifetime bound for this object type cannot be deduced from context
|
||||
}
|
||||
thread_local! {
|
||||
static c: RefCell<HashMap<i32, Vec<Vec<Qux<i32>>>>> = RefCell::new(HashMap::new());
|
||||
//~^ ERROR missing lifetime specifier
|
||||
//~| ERROR missing lifetime specifier
|
||||
}
|
||||
thread_local! {
|
||||
static d: RefCell<HashMap<i32, Vec<Vec<&Tar<i32>>>>> = RefCell::new(HashMap::new());
|
||||
//~^ ERROR missing lifetime specifier
|
||||
//~| ERROR missing lifetime specifier
|
||||
//~| ERROR missing lifetime specifier
|
||||
//~| ERROR missing lifetime specifier
|
||||
//~| ERROR the lifetime bound for this object type cannot be deduced from context
|
||||
//~| ERROR the lifetime bound for this object type cannot be deduced from context
|
||||
}
|
||||
|
||||
thread_local! {
|
||||
static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, i32>>>>> = RefCell::new(HashMap::new());
|
||||
//~^ ERROR wrong number of lifetime arguments: expected 2, found 1
|
||||
//~| ERROR wrong number of lifetime arguments: expected 2, found 1
|
||||
//~| ERROR wrong number of lifetime arguments: expected 2, found 1
|
||||
//~| ERROR wrong number of lifetime arguments: expected 2, found 1
|
||||
}
|
||||
thread_local! {
|
||||
static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, i32>>>>> = RefCell::new(HashMap::new());
|
||||
//~^ ERROR the lifetime bound for this object type cannot be deduced from context
|
||||
//~| ERROR the lifetime bound for this object type cannot be deduced from context
|
||||
//~| ERROR wrong number of lifetime arguments: expected 2, found 1
|
||||
//~| ERROR wrong number of lifetime arguments: expected 2, found 1
|
||||
//~| ERROR wrong number of lifetime arguments: expected 2, found 1
|
||||
//~| ERROR wrong number of lifetime arguments: expected 2, found 1
|
||||
//~| ERROR missing lifetime specifier
|
||||
//~| ERROR missing lifetime specifier
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
256
src/test/ui/suggestions/missing-lifetime-specifier.stderr
Normal file
256
src/test/ui/suggestions/missing-lifetime-specifier.stderr
Normal file
|
|
@ -0,0 +1,256 @@
|
|||
error[E0106]: missing lifetime specifiers
|
||||
--> $DIR/missing-lifetime-specifier.rs:18:44
|
||||
|
|
||||
LL | static a: RefCell<HashMap<i32, Vec<Vec<Foo>>>> = RefCell::new(HashMap::new());
|
||||
| ^^^ expected 2 lifetime parameters
|
||||
|
|
||||
= help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
|
||||
help: consider using the `'static` lifetime
|
||||
|
|
||||
LL | static a: RefCell<HashMap<i32, Vec<Vec<Foo<'static, 'static>>>>> = RefCell::new(HashMap::new());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0106]: missing lifetime specifiers
|
||||
--> $DIR/missing-lifetime-specifier.rs:18:44
|
||||
|
|
||||
LL | static a: RefCell<HashMap<i32, Vec<Vec<Foo>>>> = RefCell::new(HashMap::new());
|
||||
| ^^^ expected 2 lifetime parameters
|
||||
|
|
||||
= help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
|
||||
help: consider using the `'static` lifetime
|
||||
|
|
||||
LL | static a: RefCell<HashMap<i32, Vec<Vec<Foo<'static, 'static>>>>> = RefCell::new(HashMap::new());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/missing-lifetime-specifier.rs:23:44
|
||||
|
|
||||
LL | static b: RefCell<HashMap<i32, Vec<Vec<&Bar>>>> = RefCell::new(HashMap::new());
|
||||
| ^ expected named lifetime parameter
|
||||
|
|
||||
= help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
|
||||
help: consider using the `'static` lifetime
|
||||
|
|
||||
LL | static b: RefCell<HashMap<i32, Vec<Vec<&'static Bar>>>> = RefCell::new(HashMap::new());
|
||||
| ^^^^^^^^
|
||||
|
||||
error[E0106]: missing lifetime specifiers
|
||||
--> $DIR/missing-lifetime-specifier.rs:23:45
|
||||
|
|
||||
LL | static b: RefCell<HashMap<i32, Vec<Vec<&Bar>>>> = RefCell::new(HashMap::new());
|
||||
| ^^^ expected 2 lifetime parameters
|
||||
|
|
||||
= help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
|
||||
help: consider using the `'static` lifetime
|
||||
|
|
||||
LL | static b: RefCell<HashMap<i32, Vec<Vec<&Bar<'static, 'static>>>>> = RefCell::new(HashMap::new());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/missing-lifetime-specifier.rs:23:44
|
||||
|
|
||||
LL | static b: RefCell<HashMap<i32, Vec<Vec<&Bar>>>> = RefCell::new(HashMap::new());
|
||||
| ^ expected named lifetime parameter
|
||||
|
|
||||
= help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
|
||||
help: consider using the `'static` lifetime
|
||||
|
|
||||
LL | static b: RefCell<HashMap<i32, Vec<Vec<&'static Bar>>>> = RefCell::new(HashMap::new());
|
||||
| ^^^^^^^^
|
||||
|
||||
error[E0106]: missing lifetime specifiers
|
||||
--> $DIR/missing-lifetime-specifier.rs:23:45
|
||||
|
|
||||
LL | static b: RefCell<HashMap<i32, Vec<Vec<&Bar>>>> = RefCell::new(HashMap::new());
|
||||
| ^^^ expected 2 lifetime parameters
|
||||
|
|
||||
= help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
|
||||
help: consider using the `'static` lifetime
|
||||
|
|
||||
LL | static b: RefCell<HashMap<i32, Vec<Vec<&Bar<'static, 'static>>>>> = RefCell::new(HashMap::new());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0106]: missing lifetime specifiers
|
||||
--> $DIR/missing-lifetime-specifier.rs:32:48
|
||||
|
|
||||
LL | static c: RefCell<HashMap<i32, Vec<Vec<Qux<i32>>>>> = RefCell::new(HashMap::new());
|
||||
| ^ expected 2 lifetime parameters
|
||||
|
|
||||
= help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
|
||||
help: consider using the `'static` lifetime
|
||||
|
|
||||
LL | static c: RefCell<HashMap<i32, Vec<Vec<Qux<'static, 'static, i32>>>>> = RefCell::new(HashMap::new());
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0106]: missing lifetime specifiers
|
||||
--> $DIR/missing-lifetime-specifier.rs:32:48
|
||||
|
|
||||
LL | static c: RefCell<HashMap<i32, Vec<Vec<Qux<i32>>>>> = RefCell::new(HashMap::new());
|
||||
| ^ expected 2 lifetime parameters
|
||||
|
|
||||
= help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
|
||||
help: consider using the `'static` lifetime
|
||||
|
|
||||
LL | static c: RefCell<HashMap<i32, Vec<Vec<Qux<'static, 'static, i32>>>>> = RefCell::new(HashMap::new());
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/missing-lifetime-specifier.rs:37:44
|
||||
|
|
||||
LL | static d: RefCell<HashMap<i32, Vec<Vec<&Tar<i32>>>>> = RefCell::new(HashMap::new());
|
||||
| ^ expected named lifetime parameter
|
||||
|
|
||||
= help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
|
||||
help: consider using the `'static` lifetime
|
||||
|
|
||||
LL | static d: RefCell<HashMap<i32, Vec<Vec<&'static Tar<i32>>>>> = RefCell::new(HashMap::new());
|
||||
| ^^^^^^^^
|
||||
|
||||
error[E0106]: missing lifetime specifiers
|
||||
--> $DIR/missing-lifetime-specifier.rs:37:49
|
||||
|
|
||||
LL | static d: RefCell<HashMap<i32, Vec<Vec<&Tar<i32>>>>> = RefCell::new(HashMap::new());
|
||||
| ^ expected 2 lifetime parameters
|
||||
|
|
||||
= help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
|
||||
help: consider using the `'static` lifetime
|
||||
|
|
||||
LL | static d: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, 'static, i32>>>>> = RefCell::new(HashMap::new());
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/missing-lifetime-specifier.rs:37:44
|
||||
|
|
||||
LL | static d: RefCell<HashMap<i32, Vec<Vec<&Tar<i32>>>>> = RefCell::new(HashMap::new());
|
||||
| ^ expected named lifetime parameter
|
||||
|
|
||||
= help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
|
||||
help: consider using the `'static` lifetime
|
||||
|
|
||||
LL | static d: RefCell<HashMap<i32, Vec<Vec<&'static Tar<i32>>>>> = RefCell::new(HashMap::new());
|
||||
| ^^^^^^^^
|
||||
|
||||
error[E0106]: missing lifetime specifiers
|
||||
--> $DIR/missing-lifetime-specifier.rs:37:49
|
||||
|
|
||||
LL | static d: RefCell<HashMap<i32, Vec<Vec<&Tar<i32>>>>> = RefCell::new(HashMap::new());
|
||||
| ^ expected 2 lifetime parameters
|
||||
|
|
||||
= help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
|
||||
help: consider using the `'static` lifetime
|
||||
|
|
||||
LL | static d: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, 'static, i32>>>>> = RefCell::new(HashMap::new());
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/missing-lifetime-specifier.rs:54:44
|
||||
|
|
||||
LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, i32>>>>> = RefCell::new(HashMap::new());
|
||||
| ^ expected named lifetime parameter
|
||||
|
|
||||
= help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
|
||||
help: consider using the `'static` lifetime
|
||||
|
|
||||
LL | static f: RefCell<HashMap<i32, Vec<Vec<&'static Tar<'static, i32>>>>> = RefCell::new(HashMap::new());
|
||||
| ^^^^^^^^
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/missing-lifetime-specifier.rs:54:44
|
||||
|
|
||||
LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, i32>>>>> = RefCell::new(HashMap::new());
|
||||
| ^ expected named lifetime parameter
|
||||
|
|
||||
= help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
|
||||
help: consider using the `'static` lifetime
|
||||
|
|
||||
LL | static f: RefCell<HashMap<i32, Vec<Vec<&'static Tar<'static, i32>>>>> = RefCell::new(HashMap::new());
|
||||
| ^^^^^^^^
|
||||
|
||||
error[E0228]: the lifetime bound for this object type cannot be deduced from context; please supply an explicit bound
|
||||
--> $DIR/missing-lifetime-specifier.rs:23:45
|
||||
|
|
||||
LL | static b: RefCell<HashMap<i32, Vec<Vec<&Bar>>>> = RefCell::new(HashMap::new());
|
||||
| ^^^
|
||||
|
||||
error[E0228]: the lifetime bound for this object type cannot be deduced from context; please supply an explicit bound
|
||||
--> $DIR/missing-lifetime-specifier.rs:23:45
|
||||
|
|
||||
LL | static b: RefCell<HashMap<i32, Vec<Vec<&Bar>>>> = RefCell::new(HashMap::new());
|
||||
| ^^^
|
||||
|
||||
error[E0228]: the lifetime bound for this object type cannot be deduced from context; please supply an explicit bound
|
||||
--> $DIR/missing-lifetime-specifier.rs:37:45
|
||||
|
|
||||
LL | static d: RefCell<HashMap<i32, Vec<Vec<&Tar<i32>>>>> = RefCell::new(HashMap::new());
|
||||
| ^^^^^^^^
|
||||
|
||||
error[E0228]: the lifetime bound for this object type cannot be deduced from context; please supply an explicit bound
|
||||
--> $DIR/missing-lifetime-specifier.rs:37:45
|
||||
|
|
||||
LL | static d: RefCell<HashMap<i32, Vec<Vec<&Tar<i32>>>>> = RefCell::new(HashMap::new());
|
||||
| ^^^^^^^^
|
||||
|
||||
error[E0107]: wrong number of lifetime arguments: expected 2, found 1
|
||||
--> $DIR/missing-lifetime-specifier.rs:47:44
|
||||
|
|
||||
LL | static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, i32>>>>> = RefCell::new(HashMap::new());
|
||||
| ^^^^^^^^^^^^^^^^^ expected 2 lifetime arguments
|
||||
|
||||
error[E0107]: wrong number of lifetime arguments: expected 2, found 1
|
||||
--> $DIR/missing-lifetime-specifier.rs:47:44
|
||||
|
|
||||
LL | static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, i32>>>>> = RefCell::new(HashMap::new());
|
||||
| ^^^^^^^^^^^^^^^^^ expected 2 lifetime arguments
|
||||
|
||||
error[E0107]: wrong number of lifetime arguments: expected 2, found 1
|
||||
--> $DIR/missing-lifetime-specifier.rs:47:44
|
||||
|
|
||||
LL | static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, i32>>>>> = RefCell::new(HashMap::new());
|
||||
| ^^^^^^^^^^^^^^^^^ expected 2 lifetime arguments
|
||||
|
||||
error[E0107]: wrong number of lifetime arguments: expected 2, found 1
|
||||
--> $DIR/missing-lifetime-specifier.rs:47:44
|
||||
|
|
||||
LL | static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, i32>>>>> = RefCell::new(HashMap::new());
|
||||
| ^^^^^^^^^^^^^^^^^ expected 2 lifetime arguments
|
||||
|
||||
error[E0107]: wrong number of lifetime arguments: expected 2, found 1
|
||||
--> $DIR/missing-lifetime-specifier.rs:54:45
|
||||
|
|
||||
LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, i32>>>>> = RefCell::new(HashMap::new());
|
||||
| ^^^^^^^^^^^^^^^^^ expected 2 lifetime arguments
|
||||
|
||||
error[E0107]: wrong number of lifetime arguments: expected 2, found 1
|
||||
--> $DIR/missing-lifetime-specifier.rs:54:45
|
||||
|
|
||||
LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, i32>>>>> = RefCell::new(HashMap::new());
|
||||
| ^^^^^^^^^^^^^^^^^ expected 2 lifetime arguments
|
||||
|
||||
error[E0228]: the lifetime bound for this object type cannot be deduced from context; please supply an explicit bound
|
||||
--> $DIR/missing-lifetime-specifier.rs:54:45
|
||||
|
|
||||
LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, i32>>>>> = RefCell::new(HashMap::new());
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0107]: wrong number of lifetime arguments: expected 2, found 1
|
||||
--> $DIR/missing-lifetime-specifier.rs:54:45
|
||||
|
|
||||
LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, i32>>>>> = RefCell::new(HashMap::new());
|
||||
| ^^^^^^^^^^^^^^^^^ expected 2 lifetime arguments
|
||||
|
||||
error[E0228]: the lifetime bound for this object type cannot be deduced from context; please supply an explicit bound
|
||||
--> $DIR/missing-lifetime-specifier.rs:54:45
|
||||
|
|
||||
LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, i32>>>>> = RefCell::new(HashMap::new());
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0107]: wrong number of lifetime arguments: expected 2, found 1
|
||||
--> $DIR/missing-lifetime-specifier.rs:54:45
|
||||
|
|
||||
LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, i32>>>>> = RefCell::new(HashMap::new());
|
||||
| ^^^^^^^^^^^^^^^^^ expected 2 lifetime arguments
|
||||
|
||||
error: aborting due to 28 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0106, E0107.
|
||||
For more information about an error, try `rustc --explain E0106`.
|
||||
|
|
@ -2,23 +2,36 @@ error[E0106]: missing lifetime specifier
|
|||
--> $DIR/return-without-lifetime.rs:2:16
|
||||
|
|
||||
LL | struct Foo<'a>(&usize);
|
||||
| ^ help: consider using the named lifetime: `&'a`
|
||||
| ^ expected named lifetime parameter
|
||||
|
|
||||
help: consider using the `'a` lifetime
|
||||
|
|
||||
LL | struct Foo<'a>(&'a usize);
|
||||
| ^^^
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/return-without-lifetime.rs:5:34
|
||||
|
|
||||
LL | fn func1<'a>(_arg: &'a Thing) -> &() { unimplemented!() }
|
||||
| --------- ^ help: consider using the named lifetime: `&'a`
|
||||
| --------- ^ expected named lifetime parameter
|
||||
|
|
||||
= help: this function's return type contains a borrowed value, but the signature does not say which one of `_arg`'s 2 lifetimes it is borrowed from
|
||||
help: consider using the `'a` lifetime
|
||||
|
|
||||
LL | fn func1<'a>(_arg: &'a Thing) -> &'a () { unimplemented!() }
|
||||
| ^^^
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/return-without-lifetime.rs:7:35
|
||||
|
|
||||
LL | fn func2<'a>(_arg: &Thing<'a>) -> &() { unimplemented!() }
|
||||
| ---------- ^ help: consider using the named lifetime: `&'a`
|
||||
| ---------- ^ expected named lifetime parameter
|
||||
|
|
||||
= help: this function's return type contains a borrowed value, but the signature does not say which one of `_arg`'s 2 lifetimes it is borrowed from
|
||||
help: consider using the `'a` lifetime
|
||||
|
|
||||
LL | fn func2<'a>(_arg: &Thing<'a>) -> &'a () { unimplemented!() }
|
||||
| ^^^
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0750]: negative impls cannot be default impls
|
||||
--> $DIR/negative-default-impls.rs:8:14
|
||||
--> $DIR/negative-default-impls.rs:8:1
|
||||
|
|
||||
LL | default impl !MyTrait for u32 {}
|
||||
| ^^^^^^^ ^
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ error[E0658]: parenthetical notation is only stable when used with `Fn`-family t
|
|||
--> $DIR/unboxed-closure-feature-gate.rs:13:20
|
||||
|
|
||||
LL | let x: Box<dyn Foo(isize)>;
|
||||
| ^^^
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #29625 <https://github.com/rust-lang/rust/issues/29625> for more information
|
||||
= help: add `#![feature(unboxed_closures)]` to the crate attributes to enable
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ error[E0658]: the precise format of `Fn`-family traits' type parameters is subje
|
|||
--> $DIR/unboxed-closure-sugar-not-used-on-fn.rs:3:17
|
||||
|
|
||||
LL | fn bar1(x: &dyn Fn<(), Output=()>) {
|
||||
| ^^ help: use parenthetical notation instead: `Fn() -> ()`
|
||||
| ^^^^^^^^^^^^^^^^^ help: use parenthetical notation instead: `Fn() -> ()`
|
||||
|
|
||||
= note: see issue #29625 <https://github.com/rust-lang/rust/issues/29625> for more information
|
||||
= help: add `#![feature(unboxed_closures)]` to the crate attributes to enable
|
||||
|
|
@ -11,7 +11,7 @@ error[E0658]: the precise format of `Fn`-family traits' type parameters is subje
|
|||
--> $DIR/unboxed-closure-sugar-not-used-on-fn.rs:7:28
|
||||
|
|
||||
LL | fn bar2<T>(x: &T) where T: Fn<()> {
|
||||
| ^^ help: use parenthetical notation instead: `Fn() -> ()`
|
||||
| ^^^^^^ help: use parenthetical notation instead: `Fn() -> ()`
|
||||
|
|
||||
= note: see issue #29625 <https://github.com/rust-lang/rust/issues/29625> for more information
|
||||
= help: add `#![feature(unboxed_closures)]` to the crate attributes to enable
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ error[E0107]: wrong number of lifetime arguments: expected 1, found 0
|
|||
--> $DIR/unboxed-closure-sugar-region.rs:30:51
|
||||
|
|
||||
LL | fn test2(x: &dyn Foo<(isize,),Output=()>, y: &dyn Foo(isize)) {
|
||||
| ^^^ expected 1 lifetime argument
|
||||
| ^^^^^^^^^^ expected 1 lifetime argument
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ error[E0107]: wrong number of type arguments: expected 3, found 1
|
|||
--> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters-3.rs:5:16
|
||||
|
|
||||
LL | fn foo(_: &dyn Three())
|
||||
| ^^^^^ expected 3 type arguments
|
||||
| ^^^^^^^ expected 3 type arguments
|
||||
|
||||
error[E0220]: associated type `Output` not found for `Three<(), [type error], [type error]>`
|
||||
--> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters-3.rs:5:16
|
||||
|
|
|
|||
|
|
@ -14,15 +14,24 @@ error[E0106]: missing lifetime specifier
|
|||
--> $DIR/underscore-lifetime-binders.rs:2:17
|
||||
|
|
||||
LL | struct Baz<'a>(&'_ &'a u8);
|
||||
| ^^ help: consider using the named lifetime: `'a`
|
||||
| ^^ expected named lifetime parameter
|
||||
|
|
||||
help: consider using the `'a` lifetime
|
||||
|
|
||||
LL | struct Baz<'a>(&'a &'a u8);
|
||||
| ^^
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/underscore-lifetime-binders.rs:10:33
|
||||
|
|
||||
LL | fn meh() -> Box<dyn for<'_> Meh<'_>>
|
||||
| ^^ help: consider giving it a 'static lifetime: `'static`
|
||||
| ^^ expected named lifetime parameter
|
||||
|
|
||||
= help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
|
||||
help: consider using the `'static` lifetime
|
||||
|
|
||||
LL | fn meh() -> Box<dyn for<'_> Meh<'static>>
|
||||
| ^^^^^^^
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/underscore-lifetime-binders.rs:16:35
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ LL | | }
|
|||
| |_- type parameter `A` must be specified for this
|
||||
...
|
||||
LL | let e = Bar::<usize>::lol();
|
||||
| ^^^ missing reference to `A`
|
||||
| ^^^^^^^^^^^^^^^^^ missing reference to `A`
|
||||
|
|
||||
= note: because of the default `Self` reference, type parameters must be specified on object types
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue