Suggest 'static when in static/const items.

This commit is contained in:
Camille GILLOT 2022-06-05 09:59:26 +02:00
parent af8739b96e
commit f71ad2f992
4 changed files with 35 additions and 11 deletions

View file

@ -11,7 +11,7 @@ LL | type Assoc<'a> where Self: 'a;
| ^^^^^ --
help: add missing lifetime argument
|
LL | fn g(&self) -> Self::Assoc<'_>;
LL | fn g(&self) -> Self::Assoc<'a>;
| ~~~~~~~~~
error[E0107]: missing generics for associated type `Trait::Assoc`
@ -27,7 +27,7 @@ LL | type Assoc<'a> where Self: 'a;
| ^^^^^ --
help: add missing lifetime argument
|
LL | fn g(&self) -> Self::Assoc<'_> {
LL | fn g(&self) -> Self::Assoc<'a> {
| ~~~~~~~~~
error: aborting due to 2 previous errors

View file

@ -11,7 +11,7 @@ LL | type Item<'a>;
| ^^^^ --
help: add missing lifetime argument
|
LL | fn next(&mut self) -> Option<Self::Item<'_>>;
LL | fn next(&mut self) -> Option<Self::Item<'a>>;
| ~~~~~~~~
error: aborting due to previous error

View file

@ -171,8 +171,8 @@ LL | pub union Qux<'t, 'k, I> {
| ^^^ -- --
help: add missing lifetime argument
|
LL | static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, '_, i32>>>>> = RefCell::new(HashMap::new());
| ++++
LL | static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, 'static, i32>>>>> = RefCell::new(HashMap::new());
| +++++++++
error[E0107]: this union takes 2 lifetime arguments but 1 lifetime argument was supplied
--> $DIR/missing-lifetime-specifier.rs:43:44
@ -243,8 +243,8 @@ LL | pub union Qux<'t, 'k, I> {
| ^^^ -- --
help: add missing lifetime argument
|
LL | static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, '_, i32>>>>> = RefCell::new(HashMap::new());
| ++++
LL | static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, 'static, i32>>>>> = RefCell::new(HashMap::new());
| +++++++++
error[E0107]: this trait takes 2 lifetime arguments but 1 lifetime argument was supplied
--> $DIR/missing-lifetime-specifier.rs:51:45
@ -261,8 +261,8 @@ LL | trait Tar<'t, 'k, I> {}
| ^^^ -- --
help: add missing lifetime argument
|
LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, '_, i32>>>>> = RefCell::new(HashMap::new());
| ++++
LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, 'static, i32>>>>> = RefCell::new(HashMap::new());
| +++++++++
error[E0106]: missing lifetime specifier
--> $DIR/missing-lifetime-specifier.rs:51:44
@ -360,8 +360,8 @@ LL | trait Tar<'t, 'k, I> {}
| ^^^ -- --
help: add missing lifetime argument
|
LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, '_, i32>>>>> = RefCell::new(HashMap::new());
| ++++
LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, 'static, i32>>>>> = RefCell::new(HashMap::new());
| +++++++++
error: aborting due to 24 previous errors