miden-assembly-syntax 0.22.1

Parsing and semantic analysis of the Miden Assembly language
Documentation
use alloc::sync::Arc;

use miden_core::program::KernelError;

use crate::{
    ast::Path,
    diagnostics::{Diagnostic, miette},
};

#[derive(Debug, thiserror::Error, Diagnostic)]
pub enum LibraryError {
    #[error("library must contain at least one exported procedure")]
    #[diagnostic()]
    NoExport,
    #[error("invalid export in kernel library: {procedure_path}")]
    InvalidKernelExport { procedure_path: Arc<Path> },
    // Technically KernelError is the source error here, but since LibraryError is sometimes
    // converted into a Report and that doesn't implement core::error::Error, treating
    // KernelError as a source error would effectively swallow it, so we include it in the
    // error message instead.
    #[error("failed to convert library into kernel library: {0}")]
    KernelConversion(KernelError),
    #[error("invalid export: no procedure root for {procedure_path} procedure")]
    NoProcedureRootForExport { procedure_path: Arc<Path> },
}