Closed
Description
trait Tr1<T> {}
fn f<T>(_x: ~Tr1<T>) {}
trait Tr2 {}
impl Tr2 for ();
fn g(_x: ~Tr2:Send) {}
// fn h1<T>(_x: ~Tr1:Send<T>) {} // error: wrong number of type arguments: expected 1 but found 0
// (apparently the <T> parameterizes Send)
// fn h2<T>(_x: ~Tr1<T>:Send) {} // error: expected `,` but found `:`
fn main() {}
Seems like both generic parameters and kind bounds are individually okay on paths, but you can't have both right now.
The pretty printer would apparently happily emit the form in h1
's declaration, but it's not currently parsed (and possibly ambiguous if there's a context where instead of Send
there could be a user-defined trait with a legimitate parameter, not sure if that is possible).
The form in h2
seems somewhat sensible to me if we pretend that type parameters are part of individual path segments now but the kind bounds apply to the type as a whole, but of course the compiler isn't convinced.
Maybe I'm missing something. :)