Commit Graph

381 Commits

Author SHA1 Message Date
zachs18
bb62be5baa
Remove "dangling" terminology for zero-sized pointees. (#262)
* Update safety comment on BoxBytes pointer field.

* Update mentions of "dangling" pointers elsewhere in src/allocation.rs.
2024-08-11 01:59:50 -06:00
zachs18
5eecd33318
Make must_cast by-value and by-shared-ref functions const (#261)
* Make must_cast by-value and by-shared-ref functions const (but not by-mut-ref)

* Add comment for transmute! macro new arm, and update Cargo.toml comment for must_cast MSRV.
2024-08-11 01:59:06 -06:00
Richard Pringle
243302d3ef
Add bytemuck attribute to NoUninit derive (#259) 2024-08-02 08:09:49 -06:00
zachs18
e1baf85f09
Fix box_bytes_zst test (#260) 2024-07-30 21:59:13 -06:00
Lokathor
20f4a09404 chore: Release bytemuck version 1.16.3 2024-07-30 17:08:09 -06:00
Lokathor
9f7161ccf0 describe pr 256 2024-07-30 17:07:44 -06:00
zachs18
291a924518
Allow casting between slices of ZSTs and slices of non-ZSTs in all cases. (#256)
Casting ZST to non-ZST will result in a slice length of 0.
Casting non-ZST to ZST will only work if the input slice has length 0, and results in a slice length of 0; if the input slice is not of length 0, PodCastError::OutputSliceWouldHaveSlop is returned.

Updates the docs of the PodCastError variants to reflect when they can occur.
Updates the docs of try_cast_slice (and checked::) to remove note about ZST <-> non-ZST not being allowed.
Update bytes_of(_mut) to remove ZST check, since casting [ZST] -> [u8] is now allowed directly using cast_slice(_mut).
Update must_cast_slice checks and doctests to allow [ZST] -> [non-ZST], but disallow [non-ZST] -> [ZST].
2024-07-30 17:05:11 -06:00
Lokathor
758774d451 chore: Release bytemuck version 1.16.2 2024-07-30 16:37:41 -06:00
Lokathor
73cd363f72 changelog 2024-07-30 16:37:05 -06:00
zachs18
1c75146bb6
Fix UB when dropping BoxBytes owning a zero-sized layout (#258) 2024-07-30 16:23:38 -06:00
zachs18
005ee3254f
Fix panics in try_cast_slice_box etc (#254)
* Fix panics in try_cast_slice_{box,rc,arc},cast_vec.

Casting from non-empty non-ZST slices to ZST slices now returns Err(SizeMismatch) (instead of panicking).
Casting from empty non-ZST slices to ZST slices is allowed and returns an empty slice (instead of panicking).
Casting from ZST slices to non-ZST slices is allowed and returns an empty slice (status quo).

* Add tests for cast_slice_box,rc,arc.
2024-07-21 10:24:43 -06:00
Lokathor
02ffd53a4e chore: Release bytemuck version 1.16.1 2024-06-18 21:26:50 -06:00
Lokathor
e0364d28c8 update changelog 2024-06-18 21:26:34 -06:00
Trevor Gross
9b81537c5f
Support Zeroable and Pod for f16 and f128 (#251)
These are gated under a new feature flag `nightly_float`.

Fixes: <https://github.com/Lokathor/bytemuck/issues/250>
2024-06-18 21:24:29 -06:00
Lokathor
d15b8e0e6d
stupid branch stuff. (#248)
* Change #![allow(clippy::missing_docs_in_private_items)] to #[allow(clippy::missing_docs_in_private_items)], also rustfmt went wild

* fix for 1.34 building.

* clippy be quiet

* derive changelog.

* chore: Release bytemuck_derive version 1.7.0
2024-05-28 12:30:53 -06:00
Lokathor
c9540064f3
Fix the errors CI is showing (#247)
* Change #![allow(clippy::missing_docs_in_private_items)] to #[allow(clippy::missing_docs_in_private_items)], also rustfmt went wild

* fix for 1.34 building.

* clippy be quiet
2024-05-28 12:22:59 -06:00
Tom Dohrmann
a630404e18
support deriving Zeroable for fieldless enums (#233)
* support deriving Zeroable for fieldless enums

* add test for deriving Zeroable on enum
2024-05-28 11:53:32 -06:00
zachs18
9a27279008
Allow generics in derive(ByteEq, ByteHash). (#219)
Note that the ergonomics are still not great, since `NoUninit` is also required to use `derive(ByteEq, ByteHash)`, and `derive(NoUninit)` doesn't support generics,
but that *explicitly* doesn't support generics, instead of silently ignoring generics like `derive(ByteEq, ByteHash)` used to, so this is strictly an improvement.
2024-05-28 11:52:54 -06:00
Andrew Gazelka
1c3751410f
fix clippy lints (#137) 2024-05-28 11:31:06 -06:00
Urgau
f9f7bb10b3
Address unexpected_cfgs warnings instead of allowing the lint (#243) 2024-05-24 13:21:58 -06:00
Lokathor
89885d160a chore: Release bytemuck_derive version 1.6.1 2024-05-24 11:54:29 -06:00
Jay White
7094cb8b8e
Ignore clippy::multiple_bound_locations lint. (#242) 2024-05-24 11:52:56 -06:00
Lokathor
4c46b919e2 chore: Release bytemuck version 1.16.0 2024-05-13 11:08:36 -06:00
Lokathor
5287f8cf6d we can put out 1.16 without waiting for more 2024-05-13 11:08:13 -06:00
Lokathor
a41510f303 put const_zeroed into the changelog 2024-05-13 10:59:46 -06:00
Lokathor
9319f4858b make clippy be quiet about useless nonsense. 2024-05-13 10:53:18 -06:00
Lokathor
b39b6813a7 fix up docs warnings 2024-05-13 10:51:37 -06:00
Tyler Ruckinger
99e95084a6
support const zeroed() (#240) 2024-05-13 10:16:20 -06:00
Julien Cretin
7ef8801cff
Add documentation to generated public items (#236)
Fixes #235
2024-04-17 09:56:34 -06:00
zachs18
eeb6e9dd53
Update TransparentWrapper asserts (#232)
* Update TransparentWrapper asserts.

* Update TransparentWrapperAlloc assert comments.
2024-04-09 19:02:38 -06:00
zachs18
0c821ce9d5
Fix miri CI (#231)
* Remove -Zmiri-tag-raw-pointers

It is now the default.

* Remove workaround for miri/2423
2024-04-01 07:31:39 -06:00
Lokathor
4d2fc16208 chore: Release bytemuck version 1.15.0 2024-03-12 23:15:46 -06:00
Lokathor
09d32a1574 move the changes to the correct changelog. 2024-03-12 23:15:07 -06:00
Lokathor
069d4585a3 changelog 2024-03-12 23:11:27 -06:00
zachs18
a888e5f2c0
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
2024-03-12 23:00:32 -06:00
Lokathor
91bbbdf9a5 chore: Release bytemuck_derive version 1.6.0 2024-03-10 11:41:42 -06:00
Lokathor
adf7bf4f2b changelog 2024-03-10 11:38:52 -06:00
Lokathor
49eed864ac chore: Release bytemuck version 1.14.3 2024-02-08 22:10:24 -07:00
Lokathor
5f4717633d clear up some warnings in tests. 2024-02-08 22:09:44 -07:00
Lokathor
031a0350ca ready changelog 2024-02-08 22:07:56 -07:00
zachs18
1afddf9d9b
Under features = ["nightly_stdsimd"], only enable stdarch_x86_avx512 feature on x86 or x86_64 targets. (#225) 2024-02-07 17:45:17 -07:00
Lokathor
04ed11bdd5 chore: Release bytemuck version 1.14.2 2024-02-06 19:55:05 -07:00
Lokathor
d5f782bb48 update changelog 2024-02-06 19:54:46 -07:00
Lokathor
678c923f52 Closes https://github.com/Lokathor/bytemuck/issues/224, the Nightly feature name changed. 2024-02-06 19:50:43 -07:00
Logan Magee
5f93477418
Fix typo in AnyBitPattern docs (#221) 2024-01-24 19:58:00 -07:00
Lokathor
1e1a22e5ea chore: Release bytemuck version 1.14.1 2024-01-24 17:32:54 -07:00
Lokathor
2ae1a14a3f changelog 2024-01-24 17:32:42 -07:00
Hrvoje Nikšić
8dc32b1e50
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 choosing between `*from_bytes(x)` and
`pod_read_unaligned(x)`, it's good to have a clearly documented
criterion.

* Cosmetic doc changes

Add a couple of missing links, add a missing "like" (consistent with
other similar sentences).

* Remove redundant link

The redundant link emits a warning in `cargo doc`.
2024-01-24 17:30:59 -07:00
Lokathor
085a5f573e Revise the crate-level docs. 2023-11-26 12:44:24 -07:00
Andri
c705218630
Added custom crate path with tests (#209)
Co-authored-by: Andri <80914617+Shuray04@users.noreply.github.com>
2023-10-19 23:02:54 -06:00