Commit Graph

29 Commits

Author SHA1 Message Date
Gilad Naaman 700fb0337a Version 0.8.0
Support for const-eval on stable
2022-12-15 20:26:53 +02:00
Gilad Naaman 726aae7d3a Automatically enable const evaluation
When running on a compiler newer than 1.65,
automatically enable usage of the macro in const contexts.

Closes https://github.com/Gilnaa/memoffset/issues/4
2022-12-11 21:53:36 +02:00
Gilad Naaman 41ef7d3c48 Updated version in README 2022-10-17 09:28:40 +03:00
yvt a0e5563c97 Remove #![feature(const_raw_ptr_deref)]
It's now stable in nightly.
2021-12-03 22:22:23 +09:00
yvt e3bcb9ebf4 Remove #![feature(const_maybe_uninit_as_ptr)]
It's now stable in nightly.
2021-12-03 22:21:14 +09:00
Aleksey Kladov db4bebb157 Modernize doc examples to use idiomatic Rust 2021-11-12 13:34:44 +03:00
Alex Touchet 5e3cb86e6d Fix crates.io badge 2021-09-03 12:56:29 -07:00
Ralf Jung cdb06e8793 the const_fn compiler feature is a NOP 2021-05-04 17:35:33 +02:00
Ralf Jung 3b62693126 update feature flags and docs for const offset_of 2021-03-28 18:59:07 +02:00
Boqun Feng 8c9b3eddcf 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 664896e766 v0.6.1 (doc fixes) 2020-10-23 16:16:30 +03:00
Andrew Gaspar 7dc779f328 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
Ralf Jung 72768daee9 use MaybeUninit::as_ptr instead of transmute 2020-08-09 18:44:38 +02:00
Roland 608e11823e 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
Ralf Jung 3f21c8bba3 add support for using raw_ref macros 2020-06-20 14:23:50 +02:00
Ralf Jung f1642af871 add raw_field macro to compute raw ptr to field 2020-03-16 17:02:11 +01:00
Ralf Jung 8b95fb5233 Merge pull request #31 from Gilnaa/feature/constant-offset
Added impl for constant offset_of
2019-11-16 21:45:06 +01:00
Gilad Naaman 176b647ccd Added impl for constant offset_of 2019-11-16 22:34:38 +02:00
Ralf Jung c1d80999cf we actually work on 1.19 as well 2019-11-16 11:03:15 +01:00
Ralf Jung f734f5bbad no need to use NonNull 2019-08-10 11:59:47 +02:00
Ralf Jung 5151f6b2c1 fix testing README and fix README tests 2019-08-10 11:12:48 +02:00
Ralf Jung e5bbb9d812 Merge commit 'refs/pull/8/head' of https://github.com/Gilnaa/memoffset 2019-08-10 11:05:56 +02:00
Ralf Jung 54096c6a95 update version info in README 2019-08-10 11:05:08 +02:00
Guillaume Gomez 10d9e098f8 Add tests for README file 2019-05-20 15:12:50 +02:00
Gilad Naaman 9174130890 Added dual support for 1.33 and 1.19 2019-03-15 11:38:46 +02:00
Gilad Naaman f402a6f370 Bumped version to 0.2 2018-01-13 19:37:05 +02:00
Gilad Naaman 745368a41f Cargo.toml update 2017-10-17 09:15:37 +03:00
Gilad Naaman 8d2818c039 More readme examples 2017-10-17 09:08:07 +03:00
Gilad Naaman 057a247d25 Cleanup. Macors no longer thoretically allocate. 2017-10-16 22:51:37 +03:00