summaryrefslogtreecommitdiffstats
path: root/vendor/memoffset
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:57:31 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:57:31 +0000
commitdc0db358abe19481e475e10c32149b53370f1a1c (patch)
treeab8ce99c4b255ce46f99ef402c27916055b899ee /vendor/memoffset
parentReleasing progress-linux version 1.71.1+dfsg1-2~progress7.99u1. (diff)
downloadrustc-dc0db358abe19481e475e10c32149b53370f1a1c.tar.xz
rustc-dc0db358abe19481e475e10c32149b53370f1a1c.zip
Merging upstream version 1.72.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/memoffset')
-rw-r--r--vendor/memoffset/.cargo-checksum.json2
-rw-r--r--vendor/memoffset/Cargo.toml3
-rw-r--r--vendor/memoffset/src/lib.rs1
-rw-r--r--vendor/memoffset/src/offset_of.rs76
4 files changed, 64 insertions, 18 deletions
diff --git a/vendor/memoffset/.cargo-checksum.json b/vendor/memoffset/.cargo-checksum.json
index c8b72f989..07f8b9108 100644
--- a/vendor/memoffset/.cargo-checksum.json
+++ b/vendor/memoffset/.cargo-checksum.json
@@ -1 +1 @@
-{"files":{"Cargo.toml":"d1193e8d228ceb5aa5792b8170c0cec8802489d66eb590bae693ae0a009c3bb9","LICENSE":"3234ac55816264ee7b6c7ee27efd61cf0a1fe775806870e3d9b4c41ea73c5cb1","README.md":"a673f0b4b5ac46034590a670572bd1a87837fdedb5170dabbea08d392e6cfa4b","build.rs":"df34c830dbb08eba3474304eed481bc2c8a29e897bc50f46d37b5dbb6e443a2b","src/lib.rs":"cc7f53556da6f53e5818e31330b488ad0de8d58096edf05f9f27e7f1159d1bfe","src/offset_of.rs":"9a2f9e8a7739a615df214738302bb74df584a53485a7f3536c0aca17ce936db3","src/raw_field.rs":"ef54087d5f507c2b639a4f61f2881eb1e41a46e22191ffd0e23b2fe9e3f17c25","src/span_of.rs":"b900faef2b852b52c37c55a172c05c9144bfff7d84dbc06e943fb0453d68adfc"},"package":"d61c719bcfbcf5d62b3a09efa6088de8c54bc0bfcd3ea7ae39fcc186108b8de1"} \ No newline at end of file
+{"files":{"Cargo.toml":"9039cd9c621a44a65a2fe19c2e883a7b06c6801c64bb9d2255c94adc2051880f","LICENSE":"3234ac55816264ee7b6c7ee27efd61cf0a1fe775806870e3d9b4c41ea73c5cb1","README.md":"a673f0b4b5ac46034590a670572bd1a87837fdedb5170dabbea08d392e6cfa4b","build.rs":"df34c830dbb08eba3474304eed481bc2c8a29e897bc50f46d37b5dbb6e443a2b","src/lib.rs":"a91af41fef48edc5295a99cf90b14273e04db201ed65d88dea101496112c8cd5","src/offset_of.rs":"501f3eb9ec2ada6bd9cd18c73eafdd8ac75bfbfe7e7b543428d9bb97e1cbc478","src/raw_field.rs":"ef54087d5f507c2b639a4f61f2881eb1e41a46e22191ffd0e23b2fe9e3f17c25","src/span_of.rs":"b900faef2b852b52c37c55a172c05c9144bfff7d84dbc06e943fb0453d68adfc"},"package":"5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c"} \ No newline at end of file
diff --git a/vendor/memoffset/Cargo.toml b/vendor/memoffset/Cargo.toml
index 5d71c6496..77fe68f74 100644
--- a/vendor/memoffset/Cargo.toml
+++ b/vendor/memoffset/Cargo.toml
@@ -11,7 +11,7 @@
[package]
name = "memoffset"
-version = "0.8.0"
+version = "0.9.0"
authors = ["Gilad Naaman <gilad.naaman@gmail.com>"]
description = "offset_of functionality for Rust structs."
readme = "README.md"
@@ -34,3 +34,4 @@ version = "1"
[features]
default = []
unstable_const = []
+unstable_offset_of = []
diff --git a/vendor/memoffset/src/lib.rs b/vendor/memoffset/src/lib.rs
index 72736aa09..ccf182b61 100644
--- a/vendor/memoffset/src/lib.rs
+++ b/vendor/memoffset/src/lib.rs
@@ -61,6 +61,7 @@
feature(const_ptr_offset_from)
)]
#![cfg_attr(feature = "unstable_const", feature(const_refs_to_cell))]
+#![cfg_attr(feature = "unstable_offset_of", feature(allow_internal_unstable))]
#[macro_use]
#[cfg(doctests)]
diff --git a/vendor/memoffset/src/offset_of.rs b/vendor/memoffset/src/offset_of.rs
index 9ce4ae200..190ca7253 100644
--- a/vendor/memoffset/src/offset_of.rs
+++ b/vendor/memoffset/src/offset_of.rs
@@ -67,6 +67,28 @@ macro_rules! _memoffset_offset_from_unsafe {
($field as usize) - ($base as usize)
};
}
+#[cfg(not(feature = "unstable_offset_of"))]
+#[macro_export(local_inner_macros)]
+#[doc(hidden)]
+macro_rules! _memoffset__offset_of_impl {
+ ($parent:path, $field:tt) => {{
+ // Get a base pointer (non-dangling if rustc supports `MaybeUninit`).
+ _memoffset__let_base_ptr!(base_ptr, $parent);
+ // Get field pointer.
+ let field_ptr = raw_field!(base_ptr, $parent, $field);
+ // Compute offset.
+ _memoffset_offset_from_unsafe!(field_ptr, base_ptr)
+ }};
+}
+#[cfg(feature = "unstable_offset_of")]
+#[macro_export]
+#[doc(hidden)]
+#[allow_internal_unstable(offset_of)]
+macro_rules! _memoffset__offset_of_impl {
+ ($parent:path, $field:tt) => {{
+ $crate::__priv::mem::offset_of!($parent, $field)
+ }};
+}
/// Calculates the offset of the specified field from the start of the named struct.
///
@@ -98,14 +120,9 @@ macro_rules! _memoffset_offset_from_unsafe {
/// As a result, the value should not be retained and used between different compilations.
#[macro_export(local_inner_macros)]
macro_rules! offset_of {
- ($parent:path, $field:tt) => {{
- // Get a base pointer (non-dangling if rustc supports `MaybeUninit`).
- _memoffset__let_base_ptr!(base_ptr, $parent);
- // Get field pointer.
- let field_ptr = raw_field!(base_ptr, $parent, $field);
- // Compute offset.
- _memoffset_offset_from_unsafe!(field_ptr, base_ptr)
- }};
+ ($parent:path, $field:tt) => {
+ _memoffset__offset_of_impl!($parent, $field)
+ };
}
/// Calculates the offset of the specified field from the start of the tuple.
@@ -131,6 +148,30 @@ macro_rules! offset_of_tuple {
}};
}
+#[cfg(not(feature = "unstable_offset_of"))]
+#[macro_export(local_inner_macros)]
+#[doc(hidden)]
+macro_rules! _memoffset__offset_of_union_impl {
+ ($parent:path, $field:tt) => {{
+ // Get a base pointer (non-dangling if rustc supports `MaybeUninit`).
+ _memoffset__let_base_ptr!(base_ptr, $parent);
+ // Get field pointer.
+ let field_ptr = raw_field_union!(base_ptr, $parent, $field);
+ // Compute offset.
+ _memoffset_offset_from_unsafe!(field_ptr, base_ptr)
+ }};
+}
+
+#[cfg(feature = "unstable_offset_of")]
+#[macro_export(local_inner_macros)]
+#[doc(hidden)]
+#[allow_internal_unstable(offset_of)]
+macro_rules! _memoffset__offset_of_union_impl {
+ ($parent:path, $field:tt) => {{
+ $crate::__priv::mem::offset_of!($parent, $field)
+ }};
+}
+
/// Calculates the offset of the specified union member from the start of the union.
///
/// ## Examples
@@ -155,12 +196,7 @@ macro_rules! offset_of_tuple {
#[macro_export(local_inner_macros)]
macro_rules! offset_of_union {
($parent:path, $field:tt) => {{
- // Get a base pointer (non-dangling if rustc supports `MaybeUninit`).
- _memoffset__let_base_ptr!(base_ptr, $parent);
- // Get field pointer.
- let field_ptr = raw_field_union!(base_ptr, $parent, $field);
- // Compute offset.
- _memoffset_offset_from_unsafe!(field_ptr, base_ptr)
+ _memoffset__offset_of_union_impl!($parent, $field)
}};
}
@@ -312,7 +348,11 @@ mod tests {
assert_eq!(f_ptr as usize + 0, raw_field_union!(f_ptr, Foo, c) as usize);
}
- #[cfg(any(feature = "unstable_const", stable_const))]
+ #[cfg(any(
+ feature = "unstable_const",
+ feature = "unstable_offset_of",
+ stable_const
+ ))]
#[test]
fn const_offset() {
#[repr(C)]
@@ -337,7 +377,11 @@ mod tests {
assert_eq!([0; offset_of!(Foo, b)].len(), 4);
}
- #[cfg(any(feature = "unstable_const", stable_const))]
+ #[cfg(any(
+ feature = "unstable_const",
+ feature = "unstable_offset_of",
+ stable_const
+ ))]
#[test]
fn const_fn_offset() {
const fn test_fn() -> usize {