1
Fork 0

Made fail! and assert! accept both &'static str and ~str, as well as a fmt! like format list.

Unwinding through macros now happens as a call to the trait function `FailWithCause::fail_with()`, which consumes self, allowing to use a more generic failure object in the future.
This commit is contained in:
Marvin Löbel 2013-04-23 22:30:58 +02:00
parent 1d53babd2f
commit e1be9ae224
9 changed files with 90 additions and 26 deletions

View file

@ -474,11 +474,12 @@ pub fn mk_unreachable(cx: @ext_ctxt, span: span) -> @ast::expr {
~[
cx.ident_of(~"core"),
cx.ident_of(~"sys"),
cx.ident_of(~"begin_unwind"),
cx.ident_of(~"FailWithCause"),
cx.ident_of(~"fail_with"),
],
~[
mk_uniq_str(cx, span, ~"internal error: entered unreachable code"),
mk_uniq_str(cx, span, loc.file.name),
mk_base_str(cx, span, ~"internal error: entered unreachable code"),
mk_base_str(cx, span, loc.file.name),
mk_uint(cx, span, loc.line),
]
)