We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
SmirError
1 parent dfab0df commit 870826cCopy full SHA for 870826c
compiler/rustc_smir/src/stable_mir/error.rs
@@ -7,6 +7,10 @@
7
use std::fmt::{Debug, Display, Formatter};
8
use std::{fmt, io};
9
10
+use rustc_smir::SmirError;
11
+
12
+use crate::rustc_smir;
13
14
macro_rules! error {
15
($fmt: literal $(,)?) => { Error(format!($fmt)) };
16
($fmt: literal, $($arg:tt)*) => { Error(format!($fmt, $($arg)*)) };
@@ -30,10 +34,14 @@ pub enum CompilerError<T> {
30
34
#[derive(Clone, Debug, Eq, PartialEq)]
31
35
pub struct Error(pub(crate) String);
32
36
33
-impl Error {
- pub fn new(msg: String) -> Self {
37
+impl SmirError for Error {
38
+ fn new(msg: String) -> Self {
39
Self(msg)
40
}
41
42
+ fn from_internal<T: Debug>(err: T) -> Self {
43
+ Self(format!("{err:?}"))
44
+ }
45
46
47
impl From<&str> for Error {
0 commit comments