Created
April 6, 2016 13:04
-
-
Save anonymous/3eea892a079a1884849113e6892443d6 to your computer and use it in GitHub Desktop.
Shared via Rust Playground
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
macro_rules! foo { | |
($trait_:ident) => { foo! { $trait_<> } }; | |
($trait_:ident < $($args:ident),* $(,)* >) => { | |
impl $trait_ { | |
pub fn bar<T: $trait_<$($args)*>>(&self) {} | |
} | |
}; | |
} | |
trait Trait1 {} | |
trait Trait2<T> {} | |
foo!(Trait1); | |
foo!(Trait2<T>); // error: no rules expected the token `<` | |
fn main() {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment