diff options
Diffstat (limited to 'compiler/stable_mir/src/error.rs')
| -rw-r--r-- | compiler/stable_mir/src/error.rs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/compiler/stable_mir/src/error.rs b/compiler/stable_mir/src/error.rs index 19910691456..1ff65717e87 100644 --- a/compiler/stable_mir/src/error.rs +++ b/compiler/stable_mir/src/error.rs @@ -8,6 +8,11 @@ use std::convert::From; use std::fmt::{Debug, Display, Formatter}; use std::{error, fmt}; +macro_rules! error { + ($fmt: literal $(,)?) => { Error(format!($fmt)) }; + ($fmt: literal, $($arg:tt)*) => { Error(format!($fmt, $($arg:tt)*)) }; + } + /// An error type used to represent an error that has already been reported by the compiler. #[derive(Clone, Copy, PartialEq, Eq)] pub enum CompilerError<T> { @@ -24,10 +29,10 @@ pub enum CompilerError<T> { /// A generic error to represent an API request that cannot be fulfilled. #[derive(Debug)] -pub struct Error(String); +pub struct Error(pub(crate) String); impl Error { - pub(crate) fn new(msg: String) -> Self { + pub fn new(msg: String) -> Self { Self(msg) } } |
