Files
wasmtime/lib/codegen/src/result.rs
Dan Gohman 6b88cd44a8 Update to rustfmt-preview (#348)
* Update to rustfmt-preview.

* Run "cargo fmt --all" with rustfmt 0.4.1.

rustfmt 0.4.1 is the latest release of rustfmt-preview available on the
stable channel.

* Fix a long line that rustfmt 0.4.1 can't handle.

* Remove unneeded commas left behind by rustfmt.
2018-05-25 11:38:38 -07:00

42 lines
1.4 KiB
Rust

//! Result and error types representing the outcome of compiling a function.
use verifier;
/// A compilation error.
///
/// When Cretonne fails to compile a function, it will return one of these error codes.
#[derive(Fail, Debug, PartialEq, Eq)]
pub enum CtonError {
/// An IR verifier error.
///
/// This always represents a bug, either in the code that generated IR for Cretonne, or a bug
/// in Cretonne itself.
#[fail(display = "Verifier error: {}", _0)]
Verifier(#[cause] verifier::Error),
/// An implementation limit was exceeded.
///
/// Cretonne can compile very large and complicated functions, but the [implementation has
/// limits][limits] that cause compilation to fail when they are exceeded.
///
/// [limits]: https://cretonne.readthedocs.io/en/latest/langref.html#implementation-limits
#[fail(display = "Implementation limit exceeded")]
ImplLimitExceeded,
/// The code size for the function is too large.
///
/// Different target ISAs may impose a limit on the size of a compiled function. If that limit
/// is exceeded, compilation fails.
#[fail(display = "Code for function is too large")]
CodeTooLarge,
}
/// A Cretonne compilation result.
pub type CtonResult = Result<(), CtonError>;
impl From<verifier::Error> for CtonError {
fn from(e: verifier::Error) -> Self {
CtonError::Verifier(e)
}
}