diff options
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ext/quote.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/libsyntax/ext/quote.rs b/src/libsyntax/ext/quote.rs index 696d62838ba..0eab9a90b95 100644 --- a/src/libsyntax/ext/quote.rs +++ b/src/libsyntax/ext/quote.rs @@ -67,6 +67,15 @@ pub mod rt { } } + impl<T: ToTokens> ToTokens for Option<T> { + fn to_tokens(&self, cx: &ExtCtxt) -> Vec<TokenTree> { + match self { + &Some(ref t) => t.to_tokens(cx), + &None => Vec::new(), + } + } + } + /* Should be (when bugs in default methods are fixed): trait ToSource : ToTokens { |
