Commit Graph

367 Commits

Author SHA1 Message Date
Lokathor
7b67524a43 (cargo-release) version 1.12.2 2022-10-30 16:23:59 -06:00
Lokathor
579950fdb5 changelog 2022-10-30 16:23:27 -06:00
Lokathor
12f5bfd62e clippy you are often a pain in my butt 2022-10-30 16:18:16 -06:00
Dennis Duda
f1571512d2
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` error. In the worst case, this allows UB in safe code by having a type allowing any bit pattern and being pointer-sized.
2022-10-30 16:06:55 -06:00
zachs18
09dd2ffd68
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 didn't modify)

* Make `cast_rc` (etc) have the same bounds as `cast_mut`, due to the existence of `Rc::get_mut_unchecked`.
2022-09-01 17:23:28 -06:00
Lokathor
950a3ed3b9 use the new derive updates. 2022-08-16 21:03:48 -06:00
Lokathor
3f2e91d3a6 (cargo-release) version 1.2.1 2022-08-16 21:01:26 -06:00
Lokathor
b7b438026d derive changlog. 2022-08-16 21:00:48 -06:00
Daniel Henry-Mantilla
d47d527ac2
Fix regression #127: support align in reprs again (#128) 2022-08-16 12:42:07 -06:00
Lokathor
995205de23 version bump 2022-08-14 10:10:45 -06:00
Lokathor
fd6b212a35 Update the readme to reflect the project status as of 2022-august 2022-08-14 09:52:26 -06:00
Lokathor
9ea5f65e0f add a note about intended MSRV of the derives (none!) 2022-08-14 09:50:39 -06:00
Lokathor
f053800ce0 bump bytemuck_derive version with changelog 2022-08-14 09:49:53 -06:00
Daniel Henry-Mantilla
1ebf7c251d
Cleanup: use a macro for reprs, use syn errors & fix cfg-target-arch (#124) 2022-08-12 06:50:51 -06:00
pali
bbd6a927ad
fix something_went_wrong on spirv (#125)
Removed Display trait bound on the SPIR-V architecture.
2022-08-11 12:11:48 -06:00
Tom Dohrmann
2c97676bfc
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 6632bcef2c.
2022-08-07 14:32:00 -06:00
Waffle Maybe
331762b014
run cargo fmt (#120) 2022-07-24 09:27:49 -06:00
Lokathor
d75942c484 (cargo-release) version 1.11.0 2022-07-23 21:15:23 -06:00
Lokathor
5ed7a7fc52
Update changelog.md 2022-07-23 21:12:15 -06:00
Waffle Maybe
0fe2b2c568
Add {wrap,peel}_box functions to TransparentWrapperAlloc (#119)
* Add `{wrap,peel}_box` functions to `TransparentWrapperAlloc`

* Add tests for `{wrap,peel}_box`
2022-07-23 21:09:32 -06:00
Lokathor
a053f1d887 derive version bump. 2022-07-18 19:27:55 -06:00
Lokathor
89bbdb1620 spelling 2022-07-18 19:25:57 -06:00
Edward
2864b52591
Fix/syn broken semver (#116)
* fix(derive): syn backwards compatibility

* fix: bump minimum syn version more after tests
2022-07-18 19:25:00 -06:00
piwicode
9d90497f7c
Replace LICENCES-* symlinks with a licence copy. (#118)
Fixes the licences content in bytemuck_derive.

Archives on crates.io does not contain a licence copy, but
just a file containing the symlink relative path instead.

https://static.crates.io/crates/bytemuck_derive/bytemuck_derive-1.1.0.crate
2022-07-13 06:53:17 -06:00
daxpedda
237d7d3730
Avoid clippy::missing_const_for_fn (#115) 2022-07-08 17:16:25 -06:00
Gray Olson
e612031c1f
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 :)
2022-07-07 08:54:34 -06:00
Lokathor
bf68430b59 (cargo-release) version 1.10.0 2022-07-02 18:14:46 -06:00
Lokathor
919c69cc4e changelog 2022-07-02 15:46:07 -06:00
Lokathor
6beb5382ec move this little guy where he goes 2022-07-02 15:30:08 -06:00
Lokathor
fda9e9f852 improve docs 2022-07-02 15:29:48 -06:00
Lokathor
1f265a9e0d Move the FooInOption traits into their own files for easier organization. 2022-07-02 15:21:11 -06:00
Edward
abe55e525e
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
2022-06-28 17:55:31 -06:00
Edward
e8cd71df54
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
2022-06-28 17:54:56 -06:00
nils
e9eb13e0e7
Use `-Zmiri-tag-raw-pointers in CI (#113)
Normal Miri does not provide sufficient safety guarantees. Using the flag `-Zmiri-tag-raw-pointers` also checks usage of pointers in a more strict way.
2022-06-26 10:22:38 -06:00
John
d691aa6a14
implement NoUninit for NonZero* (#107) 2022-06-06 13:20:34 -06:00
HeroicKatora
21e2ac55d7
Note on shared references to Pod-like types (#106)
* Note on shared references to Pod-like types

* Expand explanation of no-interior-mutability
2022-05-19 11:47:54 -06:00
Nicholas Bishop
96f2e549b3
Fix docstring typo (#104) 2022-05-13 14:51:43 -06:00
mystise
d8b67687f3
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
2022-04-19 11:50:28 -06:00
Lokathor
b75005c4d0 (cargo-release) version 1.9.1 2022-04-01 23:49:36 -06:00
Lokathor
f7963d6281 update changelog. 2022-04-01 23:49:13 -06:00
Justin Starry
26e1495d61
Bump bytemuck_derive dependency to required version (#97) 2022-04-01 11:55:28 -06:00
Lokathor
73ae1ee89e (cargo-release) version 1.1.0 2022-03-29 23:15:56 -06:00
Lokathor
4459b9295c changelog for the derives. 2022-03-29 23:15:32 -06:00
Lokathor
73eaaaf9b8 (cargo-release) version 1.9.0 2022-03-29 23:14:16 -06:00
Lokathor
950ae43012 back to the correct derive dependency line 2022-03-29 23:13:34 -06:00
Lokathor
d8215fb95a
Update changelog.md (#96)
* Update changelog.md

* Update changelog.md

* Use the `5` instead of an `s`, because we're l33t
2022-03-29 23:10:43 -06:00
Gray Olson
1fb245c926
rename NoPadding to NoUninit and clarify docs (#95) 2022-03-29 21:25:51 -06:00
Gray Olson
1652a2dcd2
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
2022-03-29 20:01:48 -06:00
Gray Olson
b472189ff8
Add NoPadding, AnyBitPattern, and CheckedBitPattern traits (#91)
* add MaybePod and NoPadding traits

* MaybePod and NoPadding derive macros

* fix doctest

* fmt

* fix bad doc link

* move new casting functions into separate modules

* fmt

* fix doctest and derive test

* remove relaxed module, add anybitpattern

* rename MaybePod to CheckedCastFromPod

* rename checked casting functions

* rework CheckedCastFromPod into CheckedBitPattern

* add anybitpattern derive, fix up other derives

* fix doctest

* fix derive trait of bits type

* export AnyBitPattern derive

* export anybitpattern from traits

* actually export derive macro for AnyBitPattern

* make bits struct pub because of type leaking rules

* allow clippy lint in derive

* add copy bound to CheckedBitPattern

* - replace Pod bounds with NoPadding+AnyBitPattern
- add try and panic versions of checked cast functions
- slightly update docs

* fix derive tests

* - adapt the allocation module cast functions as well
- as part of that, make AnyBitPattern a subtrait of Zeroable
- AnyBitPattern derive also derives Zeroable

* @JakobDegen and @zakarumych nits

* superset -> subset on CheckedBitPattern and NoPadding docs

* derive Debug on generated `Bits` structs, which can be useful for debugging failures

* don't derive debug on spirv target arch

* make it work on 1.34

* merge conflicts

* fix erroneous behavior in doctest
2022-03-29 17:01:02 -06:00
Lokathor
4569a30c9f (cargo-release) version 1.8.0 2022-03-01 18:12:36 -07:00