syn icon indicating copy to clipboard operation
syn copied to clipboard

Consider parsing `impl 'a` or `impl` as a type

Open dtolnay opened this issue 2 years ago • 0 comments

Rustc considers this code syntactically valid, it's only a later stage of compilation that reports an error. Syn does not currently permit these.

#[cfg(any())]
fn f(_: impl 'static, _: impl) {}
error: at least one trait must be specified
 --> src/main.rs:2:9
  |
2 | fn f(_: impl 'static, _: impl) {}
  |         ^^^^^^^^^^^^

error: at least one trait must be specified
 --> src/main.rs:2:26
  |
2 | fn f(_: impl 'static, _: impl) {}
  |                          ^^^^

dtolnay avatar Sep 25 '22 02:09 dtolnay