Reputation: 64844
Several documents for Rust mention the fail! function as a way to abort execution with an error.
For example, chapter 27 of Rust By Example (accessed November 16, 2014) states:
The
fail!
macro can be used to generate a task failure and start unwinding its stack. While unwinding, the runtime will take care of freeing all the resources owned by the task by calling the destructor of all its objects.
However when I try to use this in my own code I get the following error:
error: macro undefined: 'fail!'
You can click "Run" on the example on the "Rust By Example" page to reproduce for yourself.
What took the place of fail in the Rust standard library?
Upvotes: 16
Views: 4367
Reputation: 1120
It has been renamed to panic!
, see Issue 17489 and the nightly doc
Upvotes: 22