diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2013-01-22 16:00:07 -0800 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2013-01-23 14:46:24 -0800 |
| commit | 154488df1999e4c42f96ebaa6ee6c08be3f999a6 (patch) | |
| tree | a40399560573d6d8709fceae1bc2ffcc2df230c8 /src/libsyntax/ext | |
| parent | 54b2cad8b341434c7c0edb153a0fa662fb2981f1 (diff) | |
| download | rust-154488df1999e4c42f96ebaa6ee6c08be3f999a6.tar.gz rust-154488df1999e4c42f96ebaa6ee6c08be3f999a6.zip | |
libsyntax: Implement `assert` as a macro (called `fail_unless!` on a transitionary basis to avoid conflicting with the keyword right now). r=brson
Diffstat (limited to 'src/libsyntax/ext')
| -rw-r--r-- | src/libsyntax/ext/expand.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index 7c641b0e985..068b372c069 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -300,6 +300,14 @@ fn core_macros() -> ~str { ) ) + macro_rules! fail_unless( + ($cond:expr) => { + if !$cond { + die!(~\"assertion failed: \" + stringify!($cond)) + } + } + ) + macro_rules! condition ( { $c:ident: $in:ty -> $out:ty; } => { |
