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?
It has been renamed to panic!
, see Issue 17489 and the nightly doc
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With