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:
parent
1d53babd2f
commit
e1be9ae224
9 changed files with 90 additions and 26 deletions
|
@ -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),
|
||||
]
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue