error

Function error 

Source
pub fn error(msg: &str)
Expand description

Displays an error on the terminal.

ยงThis error fails the build even if all the other steps finished successfully.
cargo_build::error("Fatal error during build process");

cargo_build::error("Fatal multi
line error
during build process");

See error! macro with compile-time checked formatting.

The error instruction tells Cargo to display an error after the build script has finished running, and then fail the build.

Note: Build script libraries should carefully consider if they want to use cargo::error versus returning a Result. It may be better to return a Result, and allow the caller to decide if the error is fatal or not. The caller can then decide whether or not to display the Err variant using cargo::error.

https://doc.rust-lang.org/cargo/reference/build-scripts.html#cargo-error