summaryrefslogtreecommitdiffstats
path: root/vendor/memoffset/src
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 02:49:42 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 02:49:42 +0000
commit837b550238aa671a591ccf282dddeab29cadb206 (patch)
tree914b6b8862bace72bd3245ca184d374b08d8a672 /vendor/memoffset/src
parentAdding debian version 1.70.0+dfsg2-1. (diff)
downloadrustc-837b550238aa671a591ccf282dddeab29cadb206.tar.xz
rustc-837b550238aa671a591ccf282dddeab29cadb206.zip
Merging upstream version 1.71.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/memoffset/src')
-rw-r--r--vendor/memoffset/src/lib.rs5
-rw-r--r--vendor/memoffset/src/offset_of.rs8
2 files changed, 7 insertions, 6 deletions
diff --git a/vendor/memoffset/src/lib.rs b/vendor/memoffset/src/lib.rs
index d80ff1743..72736aa09 100644
--- a/vendor/memoffset/src/lib.rs
+++ b/vendor/memoffset/src/lib.rs
@@ -57,9 +57,10 @@
#![no_std]
#![cfg_attr(
- feature = "unstable_const",
- feature(const_ptr_offset_from, const_refs_to_cell)
+ all(feature = "unstable_const", not(stable_const)),
+ feature(const_ptr_offset_from)
)]
+#![cfg_attr(feature = "unstable_const", feature(const_refs_to_cell))]
#[macro_use]
#[cfg(doctests)]
diff --git a/vendor/memoffset/src/offset_of.rs b/vendor/memoffset/src/offset_of.rs
index d070181ce..9ce4ae200 100644
--- a/vendor/memoffset/src/offset_of.rs
+++ b/vendor/memoffset/src/offset_of.rs
@@ -46,7 +46,7 @@ macro_rules! _memoffset__let_base_ptr {
}
/// Macro to compute the distance between two pointers.
-#[cfg(feature = "unstable_const")]
+#[cfg(any(feature = "unstable_const", stable_const))]
#[macro_export]
#[doc(hidden)]
macro_rules! _memoffset_offset_from_unsafe {
@@ -58,7 +58,7 @@ macro_rules! _memoffset_offset_from_unsafe {
unsafe { (field as *const u8).offset_from(base as *const u8) as usize }
}};
}
-#[cfg(not(feature = "unstable_const"))]
+#[cfg(not(any(feature = "unstable_const", stable_const)))]
#[macro_export]
#[doc(hidden)]
macro_rules! _memoffset_offset_from_unsafe {
@@ -312,7 +312,7 @@ mod tests {
assert_eq!(f_ptr as usize + 0, raw_field_union!(f_ptr, Foo, c) as usize);
}
- #[cfg(feature = "unstable_const")]
+ #[cfg(any(feature = "unstable_const", stable_const))]
#[test]
fn const_offset() {
#[repr(C)]
@@ -337,7 +337,7 @@ mod tests {
assert_eq!([0; offset_of!(Foo, b)].len(), 4);
}
- #[cfg(feature = "unstable_const")]
+ #[cfg(any(feature = "unstable_const", stable_const))]
#[test]
fn const_fn_offset() {
const fn test_fn() -> usize {