Created
April 14, 2016 17:04
-
-
Save anonymous/dd7f96807ffb4518e92597c5267545dc to your computer and use it in GitHub Desktop.
Shared via Rust Playground
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![feature(trace_macros)] | |
trace_macros!(true); | |
macro_rules! wrap { | |
($n:expr) => (wrap!(S($n))) | |
} | |
macro_rules! wrap_nocrash { | |
($($n:tt)*) => (wrap_nocrash!(S($($n)*))) | |
} | |
macro_rules! nest2 { | |
($($n:tt)*) => (id!($($n)*)) | |
} | |
macro_rules! nest { | |
($n:expr) => (id_tt!($n)) | |
} | |
macro_rules! id { | |
($n:expr) => ($n) | |
} | |
macro_rules! id_tt { | |
($($n:tt)*) => (id!($($n)*)) | |
} | |
macro_rules! nest3 { | |
($n:expr) => (nest!(S($n))) | |
} | |
fn main() { | |
//wrap!(0); // Crashes | |
//wrap2!(0); // Doesn't crash | |
// nest! { S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(0))))))))))))))))))))))))) }; // Doesn't crash | |
//nest! { S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(0)))))))))))))))))))))))))) }; | |
nest3! { S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(0))))))))))))))))))))))))) }; | |
//id!{id! { S (S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(0)))))))))))))))))))))))))) ) }}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment