mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-30 10:45:18 +00:00
19 lines
267 B
Rust
19 lines
267 B
Rust
//@ run-pass
|
|
|
|
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());
|
|
}
|