Require documentation on cretonne public items.

This commit is contained in:
Jakob Stoklund Olesen
2016-10-26 18:41:39 -07:00
parent e2418c6ec9
commit 80823b5fc4
16 changed files with 124 additions and 44 deletions

View File

@@ -61,7 +61,9 @@ use std::result;
/// A verifier error.
#[derive(Debug, PartialEq, Eq)]
pub struct Error {
/// The entity causing the verifier error.
pub location: AnyEntity,
/// Error message.
pub message: String,
}
@@ -71,6 +73,7 @@ impl Display for Error {
}
}
/// Verifier result.
pub type Result<T> = result::Result<T, Error>;
// Create an `Err` variant of `Result<X>` from a location and `format!` args.
@@ -90,11 +93,12 @@ macro_rules! err {
};
}
/// Verify `func`.
pub fn verify_function(func: &Function) -> Result<()> {
Verifier::new(func).run()
}
pub struct Verifier<'a> {
struct Verifier<'a> {
func: &'a Function,
}
@@ -165,7 +169,7 @@ impl<'a> Verifier<'a> {
#[cfg(test)]
mod tests {
use super::*;
use super::{Verifier, Error};
use ir::Function;
use ir::instructions::{InstructionData, Opcode};
use ir::types;