pub struct Entry<'a, K, V> {
k: &'a mut K,
v: V,
}
pub fn entry<'a, K, V>() -> Entry<'a: 'static, K, V> {
unimplemented!()
}
error: expected one of `,` or `>`, found `:`
--> src/lib.rs:6:37
|
6 | pub fn entry<'a, K, V>() -> Entry<'a: 'static, K, V> {
| ^ expected one of `,` or `>`
|
help: expressions must be enclosed in braces to be used as const generic arguments
|
6 | pub fn entry<'a, K, V>() -> Entry<{ 'a: 'static }, K, V> {
| + +
[E0106]: missing lifetime specifier
--> src/lib.rs:6:35
|
6 | pub fn entry<'a, K, V>() -> Entry<'a: 'static, K, V> {
| ^ 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 `'a` lifetime
|
6 | pub fn entry<'a, K, V>() -> Entry<'a, 'a: 'static, K, V> {
| +++
[E0107]: this struct takes 2 generic arguments but 3 generic arguments were supplied
--> src/lib.rs:6:29
|
6 | pub fn entry<'a, K, V>() -> Entry<'a: 'static, K, V> {
| ^^^^^ - help: remove this generic argument
| |
| expected 2 generic arguments
|
note: struct defined here, with 2 generic parameters: `K`, `V`
--> src/lib.rs:1:12
|
1 | pub struct Entry<'a, K, V> {
| ^^^^^ - -
Some errors have detailed explanations: E0106, E0107.
For more information about an error, try `rustc --explain E0106`.
Given the following code: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=4f89aeb79b3d5b09db11201a04b0786e
The current output is:
The
:and=suggestions are misleading, because this is a generic invocation, not a generic declaration. You cannot, in fact, write a:or an=here:When you write a
:This code:
Produces this output: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=fe71e2beefbe699e32f4d2c91dfb9b4e
When you write an
=This code:
Produces this output: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=4eb1f410e20dd4e36879637261f0d859