mirror of
https://github.com/Lokathor/bytemuck.git
synced 2024-11-21 22:32:23 +00:00
Make AnyBitPattern
derive work for generic structs (#101)
* Allow generic structs to use `AnyBitPattern` derive. * Attempt to nudge the CI into retrying.
This commit is contained in:
parent
b41f4cc1af
commit
8391afa876
@ -155,9 +155,9 @@ struct CheckedBitPatternStruct {
|
|||||||
|
|
||||||
#[derive(Debug, Copy, Clone, AnyBitPattern, PartialEq, Eq)]
|
#[derive(Debug, Copy, Clone, AnyBitPattern, PartialEq, Eq)]
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
struct AnyBitPatternTest {
|
struct AnyBitPatternTest<A: AnyBitPattern, B: AnyBitPattern> {
|
||||||
a: u16,
|
a: A,
|
||||||
b: u16,
|
b: B,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// ```compile_fail
|
/// ```compile_fail
|
||||||
@ -259,8 +259,8 @@ fn passes_cast_struct() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn anybitpattern_implies_zeroable() {
|
fn anybitpattern_implies_zeroable() {
|
||||||
let test = AnyBitPatternTest::zeroed();
|
let test = AnyBitPatternTest::<isize, usize>::zeroed();
|
||||||
assert_eq!(test, AnyBitPatternTest { a: 0, b: 0 });
|
assert_eq!(test, AnyBitPatternTest { a: 0isize, b: 0usize });
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
Loading…
Reference in New Issue
Block a user