Skip to content

Commit dbc5377

Browse files
committed
Avoid repeating the underlined type in the label
1 parent cca5215 commit dbc5377

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

syntax/check.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ fn check_type_ident(cx: &mut Check, ident: &Ident) {
6767
&& !cx.types.cxx.contains(ident)
6868
&& !cx.types.rust.contains(ident)
6969
{
70-
cx.error(ident, &format!("unsupported type: {}", ident));
70+
let msg = format!("unsupported type: {}", ident);
71+
cx.error(ident, &msg);
7172
}
7273
}
7374

syntax/error.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ pub static ERRORS: &[Error] = &[
2121
DISCRIMINANT_OVERFLOW,
2222
DOUBLE_UNDERSCORE,
2323
RUST_TYPE_BY_VALUE,
24+
UNSUPPORTED_TYPE,
2425
USE_NOT_ALLOWED,
2526
];
2627

@@ -66,6 +67,12 @@ pub static RUST_TYPE_BY_VALUE: Error = Error {
6667
note: Some("hint: wrap it in a Box<>"),
6768
};
6869

70+
pub static UNSUPPORTED_TYPE: Error = Error {
71+
msg: "unsupported type: ",
72+
label: Some("unsupported type"),
73+
note: None,
74+
};
75+
6976
pub static USE_NOT_ALLOWED: Error = Error {
7077
msg: "`use` items are not allowed within cxx bridge",
7178
label: Some("not allowed"),

0 commit comments

Comments
 (0)