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.
This commit is contained in:
commit
f81e47f85e
2 changed files with 18 additions and 1 deletions
16
src/test/run-pass/macros/issue-25274.rs
Normal file
16
src/test/run-pass/macros/issue-25274.rs
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
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() {
|
||||
println!("{}", fun(0).unwrap());
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue