diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2018-10-10 16:54:17 -0700 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2018-10-10 16:54:17 -0700 |
| commit | c77a0cf5881e8e894d6fc15403cca002b9781d15 (patch) | |
| tree | 41d96ec097480772c8c802da3dee05bdf4fa5906 /src/libsyntax | |
| parent | e1041c6cd1a027ab3ada3e8538620d2e1d7067fe (diff) | |
| download | rust-c77a0cf5881e8e894d6fc15403cca002b9781d15.tar.gz rust-c77a0cf5881e8e894d6fc15403cca002b9781d15.zip | |
Accept `Option<Box<$t:ty>>` in macro argument
Given the following code, compile successfuly:
```
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>>;
}
```
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ext/tt/macro_rules.rs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs index 214bc9cffc4..07d9bdb03ad 100644 --- a/src/libsyntax/ext/tt/macro_rules.rs +++ b/src/libsyntax/ext/tt/macro_rules.rs @@ -902,7 +902,8 @@ fn is_in_follow(tok: "ed::TokenTree, frag: &str) -> Result<bool, (String, &' "path" | "ty" => match *tok { TokenTree::Token(_, ref tok) => match *tok { OpenDelim(token::DelimToken::Brace) | OpenDelim(token::DelimToken::Bracket) | - Comma | FatArrow | Colon | Eq | Gt | Semi | BinOp(token::Or) => Ok(true), + Comma | FatArrow | Colon | Eq | Gt | BinOp(token::Shr) | Semi | + BinOp(token::Or) => Ok(true), Ident(i, false) if i.name == "as" || i.name == "where" => Ok(true), _ => Ok(false) }, |
