2014-11-17 47 views
12

Rust的幾個文件提到失敗!函數作爲用錯誤中止執行的一種方式。生鏽:錯誤:宏未定義:'失敗!'

例如,chapter 27 of Rust By Example(訪問2014年11月16日)指出:

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.

然而,當我嘗試在自己的代碼中使用此我得到以下錯誤:

error: macro undefined: 'fail!' 

你可以點擊「Rust By Example」頁面上的「Run」來自行重現。

什麼取代了鏽標準庫中的失敗的地方?

+0

[問題日提交](https://github.com/japaric/rust-by-example/pull/274) – Manishearth

回答

相關問題