Closed
Description
Using ty
followed by >>
doesn't work in a macro but it does works when followed by > >
instead. This seems very like one of the old C++03 template issues.
Using >>
: http://is.gd/KTICUL
macro_rules! test {
(
fn fun() -> Option<Box<$t:ty>>;
) => {
fn fun(x: $t) -> Option<Box<$t>>
{ Some(Box::new(x)) }
}
}
test! {
fn fun() -> Option<Box<i32>>;
}
fn main() {
fun(0).unwrap();
}
Gives
<anon>:4:32: 4:37 error: `$t:ty` is followed by `>>`, which is not allowed for `ty` fragments
<anon>:4 fn fun() -> Option<Box<$t:ty>>;
^~~~~
Using > >
instead of >>
fixes it: http://is.gd/gSD3MR
Meta
All the tests were conducted on the playpen using the nightly and beta option (no difference) so I'm not sure about the version but the issue also happens on my local installation rustc 1.0.0-beta.3 (5241bf9c3 2015-04-25) (built 2015-04-25)
(yep a bit outdated but cba to update eh).