Commit Graph

29 Commits

Author SHA1 Message Date
Gilad Naaman
0fac3ac664 Version 0.8.0
Support for const-eval on stable
2022-12-15 20:26:53 +02:00
Gilad Naaman
923a5f2386 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
b94d014a25 Updated version in README 2022-10-17 09:28:40 +03: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
Aleksey Kladov
db56a2d8ce Modernize doc examples to use idiomatic Rust 2021-11-12 13:34:44 +03:00
Alex Touchet
61524a3fbf
Fix crates.io badge 2021-09-03 12:56:29 -07:00
Ralf Jung
96c7cad37e the const_fn compiler feature is a NOP 2021-05-04 17:35:33 +02:00
Ralf Jung
7c247a4c36 update feature flags and docs for const offset_of 2021-03-28 18:59:07 +02: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
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
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
Ralf Jung
8c5200e9e2 add support for using raw_ref macros 2020-06-20 14:23:50 +02:00
Ralf Jung
497aded88d add raw_field macro to compute raw ptr to field 2020-03-16 17:02:11 +01:00
Ralf Jung
e4cd532852
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
425477dc5b Added impl for constant offset_of 2019-11-16 22:34:38 +02:00
Ralf Jung
9540a013b5 we actually work on 1.19 as well 2019-11-16 11:03:15 +01:00
Ralf Jung
a614a209ab no need to use NonNull 2019-08-10 11:59:47 +02:00
Ralf Jung
5abf873462 fix testing README and fix README tests 2019-08-10 11:12:48 +02:00
Ralf Jung
b35ec98360 Merge commit 'refs/pull/8/head' of https://github.com/Gilnaa/memoffset 2019-08-10 11:05:56 +02:00
Ralf Jung
4f2fb3fded update version info in README 2019-08-10 11:05:08 +02:00
Guillaume Gomez
2f6bb9c370 Add tests for README file 2019-05-20 15:12:50 +02:00
Gilad Naaman
2d96bfe695 Added dual support for 1.33 and 1.19 2019-03-15 11:38:46 +02:00
Gilad Naaman
a9cc05526c 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