Commit Graph

145 Commits

Author SHA1 Message Date
Gilad Naaman
b17ae388df
Update src/offset_of.rs
Co-authored-by: Ralf Jung <post@ralfj.de>
2022-10-10 20:45:55 +03:00
Gilad Naaman
71c39fbdfb Support unions in offset_of(_union) 2022-10-10 17:48:18 +03:00
Gilad Naaman
66f4c956a7
Merge pull request #65 from RalfJung/miri
update Miri CI config
2022-03-08 10:34:51 -08:00
Ralf Jung
cb61d3768b update Miri CI config 2022-03-08 13:16:23 -05:00
yvt
2a74b62c26
Suppress clippy::unneeded_wildcard_pattern (#64) 2022-02-23 22:19:16 -05:00
Gilad Naaman
01e2e42ef0 v0.6.5 2021-12-03 18:26:55 +02:00
Gilad Naaman
fd81a21866
Merge pull request #63 from yvt/fix-nightly
Fix `unstable_const` for the latest compiler
2021-12-03 16:18:05 +02:00
yvt
42483952ce Remove #![feature(const_raw_ptr_deref)]
It's now stable in nightly.
2021-12-03 22:22:23 +09:00
yvt
4c71bed98d Remove #![feature(const_maybe_uninit_as_ptr)]
It's now stable in nightly.
2021-12-03 22:21:14 +09:00
Gilad Naaman
b14262b1b3
Merge pull request #62 from matklad/idioms
Modernize doc examples to use idiomatic Rust
2021-11-12 13:14:20 +02:00
Aleksey Kladov
d41cc25cd7 only doctest on modern Rust 2021-11-12 14:05:15 +03:00
Aleksey Kladov
db56a2d8ce Modernize doc examples to use idiomatic Rust 2021-11-12 13:34:44 +03:00
Gilad Naaman
1645cddf2e
Merge pull request #61 from atouchet/badge
Fix crates.io badge
2021-09-03 23:03:01 +03:00
Alex Touchet
61524a3fbf
Fix crates.io badge 2021-09-03 12:56:29 -07:00
Gilad Naaman
32aa69d018
Merge pull request #60 from RalfJung/ci
switch to GHA
2021-07-11 06:16:30 -07:00
Ralf Jung
0e0f8708e1 switch to GHA 2021-07-11 14:58:43 +02:00
Gilad Naaman
bbd58f2cbe v0.6.4 2021-05-27 17:21:15 +03:00
Gilad Naaman
9ab0fcd406
Merge pull request #56 from RalfJung/const_fn
the const_fn compiler feature is a NOP
2021-05-04 21:39:09 -07:00
Ralf Jung
96c7cad37e the const_fn compiler feature is a NOP 2021-05-04 17:35:33 +02:00
Gilad Naaman
cc587faa9d
Merge pull request #55 from RalfJung/const
update feature flags and docs for const offset_of
2021-03-28 22:29:51 +03:00
Ralf Jung
7c247a4c36 update feature flags and docs for const offset_of 2021-03-28 18:59:07 +02:00
Gilad Naaman
9846cd17f3 v0.6.3 2021-03-28 13:11:22 +03:00
Gilad Naaman
b9063d1a7a
Merge pull request #54 from RalfJung/span_of_soundness
Make span_of sound
2021-03-27 18:50:23 +03:00
Ralf Jung
bf9450ea19 fix build on old rustc 2021-03-27 15:30:05 +01:00
Ralf Jung
a73081902e test all versions that are significant in build.rs 2021-03-27 15:26:49 +01:00
Ralf Jung
4746d5a0a8 move mem and ptr into __priv 2021-03-27 15:26:49 +01:00
Ralf Jung
5f9e008def avoid use of size_of_val in span_of 2021-03-27 15:21:43 +01:00
Ralf Jung
ca3425e81a rename _memoffset_offset_from macro to reflect that it is unsafe to call 2021-03-26 09:52:02 +01:00
Gilad Naaman
c063d2c4ca
Merge pull request #53 from RalfJung/unsafe
avoid putting user code inside unsafe blocks
2021-03-26 11:39:43 +03:00
Gilad Naaman
2423502a96 v0.6.2 2021-03-26 03:36:12 +03:00
Ralf Jung
e66b61937d avoid putting user code inside unsafe blocks 2021-03-26 00:01:10 +01:00
Boqun Feng
576166bb63
Use stablilized addr_of! macro (#50)
Since Rust 1.51.0, support for macro addr_of! has been stabilized[1],
and this provides a way to get a raw pointer without potential UB in
some cases.

Memoffset alreadly uses the feature at the pre-stablilized stage (the
macro was named as raw_const! then). Therefore, switch to use the
stablilized version (and name) if Rust 1.51.0 and above is used,
otherwise use the original fallback version, which works in a less
technically correct way.

[1]: https://github.com/rust-lang/rust/pull/72279

Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
2021-03-08 19:56:59 +01:00
Gilad Naaman
91114005f0 v0.6.1 (doc fixes) 2020-10-23 16:16:30 +03:00
Gilad Naaman
e592834acc v0.6.0 2020-10-23 16:16:24 +03:00
Andrew Gaspar
5f8f5a6b9e
Support tuples in offset_of (#48)
Support tuple types via new offset_of_tuple / raw_field_tuple macros
2020-10-23 09:16:25 +02:00
Gilad Naaman
f2a5508ab8 v0.5.6 2020-09-20 14:54:44 +03:00
Ralf Jung
9549c8b47b remove unnecessary 'cargo miri setup' 2020-08-25 11:58:09 +02:00
Gilad Naaman
8adf72ac67
Merge pull request #46 from RalfJung/no-transmute
use MaybeUninit::as_ptr instead of transmute
2020-08-11 13:39:09 +03:00
Ralf Jung
bcf50b5cdd use MaybeUninit::as_ptr instead of transmute 2020-08-09 18:44:38 +02:00
Roland
9520967b00
Remove const_transmute feature dependency (#45)
Remove `const_transmute` feature flag

`const_transmute` has been stabilized on current nightly, see https://github.com/rust-lang/rust/pull/72920.
Document `const_fn_transmute` requirement when using `offset_of!` inside a `const fn`.
Add test for `offset_of!` inside a `const fn`.
2020-07-31 00:21:18 +02:00
Gilad Naaman
8ec286293c v0.5.5 2020-07-01 21:55:07 +03:00
Gilad Naaman
d09d3324f0
Merge pull request #44 from RalfJung/refactor
some reorganization
2020-06-23 11:08:07 +03:00
Ralf Jung
72d7c04348 Travis shares caches between jobs unless their env vars differ 2020-06-23 08:51:10 +02:00
Ralf Jung
782c7d4408 fix allow_clippy 2020-06-22 10:43:53 +02:00
Ralf Jung
6098248fd4 share more code in raw_field 2020-06-22 10:07:50 +02:00
Ralf Jung
a1a14b8120 factor difference between const and non-const into sub-macro 2020-06-22 10:06:53 +02:00
Ralf Jung
8c8900af68 make the const variant closer to the normal variant (just the offset part is different) 2020-06-21 12:12:34 +02:00
Ralf Jung
eb7f7554ef span_of: use raw_field macro for more safety 2020-06-21 12:00:25 +02:00
Ralf Jung
b5e7f3febb move raw_field macro to its own file 2020-06-21 11:53:48 +02:00
Gilad Naaman
5d890ec403
Merge pull request #43 from RalfJung/raw_ref
add support for using raw_ref macros
2020-06-20 16:37:24 +03:00