Static assertions that certain types implement Copy

This commit is contained in:
Ayaz Hafiz 2022-04-21 09:19:33 -04:00
parent 188bd33f1f
commit 435781aa5b
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
2 changed files with 11 additions and 0 deletions

View file

@ -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,

View file

@ -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