Avoid repeating the underlined type in the label
diff --git a/syntax/check.rs b/syntax/check.rs
index ced1570..25183c9 100644
--- a/syntax/check.rs
+++ b/syntax/check.rs
@@ -67,7 +67,8 @@
&& !cx.types.cxx.contains(ident)
&& !cx.types.rust.contains(ident)
{
- cx.error(ident, &format!("unsupported type: {}", ident));
+ let msg = format!("unsupported type: {}", ident);
+ cx.error(ident, &msg);
}
}
diff --git a/syntax/error.rs b/syntax/error.rs
index a60b7da..2749277 100644
--- a/syntax/error.rs
+++ b/syntax/error.rs
@@ -21,6 +21,7 @@
DISCRIMINANT_OVERFLOW,
DOUBLE_UNDERSCORE,
RUST_TYPE_BY_VALUE,
+ UNSUPPORTED_TYPE,
USE_NOT_ALLOWED,
];
@@ -66,6 +67,12 @@
note: Some("hint: wrap it in a Box<>"),
};
+pub static UNSUPPORTED_TYPE: Error = Error {
+ msg: "unsupported type: ",
+ label: Some("unsupported type"),
+ note: None,
+};
+
pub static USE_NOT_ALLOWED: Error = Error {
msg: "`use` items are not allowed within cxx bridge",
label: Some("not allowed"),