mirror of
https://github.com/neondatabase/neon.git
synced 2025-12-22 21:59:59 +00:00
Replace 'memoffset' crate with core functionality (#12761)
The `std::mem::offset_of` macro was introduced in Rust 1.77.0. In the passing, mark the function as `const`, as suggested in the comment. Not sure which compiler version that requires, but it works with what have currently.
This commit is contained in:
committed by
GitHub
parent
e7a1d5de94
commit
d487ba2b9b
1
Cargo.lock
generated
1
Cargo.lock
generated
@@ -5078,7 +5078,6 @@ dependencies = [
|
|||||||
"criterion",
|
"criterion",
|
||||||
"env_logger",
|
"env_logger",
|
||||||
"log",
|
"log",
|
||||||
"memoffset 0.9.0",
|
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"postgres",
|
"postgres",
|
||||||
"postgres_ffi_types",
|
"postgres_ffi_types",
|
||||||
|
|||||||
@@ -135,7 +135,6 @@ lock_api = "0.4.13"
|
|||||||
md5 = "0.7.0"
|
md5 = "0.7.0"
|
||||||
measured = { version = "0.0.22", features=["lasso"] }
|
measured = { version = "0.0.22", features=["lasso"] }
|
||||||
measured-process = { version = "0.0.22" }
|
measured-process = { version = "0.0.22" }
|
||||||
memoffset = "0.9"
|
|
||||||
moka = { version = "0.12", features = ["sync"] }
|
moka = { version = "0.12", features = ["sync"] }
|
||||||
nix = { version = "0.30.1", features = ["dir", "fs", "mman", "process", "socket", "signal", "poll"] }
|
nix = { version = "0.30.1", features = ["dir", "fs", "mman", "process", "socket", "signal", "poll"] }
|
||||||
# Do not update to >= 7.0.0, at least. The update will have a significant impact
|
# Do not update to >= 7.0.0, at least. The update will have a significant impact
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ crc32c.workspace = true
|
|||||||
criterion.workspace = true
|
criterion.workspace = true
|
||||||
once_cell.workspace = true
|
once_cell.workspace = true
|
||||||
log.workspace = true
|
log.workspace = true
|
||||||
memoffset.workspace = true
|
|
||||||
pprof.workspace = true
|
pprof.workspace = true
|
||||||
thiserror.workspace = true
|
thiserror.workspace = true
|
||||||
serde.workspace = true
|
serde.workspace = true
|
||||||
|
|||||||
@@ -34,9 +34,8 @@ const SIZEOF_CONTROLDATA: usize = size_of::<ControlFileData>();
|
|||||||
impl ControlFileData {
|
impl ControlFileData {
|
||||||
/// Compute the offset of the `crc` field within the `ControlFileData` struct.
|
/// Compute the offset of the `crc` field within the `ControlFileData` struct.
|
||||||
/// Equivalent to offsetof(ControlFileData, crc) in C.
|
/// Equivalent to offsetof(ControlFileData, crc) in C.
|
||||||
// Someday this can be const when the right compiler features land.
|
const fn pg_control_crc_offset() -> usize {
|
||||||
fn pg_control_crc_offset() -> usize {
|
std::mem::offset_of!(ControlFileData, crc)
|
||||||
memoffset::offset_of!(ControlFileData, crc)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
|
|||||||
Reference in New Issue
Block a user