Skip to content

Commit 7b14585

Browse files
authored
Merge pull request #377 from dtolnay/unsupported-type
Include typename in diagnostic on unsupported type
2 parents 353d98c + dbc5377 commit 7b14585

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, "unsupported type");
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
@@ -22,6 +22,7 @@ pub static ERRORS: &[Error] = &[
2222
DOT_INCLUDE,
2323
DOUBLE_UNDERSCORE,
2424
RUST_TYPE_BY_VALUE,
25+
UNSUPPORTED_TYPE,
2526
USE_NOT_ALLOWED,
2627
];
2728

@@ -73,6 +74,12 @@ pub static RUST_TYPE_BY_VALUE: Error = Error {
7374
note: Some("hint: wrap it in a Box<>"),
7475
};
7576

77+
pub static UNSUPPORTED_TYPE: Error = Error {
78+
msg: "unsupported type: ",
79+
label: Some("unsupported type"),
80+
note: None,
81+
};
82+
7683
pub static USE_NOT_ALLOWED: Error = Error {
7784
msg: "`use` items are not allowed within cxx bridge",
7885
label: Some("not allowed"),

0 commit comments

Comments
 (0)