Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

rust: error: macro undefined: 'fail!'

Tags:

rust

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?

like image 936
Kevin Burke Avatar asked Nov 17 '14 03:11

Kevin Burke


1 Answers

It has been renamed to panic!, see Issue 17489 and the nightly doc

like image 98
Windor C Avatar answered Oct 22 '22 14:10

Windor C