mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-23 23:51:48 +00:00
Rust: Fix Copy and Clone impls for a few generic types (#5577)
* Rust: Fix Copy and Clone impls for a few generic types * Add tests for Copy+Clone * Wrap Copy+Clone checks in a #[test] function
This commit is contained in:
committed by
Robert Winslow
parent
26f238c248
commit
b4774d2354
@@ -19,6 +19,7 @@ path = "bin/alloc_check.rs"
|
||||
quickcheck = "0.6"
|
||||
# TODO(rw): look into moving to criterion.rs
|
||||
bencher = "0.1.5"
|
||||
static_assertions = "1.0.0"
|
||||
|
||||
[[bench]]
|
||||
# setup for bencher
|
||||
|
||||
@@ -2694,6 +2694,21 @@ mod byte_layouts {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod copy_clone_traits {
|
||||
#[test]
|
||||
fn follow_types_implement_copy_and_clone() {
|
||||
static_assertions::assert_impl_all!(flatbuffers::WIPOffset<u32>: Copy, Clone);
|
||||
static_assertions::assert_impl_all!(flatbuffers::WIPOffset<Vec<u32>>: Copy, Clone);
|
||||
|
||||
static_assertions::assert_impl_all!(flatbuffers::ForwardsUOffset<u32>: Copy, Clone);
|
||||
static_assertions::assert_impl_all!(flatbuffers::ForwardsUOffset<Vec<u32>>: Copy, Clone);
|
||||
|
||||
static_assertions::assert_impl_all!(flatbuffers::Vector<'static, u32>: Copy, Clone);
|
||||
static_assertions::assert_impl_all!(flatbuffers::Vector<'static, Vec<u32>>: Copy, Clone);
|
||||
}
|
||||
}
|
||||
|
||||
// this is not technically a test, but we want to always keep this generated
|
||||
// file up-to-date, and the simplest way to do that is to make sure that when
|
||||
// tests are run, the file is generated.
|
||||
|
||||
Reference in New Issue
Block a user