commit_hash
stringlengths
40
40
author
stringlengths
1
57
date
timestamp[s]date
2010-07-26 04:45:09
2026-04-14 18:21:10
message
stringlengths
8
1.39M
diff
stringlengths
68
51.2k
files_changed
int64
1
136
insertions
int64
0
2.35k
deletions
int64
0
1.9k
9319f4858b98a7ce1cfb888450ffe08e9cdb43c0
Lokathor
2024-05-13T16:53:18
make clippy be quiet about useless nonsense.
diff --git a/src/contiguous.rs b/src/contiguous.rs index 538514b..91308d0 100644 --- a/src/contiguous.rs +++ b/src/contiguous.rs @@ -1,3 +1,5 @@ +#![allow(clippy::legacy_numeric_constants)] + use super::*; /// A trait indicating that:
1
2
0
b39b6813a7253a4411d77213fc13c004b0a9a735
Lokathor
2024-05-13T16:51:37
fix up docs warnings
diff --git a/src/allocation.rs b/src/allocation.rs index 83f11b8..bdcf724 100644 --- a/src/allocation.rs +++ b/src/allocation.rs @@ -19,16 +19,18 @@ use alloc::{ vec, vec::Vec, }; -use core::mem::ManuallyDrop; -use core::ops::{Deref, DerefMut}; +use core::{ + mem::ManuallyDrop, + ops::{Deref, DerefMut}, +}; ...
2
22
23
99e95084a613b552d1a828b2603e71e46d46208e
Tyler Ruckinger
2024-05-13T16:16:20
support const zeroed() (#240)
diff --git a/Cargo.toml b/Cargo.toml index 1180a90..2428d59 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -34,6 +34,8 @@ aarch64_simd = [] # MSRV 1.59.0: support aarch64 simd types must_cast = [] # MSRV 1.57.0: support the `must` module. +const_zeroed = [] # MSRV 1.75.0: support const `zeroed()` + # Do not use if y...
5
26
6
7ef8801cfff71abab08b9a9a5425d5538e64a3da
Julien Cretin
2024-04-17T15:56:34
Add documentation to generated public items (#236) Fixes #235
diff --git a/derive/src/traits.rs b/derive/src/traits.rs index f99d722..5ba6f9f 100644 --- a/derive/src/traits.rs +++ b/derive/src/traits.rs @@ -485,6 +485,7 @@ fn generate_checked_bit_pattern_struct( Ok(( quote! { + #[doc = #GENERATED_TYPE_DOCUMENTATION] #repr #[derive(Clone, Copy, #...
1
7
0
eeb6e9dd5313e46770ad300e0ee0a3a6c2121b73
zachs18
2024-04-10T01:02:38
Update TransparentWrapper asserts (#232) * Update TransparentWrapper asserts. * Update TransparentWrapperAlloc assert comments.
diff --git a/src/allocation.rs b/src/allocation.rs index fe39e81..047f396 100644 --- a/src/allocation.rs +++ b/src/allocation.rs @@ -531,6 +531,11 @@ pub trait TransparentWrapperAlloc<Inner: ?Sized>: /// type. #[inline] fn wrap_box(s: Box<Inner>) -> Box<Self> { + // The unsafe contract requires that these t...
2
77
30
4d2fc16208e55db8e231a6f0bf5ea4b928579502
Lokathor
2024-03-13T05:15:46
chore: Release bytemuck version 1.15.0
diff --git a/Cargo.toml b/Cargo.toml index 53050f0..1180a90 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "bytemuck" description = "A crate for mucking around with piles of bytes." -version = "1.14.3" +version = "1.15.0" authors = ["Lokathor <zefria@gmail.com>"] repository = "https://gi...
1
1
1
a888e5f2c009dd5ef048185fb2a766ae173f3c4d
zachs18
2024-03-13T05:00:32
Convert `BoxBytes` to/from boxed slices (#228) * Allow converting BoxBytes to/from boxed slices of NoUninit, and from Box<str>. * Implement From<Box<T>> for BoxBytes generically * Minor cleanup
diff --git a/src/allocation.rs b/src/allocation.rs index 2000674..fe39e81 100644 --- a/src/allocation.rs +++ b/src/allocation.rs @@ -727,53 +727,132 @@ impl Drop for BoxBytes { } } -impl<T: NoUninit> From<Box<T>> for BoxBytes { +impl<T: ?Sized + sealed::BoxBytesOf> From<Box<T>> for BoxBytes { fn from(value: Bo...
1
98
19
91bbbdf9a51380fd58c840e178d24ddf1e1a745a
Lokathor
2024-03-10T17:41:42
chore: Release bytemuck_derive version 1.6.0
diff --git a/derive/Cargo.toml b/derive/Cargo.toml index fef302d..6b960bd 100644 --- a/derive/Cargo.toml +++ b/derive/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "bytemuck_derive" description = "derive proc-macros for `bytemuck`" -version = "1.5.0" +version = "1.6.0" authors = ["Lokathor <zefria@gmail.com>"] repos...
1
1
1
49eed864acb5791f61753bfeae488718d481f1f3
Lokathor
2024-02-09T05:10:24
chore: Release bytemuck version 1.14.3
diff --git a/Cargo.toml b/Cargo.toml index e0196e4..53050f0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "bytemuck" description = "A crate for mucking around with piles of bytes." -version = "1.14.2" +version = "1.14.3" authors = ["Lokathor <zefria@gmail.com>"] repository = "https://gi...
1
1
1
5f4717633d540e910e03b198222360bc92b1ec26
Lokathor
2024-02-09T05:09:44
clear up some warnings in tests.
diff --git a/tests/doc_tests.rs b/tests/doc_tests.rs index d08e970..92b1b5c 100644 --- a/tests/doc_tests.rs +++ b/tests/doc_tests.rs @@ -1,4 +1,5 @@ #![allow(clippy::disallowed_names)] +#![allow(dead_code)] //! Cargo miri doesn't run doctests yet, so we duplicate these here. It's //! probably not that important to...
2
2
0
1afddf9d9b76ad9c9193a3f0ca126049942e2ba1
zachs18
2024-02-08T00:45:17
Under `features = ["nightly_stdsimd"]`, only enable `stdarch_x86_avx512` feature on x86 or x86_64 targets. (#225)
diff --git a/src/lib.rs b/src/lib.rs index 68dbabf..a810bb4 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -4,7 +4,13 @@ #![allow(clippy::uninlined_format_args)] #![cfg_attr(feature = "nightly_docs", feature(doc_cfg))] #![cfg_attr(feature = "nightly_portable_simd", feature(portable_simd))] -#![cfg_attr(feature = "night...
1
7
1
04ed11bdd5ec8e53d3377272f42bb2d4b21b1d31
Lokathor
2024-02-07T02:55:05
chore: Release bytemuck version 1.14.2
diff --git a/Cargo.toml b/Cargo.toml index fdd9e06..e0196e4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "bytemuck" description = "A crate for mucking around with piles of bytes." -version = "1.14.1" +version = "1.14.2" authors = ["Lokathor <zefria@gmail.com>"] repository = "https://gi...
1
1
1
678c923f527f8836e8f33f92d3a3a63a1b016afe
Lokathor
2024-02-07T02:50:43
Closes https://github.com/Lokathor/bytemuck/issues/224, the Nightly feature name changed.
diff --git a/src/lib.rs b/src/lib.rs index fb99c34..68dbabf 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -4,7 +4,7 @@ #![allow(clippy::uninlined_format_args)] #![cfg_attr(feature = "nightly_docs", feature(doc_cfg))] #![cfg_attr(feature = "nightly_portable_simd", feature(portable_simd))] -#![cfg_attr(feature = "nightl...
1
5
5
5f9347741878dcab5df67459aa993e01b22f5bb5
Logan Magee
2024-01-25T02:58:00
Fix typo in AnyBitPattern docs (#221)
diff --git a/src/anybitpattern.rs b/src/anybitpattern.rs index a759738..56c6bc6 100644 --- a/src/anybitpattern.rs +++ b/src/anybitpattern.rs @@ -14,7 +14,7 @@ use crate::{Pod, Zeroable}; /// /// [`AnyBitPattern`] is a subset of [`Zeroable`], meaning that any `T: /// AnyBitPattern` is also [`Zeroable`], but any `T: Z...
1
1
1
1e1a22e5eac57e5b473e0c427dc187008228ad46
Lokathor
2024-01-25T00:32:54
chore: Release bytemuck version 1.14.1
diff --git a/Cargo.toml b/Cargo.toml index b66b726..fdd9e06 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "bytemuck" description = "A crate for mucking around with piles of bytes." -version = "1.14.0" +version = "1.14.1" authors = ["Lokathor <zefria@gmail.com>"] repository = "https://gi...
1
1
1
8dc32b1e509b04ea7a052960bf7b49dce0927e12
Hrvoje Nikšić
2024-01-25T00:30:59
Explicitly document that pod_read_unaligned and try_pod_read_unaligned don't panic on unallowed reads (#220) * Explicitly document that pod_read_unaligned and try_pod_read_unaligned don't panic on unallowed reads Their names make that reasonably clear already, but it doesn't hurt to be explicit. Also, when choosin...
diff --git a/src/checked.rs b/src/checked.rs index 722c31d..ae45823 100644 --- a/src/checked.rs +++ b/src/checked.rs @@ -450,7 +450,7 @@ pub fn pod_read_unaligned<T: CheckedBitPattern>(bytes: &[u8]) -> T { /// /// ## Panics /// -/// * This is like [`try_cast`](try_cast), but will panic on a size mismatch. +/// * Thi...
2
14
6
085a5f573ed588d5da085708c611dd8c623b7fdf
Lokathor
2023-11-26T19:44:24
Revise the crate-level docs.
diff --git a/src/lib.rs b/src/lib.rs index 000dacb..203a0fb 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -19,28 +19,64 @@ //! * `&[T]` uses [`cast_slice`] //! * `&mut [T]` uses [`cast_slice_mut`] //! -//! Some casts will never fail (eg: `cast::<u32, f32>` always works), other -//! casts might fail (eg: `cast_ref::<[u...
1
53
16
c705218630d0a11af39b39a1c7639de6dce04db3
Andri
2023-10-20T05:02:54
Added custom crate path with tests (#209) Co-authored-by: Andri <80914617+Shuray04@users.noreply.github.com>
diff --git a/derive/src/lib.rs b/derive/src/lib.rs index 20f4b0f..ee8f235 100644 --- a/derive/src/lib.rs +++ b/derive/src/lib.rs @@ -9,8 +9,8 @@ use quote::quote; use syn::{parse_macro_input, DeriveInput, Result}; use crate::traits::{ - AnyBitPattern, CheckedBitPattern, Contiguous, Derivable, NoUninit, Pod, - Tra...
3
123
67
fd27a5b018eef255b888b348f09c594878be9c7f
Julien Cretin
2023-10-20T04:50:33
Add from_box_bytes and box_bytes_of with BoxBytes type (#211) * Add from_box_bytes and box_bytes_of with BoxBytes type * Apply suggestions from code review Co-authored-by: zachs18 <8355914+zachs18@users.noreply.github.com> * Add into_raw_parts * Add tests * Rename from_parts to from_raw_parts -------...
diff --git a/src/allocation.rs b/src/allocation.rs index a2633b5..2000674 100644 --- a/src/allocation.rs +++ b/src/allocation.rs @@ -19,6 +19,7 @@ use alloc::{ vec, vec::Vec, }; +use core::ops::{Deref, DerefMut}; /// As [`try_cast_box`](try_cast_box), but unwraps for you. #[inline] @@ -686,4 +687,117 @@ pub ...
2
175
1
d10fbfc6ffb9a2adf2faa001cd614bd7dfe20f02
Tom Dohrmann
2023-09-06T15:37:07
allow deriving `CheckedBitPattern` for enums with fields (#171) * simplify `ToTokens` impl for `Representation` Instead of collecting the representation and modifier into `Option`s and determining whether a comma is needed manually, we can use the `Puncutuated` struct which handles commas automatically. This w...
diff --git a/derive/src/lib.rs b/derive/src/lib.rs index 7ca9527..20f4b0f 100644 --- a/derive/src/lib.rs +++ b/derive/src/lib.rs @@ -218,7 +218,7 @@ pub fn derive_zeroable( /// - The struct must contain no generic parameters /// /// If applied to an enum: -/// - The enum must be explicit `#[repr(Int)]` +/// - The en...
3
706
114
ff0b14dae9a4f0650f17c15c16acbd75df1cc4b5
Lokathor
2023-09-05T21:32:43
chore: Release bytemuck version 1.14.0
diff --git a/Cargo.toml b/Cargo.toml index bc0587d..b66b726 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "bytemuck" description = "A crate for mucking around with piles of bytes." -version = "1.13.2" +version = "1.14.0" authors = ["Lokathor <zefria@gmail.com>"] repository = "https://gi...
1
1
1
88f5c8be75d3b33f43dc3d709c2fdf1528eed7f1
Lokathor
2023-09-05T21:15:09
chore: Release bytemuck_derive version 1.5.0
diff --git a/derive/Cargo.toml b/derive/Cargo.toml index e097092..fef302d 100644 --- a/derive/Cargo.toml +++ b/derive/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "bytemuck_derive" description = "derive proc-macros for `bytemuck`" -version = "1.4.1" +version = "1.5.0" authors = ["Lokathor <zefria@gmail.com>"] repos...
1
1
1
1ba421505037fe8c53a8f13967abf96a7e5f02ec
Lokathor
2023-09-05T20:08:36
Create `align_offset` feature so that we can continue to work on 1.34
diff --git a/Cargo.toml b/Cargo.toml index 0a82e8b..e6d77a0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,12 +18,19 @@ extern_crate_alloc = [] extern_crate_std = ["extern_crate_alloc"] zeroable_maybe_uninit = [] zeroable_atomics = [] -min_const_generics = [] -wasm_simd = [] # Until >= 1.54.0 is MSRV this is an off...
2
23
9
caff75906609abf857dd2718de81c21c328d939a
sarah
2023-09-05T20:04:52
Use `align_offset` to check alignment (#176) Co-authored-by: sarah <>
diff --git a/src/internal.rs b/src/internal.rs index 2984d26..be8c309 100644 --- a/src/internal.rs +++ b/src/internal.rs @@ -130,6 +130,19 @@ pub(crate) unsafe fn pod_read_unaligned<T: Copy>(bytes: &[u8]) -> T { } } +/// Checks if `ptr` is aligned to an `align` memory boundary. +/// +/// ## Panics +/// * If `alig...
1
19
6
b38d7d0e215dea99d8b6820b26d78d0561ffc15e
zachs18
2023-09-05T20:01:02
Have `cfg`s as part of the input to `impl_unsafe_marker_for_simd` (#207) ... so that the macro can correctly expand with `doc(cfg(...))` attributes under `feature = "nightly_docs"`.
diff --git a/src/lib.rs b/src/lib.rs index dc89cca..000dacb 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -79,10 +79,13 @@ macro_rules! transmute { /// with relevant cargo features enabled. #[allow(unused)] macro_rules! impl_unsafe_marker_for_simd { - (unsafe impl $trait:ident for $platform:ident :: {}) => {}; - (un...
3
118
101
d9b23e351867d74a664bf93d0fb65d3a0d5e0ad9
Lokathor
2023-09-05T19:54:15
rename these functions before publishing them.
diff --git a/src/lib.rs b/src/lib.rs index ebfc195..dc89cca 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -414,9 +414,9 @@ pub fn try_cast_slice_mut< /// This is similar to `*target = Zeroable::zeroed()`, but guarantees that any /// padding bytes in `target` are zeroed as well. /// -/// See also [`fill_zero`], if you ...
1
5
5
d790c043a8e0b588d1c9f5a3120a63cb6d311da5
Thom Chiovoloni
2023-09-05T19:46:04
Add functions for writing zeroed bytes to `&mut impl Zeroable` and `&mut [impl Zeroable]` (#193) * Add functions for writing zeroed bytes to `&mut impl Zeroable` and `&mut [impl Zeroable]` * Support `T: !Copy` in `fill_zero`/`write_zero` * Zero bytes in the drop guard for write_zero * Update src/lib.rs Co-...
diff --git a/src/lib.rs b/src/lib.rs index a51ed8a..ebfc195 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -408,3 +408,47 @@ pub fn try_cast_slice_mut< ) -> Result<&mut [B], PodCastError> { unsafe { internal::try_cast_slice_mut(a) } } + +/// Fill all bytes of `target` with zeroes (see [`Zeroable`]). +/// +/// This is...
1
44
0
3c1a0d9b35c3596b58fe5f8bbb994e14201fd915
Valentin
2023-09-05T19:41:44
Improve assembly of Contiguous derive (#200) `from_integer` and `into_integer` are usually provided by the trait's default implementation. We override this implementation because it goes through `transmute_copy`, which can lead to inefficient assembly as seen in https://github.com/Lokathor/bytemuck/issues/175 .
diff --git a/derive/src/traits.rs b/derive/src/traits.rs index da51275..f513356 100644 --- a/derive/src/traits.rs +++ b/derive/src/traits.rs @@ -378,12 +378,31 @@ impl Derivable for Contiguous { let min_lit = LitInt::new(&format!("{}", min), input.span()); let max_lit = LitInt::new(&format!("{}", max), input....
1
19
0
58445b125091ea65a80bf7b490adbaa90bfc650d
zachs18
2023-09-05T19:36:10
Fix derive non-run doctests. (#204) Doctests only run in the crate proper; doctests inside of integration tests are not run. Move the existing doctests from derive/tests/basic.rs to derive/lib.rs, expanding them to make them better for documentation as well.
diff --git a/derive/src/lib.rs b/derive/src/lib.rs index 23ddf5e..7ca9527 100644 --- a/derive/src/lib.rs +++ b/derive/src/lib.rs @@ -23,19 +23,69 @@ use crate::traits::{ /// - All fields in the struct must implement `Pod` /// - The struct must be `#[repr(C)]` or `#[repr(transparent)]` /// - The struct must not conta...
2
87
37
db69feee1e7683b7db98f506b647c8488f563f27
Lukasz Anforowicz
2023-09-05T19:34:39
Use safe, public APIs where possible to remove some `unsafe` blocks. (#206)
diff --git a/src/checked.rs b/src/checked.rs index a9c0e67..68f72a9 100644 --- a/src/checked.rs +++ b/src/checked.rs @@ -243,7 +243,7 @@ impl From<crate::PodCastError> for CheckedCastError { pub fn try_from_bytes<T: CheckedBitPattern>( s: &[u8], ) -> Result<&T, CheckedCastError> { - let pod = unsafe { internal::t...
1
5
5
16610417beea49918613d548ca1945457baa1fef
Lokathor
2023-09-05T19:26:08
tell clippy to quiet down
diff --git a/tests/cast_slice_tests.rs b/tests/cast_slice_tests.rs index f1297f6..ce6dedc 100644 --- a/tests/cast_slice_tests.rs +++ b/tests/cast_slice_tests.rs @@ -1,3 +1,6 @@ +#![allow(clippy::unnecessary_cast)] +#![allow(clippy::manual_slice_size_calculation)] + use core::mem::size_of; use bytemuck::*; diff --gi...
2
6
0
39b42b8fa364a1456e312dfb5005e3daca28d83d
zachs18
2023-07-26T19:50:58
Zeroable derive custom bounds (#196) * Add space because rust-analyzer thinks it's a weird literal otherwise. * Add custom bounds for Zeroable. * Cleanup custom bounds code. * Only parse explicit bounds for Zeroable. * Qualify syn types. * If no explicit bounds are given, apply the default bounds. * ...
diff --git a/derive/src/lib.rs b/derive/src/lib.rs index 448e503..23ddf5e 100644 --- a/derive/src/lib.rs +++ b/derive/src/lib.rs @@ -77,7 +77,6 @@ pub fn derive_anybitpattern( /// /// ```rust /// # use bytemuck_derive::{Zeroable}; -/// /// #[derive(Copy, Clone, Zeroable)] /// #[repr(C)] /// struct Test { @@ -85,7...
2
192
13
3b81c85c60fcc09b489608e2ba2fc1c5f8260b23
Connor Horman
2023-07-25T22:15:01
Update proc-macro2 (#201)
diff --git a/derive/Cargo.toml b/derive/Cargo.toml index e393eb7..e097092 100644 --- a/derive/Cargo.toml +++ b/derive/Cargo.toml @@ -18,7 +18,7 @@ proc-macro = true # syn seems to have broken backwards compatibility in this version https://github.com/dtolnay/syn/issues/1194 syn = "2.0.1" quote = "1" -proc-macro2 = "...
1
1
1
1ed1aaecf9d56cf13e3eb3dfc67808ac9e175569
zachs18
2023-07-17T16:01:10
Remove FIXME and checks about NonZero[int] layout. (#199) The layout was documented as guaranteed in 1.70.0 https://github.com/rust-lang/rust/pull/94786/
diff --git a/src/checked.rs b/src/checked.rs index 2eabfe8..a9c0e67 100644 --- a/src/checked.rs +++ b/src/checked.rs @@ -170,6 +170,7 @@ unsafe impl CheckedBitPattern for bool { } } +// Rust 1.70.0 documents that NonZero[int] has the same layout as [int]. macro_rules! impl_checked_for_nonzero { ($($nonzero:ty...
1
2
8
588d89082d81301702d62a8ebeb13764cffb4dc2
zachs18
2023-06-15T22:43:27
Relax Pod for PhantomData (#195) As with Zeroable for PhantomData.
diff --git a/src/pod.rs b/src/pod.rs index 6cb2458..a98def8 100644 --- a/src/pod.rs +++ b/src/pod.rs @@ -60,7 +60,7 @@ unsafe impl<T: 'static> Pod for *const T {} #[cfg(feature = "unsound_ptr_pod_impl")] unsafe impl<T: 'static> PodInOption for NonNull<T> {} -unsafe impl<T: Pod> Pod for PhantomData<T> {} +unsafe imp...
1
1
1
c286994891c1736d4a5824fb3e56f55cc8df831b
zachs18
2023-06-15T15:54:23
must_cast: fix test failures and fmt. (#194) * cargo fmt src/must.rs * Fix must.rs test failures. * Under miri, use should_panic instead of compile_fail for must_cast doctests. * Add description for workaround.
diff --git a/src/must.rs b/src/must.rs index 5b25411..8373e71 100644 --- a/src/must.rs +++ b/src/must.rs @@ -8,9 +8,30 @@ use core::mem::{align_of, size_of}; struct Cast<A, B>((A, B)); impl<A, B> Cast<A, B> { - const ASSERT_ALIGN_GREATER_THAN_EQUAL : () = assert!(align_of::<A>() >= align_of::<B>()); - const ASSER...
1
48
26
8f130f2b79725b1af846647181dc3d23caa7faf3
MaulingMonkey
2023-06-06T21:50:39
must_cast (#187)
diff --git a/Cargo.toml b/Cargo.toml index b85f122..e429457 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,6 +20,7 @@ zeroable_maybe_uninit = [] zeroable_atomics = [] min_const_generics = [] wasm_simd = [] # Until >= 1.54.0 is MSRV this is an off-by-default feature. +must_cast = [] # Until >= 1.57.0 is MSRV this is...
3
189
0
e528c1662f10c42aa70e3f8a2b3f59c818a37aeb
Daniel Henry-Mantilla
2023-06-06T21:48:41
Add missing `?Sized` for `TransparentWrapperAlloc` extension trait (#185) * Add missing `?Sized` for `TransparentWrapperAlloc` extension trait * chore: Release bytemuck version 1.13.2
diff --git a/Cargo.toml b/Cargo.toml index 9d6be11..b85f122 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "bytemuck" description = "A crate for mucking around with piles of bytes." -version = "1.13.1" +version = "1.13.2" authors = ["Lokathor <zefria@gmail.com>"] repository = "https://gi...
2
3
2
df5262b19ca4fde16bc1a15eecb7438f0ecdbe42
Charles Lew
2023-05-31T14:46:00
Add `#[doc(hidden)]` on derive generated items. (#189)
diff --git a/derive/src/traits.rs b/derive/src/traits.rs index 767fb80..ec6afd9 100644 --- a/derive/src/traits.rs +++ b/derive/src/traits.rs @@ -538,6 +538,7 @@ fn generate_assert_no_padding(input: &DeriveInput) -> Result<TokenStream> { }; Ok(quote_spanned! {span => const _: fn() = || { + #[doc(hidden)] ...
1
2
0
8391afa876ba2e99dffb0c991cc7fa775287d106
C. K. Young
2023-03-24T00:22:56
Make `AnyBitPattern` derive work for generic structs (#101) * Allow generic structs to use `AnyBitPattern` derive. * Attempt to nudge the CI into retrying.
diff --git a/derive/tests/basic.rs b/derive/tests/basic.rs index e53344e..1be54c4 100644 --- a/derive/tests/basic.rs +++ b/derive/tests/basic.rs @@ -155,9 +155,9 @@ struct CheckedBitPatternStruct { #[derive(Debug, Copy, Clone, AnyBitPattern, PartialEq, Eq)] #[repr(C)] -struct AnyBitPatternTest { - a: u16, - b: u1...
1
5
5
b41f4cc1af994158031ea536f5ba8e046481d623
Lokathor
2023-03-23T21:40:54
chore: Release bytemuck_derive version 1.4.1
diff --git a/derive/Cargo.toml b/derive/Cargo.toml index e696bd4..e393eb7 100644 --- a/derive/Cargo.toml +++ b/derive/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "bytemuck_derive" description = "derive proc-macros for `bytemuck`" -version = "1.4.0" +version = "1.4.1" authors = ["Lokathor <zefria@gmail.com>"] repos...
1
1
1
b97dee7f9047da4db90e8c0ccd66e8303435b5f2
Christopher Serr
2023-03-21T19:52:18
Switch to `syn` 2.0 (#183) This upgrades the derives from `syn` 1.0 to `syn` 2.0. While the MSRV for `syn` 2.0 is not Rust 1.56 which is higher than the MSRV of `bytemuck`, the derives don't fall under the MSRV policy.
diff --git a/derive/Cargo.toml b/derive/Cargo.toml index b908a22..e696bd4 100644 --- a/derive/Cargo.toml +++ b/derive/Cargo.toml @@ -16,7 +16,7 @@ proc-macro = true [dependencies] # syn seems to have broken backwards compatibility in this version https://github.com/dtolnay/syn/issues/1194 -syn = "1.0.99" +syn = "2....
2
7
9
b19f8abfe34d6ab660e748086874c01e0212b738
Lokathor
2023-02-28T20:40:46
chore: Release bytemuck version 1.13.1
diff --git a/Cargo.toml b/Cargo.toml index b636b86..9d6be11 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "bytemuck" description = "A crate for mucking around with piles of bytes." -version = "1.13.0" +version = "1.13.1" authors = ["Lokathor <zefria@gmail.com>"] repository = "https://gi...
1
1
1
1b1b9a0e898d2c8131754bcfffaa2a5599dc91b2
Lokathor
2023-02-28T20:29:34
Fix 177 (#178) * reduce required bounds. * clippy get off my case * spelling * clippy lints on tests.
diff --git a/src/allocation.rs b/src/allocation.rs index c4141ec..1c1616b 100644 --- a/src/allocation.rs +++ b/src/allocation.rs @@ -209,7 +209,7 @@ pub fn cast_vec<A: NoUninit, B: AnyBitPattern>(input: Vec<A>) -> Vec<B> { /// alignment. /// * The start and end content size in bytes of the `Vec` must be the exact ...
7
137
47
2d1f87621683bbc5bb300dcb013d8d35d1c9f34d
Tom Dohrmann
2023-01-26T04:49:46
various small fixes to the derive macros (#168) * parse `repr(usize)` and `repr(isize)` This can be used with enums. * emit packed repr without type suffix Previously we emitted the packed attribute with a type suffix for the value `packed(4u32)`. This is not allowed. Instead we should emit `packed(4)`. ...
diff --git a/derive/src/lib.rs b/derive/src/lib.rs index e16d43e..448e503 100644 --- a/derive/src/lib.rs +++ b/derive/src/lib.rs @@ -334,7 +334,7 @@ fn derive_marker_trait_inner<Trait: Derivable>( let (trait_impl_extras, trait_impl) = Trait::trait_impl(&input)?; let implies_trait = if let Some(implies_trait) = ...
2
8
3
49c23727fa681753eaae8010958a9a1293954103
Lokathor
2023-01-20T06:05:43
(cargo-release) version 1.13.0
diff --git a/Cargo.toml b/Cargo.toml index 07027cf..b636b86 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "bytemuck" description = "A crate for mucking around with piles of bytes." -version = "1.12.4" +version = "1.13.0" authors = ["Lokathor <zefria@gmail.com>"] repository = "https://gi...
1
1
1
0e65f1e64d529a733fcb35361260ec65945e10b3
Lokathor
2023-01-20T05:58:28
bump bytemuck_derive min version.
diff --git a/Cargo.toml b/Cargo.toml index 0fc3a18..07027cf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,7 +30,7 @@ nightly_portable_simd = [] nightly_stdsimd = [] [dependencies] -bytemuck_derive = { version = "1.2.1", path = "derive", optional = true } +bytemuck_derive = { version = "1.4", path = "derive", opti...
1
1
1
2bcc0ef6de45203b3added2593787d3bab213280
Lokathor
2023-01-20T00:45:46
chore: Release bytemuck_derive version 1.4.0
diff --git a/derive/Cargo.toml b/derive/Cargo.toml index d0f0398..020f76a 100644 --- a/derive/Cargo.toml +++ b/derive/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "bytemuck_derive" description = "derive proc-macros for `bytemuck`" -version = "1.3.0" +version = "1.4.0" authors = ["Lokathor <zefria@gmail.com>"] repos...
1
1
1
cb5caf7bf861b96b9700a8ec626db1ac20e15bca
Lokathor
2023-01-19T20:48:06
(cargo-release) version 1.12.4
diff --git a/Cargo.toml b/Cargo.toml index 470cc6e..0fc3a18 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "bytemuck" description = "A crate for mucking around with piles of bytes." -version = "1.12.3" +version = "1.12.4" authors = ["Lokathor <zefria@gmail.com>"] repository = "https://gi...
1
1
1
fa5e5dd1d20487e2133fca7349f294294879f24d
Alphyr
2023-01-19T20:33:27
Simplify `try_zeroed_box` and `try_zeroed_slice_box` (#162)
diff --git a/src/allocation.rs b/src/allocation.rs index 9d6c0e6..c4141ec 100644 --- a/src/allocation.rs +++ b/src/allocation.rs @@ -19,7 +19,6 @@ use alloc::{ vec, vec::Vec, }; -use core::convert::TryInto; /// As [`try_cast_box`](try_cast_box), but unwraps for you. #[inline] @@ -64,23 +63,11 @@ pub fn try_c...
1
9
26
2548e460cb5f94e361ac56b232f0bf3f58292545
Alphyr
2023-01-19T17:03:41
Add more `Zeroable` and `ZeroableInOption` impls (#158)
diff --git a/src/zeroable.rs b/src/zeroable.rs index ac79152..687ba0f 100644 --- a/src/zeroable.rs +++ b/src/zeroable.rs @@ -53,8 +53,17 @@ unsafe impl Zeroable for f64 {} unsafe impl<T: Zeroable> Zeroable for Wrapping<T> {} unsafe impl<T: Zeroable> Zeroable for core::cmp::Reverse<T> {} +// Note: we can't implement...
2
16
1
117222d3e40d5abc51ada08a7be8754d68135dc6
zachs18
2023-01-11T07:24:05
Implement AnyBitPattern for MaybeUninit<T> where T: AnyBitPattern. (#160)
diff --git a/src/anybitpattern.rs b/src/anybitpattern.rs index 3a55e62..c35a9a7 100644 --- a/src/anybitpattern.rs +++ b/src/anybitpattern.rs @@ -54,3 +54,7 @@ pub unsafe trait AnyBitPattern: } unsafe impl<T: Pod> AnyBitPattern for T {} + +#[cfg(feature = "zeroable_maybe_uninit")] +unsafe impl<T> AnyBitPattern for c...
1
4
0
dbb776d44307fd2841746cf4cb4e283cd36aa2b5
zachs18
2022-12-30T00:23:14
Allow byte literals as enum discriminants in CheckedBitPattern derive macro. (#155)
diff --git a/derive/src/traits.rs b/derive/src/traits.rs index 2590267..0f4e0a9 100644 --- a/derive/src/traits.rs +++ b/derive/src/traits.rs @@ -766,6 +766,7 @@ fn parse_int_expr(expr: &Expr) -> Result<i64> { parse_int_expr(expr).map(|int| -int) } Expr::Lit(ExprLit { lit: Lit::Int(int), .. }) => int.ba...
2
24
0
a758c0956e52e54629f00f8283568eaa0d27489f
Christofer Nolander
2022-12-21T20:54:31
`impl Zeroable for Atomic*` (#157) * `impl Zeroable for Atomic*` fixes #74 * added feature flag for `zeroable_atomics` Added documentation for some feature flags on the `Zeroable` trait. Also fixed some invalid references in doc-comments.
diff --git a/Cargo.toml b/Cargo.toml index 9bed82b..470cc6e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,6 +17,7 @@ derive = ["bytemuck_derive"] extern_crate_alloc = [] extern_crate_std = ["extern_crate_alloc"] zeroable_maybe_uninit = [] +zeroable_atomics = [] min_const_generics = [] wasm_simd = [] # Until >= 1...
3
54
2
4eea45e21885af768ac2fb4b24e88488c2f1c0ac
zachs18
2022-12-18T20:44:25
Refactor simd impls. (#156)
diff --git a/src/lib.rs b/src/lib.rs index 19f4630..2ae0b4d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -72,6 +72,18 @@ macro_rules! transmute { }; } +/// A macro to implement marker traits for various simd types. +/// #[allow(unused)] because the impls are only compiled on relevant platforms +/// with relevant c...
3
114
504
2c8ce95548d2096f2092fedc05c4fc5af6824162
Scallop Ye
2022-12-17T23:13:52
Experimental support for `stdsimd` types (#154)
diff --git a/Cargo.toml b/Cargo.toml index 0e25a8d..9bed82b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,6 +26,7 @@ unsound_ptr_pod_impl = [] # NOT SEMVER SUPPORTED! TEMPORARY ONLY! nightly_portable_simd = [] +nightly_stdsimd = [] [dependencies] bytemuck_derive = { version = "1.2.1", path = "derive", optiona...
4
54
0
4c37652113b57c61f8a237ee86d4e2d7673c40dd
zachs18
2022-11-30T19:09:17
Implement CheckedBitPattern for core::num::NonZero*. (#151) * Implement CheckedBitPattern for core::num::NonZero*. * Add tests for CheckedBitPattern. * Fix stacked borrows violation. `<&mut T>::as_ptr` gives a `*const T` which is read-only. `<&mut T>::as_mut_ptr` is necessary to get a `*mut T`. * MSRV fix....
diff --git a/src/checked.rs b/src/checked.rs index d28eaa7..6ac5112 100644 --- a/src/checked.rs +++ b/src/checked.rs @@ -170,6 +170,42 @@ unsafe impl CheckedBitPattern for bool { } } +macro_rules! impl_checked_for_nonzero { + ($($nonzero:ty: $primitive:ty),* $(,)?) => { + $( + unsafe impl CheckedBitPatte...
2
365
1
911f43db98ff9e1d663104ff06e10722c5897720
zachs18
2022-11-28T22:12:32
Make `checked::pod_read_unaligned` require `T: CheckedBitPattern` (#150) Currently, `checked::pod_read_unaligned` requires `T: AnyBitPattern`. (This was likely just a copy-paste error from when the function was introduced in #91.) There should be no current UB nor semver breakage, since this only relaxes the bound (a...
diff --git a/src/checked.rs b/src/checked.rs index 2fea55d..d28eaa7 100644 --- a/src/checked.rs +++ b/src/checked.rs @@ -404,7 +404,7 @@ pub fn from_bytes_mut<T: NoUninit + CheckedBitPattern>(s: &mut [u8]) -> &mut T { /// ## Panics /// * This is like `try_pod_read_unaligned` but will panic on failure. #[inline] -pub...
1
1
1
f14410f32989d2f192656ae64854529fe32f8f33
yvt
2022-11-21T04:28:55
Implement `Zeroable` on `{Cell,Reverse}<impl Zeroable>` (#149) * Implement `Zeroable` on `Cell<impl Zeroable>` * Implement `Zeroable` on `Reverse<impl Zeroable>`
diff --git a/src/zeroable.rs b/src/zeroable.rs index 4d3c28a..efce2b5 100644 --- a/src/zeroable.rs +++ b/src/zeroable.rs @@ -41,6 +41,7 @@ unsafe impl Zeroable for i128 {} unsafe impl Zeroable for f32 {} unsafe impl Zeroable for f64 {} unsafe impl<T: Zeroable> Zeroable for Wrapping<T> {} +unsafe impl<T: Zeroable> Ze...
1
2
0
0da8f3a28f175f6a552110d06d43ed8d69244898
yvt
2022-11-20T23:40:41
Implement `Zeroable` on `UnsafeCell<impl Zeroable>` (#148)
diff --git a/src/zeroable.rs b/src/zeroable.rs index 4e94664..4d3c28a 100644 --- a/src/zeroable.rs +++ b/src/zeroable.rs @@ -47,6 +47,7 @@ unsafe impl<T> Zeroable for *const T {} unsafe impl<T: Zeroable> Zeroable for PhantomData<T> {} unsafe impl Zeroable for PhantomPinned {} unsafe impl<T: Zeroable> Zeroable for Ma...
1
1
0
c9e1ae137373ba5df06b8c3312a56499d65c5b13
zachs18
2022-11-20T23:40:20
Remove where clause from derived TransparentWrapper impls. (#146) * Remove where clause from derived TransparentWrapper impls. * Add test for TransparentWrapper trait bound regression.
diff --git a/derive/src/lib.rs b/derive/src/lib.rs index 6a40e8c..e16d43e 100644 --- a/derive/src/lib.rs +++ b/derive/src/lib.rs @@ -339,6 +339,12 @@ fn derive_marker_trait_inner<Trait: Derivable>( quote!() }; + let where_clause = if Trait::requires_where_clause() { + where_clause + } else { + None + ...
3
39
0
7311e9b4b801f8ab08b62af07cc6c41ec150d526
Christopher Serr
2022-11-17T20:13:24
Implement `ByteEq` and `ByteHash` derives (#144) * Implement `ByteEq` and `ByteHash` derives This adds the derives `ByteEq` and `ByteHash` that can be used as an alternative to the `Eq` / `PartialEq` and `Hash` derives from the standard library. The difference is that these variants use `bytemuck` to convert the...
diff --git a/derive/src/lib.rs b/derive/src/lib.rs index b5c106c..6a40e8c 100644 --- a/derive/src/lib.rs +++ b/derive/src/lib.rs @@ -224,6 +224,93 @@ pub fn derive_contiguous( proc_macro::TokenStream::from(expanded) } +/// Derive the `PartialEq` and `Eq` trait for a type +/// +/// The macro implements `PartialEq`...
3
91
4
06a62314a362d82251d09103cfe889ae470df33c
Lokathor
2022-11-05T21:53:28
(cargo-release) version 1.12.3
diff --git a/Cargo.toml b/Cargo.toml index 36ea7c4..0e25a8d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "bytemuck" description = "A crate for mucking around with piles of bytes." -version = "1.12.2" +version = "1.12.3" authors = ["Lokathor <zefria@gmail.com>"] repository = "https://gi...
1
1
1
5c9d81ca1a17ef2077fdbcdeb05bd14d6328062f
Lokathor
2022-11-05T21:49:51
(cargo-release) version 1.3.0
diff --git a/derive/Cargo.toml b/derive/Cargo.toml index 2335922..d0f0398 100644 --- a/derive/Cargo.toml +++ b/derive/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "bytemuck_derive" description = "derive proc-macros for `bytemuck`" -version = "1.2.1" +version = "1.3.0" authors = ["Lokathor <zefria@gmail.com>"] repos...
1
1
1
02021fba24a3c89bc10e359d41678f44e2c33a80
Christopher Serr
2022-11-05T13:00:40
Conditionally compile in `Arc` (#140) Apparently the latest release of `bytemuck` doesn't compile on some of the targets that it used to because it uses `Arc`. `Arc` is not a type that exists on every target, because not every targets supports atomics.
diff --git a/src/allocation.rs b/src/allocation.rs index 8c29864..9d6c0e6 100644 --- a/src/allocation.rs +++ b/src/allocation.rs @@ -10,11 +10,12 @@ //! ["extern_crate_alloc"]}` use super::*; +#[cfg(target_has_atomic = "ptr")] +use alloc::sync::Arc; use alloc::{ alloc::{alloc_zeroed, Layout}, boxed::Box, ...
2
19
7
518baf9c0b73c92b4ea4406fe15e005c6d71535a
John Nunley
2022-11-03T13:53:01
Allow `repr(transparent)` to be used generically in `derive(Pod)` (#139) * Enabled transparent generics * Move trait checks to implementation block * Replace add_trait_marker impl
diff --git a/derive/src/lib.rs b/derive/src/lib.rs index 8a877f8..b5c106c 100644 --- a/derive/src/lib.rs +++ b/derive/src/lib.rs @@ -9,7 +9,8 @@ use quote::quote; use syn::{parse_macro_input, DeriveInput, Result}; use crate::traits::{ - AnyBitPattern, Contiguous, Derivable, CheckedBitPattern, NoUninit, Pod, Transp...
4
149
116
7b67524a43aeee8c8e07ad8f4486cfe81e51591c
Lokathor
2022-10-30T22:23:59
(cargo-release) version 1.12.2
diff --git a/Cargo.toml b/Cargo.toml index 5b7e1cf..36ea7c4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "bytemuck" description = "A crate for mucking around with piles of bytes." -version = "1.12.1" +version = "1.12.2" authors = ["Lokathor <zefria@gmail.com>"] repository = "https://gi...
1
1
1
12f5bfd62ecfa8b0d4b8f22080cff0685fbdfb64
Lokathor
2022-10-30T22:18:16
clippy you are often a pain in my butt
diff --git a/src/lib.rs b/src/lib.rs index 6078689..8bb7052 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,5 +1,6 @@ #![no_std] #![warn(missing_docs)] +#![allow(clippy::match_like_matches_macro)] #![cfg_attr(feature = "nightly_portable_simd", feature(portable_simd))] //! This crate gives small utilities for casti...
1
1
0
f1571512d2f1e730f360ca7f6a2cbc9ab3c3ebef
Dennis Duda
2022-10-30T22:06:55
fix `try_pod_read_unaligned`... never having worked correctly (#138) It seems like a copy-paste error has happened between `try_from_bytes`/`try_from_bytes_mut` and `try_pod_read_unaligned`, causing `internal::try_pod_read_unaligned` to try to read a &T::Bits instead of a T::Bits, usually failing with a `SizeMismatch`...
diff --git a/derive/tests/basic.rs b/derive/tests/basic.rs index 5e05555..9d5667d 100644 --- a/derive/tests/basic.rs +++ b/derive/tests/basic.rs @@ -186,6 +186,21 @@ fn anybitpattern_implies_zeroable() { assert_eq!(test, AnyBitPatternTest { a: 0, b: 0 }); } +#[test] +fn checkedbitpattern_try_pod_read_unaligned() ...
2
16
1
09dd2ffd682182294a09d5874b0e255d699d833f
zachs18
2022-09-01T23:23:28
Add `cast_{arc,rc}` (and slice and try), and `{wrap,peel}_{arc,rc}`. (#132) * Add `allocation::{try_,}cast_{arc,rc}`, and add `{wrap,peel}_{arc,rc}` to `TransparentWrapperAlloc`. * Avoid intermediate slice reference in `try_cast_slice_{arc,rc}`. * remove `unsafe` block; run `cargo +nightly fmt` (ignoring files I...
diff --git a/src/allocation.rs b/src/allocation.rs index 93664bf..8c29864 100644 --- a/src/allocation.rs +++ b/src/allocation.rs @@ -13,6 +13,8 @@ use super::*; use alloc::{ alloc::{alloc_zeroed, Layout}, boxed::Box, + rc::Rc, + sync::Arc, vec, vec::Vec, }; @@ -315,6 +317,205 @@ pub fn pod_collect_to_ve...
2
304
0
3f2e91d3a6a496fd93b0a7b63ab68242a65d4cd5
Lokathor
2022-08-17T03:01:26
(cargo-release) version 1.2.1
diff --git a/derive/Cargo.toml b/derive/Cargo.toml index ee7cae2..2335922 100644 --- a/derive/Cargo.toml +++ b/derive/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "bytemuck_derive" description = "derive proc-macros for `bytemuck`" -version = "1.2.0" +version = "1.2.1" authors = ["Lokathor <zefria@gmail.com>"] repos...
1
1
1
d47d527ac2b8de0544bd3c5c5ab1361be52e8de1
Daniel Henry-Mantilla
2022-08-16T18:42:07
Fix regression #127: support `align` in `repr`s again (#128)
diff --git a/derive/src/traits.rs b/derive/src/traits.rs index 455d1ef..815e77c 100644 --- a/derive/src/traits.rs +++ b/derive/src/traits.rs @@ -592,6 +592,11 @@ fn get_repr(attributes: &[Attribute]) -> Result<Representation> { | (None, b) => b, | _ => bail!("conflicting representation hints"), ...
2
17
1
1ebf7c251d22b6f81d4bac8f655258f86c2f2047
Daniel Henry-Mantilla
2022-08-12T12:50:51
Cleanup: use a macro for reprs, use syn errors & fix cfg-target-arch (#124)
diff --git a/derive/src/lib.rs b/derive/src/lib.rs index 648a1fc..8a877f8 100644 --- a/derive/src/lib.rs +++ b/derive/src/lib.rs @@ -5,8 +5,8 @@ extern crate proc_macro; mod traits; use proc_macro2::TokenStream; -use quote::{quote, quote_spanned}; -use syn::{parse_macro_input, DeriveInput, spanned::Spanned}; +use q...
2
228
268
bbd6a927adfaf8e0218418248d1285a20274d77c
pali
2022-08-11T18:11:48
fix something_went_wrong on spirv (#125) Removed Display trait bound on the SPIR-V architecture.
diff --git a/src/internal.rs b/src/internal.rs index f5b85ca..fd60779 100644 --- a/src/internal.rs +++ b/src/internal.rs @@ -20,22 +20,26 @@ possibility code branch. */ /// Immediately panics. +#[cfg(not(target_arch = "spirv"))] #[cold] #[inline(never)] -pub(crate) fn something_went_wrong<D: core::fmt::Display>( ...
1
9
5
2c97676bfc846c7f1ba2f78cf2985acaee053622
Tom Dohrmann
2022-08-07T20:32:00
support deriving `Pod` for packed generic types. (#123) * improve `#[repr]` parsing * allow deriving `Pod` for packed generic types * Revert "Update Cargo.toml" This reverts commit 6632bcef2cc6fdfb89034743da97ffa5d2b3cb3a.
diff --git a/Cargo.toml b/Cargo.toml index 0732036..b60e41b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,9 +28,7 @@ unsound_ptr_pod_impl = [] nightly_portable_simd = [] [dependencies] -# use the upper line for testing against bytemuck_derive changes, if any -#bytemuck_derive = { path = "./derive", optional = tru...
3
270
40
331762b0144c6338eed6b521a69b35d32473e6b2
Waffle Maybe
2022-07-24T15:27:49
run `cargo fmt` (#120)
diff --git a/src/allocation.rs b/src/allocation.rs index 888d3c1..93664bf 100644 --- a/src/allocation.rs +++ b/src/allocation.rs @@ -93,11 +93,13 @@ pub fn zeroed_box<T: Zeroable>() -> Box<T> { try_zeroed_box().unwrap() } -/// Allocates a `Vec<T>` of length and capacity exactly equal to `length` and all elements ...
6
177
141
d75942c484d18137844cb905399e5a4a354e5916
Lokathor
2022-07-24T03:15:23
(cargo-release) version 1.11.0
diff --git a/Cargo.toml b/Cargo.toml index 4db41bf..0732036 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "bytemuck" description = "A crate for mucking around with piles of bytes." -version = "1.10.0" +version = "1.11.0" authors = ["Lokathor <zefria@gmail.com>"] repository = "https://gi...
1
1
1
0fe2b2c5688533e11b0a5e139f56ac3b17fb5d4c
Waffle Maybe
2022-07-24T03:09:32
Add `{wrap,peel}_box` functions to `TransparentWrapperAlloc` (#119) * Add `{wrap,peel}_box` functions to `TransparentWrapperAlloc` * Add tests for `{wrap,peel}_box`
diff --git a/src/allocation.rs b/src/allocation.rs index 735f6db..888d3c1 100644 --- a/src/allocation.rs +++ b/src/allocation.rs @@ -339,6 +339,30 @@ pub trait TransparentWrapperAlloc<Inner: ?Sized>: TransparentWrapper<Inner> { } } + /// Convert a box to the inner type into a box to the wrapper + /// type. ...
2
67
8
89bbdb1620d1cc3bf8383af3bd0d3db3a12e4f88
Lokathor
2022-07-19T01:25:57
spelling
diff --git a/Cargo.toml b/Cargo.toml index 7cca8dc..4db41bf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -33,7 +33,7 @@ nightly_portable_simd = [] bytemuck_derive = { version = "1.1", optional = true } [package.metadata.docs.rs] -# Note(Lokathor): Don't use all-feautures or it would use `unsound_ptr_pod_impl` too. +...
1
2
2
2864b5259161cbcd3110a52cf275ab33f01ffd20
Edward
2022-07-19T01:25:00
Fix/syn broken semver (#116) * fix(derive): syn backwards compatibility * fix: bump minimum syn version more after tests
diff --git a/derive/Cargo.toml b/derive/Cargo.toml index e3e0f39..8bbe64f 100644 --- a/derive/Cargo.toml +++ b/derive/Cargo.toml @@ -15,7 +15,8 @@ name = "bytemuck_derive" proc-macro = true [dependencies] -syn = "1" +# syn seems to have broken backwards compability in this version https://github.com/dtolnay/syn/iss...
1
2
1
237d7d3730cf872cd1103a853d6c70fdbacce1d9
daxpedda
2022-07-08T23:16:25
Avoid `clippy::missing_const_for_fn` (#115)
diff --git a/derive/src/traits.rs b/derive/src/traits.rs index c5f8bcb..a7791c7 100644 --- a/derive/src/traits.rs +++ b/derive/src/traits.rs @@ -510,6 +510,7 @@ fn generate_fields_are_trait( let span = input.span(); let field_types = get_field_types(&fields); Ok(quote_spanned! {span => #(const _: fn() = || { +...
1
1
0
e612031c1ff07326df5b6a6eb55603afa7cbe761
Gray Olson
2022-07-07T14:54:34
Add `try_zeroed_vec` and `zeroed_vec` (#117) * add `try_zeroed_vec` and `zeroed_vec`, adjust impl of `try_zeroed_slice_box` * go back to returning an error rather than calling handle_alloc_error * use boxed slice .into_vec instead :)
diff --git a/src/allocation.rs b/src/allocation.rs index 50be3b3..735f6db 100644 --- a/src/allocation.rs +++ b/src/allocation.rs @@ -93,6 +93,25 @@ pub fn zeroed_box<T: Zeroable>() -> Box<T> { try_zeroed_box().unwrap() } +/// Allocates a `Vec<T>` of length and capacity exactly equal to `length` and all elements z...
1
22
8
bf68430b59d019bbeddd2a2fa44a6de32c7b24b6
Lokathor
2022-07-03T00:14:46
(cargo-release) version 1.10.0
diff --git a/Cargo.toml b/Cargo.toml index dc93bd3..7cca8dc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "bytemuck" description = "A crate for mucking around with piles of bytes." -version = "1.9.1" +version = "1.10.0" authors = ["Lokathor <zefria@gmail.com>"] repository = "https://git...
1
1
1
6beb5382ec652d223e4fa520eb6a331b942a0325
Lokathor
2022-07-02T21:30:08
move this little guy where he goes
diff --git a/src/zeroable.rs b/src/zeroable.rs index e30f834..4e94664 100644 --- a/src/zeroable.rs +++ b/src/zeroable.rs @@ -44,7 +44,6 @@ unsafe impl<T: Zeroable> Zeroable for Wrapping<T> {} unsafe impl<T> Zeroable for *mut T {} unsafe impl<T> Zeroable for *const T {} -unsafe impl<T> ZeroableInOption for NonNull<T...
2
2
1
fda9e9f8526325bb8188a8e0aa5271b45d442837
Lokathor
2022-07-02T21:29:48
improve docs
diff --git a/src/pod_in_option.rs b/src/pod_in_option.rs index 5797203..3327e99 100644 --- a/src/pod_in_option.rs +++ b/src/pod_in_option.rs @@ -9,6 +9,8 @@ unsafe impl<T: PodInOption> Pod for Option<T> {} /// ## Safety /// /// * `Option<T>` must uphold the same invariants as [Pod](Pod). +/// * **Reminder:** pointer...
1
2
0
1f265a9e0d942164b6e3eacf65eba9779256cb54
Lokathor
2022-07-02T21:21:11
Move the FooInOption traits into their own files for easier organization.
diff --git a/src/lib.rs b/src/lib.rs index afd3684..6078689 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -90,9 +90,13 @@ mod internal; mod zeroable; pub use zeroable::*; +mod zeroable_in_option; +pub use zeroable_in_option::*; mod pod; pub use pod::*; +mod pod_in_option; +pub use pod_in_option::*; mod no_unin...
5
107
64
abe55e525ee8b4f17dfd05ba31732b6a3580fe07
Edward
2022-06-28T23:55:31
feat: add TransparentWrapperAlloc trait (#111) * feat: add TransparentWrapperAlloc trait * implements wrap_vec and peel_vec * fix: review comments * remote asserts as they don't do anything * avoid issue with stacked borrows
diff --git a/src/allocation.rs b/src/allocation.rs index 72f3f16..50be3b3 100644 --- a/src/allocation.rs +++ b/src/allocation.rs @@ -297,3 +297,57 @@ pub fn pod_collect_to_vec< dst_bytes[..src_size].copy_from_slice(src_bytes); dst } + +/// An extension trait for `TransparentWrapper` and alloc types. +pub trait T...
2
71
0
e8cd71df545a6bef741fec18a5ddf938c401a02a
Edward
2022-06-28T23:54:56
feat: ZeroableInOption and PodInOption traits (#114) * same as Zeroable and Pod but for types which are Zeroable and Pod when wrapped in Option * allows downstream users to implement Zeroable and Pod for their own Option<T> types without running into orphan rules
diff --git a/src/pod.rs b/src/pod.rs index a612f0f..a7bbf9f 100644 --- a/src/pod.rs +++ b/src/pod.rs @@ -52,25 +52,33 @@ unsafe impl Pod for f32 {} unsafe impl Pod for f64 {} unsafe impl<T: Pod> Pod for Wrapping<T> {} -unsafe impl Pod for Option<NonZeroI8> {} -unsafe impl Pod for Option<NonZeroI16> {} -unsafe impl ...
2
42
26
d691aa6a1435cb773cc2a27bbf9bc374806fb19d
John
2022-06-06T19:20:34
implement NoUninit for NonZero* (#107)
diff --git a/src/no_uninit.rs b/src/no_uninit.rs index ae628cb..620886d 100644 --- a/src/no_uninit.rs +++ b/src/no_uninit.rs @@ -1,4 +1,18 @@ use crate::Pod; +use core::num::{ + NonZeroU8, + NonZeroI8, + NonZeroU16, + NonZeroI16, + NonZeroU32, + NonZeroI32, + NonZeroU64, + NonZeroI64, + NonZ...
1
27
0
21e2ac55d74474e79efbe610cb00f7453807c9cf
HeroicKatora
2022-05-19T17:47:54
Note on shared references to Pod-like types (#106) * Note on shared references to Pod-like types * Expand explanation of no-interior-mutability
diff --git a/src/anybitpattern.rs b/src/anybitpattern.rs index 2984db2..5e1fb88 100644 --- a/src/anybitpattern.rs +++ b/src/anybitpattern.rs @@ -3,7 +3,7 @@ use crate::{Pod, Zeroable}; /// Marker trait for "plain old data" types that are valid for any bit pattern. /// /// The requirements for this is very similar to...
3
22
1
96f2e549b367d55a61ad5d1d6238830f12c0f094
Nicholas Bishop
2022-05-13T20:51:43
Fix docstring typo (#104)
diff --git a/derive/src/lib.rs b/derive/src/lib.rs index 27b91f9..648a1fc 100644 --- a/derive/src/lib.rs +++ b/derive/src/lib.rs @@ -51,7 +51,7 @@ pub fn derive_pod(input: proc_macro::TokenStream) -> proc_macro::TokenStream { /// /// The following constraints need to be satisfied for the macro to succeed /// -/// - ...
1
2
2
d8b67687f3bfceecad6df30c67222c5e9a62fadd
mystise
2022-04-19T17:50:28
Add cast_slice_box and try_cast_slice_box, changed try_cast_vec to adjust length and capacity when valid. (#100) * Added try_cast_slice_box and cast_slice_box * Modified try_cast_slice_box and try_cast_vec to recalculate the length if the change in size between the two types is valid. * Ran cargo format
diff --git a/src/allocation.rs b/src/allocation.rs index b6aa8b6..72f3f16 100644 --- a/src/allocation.rs +++ b/src/allocation.rs @@ -5,7 +5,9 @@ //! * You must enable the `extern_crate_alloc` feature of `bytemuck` or you will //! not be able to use this module! This is generally done by adding the //! feature to...
1
96
11
b75005c4d04e60576e9d1770c016f9946bc86ff3
Lokathor
2022-04-02T05:49:36
(cargo-release) version 1.9.1
diff --git a/Cargo.toml b/Cargo.toml index 145ca24..dc93bd3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "bytemuck" description = "A crate for mucking around with piles of bytes." -version = "1.9.0" +version = "1.9.1" authors = ["Lokathor <zefria@gmail.com>"] repository = "https://gith...
1
1
1
26e1495d618e85972f96f7dbff00e52bdf2c5a60
Justin Starry
2022-04-01T17:55:28
Bump bytemuck_derive dependency to required version (#97)
diff --git a/Cargo.toml b/Cargo.toml index f4e0b21..145ca24 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,7 +30,7 @@ nightly_portable_simd = [] [dependencies] # use the upper line for testing against bytemuck_derive changes, if any #bytemuck_derive = { path = "./derive", optional = true } -bytemuck_derive = { vers...
1
1
1
73ae1ee89e42be4f30d2d5e04f7f3e7fb89b6b97
Lokathor
2022-03-30T05:15:56
(cargo-release) version 1.1.0
diff --git a/derive/Cargo.toml b/derive/Cargo.toml index a190cdc..e3e0f39 100644 --- a/derive/Cargo.toml +++ b/derive/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "bytemuck_derive" description = "derive proc-macros for `bytemuck`" -version = "1.0.2-alpha.0" +version = "1.1.0" authors = ["Lokathor <zefria@gmail.com>"...
1
1
1
73eaaaf9b86caffc503a02cbc87da464e28026d1
Lokathor
2022-03-30T05:14:16
(cargo-release) version 1.9.0
diff --git a/Cargo.toml b/Cargo.toml index 1230120..f4e0b21 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "bytemuck" description = "A crate for mucking around with piles of bytes." -version = "1.8.0" +version = "1.9.0" authors = ["Lokathor <zefria@gmail.com>"] repository = "https://gith...
1
1
1
950ae4301253694e72bcba9436f37b6cc00290e8
Lokathor
2022-03-30T05:13:34
back to the correct derive dependency line
diff --git a/Cargo.toml b/Cargo.toml index 0b09a2d..1230120 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -29,8 +29,8 @@ nightly_portable_simd = [] [dependencies] # use the upper line for testing against bytemuck_derive changes, if any -bytemuck_derive = { path = "./derive", optional = true } -# bytemuck_derive = { v...
1
2
2
1fb245c926a9a7bdf99d5911dc741945c0e96728
Gray Olson
2022-03-30T03:25:51
rename NoPadding to NoUninit and clarify docs (#95)
diff --git a/derive/src/lib.rs b/derive/src/lib.rs index bbbdf9d..27b91f9 100644 --- a/derive/src/lib.rs +++ b/derive/src/lib.rs @@ -9,7 +9,7 @@ use quote::{quote, quote_spanned}; use syn::{parse_macro_input, DeriveInput, spanned::Spanned}; use crate::traits::{ - AnyBitPattern, Contiguous, Derivable, CheckedBitPat...
9
87
87
1652a2dcd2b5da770cb6dd9ff2218df28ce34fe0
Gray Olson
2022-03-30T02:01:48
Support unions in derive macros (#94) * allow deriving traits on unions in some cases * basic union tests for nopadding and anybitpattern * implement derives for unions for more traits * remove Pod and AnyBitPattern derives for unions due to possible unsoundness
diff --git a/derive/src/lib.rs b/derive/src/lib.rs index b26d90a..bbbdf9d 100644 --- a/derive/src/lib.rs +++ b/derive/src/lib.rs @@ -5,8 +5,8 @@ extern crate proc_macro; mod traits; use proc_macro2::TokenStream; -use quote::quote; -use syn::{parse_macro_input, DeriveInput}; +use quote::{quote, quote_spanned}; +use ...
3
54
24
4569a30c9f0e818b6441b2ee8ddfb7dfd1ba33bf
Lokathor
2022-03-02T01:12:36
(cargo-release) version 1.8.0
diff --git a/Cargo.toml b/Cargo.toml index b0aa52a..cd2e946 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "bytemuck" description = "A crate for mucking around with piles of bytes." -version = "1.7.3" +version = "1.8.0" authors = ["Lokathor <zefria@gmail.com>"] repository = "https://gith...
1
1
1