aboutsummaryrefslogtreecommitdiff
path: root/syntax/error.rs
diff options
context:
space:
mode:
Diffstat (limited to 'syntax/error.rs')
-rw-r--r--syntax/error.rs28
1 files changed, 15 insertions, 13 deletions
diff --git a/syntax/error.rs b/syntax/error.rs
index f40c4a8e..4487693c 100644
--- a/syntax/error.rs
+++ b/syntax/error.rs
@@ -1,9 +1,11 @@
use std::fmt::{self, Display};
#[derive(Copy, Clone)]
-pub struct Error {
+pub(crate) struct Error {
pub msg: &'static str,
+ #[allow(dead_code)] // only used by cxx-build, not cxxbridge-macro
pub label: Option<&'static str>,
+ #[allow(dead_code)] // only used by cxx-build, not cxxbridge-macro
pub note: Option<&'static str>,
}
@@ -13,7 +15,7 @@ impl Display for Error {
}
}
-pub static ERRORS: &[Error] = &[
+pub(crate) static ERRORS: &[Error] = &[
BOX_CXX_TYPE,
CXXBRIDGE_RESERVED,
CXX_STRING_BY_VALUE,
@@ -27,67 +29,67 @@ pub static ERRORS: &[Error] = &[
USE_NOT_ALLOWED,
];
-pub static BOX_CXX_TYPE: Error = Error {
+pub(crate) static BOX_CXX_TYPE: Error = Error {
msg: "Box of a C++ type is not supported yet",
label: None,
note: Some("hint: use UniquePtr<> or SharedPtr<>"),
};
-pub static CXXBRIDGE_RESERVED: Error = Error {
+pub(crate) static CXXBRIDGE_RESERVED: Error = Error {
msg: "identifiers starting with cxxbridge are reserved",
label: Some("reserved identifier"),
note: Some("identifiers starting with cxxbridge are reserved"),
};
-pub static CXX_STRING_BY_VALUE: Error = Error {
+pub(crate) static CXX_STRING_BY_VALUE: Error = Error {
msg: "C++ string by value is not supported",
label: None,
note: Some("hint: wrap it in a UniquePtr<>"),
};
-pub static CXX_TYPE_BY_VALUE: Error = Error {
+pub(crate) static CXX_TYPE_BY_VALUE: Error = Error {
msg: "C++ type by value is not supported",
label: None,
note: Some("hint: wrap it in a UniquePtr<> or SharedPtr<>"),
};
-pub static DISCRIMINANT_OVERFLOW: Error = Error {
+pub(crate) static DISCRIMINANT_OVERFLOW: Error = Error {
msg: "discriminant overflow on value after ",
label: Some("discriminant overflow"),
note: Some("note: explicitly set `= 0` if that is desired outcome"),
};
-pub static DOT_INCLUDE: Error = Error {
+pub(crate) static DOT_INCLUDE: Error = Error {
msg: "#include relative to `.` or `..` is not supported in Cargo builds",
label: Some("#include relative to `.` or `..` is not supported in Cargo builds"),
note: Some("note: use a path starting with the crate name"),
};
-pub static DOUBLE_UNDERSCORE: Error = Error {
+pub(crate) static DOUBLE_UNDERSCORE: Error = Error {
msg: "identifiers containing double underscore are reserved in C++",
label: Some("reserved identifier"),
note: Some("identifiers containing double underscore are reserved in C++"),
};
-pub static RESERVED_LIFETIME: Error = Error {
+pub(crate) static RESERVED_LIFETIME: Error = Error {
msg: "invalid lifetime parameter name: `'static`",
label: Some("'static is a reserved lifetime name"),
note: None,
};
-pub static RUST_TYPE_BY_VALUE: Error = Error {
+pub(crate) static RUST_TYPE_BY_VALUE: Error = Error {
msg: "opaque Rust type by value is not supported",
label: None,
note: Some("hint: wrap it in a Box<>"),
};
-pub static UNSUPPORTED_TYPE: Error = Error {
+pub(crate) static UNSUPPORTED_TYPE: Error = Error {
msg: "unsupported type: ",
label: Some("unsupported type"),
note: None,
};
-pub static USE_NOT_ALLOWED: Error = Error {
+pub(crate) static USE_NOT_ALLOWED: Error = Error {
msg: "`use` items are not allowed within cxx bridge",
label: Some("not allowed"),
note: Some(