@@ -1077,20 +1077,83 @@ def layout.primitive_checks.check_empty_layout
10771077native_models def FromZeros.new_zeroed.default (Self : Type) : Result Self := do
10781078 core.mem.zeroed Self
10791079
1080+ /-- [ zerocopy::trait_checks::unaligned_alignment ] :
1081+ Source: 'src/trait_checks.rs', lines 25:0-27:1 -/
1082+ def trait_checks.unaligned_alignment
1083+ {T : Type} (UnalignedInst : Unaligned T) : Result Std.Usize := do
1084+ core.mem.align_of T
1085+
1086+ /-- [ zerocopy::trait_checks::check_unaligned ] :
1087+ Source: 'src/trait_checks.rs', lines 35:0-37:1 -/
1088+ def trait_checks.check_unaligned
1089+ {T : Type} (UnalignedInst : Unaligned T) : Result Unit := do
1090+ let i ← trait_checks.unaligned_alignment UnalignedInst
1091+ massert (i = 1#usize)
1092+
1093+ /-- [ zerocopy::trait_checks::unused_unaligned_bound ] :
1094+ Source: 'src/trait_checks.rs', lines 48:0-50:1 -/
1095+ def trait_checks.unused_unaligned_bound
1096+ {T : Type} (UnalignedInst : Unaligned T) (value : Std.Usize) :
1097+ Result Std.Usize
1098+ := do
1099+ ok value
1100+
1101+ /-- [zerocopy::impls::_#1::{impl zerocopy::Unaligned for u8}::only_derive_is_allowed_to_implement_this_trait]:
1102+ Source: 'src/util/macros.rs', lines 165:8-165:62
1103+ Visibility: public -/
1104+ def U8.Insts.ZerocopyUnaligned.only_derive_is_allowed_to_implement_this_trait
1105+ : Result Unit := do
1106+ ok ()
1107+
1108+ /-- Trait implementation: [zerocopy::impls::_#1::{impl zerocopy::Unaligned for u8}]
1109+ Source: 'src/util/macros.rs', lines 30:8-32:9 -/
1110+ @[ reducible ]
1111+ def U8.Insts.ZerocopyUnaligned : Unaligned Std.U8 := {
1112+ only_derive_is_allowed_to_implement_this_trait :=
1113+ U8.Insts.ZerocopyUnaligned.only_derive_is_allowed_to_implement_this_trait
1114+ }
1115+
1116+ /-- [ zerocopy::trait_checks::check_byte_unaligned ] :
1117+ Source: 'src/trait_checks.rs', lines 58:0-60:1 -/
1118+ def trait_checks.check_byte_unaligned : Result Unit := do
1119+ trait_checks.check_unaligned U8.Insts.ZerocopyUnaligned
1120+
1121+ /-- [ zerocopy::trait_checks::divide_by_unaligned ] :
1122+ Source: 'src/trait_checks.rs', lines 71:0-78:1 -/
1123+ def trait_checks.divide_by_unaligned
1124+ {T : Type} (UnalignedInst : Unaligned T) (x : Std.Usize) :
1125+ Result Std.Usize
1126+ := do
1127+ let i ← core.mem.align_of T
1128+ let divisor ← 1#usize / i
1129+ let divisor1 ←
1130+ core.num.nonzero.NonZero.new_unchecked
1131+ Usize.Insts.CoreNumNonzeroZeroablePrimitiveNonZeroUsizeInner divisor
1132+ let i1 ←
1133+ core.num.nonzero.NonZero.get
1134+ Usize.Insts.CoreNumNonzeroZeroablePrimitiveNonZeroUsizeInner divisor1
1135+ x / i1
1136+
1137+ /-- [ zerocopy::trait_checks::divide_by_byte_alignment ] :
1138+ Source: 'src/trait_checks.rs', lines 86:0-88:1 -/
1139+ def trait_checks.divide_by_byte_alignment
1140+ (x : Std.Usize) : Result Std.Usize := do
1141+ trait_checks.divide_by_unaligned U8.Insts.ZerocopyUnaligned x
1142+
10801143/-- [zerocopy::trait_checks::{impl zerocopy::trait_checks::ByteCodec for zerocopy::trait_checks::XorCodec}::decode]:
1081- Source: 'src/trait_checks.rs', lines 41 :4-43 :5 -/
1144+ Source: 'src/trait_checks.rs', lines 112 :4-114 :5 -/
10821145def trait_checks.XorCodec.Insts.ZerocopyTrait_checksByteCodec.decode
10831146 (byte : Std.U8) : Result Std.U8 := do
10841147 ok (byte ^^^ 170#u8)
10851148
10861149/-- [zerocopy::trait_checks::{impl zerocopy::trait_checks::ByteCodec for zerocopy::trait_checks::XorCodec}::encode]:
1087- Source: 'src/trait_checks.rs', lines 37 :4-39 :5 -/
1150+ Source: 'src/trait_checks.rs', lines 108 :4-110 :5 -/
10881151def trait_checks.XorCodec.Insts.ZerocopyTrait_checksByteCodec.encode
10891152 (byte : Std.U8) : Result Std.U8 := do
10901153 ok (byte ^^^ 170#u8)
10911154
10921155/-- Trait implementation: [zerocopy::trait_checks::{impl zerocopy::trait_checks::ByteCodec for zerocopy::trait_checks::XorCodec}]
1093- Source: 'src/trait_checks.rs', lines 36 :0-44 :1 -/
1156+ Source: 'src/trait_checks.rs', lines 107 :0-115 :1 -/
10941157@[ reducible ]
10951158def trait_checks.XorCodec.Insts.ZerocopyTrait_checksByteCodec :
10961159 trait_checks.ByteCodec trait_checks.XorCodec := {
@@ -1099,23 +1162,23 @@ def trait_checks.XorCodec.Insts.ZerocopyTrait_checksByteCodec :
10991162}
11001163
11011164/-- [zerocopy::trait_checks::{impl zerocopy::trait_checks::ByteCodec for zerocopy::trait_checks::Forward<C>}::decode]:
1102- Source: 'src/trait_checks.rs', lines 54 :4-56 :5 -/
1165+ Source: 'src/trait_checks.rs', lines 125 :4-127 :5 -/
11031166def trait_checks.Forward.Insts.ZerocopyTrait_checksByteCodec.decode
11041167 {C : Type} (ByteCodecInst : trait_checks.ByteCodec C) (byte : Std.U8) :
11051168 Result Std.U8
11061169 := do
11071170 ByteCodecInst.decode byte
11081171
11091172/-- [zerocopy::trait_checks::{impl zerocopy::trait_checks::ByteCodec for zerocopy::trait_checks::Forward<C>}::encode]:
1110- Source: 'src/trait_checks.rs', lines 50 :4-52 :5 -/
1173+ Source: 'src/trait_checks.rs', lines 121 :4-123 :5 -/
11111174def trait_checks.Forward.Insts.ZerocopyTrait_checksByteCodec.encode
11121175 {C : Type} (ByteCodecInst : trait_checks.ByteCodec C) (byte : Std.U8) :
11131176 Result Std.U8
11141177 := do
11151178 ByteCodecInst.encode byte
11161179
11171180/-- Trait implementation: [zerocopy::trait_checks::{impl zerocopy::trait_checks::ByteCodec for zerocopy::trait_checks::Forward<C>}]
1118- Source: 'src/trait_checks.rs', lines 49 :0-57 :1 -/
1181+ Source: 'src/trait_checks.rs', lines 120 :0-128 :1 -/
11191182@[ reducible ]
11201183def trait_checks.Forward.Insts.ZerocopyTrait_checksByteCodec {C : Type}
11211184 (ByteCodecInst : trait_checks.ByteCodec C) : trait_checks.ByteCodec
@@ -1127,7 +1190,7 @@ def trait_checks.Forward.Insts.ZerocopyTrait_checksByteCodec {C : Type}
11271190}
11281191
11291192/-- [ zerocopy::trait_checks::byte_codec_roundtrip ] :
1130- Source: 'src/trait_checks.rs', lines 63 :0-65 :1 -/
1193+ Source: 'src/trait_checks.rs', lines 134 :0-136 :1 -/
11311194def trait_checks.byte_codec_roundtrip
11321195 {C : Type} (ByteCodecInst : trait_checks.ByteCodec C) (byte : Std.U8) :
11331196 Result Std.U8
@@ -1136,14 +1199,14 @@ def trait_checks.byte_codec_roundtrip
11361199 ByteCodecInst.decode i
11371200
11381201/-- [ zerocopy::trait_checks::forwarded_byte_codec ] :
1139- Source: 'src/trait_checks.rs', lines 73 :0-75 :1 -/
1202+ Source: 'src/trait_checks.rs', lines 144 :0-146 :1 -/
11401203def trait_checks.forwarded_byte_codec (byte : Std.U8) : Result Std.U8 := do
11411204 trait_checks.byte_codec_roundtrip
11421205 (trait_checks.Forward.Insts.ZerocopyTrait_checksByteCodec
11431206 trait_checks.XorCodec.Insts.ZerocopyTrait_checksByteCodec) byte
11441207
11451208/-- [ zerocopy::trait_checks::require_into_bytes ] :
1146- Source: 'src/trait_checks.rs', lines 77 :0-77 :47 -/
1209+ Source: 'src/trait_checks.rs', lines 148 :0-148 :47 -/
11471210def trait_checks.require_into_bytes
11481211 {T : Type} (IntoBytesInst : IntoBytes T) : Result Unit := do
11491212 ok ()
@@ -1213,7 +1276,7 @@ def Tuple.Insts.ZerocopyIntoBytes : IntoBytes Unit := {
12131276}
12141277
12151278/-- [ zerocopy::trait_checks::check_array_into_bytes ] :
1216- Source: 'src/trait_checks.rs', lines 92 :0-98 :1 -/
1279+ Source: 'src/trait_checks.rs', lines 163 :0-169 :1 -/
12171280def trait_checks.check_array_into_bytes : Result Unit := do
12181281 trait_checks.require_into_bytes (Array.Insts.ZerocopyIntoBytes 3#usize
12191282 Bool.Insts.ZerocopyIntoBytes)
0 commit comments