-
-
Save anka-213/7d2a946b6fe1d31b9cbd48c09e53bf0f 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