Trait bounds in parameters
GregBowyer opened this issue · 1 comments
GregBowyer commented
Given this I get the following error:
error[E0277]: the trait bound `N: Spanned` is not satisfied
--> janus/thesius/sql_parser/src/grammar.rs:46:68
|
15 | fn spanned<N: Spanned>(n: N, start: usize, end: usize) -> N {
| ------- required by this bound in `grammar::spanned`
...
46 | = start:position!() node:x() end:position!() { spanned(node, start, end) }
| ^^^^ the trait `Spanned` is not implemented for `N`
|
help: consider restricting type parameter `N`
|
45 | rule SPAN<N: Spanned>(x: rule<N>) -> N
| ^^^^^^^^^
but adding the bound is not valid for rust-peg
error: expected one of ",", ">"
--> janus/thesius/sql_parser/src/grammar.rs:45:20
|
45 | rule SPAN<N: Spanned>(x: rule<N>) -> N
| ^
Thoughts on this?
kevinmehall commented
Fixed in 4b7dcaa