diff options
| author | Pietro Albini <pietro@pietroalbini.org> | 2018-10-25 14:31:00 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-10-25 14:31:00 +0200 |
| commit | f81e47f85e539a01af95dba2e16c861058803e4d (patch) | |
| tree | b91c3f1f6d0a87812768a84a2da4d5a5ed38853c /src/libsyntax | |
| parent | 699f591a16181b6fa77411104ce609138dc5ce80 (diff) | |
| parent | c77a0cf5881e8e894d6fc15403cca002b9781d15 (diff) | |
| download | rust-f81e47f85e539a01af95dba2e16c861058803e4d.tar.gz rust-f81e47f85e539a01af95dba2e16c861058803e4d.zip | |
Rollup merge of #54977 - estebank:macro-arg-parse, r=pnkfelix
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>>;
}
```
Fix #25274.
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 87ade278c68..805aa9bef22 100644 --- a/src/libsyntax/ext/tt/macro_rules.rs +++ b/src/libsyntax/ext/tt/macro_rules.rs @@ -905,7 +905,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) }, |
