Closed
Description
I tried this almost-correct code: Playground
fn foo<'a>(_: impl 'a Sized) {}
The current output is:
Compiling playground v0.0.1 (/playground)
error: expected one of `:`, `@`, or `|`, found `)`
--> src/lib.rs:1:28
|
1 | fn foo<'a>(_: impl 'a Sized) {}
| ^ expected one of `:`, `@`, or `|`
|
= note: anonymous parameters are removed in the 2018 edition (see RFC 1685)
help: if this is a parameter name, give it a type
|
1 | fn foo<'a>(_: impl 'a Sized: TypeName) {}
| ++++++++++
help: if this is a type, explicitly ignore the parameter name
|
1 | fn foo<'a>(_: impl 'a _: Sized) {}
| ++
error: expected one of `)`, `+`, or `,`, found `Sized`
--> src/lib.rs:1:23
|
1 | fn foo<'a>(_: impl 'a Sized) {}
| -^^^^^ expected one of `)`, `+`, or `,`
| |
| help: missing `,`
error: at least one trait must be specified
--> src/lib.rs:1:15
|
1 | fn foo<'a>(_: impl 'a Sized) {}
| ^^^^^^^
error: could not compile `playground` due to 3 previous errors
Ideally the output should look like:
Compiling playground v0.0.1 (/playground)
error: expected `+` between lifetime and trait
--> src/lib.rs:1:22
|
1 | fn foo<'a>(_: impl 'a + Sized) {}
| ^
| |
| help: missing `+`
|
error: could not compile `playground` due to 1 previous errors