diff --git a/assembly/src/assembler/mod.rs b/assembly/src/assembler/mod.rs index 7c56c8072b..b6bb051d30 100644 --- a/assembly/src/assembler/mod.rs +++ b/assembly/src/assembler/mod.rs @@ -766,8 +766,9 @@ impl Assembler { context, mast_forest_builder, )? { - if let Some(basic_block_id) = - basic_block_builder.make_basic_block(mast_forest_builder)? + if let Some(basic_block_id) = basic_block_builder + .make_basic_block(mast_forest_builder) + .map_err(AssemblyError::from)? { mast_node_ids.push(basic_block_id); } @@ -779,8 +780,9 @@ impl Assembler { Op::If { then_blk, else_blk, .. } => { - if let Some(basic_block_id) = - basic_block_builder.make_basic_block(mast_forest_builder)? + if let Some(basic_block_id) = basic_block_builder + .make_basic_block(mast_forest_builder) + .map_err(AssemblyError::from)? { mast_node_ids.push(basic_block_id); } @@ -794,14 +796,15 @@ impl Assembler { let split_node = MastNode::new_split(then_blk, else_blk, mast_forest_builder.forest()); - mast_forest_builder.ensure_node(split_node)? + mast_forest_builder.ensure_node(split_node).map_err(AssemblyError::from)? }; mast_node_ids.push(split_node_id); } Op::Repeat { count, body, .. } => { - if let Some(basic_block_id) = - basic_block_builder.make_basic_block(mast_forest_builder)? + if let Some(basic_block_id) = basic_block_builder + .make_basic_block(mast_forest_builder) + .map_err(AssemblyError::from)? { mast_node_ids.push(basic_block_id); } @@ -815,8 +818,9 @@ impl Assembler { } Op::While { body, .. } => { - if let Some(basic_block_id) = - basic_block_builder.make_basic_block(mast_forest_builder)? + if let Some(basic_block_id) = basic_block_builder + .make_basic_block(mast_forest_builder) + .map_err(AssemblyError::from)? { mast_node_ids.push(basic_block_id); } @@ -827,22 +831,23 @@ impl Assembler { let loop_node_id = { let loop_node = MastNode::new_loop(loop_body_node_id, mast_forest_builder.forest()); - mast_forest_builder.ensure_node(loop_node)? + mast_forest_builder.ensure_node(loop_node).map_err(AssemblyError::from)? }; mast_node_ids.push(loop_node_id); } } } - if let Some(basic_block_id) = - basic_block_builder.try_into_basic_block(mast_forest_builder)? + if let Some(basic_block_id) = basic_block_builder + .try_into_basic_block(mast_forest_builder) + .map_err(AssemblyError::from)? { mast_node_ids.push(basic_block_id); } Ok(if mast_node_ids.is_empty() { let basic_block_node = MastNode::new_basic_block(vec![Operation::Noop]); - mast_forest_builder.ensure_node(basic_block_node)? + mast_forest_builder.ensure_node(basic_block_node).map_err(AssemblyError::from)? } else { combine_mast_node_ids(mast_node_ids, mast_forest_builder)? }) diff --git a/assembly/src/errors.rs b/assembly/src/errors.rs index 97207f782f..648fd851ef 100644 --- a/assembly/src/errors.rs +++ b/assembly/src/errors.rs @@ -137,7 +137,6 @@ pub enum AssemblyError { #[diagnostic(transparent)] Other(#[from] RelatedError), #[error(transparent)] - #[diagnostic(transparent)] Forest(#[from] MastForestError), } diff --git a/core/Cargo.toml b/core/Cargo.toml index c3c52d0b6e..d35bcf0ca7 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -31,10 +31,6 @@ std = [ math = { package = "winter-math", version = "0.9", default-features = false } miden-crypto = { git = "https://github.com/0xPolygonMiden/crypto", branch = "next", default-features = false } miden-formatting = { version = "0.1", default-features = false } -miette = { version = "7.1.0", git = "https://github.com/bitwalker/miette", branch = "no-std", default-features = false, features = [ - "fancy-no-syscall", - "derive", -] } num-derive = { version = "0.4", default-features = false } num-traits = { version = "0.2", default-features = false } thiserror = { version = "1.0", git = "https://github.com/bitwalker/thiserror", branch = "no-std", default-features = false } diff --git a/core/src/mast/mod.rs b/core/src/mast/mod.rs index 7869b3897c..b997c9f051 100644 --- a/core/src/mast/mod.rs +++ b/core/src/mast/mod.rs @@ -2,7 +2,6 @@ use core::{fmt, ops::Index}; use alloc::vec::Vec; use miden_crypto::hash::rpo::RpoDigest; -use miette::Diagnostic; mod node; pub use node::{ @@ -79,7 +78,7 @@ impl Deserializable for MastNodeId { // ================================================================================================ /// Represents the types of errors that can occur when dealing with MAST forest. -#[derive(Debug, thiserror::Error, Diagnostic)] +#[derive(Debug, thiserror::Error)] pub enum MastForestError { #[error( "invalid node count: MAST forest exceeds the maximum of {} nodes",