mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 14:54:47 +00:00
Static assertions that certain types implement Copy
This commit is contained in:
parent
188bd33f1f
commit
435781aa5b
2 changed files with 11 additions and 0 deletions
|
@ -2134,6 +2134,9 @@ roc_error_macros::assert_sizeof_aarch64!((Variable, Option<Lowercase>), 4 * 8);
|
|||
roc_error_macros::assert_sizeof_wasm!((Variable, Option<Lowercase>), 4 * 4);
|
||||
roc_error_macros::assert_sizeof_default!((Variable, Option<Lowercase>), 4 * 8);
|
||||
|
||||
roc_error_macros::assert_copyable!(Content);
|
||||
roc_error_macros::assert_copyable!(Descriptor);
|
||||
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
pub enum Content {
|
||||
/// A type variable which the user did not name in an annotation,
|
||||
|
|
|
@ -66,6 +66,14 @@ macro_rules! assert_sizeof_all {
|
|||
};
|
||||
}
|
||||
|
||||
/// Assert that a type has `Copy`
|
||||
#[macro_export]
|
||||
macro_rules! assert_copyable {
|
||||
($t: ty) => {
|
||||
static_assertions::assert_impl_all!($t: Copy);
|
||||
};
|
||||
}
|
||||
|
||||
// LARGE SCALE PROJECTS
|
||||
//
|
||||
// This section is for "todo!"-style macros enabled in sections where large-scale changes to the
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue