Merge branch 'upstream/master'

Bug: 102846
Change-Id: I013065b7e12ad8387d0b0f0fdc1c0a36c2fd0911
diff --git a/.github/workflows/bindgen.yml b/.github/workflows/bindgen.yml
index bc525ed..0bc7d23 100644
--- a/.github/workflows/bindgen.yml
+++ b/.github/workflows/bindgen.yml
@@ -13,7 +13,7 @@
     runs-on: ubuntu-latest
 
     steps:
-      - uses: actions/checkout@v2
+      - uses: actions/checkout@v3
 
       - name: Install stable
         uses: actions-rs/toolchain@v1
@@ -35,11 +35,12 @@
         uses: actions-rs/cargo@v1
         with:
           command: clippy
+          args: --tests
 
   msrv:
     runs-on: ubuntu-latest
     steps:
-      - uses: actions/checkout@v2
+      - uses: actions/checkout@v3
 
       - name: Install msrv
         uses: actions-rs/toolchain@v1
@@ -47,16 +48,16 @@
           profile: minimal
           # MSRV below is documented in README.md, please update that if you
           # change this.
-          toolchain: 1.46.0
+          toolchain: 1.54.0
           override: true
 
       - name: Build with msrv
-        run: rm Cargo.lock && cargo +1.46.0 build --lib
+        run: rm Cargo.lock && cargo +1.54.0 build --lib
 
   quickchecking:
     runs-on: ubuntu-latest
     steps:
-      - uses: actions/checkout@v2
+      - uses: actions/checkout@v3
 
       - name: Install stable
         uses: actions-rs/toolchain@v1
@@ -75,9 +76,9 @@
       matrix:
         # TODO(#1954): These should be run on mac too, but turns out they're
         # broken.
-        os: [ubuntu-latest]
+        os: [ubuntu-latest, macos-latest]
     steps:
-      - uses: actions/checkout@v2
+      - uses: actions/checkout@v3
 
       - name: Install stable
         uses: actions-rs/toolchain@v1
@@ -98,7 +99,7 @@
           - debian: null
             cross: null
             rust: null
-        llvm_version: ["3.9", "4.0", "5.0", "9.0"]
+        llvm_version: ["5.0", "9.0"]
         main_tests: [1]
         release_build: [0, 1]
         no_default_features: [0, 1]
@@ -108,19 +109,6 @@
         feature_extra_asserts: [0]
         feature_testing_only_docs: [0]
 
-        exclude:
-          # 3.9 and 4.0 are too old to support regular dynamic linking, so this
-          # is not expected to work.
-          - os: ubuntu-latest
-            llvm_version: "3.9"
-            no_default_features: 1
-            feature_runtime: 0
-
-          - os: ubuntu-latest
-            llvm_version: "4.0"
-            no_default_features: 1
-            feature_runtime: 0
-
         include:
           # Test with extra asserts + docs just with latest llvm versions to
           # prevent explosion
@@ -154,7 +142,7 @@
             feature_extra_asserts: 0
             feature_testing_only_docs: 0
     steps:
-      - uses: actions/checkout@v2
+      - uses: actions/checkout@v3
 
       - name: Install multiarch packages
         if: matrix.target.debian
@@ -196,7 +184,7 @@
   test-book:
     runs-on: ubuntu-latest
     steps:
-      - uses: actions/checkout@v2
+      - uses: actions/checkout@v3
 
       - name: Install stable
         uses: actions-rs/toolchain@v1
diff --git a/.github/workflows/deploy-book.yml b/.github/workflows/deploy-book.yml
index bf03d34..ce7083c 100644
--- a/.github/workflows/deploy-book.yml
+++ b/.github/workflows/deploy-book.yml
@@ -9,7 +9,7 @@
   deploy-book:
     runs-on: ubuntu-latest
     steps:
-      - uses: actions/checkout@v2
+      - uses: actions/checkout@v3
         with:
           persist-credentials: false
 
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 73c405c..17b3223 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,109 +1,112 @@
 <!-- START doctoc generated TOC please keep comment here to allow auto update -->
 <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
 
-
 - [Unreleased](#unreleased)
   - [Added](#added)
-  - [Fixed](#fixed)
   - [Changed](#changed)
-  - [Deprecated](#deprecated)
   - [Removed](#removed)
-  - [Fixed](#fixed-1)
+  - [Fixed](#fixed)
   - [Security](#security)
+- [0.60.0](#0600)
+  - [Added](#added-1)
+  - [Fixed](#fixed-1)
+  - [Changed](#changed-1)
+  - [Removed](#removed-1)
+- [0.59.2](#0592)
 - [0.59.1](#0591)
   - [Fixed](#fixed-2)
 - [0.59.0](#0590)
-  - [Added](#added-1)
-  - [Fixed](#fixed-3)
-  - [Changed](#changed-1)
-- [0.58.1](#0581)
   - [Added](#added-2)
-- [0.58.0](#0580)
-  - [Added](#added-3)
-  - [Fixed](#fixed-4)
+  - [Fixed](#fixed-3)
   - [Changed](#changed-2)
-  - [Deprecated](#deprecated-1)
-  - [Removed](#removed-1)
+- [0.58.1](#0581)
+  - [Added](#added-3)
+- [0.58.0](#0580)
+  - [Added](#added-4)
+  - [Fixed](#fixed-4)
+  - [Changed](#changed-3)
+  - [Deprecated](#deprecated)
+  - [Removed](#removed-2)
   - [Fixed](#fixed-5)
   - [Security](#security-1)
 - [0.57.0](#0570)
-  - [Added](#added-4)
+  - [Added](#added-5)
   - [Fixed](#fixed-6)
 - [0.56.0](#0560)
-  - [Added](#added-5)
-  - [Changed](#changed-3)
+  - [Added](#added-6)
+  - [Changed](#changed-4)
   - [Fixed](#fixed-7)
 - [0.55.1](#0551)
   - [Fixed](#fixed-8)
 - [0.55.0](#0550)
-  - [Removed](#removed-2)
-  - [Added](#added-6)
-  - [Changed](#changed-4)
-  - [Fixed](#fixed-9)
-- [0.54.1](#0541)
+  - [Removed](#removed-3)
   - [Added](#added-7)
   - [Changed](#changed-5)
-  - [Fixed](#fixed-10)
-- [0.54.0](#0540)
+  - [Fixed](#fixed-9)
+- [0.54.1](#0541)
   - [Added](#added-8)
   - [Changed](#changed-6)
+  - [Fixed](#fixed-10)
+- [0.54.0](#0540)
+  - [Added](#added-9)
+  - [Changed](#changed-7)
   - [Fixed](#fixed-11)
 - [0.53.3](#0533)
-  - [Added](#added-9)
+  - [Added](#added-10)
   - [Fixed](#fixed-12)
 - [0.53.2](#0532)
-  - [Changed](#changed-7)
-- [0.53.1](#0531)
-  - [Added](#added-10)
-- [0.53.0](#0530)
-  - [Added](#added-11)
   - [Changed](#changed-8)
-  - [Fixed](#fixed-13)
-- [0.52.0](#0520)
+- [0.53.1](#0531)
+  - [Added](#added-11)
+- [0.53.0](#0530)
   - [Added](#added-12)
   - [Changed](#changed-9)
+  - [Fixed](#fixed-13)
+- [0.52.0](#0520)
+  - [Added](#added-13)
+  - [Changed](#changed-10)
   - [Fixed](#fixed-14)
 - [0.51.1](#0511)
   - [Fixed](#fixed-15)
-  - [Changed](#changed-10)
+  - [Changed](#changed-11)
 - [0.51.0](#0510)
   - [Fixed](#fixed-16)
-  - [Changed](#changed-11)
-  - [Added](#added-13)
-- [0.50.0](#0500)
-  - [Added](#added-14)
-- [0.49.3](#0493)
-  - [Added](#added-15)
-- [0.49.2](#0492)
   - [Changed](#changed-12)
+  - [Added](#added-14)
+- [0.50.0](#0500)
+  - [Added](#added-15)
+- [0.49.3](#0493)
+  - [Added](#added-16)
+- [0.49.2](#0492)
+  - [Changed](#changed-13)
 - [0.49.1](#0491)
   - [Fixed](#fixed-17)
-  - [Changed](#changed-13)
-- [0.49.0](#0490)
-  - [Added](#added-16)
-  - [Fixed](#fixed-18)
   - [Changed](#changed-14)
+- [0.49.0](#0490)
+  - [Added](#added-17)
+  - [Fixed](#fixed-18)
+  - [Changed](#changed-15)
 - [0.48.1](#0481)
   - [Fixed](#fixed-19)
 - [0.48.0](#0480)
-  - [Changed](#changed-15)
+  - [Changed](#changed-16)
   - [Fixed](#fixed-20)
 - [0.47.4](#0474)
-  - [Added](#added-17)
+  - [Added](#added-18)
 - [0.47.3](#0473)
-  - [Changed](#changed-16)
+  - [Changed](#changed-17)
 - [0.47.2](#0472)
   - [Fixed](#fixed-21)
 - [0.47.1](#0471)
-  - [Changed](#changed-17)
+  - [Changed](#changed-18)
   - [Fixed](#fixed-22)
 - [0.47.0](#0470)
-  - [Changed](#changed-18)
+  - [Changed](#changed-19)
   - [Fixed](#fixed-23)
 - [0.33.1 .. 0.46.0](#0331--0460)
-  - [Added](#added-18)
-  - [Removed](#removed-3)
-  - [Changed](#changed-19)
+  - [Added](#added-19)
+  - [Removed](#removed-4)
+  - [Changed](#changed-20)
   - [Fixed](#fixed-24)
 - [0.33.1](#0331)
   - [Fixed](#fixed-25)
@@ -113,23 +116,23 @@
 - [0.32.1](#0321)
   - [Fixed](#fixed-27)
 - [0.32.0](#0320)
-  - [Added](#added-19)
-  - [Changed](#changed-20)
-  - [Fixed](#fixed-28)
-- [0.31.0](#0310)
   - [Added](#added-20)
   - [Changed](#changed-21)
-  - [Deprecated](#deprecated-2)
-  - [Removed](#removed-4)
-  - [Fixed](#fixed-29)
-- [0.30.0](#0300)
+  - [Fixed](#fixed-28)
+- [0.31.0](#0310)
   - [Added](#added-21)
   - [Changed](#changed-22)
-  - [Deprecated](#deprecated-3)
-  - [Fixed](#fixed-30)
-- [0.29.0](#0290)
+  - [Deprecated](#deprecated-1)
+  - [Removed](#removed-5)
+  - [Fixed](#fixed-29)
+- [0.30.0](#0300)
   - [Added](#added-22)
   - [Changed](#changed-23)
+  - [Deprecated](#deprecated-2)
+  - [Fixed](#fixed-30)
+- [0.29.0](#0290)
+  - [Added](#added-23)
+  - [Changed](#changed-24)
   - [Fixed](#fixed-31)
 
 <!-- END doctoc generated TOC please keep comment here to allow auto update -->
@@ -140,20 +143,67 @@
 
 ## Added
 
-## Fixed
-
 ## Changed
 
- * cexpr and nom have been updated, new msrv is 1.46 (#2107).
-
-## Deprecated
-
 ## Removed
 
 ## Fixed
 
 ## Security
 
+# 0.60.1
+
+Released 2022/06/06
+
+## Fixed
+
+ * Fixed stack overflow in generated tests for structs with many fields (#2219).
+
+# 0.60.0
+
+Released 2022/06/05
+
+## Added
+
+ * Objective-C structs now derive `Debug` and `Copy` to support C and Objective-C structs. [(#2176)][]
+ * Allow fully-qualified derives. (#2156)
+ * Bindings generation now returns a more suitable error (#2125)
+ * `--version --verbose` now prints clang version (#2140).
+ * Experimental vtable generation (#2145).
+ * Added an `--allowlist-file` option (#2122).
+ * Support for vectorcall ABI (#2177).
+
+## Fixed
+
+ * Fixed lifetimes with Objective-C trait templates. [(#2176)][]
+ * Fixed objc imports for non-`#[macro_use]` use. [(#2176)][]
+ * Handle differences between clang and rustc targets for RISCV (#2137).
+ * `BINDGEN_EXTRA_CLANG_ARGS` is respected on the CLI now (#1723).
+ * Use common type alias for anonymous enums in consts mode (#2191)
+ * Look for `#[must_use]` in typedefs (#2206).
+ * Fixed derive on packed structs (#2083).
+ * Fixed warnings on layout tests (#2203).
+
+## Changed
+
+ * cexpr, clap, and nom have been updated, new msrv is 1.54.
+
+## Removed
+
+ * Support for ancient libclang versions has been removed.
+
+ [(#2176)]: https://github.com/rust-lang/rust-bindgen/pull/2176
+
+# 0.59.2
+
+Released 2021/11/26
+
+ * cexpr+env_logger bump.
+ * Various fixes for C++ crashes / hangs.
+ * Enums now respect annotations and derives properly in more cases.
+ * Some more APIs (blocklist-file, etc).
+ * 'static lifetime is elided when appropriate.
+
 # 0.59.1
 
 Released 2021/07/26
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 8a9f868..d4090f6 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -71,7 +71,7 @@
 versions of llvm, or specify the path of the desired libclang explicitly:
 
 ```
-$ export LIBCLANG_PATH=path/to/clang-3.9/lib
+$ export LIBCLANG_PATH=path/to/clang-9.0/lib
 ```
 
 Additionally, you may want to build and test with the `testing_only_docs`
@@ -195,9 +195,8 @@
 version. Instead of having a single `tests/expectations/tests/my_test.rs` file,
 add each of:
 
-* `tests/expectations/tests/libclang-4/my_test.rs`
-* `tests/expectations/tests/libclang-3.9/my_test.rs`
-* `tests/expectations/tests/libclang-3.8/my_test.rs`
+* `tests/expectations/tests/libclang-9/my_test.rs`
+* `tests/expectations/tests/libclang-5/my_test.rs`
 
 If you need to update the test expectations for a test file that generates
 different bindings for different `libclang` versions, you *don't* need to have
@@ -247,8 +246,8 @@
 
 The `tests/quickchecking` crate generates property tests for `bindgen`.
 From the crate's directory you can run the tests with `cargo run`. For details
-on additional configuration including how to preserve / inspect the generated 
-property tests, see 
+on additional configuration including how to preserve / inspect the generated
+property tests, see
 [./tests/quickchecking/README.md](./tests/quickchecking/README.md).
 
 ## Code Overview
@@ -298,6 +297,8 @@
             * Its type's `ItemId`
             * Optionally, a mangled name
             * Optionally, a value
+    * An optional `clang::SourceLocation` that holds the first source code
+      location where the `Item` was encountered.
 
 The IR forms a graph of interconnected and inter-referencing types and
 functions. The `ir::traversal` module provides IR graph traversal
diff --git a/Cargo.lock b/Cargo.lock
index 400fb11..e054462 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -4,23 +4,14 @@
 
 [[package]]
 name = "aho-corasick"
-version = "0.7.15"
+version = "0.7.18"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5"
+checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f"
 dependencies = [
  "memchr",
 ]
 
 [[package]]
-name = "ansi_term"
-version = "0.11.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
-dependencies = [
- "winapi",
-]
-
-[[package]]
 name = "atty"
 version = "0.2.14"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -32,8 +23,14 @@
 ]
 
 [[package]]
+name = "autocfg"
+version = "1.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
+
+[[package]]
 name = "bindgen"
-version = "0.59.1"
+version = "0.60.1"
 dependencies = [
  "bitflags",
  "cexpr",
@@ -77,9 +74,9 @@
 
 [[package]]
 name = "clang-sys"
-version = "1.2.0"
+version = "1.3.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "853eda514c284c2287f4bf20ae614f8781f40a81d32ecda6e91449304dfe077c"
+checksum = "5a050e2153c5be08febd6734e29298e844fdb0fa21aeddd63b4eb7baa106c69b"
 dependencies = [
  "glob",
  "libc",
@@ -88,17 +85,17 @@
 
 [[package]]
 name = "clap"
-version = "2.33.3"
+version = "3.0.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002"
+checksum = "d01c9347757e131122b19cd19a05c85805b68c2352a97b623efdc3c295290299"
 dependencies = [
- "ansi_term",
  "atty",
  "bitflags",
+ "indexmap",
+ "os_str_bytes",
  "strsim",
+ "termcolor",
  "textwrap",
- "unicode-width",
- "vec_map",
 ]
 
 [[package]]
@@ -144,6 +141,12 @@
 checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"
 
 [[package]]
+name = "hashbrown"
+version = "0.11.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e"
+
+[[package]]
 name = "hermit-abi"
 version = "0.1.19"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -159,6 +162,16 @@
 checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
 
 [[package]]
+name = "indexmap"
+version = "1.7.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bc633605454125dec4b66843673f01c7df2b89479b32e0ed634e43a91cff62a5"
+dependencies = [
+ "autocfg",
+ "hashbrown",
+]
+
+[[package]]
 name = "lazy_static"
 version = "1.4.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -197,9 +210,9 @@
 
 [[package]]
 name = "memchr"
-version = "2.3.4"
+version = "2.4.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525"
+checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a"
 
 [[package]]
 name = "minimal-lexical"
@@ -219,6 +232,15 @@
 ]
 
 [[package]]
+name = "os_str_bytes"
+version = "6.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8e22443d1643a904602595ba1cd8f7d896afe56d26712531c5ff73a15b2fbf64"
+dependencies = [
+ "memchr",
+]
+
+[[package]]
 name = "peeking_take_while"
 version = "0.1.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -299,9 +321,9 @@
 
 [[package]]
 name = "regex"
-version = "1.4.6"
+version = "1.5.5"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2a26af418b574bd56588335b3a3659a65725d4e636eb1016c2f9e3b38c7cc759"
+checksum = "1a11647b6b25ff05a515cb92c365cec08801e83423a235b51e231e1808747286"
 dependencies = [
  "aho-corasick",
  "memchr",
@@ -337,9 +359,9 @@
 
 [[package]]
 name = "strsim"
-version = "0.8.0"
+version = "0.10.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
+checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
 
 [[package]]
 name = "tempfile"
@@ -366,18 +388,9 @@
 
 [[package]]
 name = "textwrap"
-version = "0.11.0"
+version = "0.14.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
-dependencies = [
- "unicode-width",
-]
-
-[[package]]
-name = "unicode-width"
-version = "0.1.8"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3"
+checksum = "0066c8d12af8b5acd21e00547c3797fde4e8677254a7ee429176ccebbe93dd80"
 
 [[package]]
 name = "unicode-xid"
@@ -386,12 +399,6 @@
 checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3"
 
 [[package]]
-name = "vec_map"
-version = "0.8.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
-
-[[package]]
 name = "version_check"
 version = "0.9.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -405,9 +412,9 @@
 
 [[package]]
 name = "which"
-version = "4.2.1"
+version = "4.2.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7cc009ab82a2afc94b9e467ab4214aee9cad1356cd9191264203d7d72006e00d"
+checksum = "ea187a8ef279bc014ec368c27a920da2024d2a711109bfbe3440585d5cf27ad9"
 dependencies = [
  "either",
  "lazy_static",
diff --git a/Cargo.toml b/Cargo.toml
index 26fd6cb..b3e4c50 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -14,7 +14,7 @@
 repository = "https://github.com/rust-lang/rust-bindgen"
 documentation = "https://docs.rs/bindgen"
 homepage = "https://rust-lang.github.io/rust-bindgen/"
-version = "0.59.1"
+version = "0.60.1"
 edition = "2018"
 build = "build.rs"
 
@@ -41,7 +41,7 @@
 
 [dev-dependencies]
 diff = "0.1"
-clap = "2"
+clap = "3"
 shlex = "1"
 tempfile = "3"
 
@@ -49,13 +49,13 @@
 bitflags = "1.0.3"
 cexpr = "0.6"
 # This kinda sucks: https://github.com/rust-lang/cargo/issues/1982
-clap = { version = "2", optional = true }
+clap = { version = "3", optional = true }
 clang-sys = { version = "1", features = ["clang_6_0"] }
 lazycell = "1"
 lazy_static = "1"
 peeking_take_while = "0.1.2"
 quote = { version = "1", default-features = false }
-regex = { version = "1.0", default-features = false , features = [ "std", "unicode"]}
+regex = { version = "1.5", default-features = false , features = [ "std", "unicode"]}
 which = { version = "4.2.1", optional = true, default-features = false }
 shlex = "1"
 rustc-hash = "1.0.1"
@@ -83,5 +83,3 @@
 testing_only_extra_assertions = []
 testing_only_libclang_9 = []
 testing_only_libclang_5 = []
-testing_only_libclang_4 = []
-testing_only_libclang_3_9 = []
diff --git a/README.md b/README.md
index 7b2dbbc..4b1194f 100644
--- a/README.md
+++ b/README.md
@@ -39,7 +39,7 @@
 
 ## MSRV
 
-The minimum supported Rust version is **1.46**.
+The minimum supported Rust version is **1.54**.
 
 No MSRV bump policy has been established yet, so MSRV may increase in any release.
 
diff --git a/appveyor.yml b/appveyor.yml
index 342f47c..62efeea 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -3,24 +3,12 @@
   RUST_CHANNEL: "%Configuration%"
   matrix:
   - TARGET: gnu
-    LLVM_VERSION: 3.9.0-2
-    BINDGEN_FEATURES: testing_only_libclang_3_9
-  - TARGET: gnu
-    LLVM_VERSION: 4.0.0-1
-    BINDGEN_FEATURES: testing_only_libclang_4
-  - TARGET: gnu
     LLVM_VERSION: 5.0.0-1
     BINDGEN_FEATURES: testing_only_libclang_5
   - TARGET: gnu
     LLVM_VERSION: 9.0.0-1
     BINDGEN_FEATURES: testing_only_libclang_9
   - TARGET: msvc
-    LLVM_VERSION: 3.9.0
-    BINDGEN_FEATURES: testing_only_libclang_3_9
-  - TARGET: msvc
-    LLVM_VERSION: 4.0.0
-    BINDGEN_FEATURES: testing_only_libclang_4
-  - TARGET: msvc
     LLVM_VERSION: 5.0.0
     BINDGEN_FEATURES: testing_only_libclang_5
   - TARGET: msvc
diff --git a/bindgen-integration/.gitattributes b/bindgen-integration/.gitattributes
new file mode 100644
index 0000000..d42187e
--- /dev/null
+++ b/bindgen-integration/.gitattributes
@@ -0,0 +1,4 @@
+# Tell Github Linguist to avoid counting these C and C++ test inputs toward
+# statistics.
+*.h -linguist-detectable
+*.cc -linguist-detectable
diff --git a/bindgen-integration/Cargo.toml b/bindgen-integration/Cargo.toml
index 650deda..733fba5 100644
--- a/bindgen-integration/Cargo.toml
+++ b/bindgen-integration/Cargo.toml
@@ -18,5 +18,3 @@
 testing_only_extra_assertions = ["bindgen/testing_only_extra_assertions"]
 testing_only_libclang_9 = ["bindgen/testing_only_libclang_9"]
 testing_only_libclang_5 = ["bindgen/testing_only_libclang_5"]
-testing_only_libclang_4 = ["bindgen/testing_only_libclang_4"]
-testing_only_libclang_3_9 = ["bindgen/testing_only_libclang_3_9"]
diff --git a/bindgen-integration/build.rs b/bindgen-integration/build.rs
index fa0246c..d0ec3bc 100644
--- a/bindgen-integration/build.rs
+++ b/bindgen-integration/build.rs
@@ -126,6 +126,10 @@
             vec![
                 "PartialEq".into(),
             ]
+        } else if name == "MyOrderedEnum" {
+            vec![
+                "std::cmp::PartialOrd".into(),
+            ]
         } else {
             vec![]
         }
diff --git a/bindgen-integration/cpp/Test.h b/bindgen-integration/cpp/Test.h
index ad71b0f..eee1974 100644
--- a/bindgen-integration/cpp/Test.h
+++ b/bindgen-integration/cpp/Test.h
@@ -234,3 +234,10 @@
 } Coord;
 
 Coord coord(double x, double y, double z, double t);
+
+// Used to test custom derives on enum. See `test_custom_derive`.
+enum MyOrderedEnum {
+  MICRON,
+  METER,
+  LIGHTYEAR,
+};
diff --git a/bindgen-integration/src/lib.rs b/bindgen-integration/src/lib.rs
index f56e725..43f7158 100755
--- a/bindgen-integration/src/lib.rs
+++ b/bindgen-integration/src/lib.rs
@@ -275,4 +275,14 @@
     let test1 = unsafe { bindings::Test::new(5) };
     let test2 = unsafe { bindings::Test::new(6) };
     assert_ne!(test1, test2);
+
+    // The `add_derives` callback should have added `#[derive(PartialOrd)]`
+    // to the `MyOrderedEnum` enum. If it didn't, this will fail to compile.
+
+    let micron = unsafe { bindings::MyOrderedEnum::MICRON };
+    let meter = unsafe { bindings::MyOrderedEnum::METER };
+    let lightyear = unsafe { bindings::MyOrderedEnum::LIGHTYEAR };
+
+    assert!(meter < lightyear);
+    assert!(meter > micron);
 }
diff --git a/book/src/allowlisting.md b/book/src/allowlisting.md
index 2e28d80..edf93df 100644
--- a/book/src/allowlisting.md
+++ b/book/src/allowlisting.md
@@ -19,12 +19,14 @@
 * [`bindgen::Builder::allowlist_type`](https://docs.rs/bindgen/latest/bindgen/struct.Builder.html#method.allowlist_type)
 * [`bindgen::Builder::allowlist_function`](https://docs.rs/bindgen/latest/bindgen/struct.Builder.html#method.allowlist_function)
 * [`bindgen::Builder::allowlist_var`](https://docs.rs/bindgen/latest/bindgen/struct.Builder.html#method.allowlist_var)
+* [`bindgen::Builder::allowlist_file`](https://docs.rs/bindgen/latest/bindgen/struct.Builder.html#method.allowlist_file)
 
 ### Command Line
 
 * `--allowlist-type <type>`
 * `--allowlist-function <function>`
 * `--allowlist-var <var>`
+* `--allowlist-file <path>`
 
 ### Annotations
 
diff --git a/book/src/blocklisting.md b/book/src/blocklisting.md
index 5c082dd..6eb5786 100644
--- a/book/src/blocklisting.md
+++ b/book/src/blocklisting.md
@@ -2,8 +2,7 @@
 
 If you need to provide your own custom translation of some type (for example,
 because you need to wrap one of its fields in an `UnsafeCell`), you can
-explicitly blocklist
- generation of its definition. Uses of the blocklisted type
+explicitly blocklist generation of its definition. Uses of the blocklisted type
 will still appear in other types' definitions. (If you don't want the type to
 appear in the bindings at
 all, [make it opaque](./opaque.md) instead of
@@ -13,14 +12,25 @@
 traits, which can transitively affect other types' ability to `derive` traits or
 not.
 
+The `blocklist-file` option also allows the blocklisting of all items from a
+particular path regex, for example to block all types defined in system headers
+that are transitively included.
+
 ### Library
 
+* [`bindgen::Builder::blocklist_file`](https://docs.rs/bindgen/latest/bindgen/struct.Builder.html#method.blocklist_file)
+* [`bindgen::Builder::blocklist_function`](https://docs.rs/bindgen/latest/bindgen/struct.Builder.html#method.blocklist_function)
+* [`bindgen::Builder::blocklist_item`](https://docs.rs/bindgen/latest/bindgen/struct.Builder.html#method.blocklist_item)
 * [`bindgen::Builder::blocklist_type`](https://docs.rs/bindgen/latest/bindgen/struct.Builder.html#method.blocklist_type)
 
 ### Command Line
 
+* `--blocklist-file <path>`
+* `--blocklist-function <function>`
+* `--blocklist-item <item>`
 * `--blocklist-type <type>`
 
+
 ### Annotations
 
 ```cpp
diff --git a/book/src/cpp.md b/book/src/cpp.md
index 1be7a8a..75ef855 100644
--- a/book/src/cpp.md
+++ b/book/src/cpp.md
@@ -71,3 +71,8 @@
   generate undefined behaviour. See
   [the tracking issue for exceptions](https://github.com/rust-lang/rust-bindgen/issues/1208)
   for more details.
+  
+* Return value optimization. C++ compilers will in certain circumstances optimize functions
+  returning a struct type value to instead take an extra hidden argument that refers
+  to the return value struct. `bindgen` cannot necessarily know about this optimization and
+  thus at present `bindgen`-interfaces for these kinds of functions are invalid. 
diff --git a/book/src/requirements.md b/book/src/requirements.md
index 9ccaea9..7cce87a 100644
--- a/book/src/requirements.md
+++ b/book/src/requirements.md
@@ -7,16 +7,9 @@
 `bindgen` leverages `libclang` to preprocess, parse, and type check C and C++
 header files.
 
-It is recommended to use Clang 3.9 or greater, however `bindgen` can run with
-older Clangs with some features disabled.
+It is required to use Clang 5.0 or greater.
 
-* **If you are generating bindings to C,** 3.7 and 3.8 will probably work OK for
-you.
-
-* **If you are generating bindings to C++,** you almost definitely want 3.9 or
-greater.
-
-### Installing Clang 3.9
+### Installing Clang
 
 #### Windows
 
@@ -53,9 +46,7 @@
 # apt install llvm-dev libclang-dev clang
 ```
 
-Ubuntu 16.10 provides the necessary packages directly. If you are using older
-version of Ubuntu or other Debian-based distros, you may need to add the LLVM
-repos to get version 3.9. See http://apt.llvm.org/.
+Ubuntu 18.04 provides the necessary packages directly.
 
 #### Arch
 
@@ -79,7 +70,7 @@
 
 #### From source
 
-If your package manager doesn't yet offer Clang 3.9, you'll need to build from
+If your package manager doesn't yet offer Clang 5.0, you'll need to build from
 source. For that, follow the
 instructions [here](http://clang.llvm.org/get_started.html).
 
diff --git a/book/src/tutorial-3.md b/book/src/tutorial-3.md
index 139a24f..dcd67c5 100644
--- a/book/src/tutorial-3.md
+++ b/book/src/tutorial-3.md
@@ -7,6 +7,8 @@
 `$OUT_DIR/bindings.rs` where `$OUT_DIR` is chosen by `cargo` and is something
 like `./target/debug/build/bindgen-tutorial-bzip2-sys-afc7747d7eafd720/out/`.
 
+Note that the associated shared object to `bz2` is `libbz2.so`. In general, a `lib<name>.so` should be referenced in the build file by `<name>`.
+
 ```rust,ignore
 extern crate bindgen;
 
@@ -14,6 +16,9 @@
 use std::path::PathBuf;
 
 fn main() {
+    // Tell cargo to look for shared libraries in the specified directory
+    println!("cargo:rustc-link-search=/path/to/lib");
+
     // Tell cargo to tell rustc to link the system bzip2
     // shared library.
     println!("cargo:rustc-link-lib=bz2");
diff --git a/book/src/tutorial-5.md b/book/src/tutorial-5.md
index 54b4dda..de91d09 100644
--- a/book/src/tutorial-5.md
+++ b/book/src/tutorial-5.md
@@ -61,7 +61,7 @@
             // Finish the compression stream.
             let result = BZ2_bzCompressEnd(&mut stream as *mut _);
             match result {
-                r if r == (BZ_PARAM_ERROR as _) => panic!(BZ_PARAM_ERROR),
+                r if r == (BZ_PARAM_ERROR as _) => panic!("BZ_PARAM_ERROR"),
                 r if r == (BZ_OK as _) => {},
                 r => panic!("Unknown return value = {}", r),
             }
diff --git a/build.rs b/build.rs
index fcc0bb2..8c05d59 100644
--- a/build.rs
+++ b/build.rs
@@ -85,6 +85,6 @@
     );
     println!(
         "cargo:rerun-if-env-changed=BINDGEN_EXTRA_CLANG_ARGS_{}",
-        std::env::var("TARGET").unwrap().replace("-", "_")
+        std::env::var("TARGET").unwrap().replace('-', "_")
     );
 }
diff --git a/csmith-fuzzing/predicate.py b/csmith-fuzzing/predicate.py
index 8925755..6ca5047 100755
--- a/csmith-fuzzing/predicate.py
+++ b/csmith-fuzzing/predicate.py
@@ -219,7 +219,7 @@
     if not args.expect_bindgen_fail and child.returncode != 0:
         exit_1("Error: running `bindgen` failed", child)
 
-    for arg in args.bindings_grep:
+    for arg in args.bindings_grep or []:
         pattern = regexp(arg)
         with open(bindings, mode="r") as f:
             if not contains(pattern, f):
diff --git a/src/clang.rs b/src/clang.rs
index 36ccd26..587cc0b 100644
--- a/src/clang.rs
+++ b/src/clang.rs
@@ -1401,6 +1401,12 @@
     }
 }
 
+impl fmt::Debug for SourceLocation {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        write!(f, "{}", self)
+    }
+}
+
 /// A comment in the source text.
 ///
 /// Comments are sort of parsed by Clang, and have a tree structure.
@@ -2008,12 +2014,6 @@
             return None;
         }
 
-        if !clang_EvalResult_isUnsignedInt::is_loaded() {
-            // FIXME(emilio): There's no way to detect underflow here, and clang
-            // will just happily give us a value.
-            return Some(unsafe { clang_EvalResult_getAsInt(self.x) } as i64);
-        }
-
         if unsafe { clang_EvalResult_isUnsignedInt(self.x) } != 0 {
             let value = unsafe { clang_EvalResult_getAsUnsigned(self.x) };
             if value > i64::max_value() as c_ulonglong {
@@ -2065,10 +2065,7 @@
 
 impl TargetInfo {
     /// Tries to obtain target information from libclang.
-    pub fn new(tu: &TranslationUnit) -> Option<Self> {
-        if !clang_getTranslationUnitTargetInfo::is_loaded() {
-            return None;
-        }
+    pub fn new(tu: &TranslationUnit) -> Self {
         let triple;
         let pointer_width;
         unsafe {
@@ -2079,9 +2076,9 @@
         }
         assert!(pointer_width > 0);
         assert_eq!(pointer_width % 8, 0);
-        Some(TargetInfo {
+        TargetInfo {
             triple,
             pointer_width: pointer_width as usize,
-        })
+        }
     }
 }
diff --git a/src/codegen/bitfield_unit.rs b/src/codegen/bitfield_unit.rs
old mode 100755
new mode 100644
diff --git a/src/codegen/dyngen.rs b/src/codegen/dyngen.rs
index 71c4dab..26cfe5c 100644
--- a/src/codegen/dyngen.rs
+++ b/src/codegen/dyngen.rs
@@ -112,6 +112,7 @@
         }
     }
 
+    #[allow(clippy::too_many_arguments)]
     pub fn push(
         &mut self,
         ident: Ident,
@@ -122,6 +123,7 @@
         args_identifiers: Vec<proc_macro2::TokenStream>,
         ret: proc_macro2::TokenStream,
         ret_ty: proc_macro2::TokenStream,
+        attributes: Vec<proc_macro2::TokenStream>,
     ) {
         if !is_variadic {
             assert_eq!(args.len(), args_identifiers.len());
@@ -153,6 +155,7 @@
         // access the function pointer so that the user can call it just fine.
         if !is_variadic {
             self.struct_implementation.push(quote! {
+                #(#attributes)*
                 pub unsafe fn #ident ( &self, #( #args ),* ) -> #ret_ty {
                     #call_body
                 }
diff --git a/src/codegen/helpers.rs b/src/codegen/helpers.rs
index 2ce6894..75c169c 100644
--- a/src/codegen/helpers.rs
+++ b/src/codegen/helpers.rs
@@ -30,7 +30,7 @@
         let which_ones = which_ones
             .iter()
             .cloned()
-            .map(|one| Ident::new(one, Span::call_site()));
+            .map(|one| TokenStream::from_str(one).expect("derive to be valid"));
         quote! {
             #[derive( #( #which_ones ),* )]
         }
diff --git a/src/codegen/mod.rs b/src/codegen/mod.rs
index 69dde2c..ee4a6bf 100644
--- a/src/codegen/mod.rs
+++ b/src/codegen/mod.rs
@@ -21,8 +21,8 @@
 use crate::ir::annotations::FieldAccessorKind;
 use crate::ir::comment;
 use crate::ir::comp::{
-    Base, Bitfield, BitfieldUnit, CompInfo, CompKind, Field, FieldData,
-    FieldMethods, Method, MethodKind,
+    Bitfield, BitfieldUnit, CompInfo, CompKind, Field, FieldData, FieldMethods,
+    Method, MethodKind,
 };
 use crate::ir::context::{BindgenContext, ItemId};
 use crate::ir::derive::{
@@ -110,17 +110,13 @@
     }
 }
 
-fn derives_of_item(item: &Item, ctx: &BindgenContext) -> DerivableTraits {
+fn derives_of_item(
+    item: &Item,
+    ctx: &BindgenContext,
+    packed: bool,
+) -> DerivableTraits {
     let mut derivable_traits = DerivableTraits::empty();
 
-    if item.can_derive_debug(ctx) && !item.annotations().disallow_debug() {
-        derivable_traits |= DerivableTraits::DEBUG;
-    }
-
-    if item.can_derive_default(ctx) && !item.annotations().disallow_default() {
-        derivable_traits |= DerivableTraits::DEFAULT;
-    }
-
     let all_template_params = item.all_template_params(ctx);
 
     if item.can_derive_copy(ctx) && !item.annotations().disallow_copy() {
@@ -137,6 +133,18 @@
             // It's not hard to fix though.
             derivable_traits |= DerivableTraits::CLONE;
         }
+    } else if packed {
+        // If the struct or union is packed, deriving from Copy is required for
+        // deriving from any other trait.
+        return derivable_traits;
+    }
+
+    if item.can_derive_debug(ctx) && !item.annotations().disallow_debug() {
+        derivable_traits |= DerivableTraits::DEBUG;
+    }
+
+    if item.can_derive_default(ctx) && !item.annotations().disallow_default() {
+        derivable_traits |= DerivableTraits::DEFAULT;
     }
 
     if item.can_derive_hash(ctx) {
@@ -665,10 +673,21 @@
                     match String::from_utf8(bytes.clone()) {
                         Ok(string) => {
                             let cstr = helpers::ast_ty::cstr_expr(string);
-                            result.push(quote! {
-                                #(#attrs)*
-                                pub const #canonical_ident : &'static #ty = #cstr ;
-                            });
+                            if ctx
+                                .options()
+                                .rust_features
+                                .static_lifetime_elision
+                            {
+                                result.push(quote! {
+                                    #(#attrs)*
+                                    pub const #canonical_ident : &#ty = #cstr ;
+                                });
+                            } else {
+                                result.push(quote! {
+                                    #(#attrs)*
+                                    pub const #canonical_ident : &'static #ty = #cstr ;
+                                });
+                            }
                         }
                         Err(..) => {
                             let bytes = helpers::ast_ty::byte_array_expr(bytes);
@@ -915,7 +934,9 @@
 
                         let mut attributes =
                             vec![attributes::repr("transparent")];
-                        let derivable_traits = derives_of_item(item, ctx);
+                        let packed = false; // Types can't be packed in Rust.
+                        let derivable_traits =
+                            derives_of_item(item, ctx, packed);
                         if !derivable_traits.is_empty() {
                             let derives: Vec<_> = derivable_traits.into();
                             attributes.push(attributes::derives(&derives))
@@ -1006,23 +1027,14 @@
 
 struct Vtable<'a> {
     item_id: ItemId,
+    /// A reference to the originating compound object.
     #[allow(dead_code)]
-    methods: &'a [Method],
-    #[allow(dead_code)]
-    base_classes: &'a [Base],
+    comp_info: &'a CompInfo,
 }
 
 impl<'a> Vtable<'a> {
-    fn new(
-        item_id: ItemId,
-        methods: &'a [Method],
-        base_classes: &'a [Base],
-    ) -> Self {
-        Vtable {
-            item_id,
-            methods,
-            base_classes,
-        }
+    fn new(item_id: ItemId, comp_info: &'a CompInfo) -> Self {
+        Vtable { item_id, comp_info }
     }
 }
 
@@ -1038,15 +1050,69 @@
     ) {
         assert_eq!(item.id(), self.item_id);
         debug_assert!(item.is_enabled_for_codegen(ctx));
-
-        // For now, generate an empty struct, later we should generate function
-        // pointers and whatnot.
         let name = ctx.rust_ident(&self.canonical_name(ctx));
-        let void = helpers::ast_ty::c_void(ctx);
-        result.push(quote! {
-            #[repr(C)]
-            pub struct #name ( #void );
-        });
+
+        // For now, we will only generate vtables for classes that:
+        // - do not inherit from others (compilers merge VTable from primary parent class).
+        // - do not contain a virtual destructor (requires ordering; platforms generate different vtables).
+        if ctx.options().vtable_generation &&
+            self.comp_info.base_members().is_empty() &&
+            self.comp_info.destructor().is_none()
+        {
+            let class_ident = ctx.rust_ident(self.item_id.canonical_name(ctx));
+
+            let methods = self
+                .comp_info
+                .methods()
+                .iter()
+                .filter_map(|m| {
+                    if !m.is_virtual() {
+                        return None;
+                    }
+
+                    let function_item = ctx.resolve_item(m.signature());
+                    let function = function_item.expect_function();
+                    let signature_item = ctx.resolve_item(function.signature());
+                    let signature = match signature_item.expect_type().kind() {
+                        TypeKind::Function(ref sig) => sig,
+                        _ => panic!("Function signature type mismatch"),
+                    };
+
+                    // FIXME: Is there a canonical name without the class prepended?
+                    let function_name = function_item.canonical_name(ctx);
+
+                    // FIXME: Need to account for overloading with times_seen (separately from regular function path).
+                    let function_name = ctx.rust_ident(function_name);
+                    let mut args = utils::fnsig_arguments(ctx, signature);
+                    let ret = utils::fnsig_return_ty(ctx, signature);
+
+                    args[0] = if m.is_const() {
+                        quote! { this: *const #class_ident }
+                    } else {
+                        quote! { this: *mut #class_ident }
+                    };
+
+                    Some(quote! {
+                        pub #function_name : unsafe extern "C" fn( #( #args ),* ) #ret
+                    })
+                })
+                .collect::<Vec<_>>();
+
+            result.push(quote! {
+                #[repr(C)]
+                pub struct #name {
+                    #( #methods ),*
+                }
+            })
+        } else {
+            // For the cases we don't support, simply generate an empty struct.
+            let void = helpers::ast_ty::c_void(ctx);
+
+            result.push(quote! {
+                #[repr(C)]
+                pub struct #name ( #void );
+            });
+        }
     }
 }
 
@@ -1738,8 +1804,7 @@
 
         if !is_opaque {
             if item.has_vtable_ptr(ctx) {
-                let vtable =
-                    Vtable::new(item.id(), self.methods(), self.base_members());
+                let vtable = Vtable::new(item.id(), self);
                 vtable.codegen(ctx, result, item);
 
                 let vtable_type = vtable
@@ -1971,7 +2036,7 @@
             }
         }
 
-        let derivable_traits = derives_of_item(item, ctx);
+        let derivable_traits = derives_of_item(item, ctx, packed);
         if !derivable_traits.contains(DerivableTraits::DEBUG) {
             needs_debug_impl = ctx.options().derive_debug &&
                 ctx.options().impl_debug &&
@@ -2017,8 +2082,7 @@
             attributes.push(attributes::derives(&derives))
         }
 
-        if item.annotations().must_use_type() || ctx.must_use_type_by_name(item)
-        {
+        if item.must_use(ctx) {
             attributes.push(attributes::must_use());
         }
 
@@ -2112,32 +2176,38 @@
                     {
                         vec![]
                     } else {
-                        let asserts = self.fields()
-                                .iter()
-                                .filter_map(|field| match *field {
-                                    Field::DataMember(ref f) if f.name().is_some() => Some(f),
-                                    _ => None,
-                                })
-                                .flat_map(|field| {
-                                    let name = field.name().unwrap();
-                                    field.offset().map(|offset| {
-                                        let field_offset = offset / 8;
-                                        let field_name = ctx.rust_ident(name);
-
-                                        quote! {
+                        self.fields()
+                            .iter()
+                            .filter_map(|field| match *field {
+                                Field::DataMember(ref f) if f.name().is_some() => Some(f),
+                                _ => None,
+                            })
+                            .flat_map(|field| {
+                                let name = field.name().unwrap();
+                                field.offset().map(|offset| {
+                                    let field_offset = offset / 8;
+                                    let field_name = ctx.rust_ident(name);
+                                    // Put each check in its own function, so
+                                    // that rustc with opt-level=0 doesn't take
+                                    // too much stack space, see #2218.
+                                    let test_fn = Ident::new(&format!("test_field_{}", name), Span::call_site());
+                                    quote! {
+                                        fn #test_fn() {
                                             assert_eq!(
                                                 unsafe {
-                                                    &(*(::#prefix::ptr::null::<#canonical_ident>())).#field_name as *const _ as usize
+                                                    let uninit = ::#prefix::mem::MaybeUninit::<#canonical_ident>::uninit();
+                                                    let ptr = uninit.as_ptr();
+                                                    ::#prefix::ptr::addr_of!((*ptr).#field_name) as usize - ptr as usize
                                                 },
                                                 #field_offset,
                                                 concat!("Offset of field: ", stringify!(#canonical_ident), "::", stringify!(#field_name))
                                             );
                                         }
-                                    })
+                                        #test_fn();
+                                    }
                                 })
-                                .collect::<Vec<proc_macro2::TokenStream>>();
-
-                        asserts
+                            })
+                            .collect::<Vec<proc_macro2::TokenStream>>()
                     };
 
                     let item = quote! {
@@ -2359,9 +2429,13 @@
             _ => panic!("How in the world?"),
         };
 
-        if let (Abi::ThisCall, false) =
-            (signature.abi(), ctx.options().rust_features().thiscall_abi)
-        {
+        let supported_abi = match signature.abi() {
+            Abi::ThisCall => ctx.options().rust_features().thiscall_abi,
+            Abi::Vectorcall => ctx.options().rust_features().vectorcall_abi,
+            _ => true,
+        };
+
+        if !supported_abi {
             return;
         }
 
@@ -2566,7 +2640,6 @@
         is_bitfield: bool,
     },
     Consts {
-        repr: proc_macro2::TokenStream,
         variants: Vec<proc_macro2::TokenStream>,
         codegen_depth: usize,
     },
@@ -2637,7 +2710,6 @@
                 });
 
                 EnumBuilder::Consts {
-                    repr,
                     variants,
                     codegen_depth: enum_codegen_depth,
                 }
@@ -2741,7 +2813,7 @@
                 self
             }
 
-            EnumBuilder::Consts { ref repr, .. } => {
+            EnumBuilder::Consts { .. } => {
                 let constant_name = match mangling_prefix {
                     Some(prefix) => {
                         Cow::Owned(format!("{}_{}", prefix, variant_name))
@@ -2749,12 +2821,10 @@
                     None => variant_name,
                 };
 
-                let ty = if is_ty_named { &rust_ty } else { repr };
-
                 let ident = ctx.rust_ident(constant_name);
                 result.push(quote! {
                     #doc
-                    pub const #ident : #ty = #expr ;
+                    pub const #ident : #rust_ty = #expr ;
                 });
 
                 self
@@ -2987,21 +3057,16 @@
             attrs.push(attributes::doc(comment));
         }
 
-        if item.annotations().must_use_type() || ctx.must_use_type_by_name(item)
-        {
+        if item.must_use(ctx) {
             attrs.push(attributes::must_use());
         }
 
         if !variation.is_const() {
-            let mut derives = derives_of_item(item, ctx);
-            // For backwards compat, enums always derive Debug/Clone/Eq/PartialEq/Hash, even
-            // if we don't generate those by default.
-            if !item.annotations().disallow_debug() {
-                derives.insert(DerivableTraits::DEBUG);
-            }
-            if !item.annotations().disallow_copy() {
-                derives.insert(DerivableTraits::COPY);
-            }
+            let packed = false; // Enums can't be packed in Rust.
+            let mut derives = derives_of_item(item, ctx, packed);
+            // For backwards compat, enums always derive
+            // Clone/Eq/PartialEq/Hash, even if we don't generate those by
+            // default.
             derives.insert(
                 DerivableTraits::CLONE |
                     DerivableTraits::HASH |
@@ -3014,6 +3079,16 @@
                     derives.push(derive);
                 }
             }
+
+            // The custom derives callback may return a list of derive attributes;
+            // add them to the end of the list.
+            let custom_derives;
+            if let Some(cb) = &ctx.options().parse_callbacks {
+                custom_derives = cb.add_derives(&name);
+                // In most cases this will be a no-op, since custom_derives will be empty.
+                derives.extend(custom_derives.iter().map(|s| s.as_str()));
+            };
+
             attrs.push(attributes::derives(&derives));
         }
 
@@ -3807,6 +3882,12 @@
                 warn!("Skipping function with thiscall ABI that isn't supported by the configured Rust target");
                 Ok(proc_macro2::TokenStream::new())
             }
+            Abi::Vectorcall
+                if !ctx.options().rust_features().vectorcall_abi =>
+            {
+                warn!("Skipping function with vectorcall ABI that isn't supported by the configured Rust target");
+                Ok(proc_macro2::TokenStream::new())
+            }
             _ => Ok(quote! {
                 unsafe extern #abi fn ( #( #arguments ),* ) #ret
             }),
@@ -3839,14 +3920,17 @@
 
         // Pure virtual methods have no actual symbol, so we can't generate
         // something meaningful for them.
-        match self.kind() {
+        let is_dynamic_function = match self.kind() {
             FunctionKind::Method(ref method_kind)
                 if method_kind.is_pure_virtual() =>
             {
                 return None;
             }
-            _ => {}
-        }
+            FunctionKind::Function => {
+                ctx.options().dynamic_library_name.is_some()
+            }
+            _ => false,
+        };
 
         // Similar to static member variables in a class template, we can't
         // generate bindings to template functions, because the set of
@@ -3883,10 +3967,19 @@
 
         let mut attributes = vec![];
 
-        if signature.must_use() &&
-            ctx.options().rust_features().must_use_function
-        {
-            attributes.push(attributes::must_use());
+        if ctx.options().rust_features().must_use_function {
+            let must_use = signature.must_use() || {
+                let ret_ty = signature
+                    .return_type()
+                    .into_resolver()
+                    .through_type_refs()
+                    .resolve(ctx);
+                ret_ty.must_use(ctx)
+            };
+
+            if must_use {
+                attributes.push(attributes::must_use());
+            }
         }
 
         if let Some(comment) = item.comment(ctx) {
@@ -3898,6 +3991,12 @@
                 warn!("Skipping function with thiscall ABI that isn't supported by the configured Rust target");
                 return None;
             }
+            Abi::Vectorcall
+                if !ctx.options().rust_features().vectorcall_abi =>
+            {
+                warn!("Skipping function with vectorcall ABI that isn't supported by the configured Rust target");
+                return None;
+            }
             Abi::Win64 if signature.is_variadic() => {
                 warn!("Skipping variadic function with Win64 ABI that isn't supported");
                 return None;
@@ -3919,11 +4018,13 @@
         }
 
         let link_name = mangled_name.unwrap_or(name);
-        if !utils::names_will_be_identical_after_mangling(
-            &canonical_name,
-            link_name,
-            Some(abi),
-        ) {
+        if !is_dynamic_function &&
+            !utils::names_will_be_identical_after_mangling(
+                &canonical_name,
+                link_name,
+                Some(abi),
+            )
+        {
             attributes.push(attributes::link_name(link_name));
         }
 
@@ -3945,9 +4046,7 @@
         };
 
         // If we're doing dynamic binding generation, add to the dynamic items.
-        if ctx.options().dynamic_library_name.is_some() &&
-            self.kind() == FunctionKind::Function
-        {
+        if is_dynamic_function {
             let args_identifiers =
                 utils::fnsig_argument_identifiers(ctx, signature);
             let return_item = ctx.resolve_item(signature.return_type());
@@ -3964,6 +4063,7 @@
                 args_identifiers,
                 ret,
                 ret_ty,
+                attributes,
             );
         } else {
             result.push(tokens);
@@ -3999,9 +4099,7 @@
 
     let body = if method.is_class_method() {
         let class_name = ctx.rust_ident(
-            class_name
-                .expect("Generating a class method without class name?")
-                .to_owned(),
+            class_name.expect("Generating a class method without class name?"),
         );
         quote! {
             msg_send!(class!(#class_name), #methods_and_args)
@@ -4069,7 +4167,7 @@
                 .collect();
 
             quote! {
-                pub trait #trait_name <#(#template_names),*> : #trait_constraints {
+                pub trait #trait_name <#(#template_names:'static),*> : #trait_constraints {
                     #( #impl_items )*
                 }
             }
@@ -4085,7 +4183,7 @@
         if !self.is_category() && !self.is_protocol() {
             let struct_block = quote! {
                 #[repr(transparent)]
-                #[derive(Clone)]
+                #[derive(Debug, Copy, Clone)]
                 pub struct #class_name(pub id);
                 impl std::ops::Deref for #class_name {
                     type Target = objc::runtime::Object;
@@ -4099,7 +4197,7 @@
                 impl #class_name {
                     pub fn alloc() -> Self {
                         Self(unsafe {
-                            msg_send!(objc::class!(#class_name), alloc)
+                            msg_send!(class!(#class_name), alloc)
                         })
                     }
                 }
@@ -4321,7 +4419,7 @@
             }
         } else {
             quote! {
-                use objc;
+                use objc::{self, msg_send, sel, sel_impl, class};
             }
         };
 
diff --git a/src/features.rs b/src/features.rs
index 99b789e..5946770 100644
--- a/src/features.rs
+++ b/src/features.rs
@@ -87,8 +87,9 @@
         $x_macro!(
             /// Rust stable 1.0
             => Stable_1_0 => 1.0;
-            /// Rust stable 1.1
-            => Stable_1_1 => 1.1;
+            /// Rust stable 1.17
+            ///  * Static lifetime elision ([RFC 1623](https://github.com/rust-lang/rfcs/blob/master/text/1623-static.md))
+            => Stable_1_17 => 1.17;
             /// Rust stable 1.19
             ///  * Untagged unions ([RFC 1444](https://github.com/rust-lang/rfcs/blob/master/text/1444-union.md))
             => Stable_1_19 => 1.19;
@@ -128,6 +129,7 @@
             => Stable_1_47 => 1.47;
             /// Nightly rust
             ///  * `thiscall` calling convention ([Tracking issue](https://github.com/rust-lang/rust/issues/42202))
+            ///  * `vectorcall` calling convention (no tracking issue)
             => Nightly => nightly;
         );
     }
@@ -191,6 +193,9 @@
 // documentation for the relevant variant in the rust_target_base macro
 // definition.
 rust_feature_def!(
+    Stable_1_17 {
+        => static_lifetime_elision;
+    }
     Stable_1_19 {
         => untagged_union;
     }
@@ -230,6 +235,7 @@
     }
     Nightly {
         => thiscall_abi;
+        => vectorcall_abi;
     }
 );
 
@@ -249,31 +255,37 @@
     fn target_features() {
         let f_1_0 = RustFeatures::from(RustTarget::Stable_1_0);
         assert!(
-            !f_1_0.core_ffi_c_void &&
+            !f_1_0.static_lifetime_elision &&
+                !f_1_0.core_ffi_c_void &&
                 !f_1_0.untagged_union &&
                 !f_1_0.associated_const &&
                 !f_1_0.builtin_clone_impls &&
                 !f_1_0.repr_align &&
-                !f_1_0.thiscall_abi
+                !f_1_0.thiscall_abi &&
+                !f_1_0.vectorcall_abi
         );
         let f_1_21 = RustFeatures::from(RustTarget::Stable_1_21);
         assert!(
-            !f_1_21.core_ffi_c_void &&
+            f_1_21.static_lifetime_elision &&
+                !f_1_21.core_ffi_c_void &&
                 f_1_21.untagged_union &&
                 f_1_21.associated_const &&
                 f_1_21.builtin_clone_impls &&
                 !f_1_21.repr_align &&
-                !f_1_21.thiscall_abi
+                !f_1_21.thiscall_abi &&
+                !f_1_21.vectorcall_abi
         );
         let f_nightly = RustFeatures::from(RustTarget::Nightly);
         assert!(
-            f_nightly.core_ffi_c_void &&
+            f_nightly.static_lifetime_elision &&
+                f_nightly.core_ffi_c_void &&
                 f_nightly.untagged_union &&
                 f_nightly.associated_const &&
                 f_nightly.builtin_clone_impls &&
                 f_nightly.maybe_uninit &&
                 f_nightly.repr_align &&
-                f_nightly.thiscall_abi
+                f_nightly.thiscall_abi &&
+                f_nightly.vectorcall_abi
         );
     }
 
@@ -286,6 +298,7 @@
     #[test]
     fn str_to_target() {
         test_target("1.0", RustTarget::Stable_1_0);
+        test_target("1.17", RustTarget::Stable_1_17);
         test_target("1.19", RustTarget::Stable_1_19);
         test_target("1.21", RustTarget::Stable_1_21);
         test_target("1.25", RustTarget::Stable_1_25);
diff --git a/src/ir/analysis/mod.rs b/src/ir/analysis/mod.rs
index eb9a1c0..40dfc6d 100644
--- a/src/ir/analysis/mod.rs
+++ b/src/ir/analysis/mod.rs
@@ -281,9 +281,13 @@
         fn reverse(&self) -> Graph {
             let mut reversed = Graph::default();
             for (node, edges) in self.0.iter() {
-                reversed.0.entry(*node).or_insert(vec![]);
+                reversed.0.entry(*node).or_insert_with(Vec::new);
                 for referent in edges.iter() {
-                    reversed.0.entry(*referent).or_insert(vec![]).push(*node);
+                    reversed
+                        .0
+                        .entry(*referent)
+                        .or_insert_with(Vec::new)
+                        .push(*node);
                 }
             }
             reversed
@@ -306,8 +310,8 @@
             let reversed = graph.reverse();
             ReachableFrom {
                 reachable: Default::default(),
-                graph: graph,
-                reversed: reversed,
+                graph,
+                reversed,
             }
         }
 
@@ -328,7 +332,7 @@
             let original_size = self
                 .reachable
                 .entry(node)
-                .or_insert(HashSet::default())
+                .or_insert_with(HashSet::default)
                 .len();
 
             for sub_node in self.graph.0[&node].iter() {
@@ -337,7 +341,7 @@
                 let sub_reachable = self
                     .reachable
                     .entry(*sub_node)
-                    .or_insert(HashSet::default())
+                    .or_insert_with(HashSet::default)
                     .clone();
 
                 for transitive in sub_reachable {
diff --git a/src/ir/context.rs b/src/ir/context.rs
index 874fb5d..3bfe549 100644
--- a/src/ir/context.rs
+++ b/src/ir/context.rs
@@ -364,14 +364,11 @@
 
     in_codegen: bool,
 
-    /// The clang index for parsing.
-    index: clang::Index,
-
     /// The translation unit for parsing.
     translation_unit: clang::TranslationUnit,
 
     /// Target information that can be useful for some stuff.
-    target_info: Option<clang::TargetInfo>,
+    target_info: clang::TargetInfo,
 
     /// The options given by the user via cli or other medium.
     options: BindgenOptions,
@@ -420,12 +417,6 @@
     /// and is always `None` before that and `Some` after.
     cannot_derive_copy: Option<HashSet<ItemId>>,
 
-    /// The set of (`ItemId`s of) types that can't derive copy in array.
-    ///
-    /// This is populated when we enter codegen by `compute_cannot_derive_copy`
-    /// and is always `None` before that and `Some` after.
-    cannot_derive_copy_in_array: Option<HashSet<ItemId>>,
-
     /// The set of (`ItemId`s of) types that can't derive hash.
     ///
     /// This is populated when we enter codegen by `compute_can_derive_hash`
@@ -569,7 +560,6 @@
             replacements: Default::default(),
             collected_typerefs: false,
             in_codegen: false,
-            index,
             translation_unit,
             target_info,
             options,
@@ -582,7 +572,6 @@
             cannot_derive_debug: None,
             cannot_derive_default: None,
             cannot_derive_copy: None,
-            cannot_derive_copy_in_array: None,
             cannot_derive_hash: None,
             cannot_derive_partialeq_or_partialord: None,
             sizedness: None,
@@ -595,10 +584,7 @@
 
     /// Returns `true` if the target architecture is wasm32
     pub fn is_target_wasm32(&self) -> bool {
-        match self.target_info {
-            Some(ref ti) => ti.triple.starts_with("wasm32-"),
-            None => false,
-        }
+        self.target_info.triple.starts_with("wasm32-")
     }
 
     /// Creates a timer for the current bindgen phase. If time_phases is `true`,
@@ -611,10 +597,7 @@
     /// Returns the pointer width to use for the target for the current
     /// translation.
     pub fn target_pointer_size(&self) -> usize {
-        if let Some(ref ti) = self.target_info {
-            return ti.pointer_width / 8;
-        }
-        mem::size_of::<*mut ()>()
+        self.target_info.pointer_width / 8
     }
 
     /// Get the stack of partially parsed types that we are in the middle of
@@ -845,7 +828,7 @@
                     "macro" | "match" | "mod" | "move" | "mut" | "offsetof" |
                     "override" | "priv" | "proc" | "pub" | "pure" | "ref" |
                     "return" | "Self" | "self" | "sizeof" | "static" |
-                    "struct" | "super" | "trait" | "true" | "type" | "typeof" |
+                    "struct" | "super" | "trait" | "true" | "try" | "type" | "typeof" |
                     "unsafe" | "unsized" | "use" | "virtual" | "where" |
                     "while" | "yield" | "str" | "bool" | "f32" | "f64" |
                     "usize" | "isize" | "u128" | "i128" | "u64" | "i64" |
@@ -853,9 +836,9 @@
             )
         {
             let mut s = name.to_owned();
-            s = s.replace("@", "_");
-            s = s.replace("?", "_");
-            s = s.replace("$", "_");
+            s = s.replace('@', "_");
+            s = s.replace('?', "_");
+            s = s.replace('$', "_");
             s.push('_');
             return Cow::Owned(s);
         }
@@ -1423,7 +1406,7 @@
 
     fn build_root_module(id: ItemId) -> Item {
         let module = Module::new(Some("root".into()), ModuleKind::Normal);
-        Item::new(id, None, None, id, ItemKind::Module(module))
+        Item::new(id, None, None, id, ItemKind::Module(module), None)
     }
 
     /// Get the root module.
@@ -1733,6 +1716,7 @@
                             None,
                             self.current_module.into(),
                             ItemKind::Type(sub_ty),
+                            Some(child.location()),
                         );
 
                         // Bypass all the validations in add_item explicitly.
@@ -1797,6 +1781,7 @@
             None,
             self.current_module.into(),
             ItemKind::Type(ty),
+            Some(location.location()),
         );
 
         // Bypass all the validations in add_item explicitly.
@@ -1930,6 +1915,7 @@
     ) -> TypeId {
         let spelling = ty.spelling();
         let layout = ty.fallible_layout(self).ok();
+        let location = ty.declaration().location();
         let type_kind = TypeKind::ResolvedTypeRef(wrapped_id);
         let ty = Type::new(Some(spelling), layout, type_kind, is_const);
         let item = Item::new(
@@ -1938,6 +1924,7 @@
             None,
             parent_id.unwrap_or_else(|| self.current_module.into()),
             ItemKind::Type(ty),
+            Some(location),
         );
         self.add_builtin_item(item);
         with_id.as_type_id_unchecked()
@@ -1998,6 +1985,7 @@
         let spelling = ty.spelling();
         let is_const = ty.is_const();
         let layout = ty.fallible_layout(self).ok();
+        let location = ty.declaration().location();
         let ty = Type::new(Some(spelling), layout, type_kind, is_const);
         let id = self.next_item_id();
         let item = Item::new(
@@ -2006,6 +1994,7 @@
             None,
             self.root_module.into(),
             ItemKind::Type(ty),
+            Some(location),
         );
         self.add_builtin_item(item);
         Some(id.as_type_id_unchecked())
@@ -2194,6 +2183,7 @@
             None,
             self.current_module.into(),
             ItemKind::Module(module),
+            Some(cursor.location()),
         );
 
         let module_id = module.id().as_module_id_unchecked();
@@ -2241,11 +2231,6 @@
         assert!(self.in_codegen_phase());
         assert!(self.current_module == self.root_module);
 
-        let cb = match self.options.parse_callbacks {
-            Some(ref cb) => cb,
-            None => return CanDerive::No,
-        };
-
         *self
             .blocklisted_types_implement_traits
             .borrow_mut()
@@ -2255,8 +2240,27 @@
             .or_insert_with(|| {
                 item.expect_type()
                     .name()
-                    .and_then(|name| {
-                        cb.blocklisted_type_implements_trait(name, derive_trait)
+                    .and_then(|name| match self.options.parse_callbacks {
+                        Some(ref cb) => cb.blocklisted_type_implements_trait(
+                            name,
+                            derive_trait,
+                        ),
+                        // Sized integer types from <stdint.h> get mapped to Rust primitive
+                        // types regardless of whether they are blocklisted, so ensure that
+                        // standard traits are considered derivable for them too.
+                        None => match name {
+                            "int8_t" | "uint8_t" | "int16_t" | "uint16_t" |
+                            "int32_t" | "uint32_t" | "int64_t" |
+                            "uint64_t" | "uintptr_t" | "intptr_t" |
+                            "ptrdiff_t" => Some(CanDerive::Yes),
+                            "size_t" if self.options.size_t_is_usize => {
+                                Some(CanDerive::Yes)
+                            }
+                            "ssize_t" if self.options.size_t_is_usize => {
+                                Some(CanDerive::Yes)
+                            }
+                            _ => Some(CanDerive::No),
+                        },
                     })
                     .unwrap_or(CanDerive::No)
             })
@@ -2286,7 +2290,8 @@
                     // game.
                     if self.options().allowlisted_types.is_empty() &&
                         self.options().allowlisted_functions.is_empty() &&
-                        self.options().allowlisted_vars.is_empty()
+                        self.options().allowlisted_vars.is_empty() &&
+                        self.options().allowlisted_files.is_empty()
                     {
                         return true;
                     }
@@ -2297,6 +2302,23 @@
                         return true;
                     }
 
+                    // Items with a source location in an explicitly allowlisted file
+                    // are always included.
+                    if !self.options().allowlisted_files.is_empty() {
+                        if let Some(location) = item.location() {
+                            let (file, _, _, _) = location.location();
+                            if let Some(filename) = file.name() {
+                                if self
+                                    .options()
+                                    .allowlisted_files
+                                    .matches(&filename)
+                                {
+                                    return true;
+                                }
+                            }
+                        }
+                    }
+
                     let name = item.path_for_allowlisting(self)[1..].join("::");
                     debug!("allowlisted_items: testing {:?}", name);
                     match *item.kind() {
diff --git a/src/ir/function.rs b/src/ir/function.rs
index a3a2bbf..e8e2c2d 100644
--- a/src/ir/function.rs
+++ b/src/ir/function.rs
@@ -131,6 +131,11 @@
         self.signature
     }
 
+    /// Get this function's comment.
+    pub fn comment(&self) -> Option<&str> {
+        self.comment.as_deref()
+    }
+
     /// Get this function's kind.
     pub fn kind(&self) -> FunctionKind {
         self.kind
@@ -176,6 +181,8 @@
     Fastcall,
     /// The "thiscall" ABI.
     ThisCall,
+    /// The "vectorcall" ABI.
+    Vectorcall,
     /// The "aapcs" ABI.
     Aapcs,
     /// The "win64" ABI.
@@ -198,6 +205,7 @@
             Abi::Stdcall => quote! { "stdcall" },
             Abi::Fastcall => quote! { "fastcall" },
             Abi::ThisCall => quote! { "thiscall" },
+            Abi::Vectorcall => quote! { "vectorcall" },
             Abi::Aapcs => quote! { "aapcs" },
             Abi::Win64 => quote! { "win64" },
             Abi::Unknown(cc) => panic!(
@@ -236,6 +244,7 @@
         CXCallingConv_X86StdCall => Abi::Stdcall,
         CXCallingConv_X86FastCall => Abi::Fastcall,
         CXCallingConv_X86ThisCall => Abi::ThisCall,
+        CXCallingConv_X86VectorCall => Abi::Vectorcall,
         CXCallingConv_AAPCS => Abi::Aapcs,
         CXCallingConv_X86_64Win64 => Abi::Win64,
         other => Abi::Unknown(other),
diff --git a/src/ir/item.rs b/src/ir/item.rs
index 730271e..3b15cd6 100644
--- a/src/ir/item.rs
+++ b/src/ir/item.rs
@@ -417,6 +417,8 @@
     parent_id: ItemId,
     /// The item kind.
     kind: ItemKind,
+    /// The source location of the item.
+    location: Option<clang::SourceLocation>,
 }
 
 impl AsRef<ItemId> for Item {
@@ -433,6 +435,7 @@
         annotations: Option<Annotations>,
         parent_id: ItemId,
         kind: ItemKind,
+        location: Option<clang::SourceLocation>,
     ) -> Self {
         debug_assert!(id != parent_id || kind.is_module());
         Item {
@@ -445,6 +448,7 @@
             comment,
             annotations: annotations.unwrap_or_default(),
             kind,
+            location,
         }
     }
 
@@ -454,10 +458,15 @@
         ty: &clang::Type,
         ctx: &mut BindgenContext,
     ) -> TypeId {
+        let location = ty.declaration().location();
         let ty = Opaque::from_clang_ty(ty, ctx);
         let kind = ItemKind::Type(ty);
         let parent = ctx.root_module().into();
-        ctx.add_item(Item::new(with_id, None, None, parent, kind), None, None);
+        ctx.add_item(
+            Item::new(with_id, None, None, parent, kind, Some(location)),
+            None,
+            None,
+        );
         with_id.as_type_id_unchecked()
     }
 
@@ -521,6 +530,11 @@
         &mut self.kind
     }
 
+    /// Where in the source is this item located?
+    pub fn location(&self) -> Option<&clang::SourceLocation> {
+        self.location.as_ref()
+    }
+
     /// Get an identifier that differentiates this item from its siblings.
     ///
     /// This should stay relatively stable in the face of code motion outside or
@@ -632,6 +646,17 @@
             return true;
         }
 
+        if !ctx.options().blocklisted_files.is_empty() {
+            if let Some(location) = &self.location {
+                let (file, _, _, _) = location.location();
+                if let Some(filename) = file.name() {
+                    if ctx.options().blocklisted_files.matches(&filename) {
+                        return true;
+                    }
+                }
+            }
+        }
+
         let path = self.path_for_allowlisting(ctx);
         let name = path[1..].join("::");
         ctx.options().blocklisted_items.matches(&name) ||
@@ -1071,6 +1096,11 @@
             _ => return None,
         })
     }
+
+    /// Whether this is a #[must_use] type.
+    pub fn must_use(&self, ctx: &BindgenContext) -> bool {
+        self.annotations().must_use_type() || ctx.must_use_type_by_name(self)
+    }
 }
 
 impl<T> IsOpaque for T
@@ -1297,7 +1327,7 @@
         let id = ctx.next_item_id();
         let module = ctx.root_module().into();
         ctx.add_item(
-            Item::new(id, None, None, module, ItemKind::Type(ty)),
+            Item::new(id, None, None, module, ItemKind::Type(ty), None),
             None,
             None,
         );
@@ -1335,6 +1365,7 @@
                                 annotations,
                                 relevant_parent_id,
                                 ItemKind::$what(item),
+                                Some(cursor.location()),
                             ),
                             declaration,
                             Some(cursor),
@@ -1516,6 +1547,7 @@
                 None,
                 parent_id.unwrap_or_else(|| current_module.into()),
                 ItemKind::Type(Type::new(None, None, kind, is_const)),
+                Some(location.location()),
             ),
             None,
             None,
@@ -1647,6 +1679,7 @@
                         annotations,
                         relevant_parent_id,
                         ItemKind::Type(item),
+                        Some(location.location()),
                     ),
                     declaration,
                     Some(location),
@@ -1866,7 +1899,7 @@
 
         // See tests/headers/const_tparam.hpp and
         // tests/headers/variadic_tname.hpp.
-        let name = ty_spelling.replace("const ", "").replace(".", "");
+        let name = ty_spelling.replace("const ", "").replace('.', "");
 
         let id = with_id.unwrap_or_else(|| ctx.next_item_id());
         let item = Item::new(
@@ -1875,6 +1908,7 @@
             None,
             parent,
             ItemKind::Type(Type::named(name)),
+            Some(location.location()),
         );
         ctx.add_type_param(item, definition);
         Some(id.as_type_id_unchecked())
diff --git a/src/ir/var.rs b/src/ir/var.rs
index cd17937..e44d57a 100644
--- a/src/ir/var.rs
+++ b/src/ir/var.rs
@@ -149,52 +149,27 @@
     }
 }
 
-/// Determines whether a set of tokens from a CXCursor_MacroDefinition
-/// represent a function-like macro. If so, calls the func_macro callback
-/// and returns `Err(ParseError::Continue)` to signal to skip further
-/// processing. If conversion to UTF-8 fails (it is performed only where it
-/// should be infallible), then `Err(ParseError::Continue)` is returned as well.
+/// Parses tokens from a CXCursor_MacroDefinition pointing into a function-like
+/// macro, and calls the func_macro callback.
 fn handle_function_macro(
     cursor: &clang::Cursor,
-    tokens: &[ClangToken],
     callbacks: &dyn crate::callbacks::ParseCallbacks,
-) -> Result<(), ParseError> {
-    // TODO: Hoist the `is_macro_function_like` check into this function's
-    // caller, and thus avoid allocating the `tokens` vector for non-functional
-    // macros.
-    let is_functional_macro = cursor.is_macro_function_like();
-
-    if !is_functional_macro {
-        return Ok(());
-    }
-
+) {
     let is_closing_paren = |t: &ClangToken| {
         // Test cheap token kind before comparing exact spellings.
         t.kind == clang_sys::CXToken_Punctuation && t.spelling() == b")"
     };
-    let boundary = tokens.iter().position(is_closing_paren);
-
-    let mut spelled = tokens.iter().map(ClangToken::spelling);
-    // Add 1, to convert index to length.
-    let left = spelled
-        .by_ref()
-        .take(boundary.ok_or(ParseError::Continue)? + 1);
-    let left = left.collect::<Vec<_>>().concat();
-    let left = String::from_utf8(left).map_err(|_| ParseError::Continue)?;
-    let right = spelled;
-    // Drop last token with LLVM < 4.0, due to an LLVM bug.
-    //
-    // See:
-    //   https://bugs.llvm.org//show_bug.cgi?id=9069
-    let len = match (right.len(), crate::clang_version().parsed) {
-        (len, Some((v, _))) if len > 0 && v < 4 => len - 1,
-        (len, _) => len,
-    };
-    let right: Vec<_> = right.take(len).collect();
-    callbacks.func_macro(&left, &right);
-
-    // We handled the macro, skip future macro processing.
-    Err(ParseError::Continue)
+    let tokens: Vec<_> = cursor.tokens().iter().collect();
+    if let Some(boundary) = tokens.iter().position(is_closing_paren) {
+        let mut spelled = tokens.iter().map(ClangToken::spelling);
+        // Add 1, to convert index to length.
+        let left = spelled.by_ref().take(boundary + 1);
+        let left = left.collect::<Vec<_>>().concat();
+        if let Ok(left) = String::from_utf8(left) {
+            let right: Vec<_> = spelled.collect();
+            callbacks.func_macro(&left, &right);
+        }
+    }
 }
 
 impl ClangSubItemParser for Var {
@@ -207,8 +182,6 @@
         use clang_sys::*;
         match cursor.kind() {
             CXCursor_MacroDefinition => {
-                let tokens: Vec<_> = cursor.tokens().iter().collect();
-
                 if let Some(callbacks) = ctx.parse_callbacks() {
                     match callbacks.will_parse_macro(&cursor.spelling()) {
                         MacroParsingBehavior::Ignore => {
@@ -217,10 +190,14 @@
                         MacroParsingBehavior::Default => {}
                     }
 
-                    handle_function_macro(&cursor, &tokens, callbacks)?;
+                    if cursor.is_macro_function_like() {
+                        handle_function_macro(&cursor, callbacks);
+                        // We handled the macro, skip macro processing below.
+                        return Err(ParseError::Continue);
+                    }
                 }
 
-                let value = parse_macro(ctx, &tokens);
+                let value = parse_macro(ctx, &cursor);
 
                 let (id, value) = match value {
                     Some(v) => v,
@@ -387,29 +364,14 @@
 /// Try and parse a macro using all the macros parsed until now.
 fn parse_macro(
     ctx: &BindgenContext,
-    tokens: &[ClangToken],
+    cursor: &clang::Cursor,
 ) -> Option<(Vec<u8>, cexpr::expr::EvalResult)> {
     use cexpr::expr;
 
-    let mut cexpr_tokens: Vec<_> = tokens
-        .iter()
-        .filter_map(ClangToken::as_cexpr_token)
-        .collect();
+    let cexpr_tokens = cursor.cexpr_tokens();
 
     let parser = expr::IdentifierParser::new(ctx.parsed_macros());
 
-    if let Ok((_, (id, val))) = parser.macro_definition(&cexpr_tokens) {
-        return Some((id.into(), val));
-    }
-
-    // Try without the last token, to workaround a libclang bug in versions
-    // previous to 4.0.
-    //
-    // See:
-    //   https://bugs.llvm.org//show_bug.cgi?id=9069
-    //   https://reviews.llvm.org/D26446
-    cexpr_tokens.pop()?;
-
     match parser.macro_definition(&cexpr_tokens) {
         Ok((_, (id, val))) => Some((id.into(), val)),
         _ => None,
diff --git a/src/lib.rs b/src/lib.rs
index 1129efe..3d09ab7 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -232,6 +232,20 @@
     Default::default()
 }
 
+fn get_extra_clang_args() -> Vec<String> {
+    // Add any extra arguments from the environment to the clang command line.
+    let extra_clang_args =
+        match get_target_dependent_env_var("BINDGEN_EXTRA_CLANG_ARGS") {
+            None => return vec![],
+            Some(s) => s,
+        };
+    // Try to parse it with shell quoting. If we fail, make it one single big argument.
+    if let Some(strings) = shlex::split(&extra_clang_args) {
+        return strings;
+    }
+    vec![extra_clang_args]
+}
+
 impl Builder {
     /// Generates the command line flags use for creating `Builder`.
     pub fn command_line_flags(&self) -> Vec<String> {
@@ -308,10 +322,12 @@
             (&self.options.blocklisted_types, "--blocklist-type"),
             (&self.options.blocklisted_functions, "--blocklist-function"),
             (&self.options.blocklisted_items, "--blocklist-item"),
+            (&self.options.blocklisted_files, "--blocklist-file"),
             (&self.options.opaque_types, "--opaque-type"),
             (&self.options.allowlisted_functions, "--allowlist-function"),
             (&self.options.allowlisted_types, "--allowlist-type"),
             (&self.options.allowlisted_vars, "--allowlist-var"),
+            (&self.options.allowlisted_files, "--allowlist-file"),
             (&self.options.no_partialeq_types, "--no-partialeq"),
             (&self.options.no_copy_types, "--no-copy"),
             (&self.options.no_debug_types, "--no-debug"),
@@ -567,6 +583,10 @@
             output_vector.push("--explicit-padding".into());
         }
 
+        if self.options.vtable_generation {
+            output_vector.push("--vtable-generation".into());
+        }
+
         // Add clang arguments
 
         output_vector.push("--".into());
@@ -821,6 +841,13 @@
         self
     }
 
+    /// Hide any contents of the given file from the generated bindings,
+    /// regardless of whether it's a type, function, module etc.
+    pub fn blocklist_file<T: AsRef<str>>(mut self, arg: T) -> Builder {
+        self.options.blocklisted_files.insert(arg);
+        self
+    }
+
     /// Treat the given type as opaque in the generated bindings. Regular
     /// expressions are supported.
     ///
@@ -900,6 +927,12 @@
         self
     }
 
+    /// Allowlist the given file so that its contents appear in the generated bindings.
+    pub fn allowlist_file<T: AsRef<str>>(mut self, arg: T) -> Builder {
+        self.options.allowlisted_files.insert(arg);
+        self
+    }
+
     /// Deprecated: use allowlist_var instead.
     #[deprecated(note = "use allowlist_var instead")]
     pub fn whitelist_var<T: AsRef<str>>(self, arg: T) -> Builder {
@@ -1435,19 +1468,18 @@
         self
     }
 
+    /// If true, enables experimental support to generate vtable functions.
+    ///
+    /// Should mostly work, though some edge cases are likely to be broken.
+    pub fn vtable_generation(mut self, doit: bool) -> Self {
+        self.options.vtable_generation = doit;
+        self
+    }
+
     /// Generate the Rust bindings using the options built up thus far.
-    pub fn generate(mut self) -> Result<Bindings, ()> {
+    pub fn generate(mut self) -> Result<Bindings, BindgenError> {
         // Add any extra arguments from the environment to the clang command line.
-        if let Some(extra_clang_args) =
-            get_target_dependent_env_var("BINDGEN_EXTRA_CLANG_ARGS")
-        {
-            // Try to parse it with shell quoting. If we fail, make it one single big argument.
-            if let Some(strings) = shlex::split(&extra_clang_args) {
-                self.options.clang_args.extend(strings);
-            } else {
-                self.options.clang_args.push(extra_clang_args);
-            };
-        }
+        self.options.clang_args.extend(get_extra_clang_args());
 
         // Transform input headers to arguments on the clang command line.
         self.options.input_header = self.input_headers.pop();
@@ -1534,6 +1566,10 @@
             cmd.arg(a);
         }
 
+        for a in get_extra_clang_args() {
+            cmd.arg(a);
+        }
+
         let mut child = cmd.spawn()?;
 
         let mut preprocessed = child.stdout.take().unwrap();
@@ -1669,6 +1705,10 @@
     /// blocklisted and should not appear in the generated code.
     blocklisted_items: RegexSet,
 
+    /// The set of files whose contents should be blocklisted and should not
+    /// appear in the generated code.
+    blocklisted_files: RegexSet,
+
     /// The set of types that should be treated as opaque structures in the
     /// generated code.
     opaque_types: RegexSet,
@@ -1693,6 +1733,9 @@
     /// Allowlisted variables. See docs for `allowlisted_types` for more.
     allowlisted_vars: RegexSet,
 
+    /// The set of files whose contents should be allowlisted.
+    allowlisted_files: RegexSet,
+
     /// The default style of code to generate for enums
     default_enum_style: codegen::EnumVariation,
 
@@ -1815,13 +1858,6 @@
     /// Whether to time the bindgen phases.
     time_phases: bool,
 
-    /// True if we should generate constant names that are **directly** under
-    /// namespaces.
-    namespaced_constants: bool,
-
-    /// True if we should use MSVC name mangling rules.
-    msvc_mangling: bool,
-
     /// Whether we should convert float types to f32/f64 types.
     convert_floats: bool,
 
@@ -1966,6 +2002,9 @@
 
     /// Always output explicit padding fields
     force_explicit_padding: bool,
+
+    /// Emit vtable functions.
+    vtable_generation: bool,
 }
 
 /// TODO(emilio): This is sort of a lie (see the error message that results from
@@ -1979,9 +2018,11 @@
             &mut self.allowlisted_vars,
             &mut self.allowlisted_types,
             &mut self.allowlisted_functions,
+            &mut self.allowlisted_files,
             &mut self.blocklisted_types,
             &mut self.blocklisted_functions,
             &mut self.blocklisted_items,
+            &mut self.blocklisted_files,
             &mut self.opaque_types,
             &mut self.bitfield_enums,
             &mut self.constified_enums,
@@ -2029,12 +2070,14 @@
             blocklisted_types: Default::default(),
             blocklisted_functions: Default::default(),
             blocklisted_items: Default::default(),
+            blocklisted_files: Default::default(),
             opaque_types: Default::default(),
             rustfmt_path: Default::default(),
             depfile: Default::default(),
             allowlisted_types: Default::default(),
             allowlisted_functions: Default::default(),
             allowlisted_vars: Default::default(),
+            allowlisted_files: Default::default(),
             default_enum_style: Default::default(),
             bitfield_enums: Default::default(),
             newtype_enums: Default::default(),
@@ -2070,8 +2113,6 @@
             use_core: false,
             ctypes_prefix: None,
             anon_fields_prefix: DEFAULT_ANON_FIELDS_PREFIX.into(),
-            namespaced_constants: true,
-            msvc_mangling: false,
             convert_floats: true,
             raw_lines: vec![],
             module_lines: HashMap::default(),
@@ -2111,6 +2152,7 @@
             translate_enum_integer_types: false,
             c_naming: false,
             force_explicit_padding: false,
+            vtable_generation: false,
         }
     }
 }
@@ -2141,6 +2183,41 @@
 #[cfg(not(feature = "runtime"))]
 fn ensure_libclang_is_loaded() {}
 
+/// Error type for rust-bindgen.
+#[derive(Debug, Clone, PartialEq, Eq, Hash)]
+#[non_exhaustive]
+pub enum BindgenError {
+    /// The header was a folder.
+    FolderAsHeader(PathBuf),
+    /// Permissions to read the header is insufficient.
+    InsufficientPermissions(PathBuf),
+    /// The header does not exist.
+    NotExist(PathBuf),
+    /// Clang diagnosed an error.
+    ClangDiagnostic(String),
+}
+
+impl std::fmt::Display for BindgenError {
+    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+        match self {
+            BindgenError::FolderAsHeader(h) => {
+                write!(f, "'{}' is a folder", h.display())
+            }
+            BindgenError::InsufficientPermissions(h) => {
+                write!(f, "insufficient permissions to read '{}'", h.display())
+            }
+            BindgenError::NotExist(h) => {
+                write!(f, "header '{}' does not exist.", h.display())
+            }
+            BindgenError::ClangDiagnostic(message) => {
+                write!(f, "clang diagnosed error: {}", message)
+            }
+        }
+    }
+}
+
+impl std::error::Error for BindgenError {}
+
 /// Generated Rust bindings.
 #[derive(Debug)]
 pub struct Bindings {
@@ -2159,6 +2236,10 @@
         clang_target
             .push_str(rust_target.strip_prefix("aarch64-apple-").unwrap());
         return clang_target;
+    } else if rust_target.starts_with("riscv64gc-") {
+        let mut clang_target = "riscv64-".to_owned();
+        clang_target.push_str(rust_target.strip_prefix("riscv64gc-").unwrap());
+        return clang_target;
     }
     rust_target.to_owned()
 }
@@ -2193,7 +2274,7 @@
     /// Generate bindings for the given options.
     pub(crate) fn generate(
         mut options: BindgenOptions,
-    ) -> Result<Bindings, ()> {
+    ) -> Result<Bindings, BindgenError> {
         ensure_libclang_is_loaded();
 
         #[cfg(feature = "runtime")]
@@ -2311,22 +2392,19 @@
         }
 
         if let Some(h) = options.input_header.as_ref() {
-            if let Ok(md) = std::fs::metadata(h) {
+            let path = Path::new(h);
+            if let Ok(md) = std::fs::metadata(path) {
                 if md.is_dir() {
-                    eprintln!("error: '{}' is a folder", h);
-                    return Err(());
+                    return Err(BindgenError::FolderAsHeader(path.into()));
                 }
                 if !can_read(&md.permissions()) {
-                    eprintln!(
-                        "error: insufficient permissions to read '{}'",
-                        h
-                    );
-                    return Err(());
+                    return Err(BindgenError::InsufficientPermissions(
+                        path.into(),
+                    ));
                 }
                 options.clang_args.push(h.clone())
             } else {
-                eprintln!("error: header '{}' does not exist.", h);
-                return Err(());
+                return Err(BindgenError::NotExist(path.into()));
             }
         }
 
@@ -2547,19 +2625,24 @@
 }
 
 /// Parse the Clang AST into our `Item` internal representation.
-fn parse(context: &mut BindgenContext) -> Result<(), ()> {
+fn parse(context: &mut BindgenContext) -> Result<(), BindgenError> {
     use clang_sys::*;
 
-    let mut any_error = false;
+    let mut error = None;
     for d in context.translation_unit().diags().iter() {
         let msg = d.format();
         let is_err = d.severity() >= CXDiagnostic_Error;
-        eprintln!("{}, err: {}", msg, is_err);
-        any_error |= is_err;
+        if is_err {
+            let error = error.get_or_insert_with(String::new);
+            error.push_str(&msg);
+            error.push('\n');
+        } else {
+            eprintln!("clang diag: {}", msg);
+        }
     }
 
-    if any_error {
-        return Err(());
+    if let Some(message) = error {
+        return Err(BindgenError::ClangDiagnostic(message));
     }
 
     let cursor = context.translation_unit().cursor();
@@ -2631,7 +2714,7 @@
             return Some(v);
         }
         if let Ok(v) =
-            env::var(&format!("{}_{}", var, target.replace("-", "_")))
+            env::var(&format!("{}_{}", var, target.replace('-', "_")))
         {
             return Some(v);
         }
@@ -2642,7 +2725,7 @@
 /// A ParseCallbacks implementation that will act on file includes by echoing a rerun-if-changed
 /// line
 ///
-/// When running in side a `build.rs` script, this can be used to make cargo invalidate the
+/// When running inside a `build.rs` script, this can be used to make cargo invalidate the
 /// generated bindings whenever any of the files included from the header change:
 /// ```
 /// use bindgen::builder;
@@ -2677,9 +2760,7 @@
     .map(|&x| x.into())
     .collect::<Vec<String>>();
 
-    assert!(test_cases
-        .iter()
-        .all(|ref x| command_line_flags.contains(x),));
+    assert!(test_cases.iter().all(|x| command_line_flags.contains(x)));
 
     //Test 2
     let bindings = crate::builder()
@@ -2704,12 +2785,18 @@
     .collect::<Vec<String>>();
     println!("{:?}", command_line_flags);
 
-    assert!(test_cases
-        .iter()
-        .all(|ref x| command_line_flags.contains(x),));
+    assert!(test_cases.iter().all(|x| command_line_flags.contains(x)));
 }
 
 #[test]
 fn test_rust_to_clang_target() {
     assert_eq!(rust_to_clang_target("aarch64-apple-ios"), "arm64-apple-ios");
 }
+
+#[test]
+fn test_rust_to_clang_target_riscv() {
+    assert_eq!(
+        rust_to_clang_target("riscv64gc-unknown-linux-gnu"),
+        "riscv64-unknown-linux-gnu"
+    )
+}
diff --git a/src/main.rs b/src/main.rs
index f3398db..50f3e71 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -23,10 +23,6 @@
         Some((9, 0))
     } else if cfg!(feature = "testing_only_libclang_5") {
         Some((5, 0))
-    } else if cfg!(feature = "testing_only_libclang_4") {
-        Some((4, 0))
-    } else if cfg!(feature = "testing_only_libclang_3_9") {
-        Some((3, 9))
     } else {
         None
     };
diff --git a/src/options.rs b/src/options.rs
index 9aac5da..4e1fb93 100644
--- a/src/options.rs
+++ b/src/options.rs
@@ -23,18 +23,18 @@
     );
 
     let matches = App::new("bindgen")
-        .version(option_env!("CARGO_PKG_VERSION").unwrap_or("unknown"))
         .about("Generates Rust bindings from C/C++ headers.")
-        .usage("bindgen [FLAGS] [OPTIONS] <header> -- <clang-args>...")
+        .setting(clap::AppSettings::NoAutoVersion)
+        .override_usage("bindgen [FLAGS] [OPTIONS] <header> -- <clang-args>...")
         .args(&[
-            Arg::with_name("header")
+            Arg::new("header")
                 .help("C or C++ header file")
-                .required(true),
-            Arg::with_name("depfile")
+                .required_unless_present("V"),
+            Arg::new("depfile")
                 .long("depfile")
                 .takes_value(true)
                 .help("Path to write depfile to"),
-            Arg::with_name("default-enum-style")
+            Arg::new("default-enum-style")
                 .long("default-enum-style")
                 .help("The default style of code used to generate enums.")
                 .value_name("variant")
@@ -47,8 +47,8 @@
                     "rust",
                     "rust_non_exhaustive",
                 ])
-                .multiple(false),
-            Arg::with_name("bitfield-enum")
+                .multiple_occurrences(false),
+            Arg::new("bitfield-enum")
                 .long("bitfield-enum")
                 .help(
                     "Mark any enum whose name matches <regex> as a set of \
@@ -56,23 +56,23 @@
                 )
                 .value_name("regex")
                 .takes_value(true)
-                .multiple(true)
+                .multiple_occurrences(true)
                 .number_of_values(1),
-            Arg::with_name("newtype-enum")
+            Arg::new("newtype-enum")
                 .long("newtype-enum")
                 .help("Mark any enum whose name matches <regex> as a newtype.")
                 .value_name("regex")
                 .takes_value(true)
-                .multiple(true)
+                .multiple_occurrences(true)
                 .number_of_values(1),
-            Arg::with_name("rustified-enum")
+            Arg::new("rustified-enum")
                 .long("rustified-enum")
                 .help("Mark any enum whose name matches <regex> as a Rust enum.")
                 .value_name("regex")
                 .takes_value(true)
-                .multiple(true)
+                .multiple_occurrences(true)
                 .number_of_values(1),
-            Arg::with_name("constified-enum")
+            Arg::new("constified-enum")
                 .long("constified-enum")
                 .help(
                     "Mark any enum whose name matches <regex> as a series of \
@@ -80,9 +80,9 @@
                 )
                 .value_name("regex")
                 .takes_value(true)
-                .multiple(true)
+                .multiple_occurrences(true)
                 .number_of_values(1),
-            Arg::with_name("constified-enum-module")
+            Arg::new("constified-enum-module")
                 .long("constified-enum-module")
                 .help(
                     "Mark any enum whose name matches <regex> as a module of \
@@ -90,16 +90,16 @@
                 )
                 .value_name("regex")
                 .takes_value(true)
-                .multiple(true)
+                .multiple_occurrences(true)
                 .number_of_values(1),
-            Arg::with_name("default-macro-constant-type")
+            Arg::new("default-macro-constant-type")
                 .long("default-macro-constant-type")
                 .help("The default signed/unsigned type for C macro constants.")
                 .value_name("variant")
                 .default_value("unsigned")
                 .possible_values(&["signed", "unsigned"])
-                .multiple(false),
-            Arg::with_name("default-alias-style")
+                .multiple_occurrences(false),
+            Arg::new("default-alias-style")
                 .long("default-alias-style")
                 .help("The default style of code used to generate typedefs.")
                 .value_name("variant")
@@ -109,8 +109,8 @@
                     "new_type",
                     "new_type_deref",
                 ])
-                .multiple(false),
-            Arg::with_name("normal-alias")
+                .multiple_occurrences(false),
+            Arg::new("normal-alias")
                 .long("normal-alias")
                 .help(
                     "Mark any typedef alias whose name matches <regex> to use \
@@ -118,9 +118,9 @@
                 )
                 .value_name("regex")
                 .takes_value(true)
-                .multiple(true)
+                .multiple_occurrences(true)
                 .number_of_values(1),
-             Arg::with_name("new-type-alias")
+             Arg::new("new-type-alias")
                 .long("new-type-alias")
                 .help(
                     "Mark any typedef alias whose name matches <regex> to have \
@@ -128,9 +128,9 @@
                 )
                 .value_name("regex")
                 .takes_value(true)
-                .multiple(true)
+                .multiple_occurrences(true)
                 .number_of_values(1),
-             Arg::with_name("new-type-alias-deref")
+             Arg::new("new-type-alias-deref")
                 .long("new-type-alias-deref")
                 .help(
                     "Mark any typedef alias whose name matches <regex> to have \
@@ -138,86 +138,94 @@
                 )
                 .value_name("regex")
                 .takes_value(true)
-                .multiple(true)
+                .multiple_occurrences(true)
                 .number_of_values(1),
-            Arg::with_name("blocklist-type")
+            Arg::new("blocklist-type")
                 .alias("blacklist-type")
                 .long("blocklist-type")
                 .help("Mark <type> as hidden.")
                 .value_name("type")
                 .takes_value(true)
-                .multiple(true)
+                .multiple_occurrences(true)
                 .number_of_values(1),
-            Arg::with_name("blocklist-function")
+            Arg::new("blocklist-function")
                 .alias("blacklist-function")
                 .long("blocklist-function")
                 .help("Mark <function> as hidden.")
                 .value_name("function")
                 .takes_value(true)
-                .multiple(true)
+                .multiple_occurrences(true)
                 .number_of_values(1),
-            Arg::with_name("blocklist-item")
+            Arg::new("blocklist-item")
                 .alias("blacklist-item")
                 .long("blocklist-item")
                 .help("Mark <item> as hidden.")
                 .value_name("item")
                 .takes_value(true)
-                .multiple(true)
+                .multiple_occurrences(true)
                 .number_of_values(1),
-            Arg::with_name("no-layout-tests")
+            Arg::new("blocklist-file")
+                .alias("blacklist-file")
+                .long("blocklist-file")
+                .help("Mark all contents of <path> as hidden.")
+                .value_name("path")
+                .takes_value(true)
+                .multiple_occurrences(true)
+                .number_of_values(1),
+            Arg::new("no-layout-tests")
                 .long("no-layout-tests")
                 .help("Avoid generating layout tests for any type."),
-            Arg::with_name("no-derive-copy")
+            Arg::new("no-derive-copy")
                 .long("no-derive-copy")
                 .help("Avoid deriving Copy on any type."),
-            Arg::with_name("no-derive-debug")
+            Arg::new("no-derive-debug")
                 .long("no-derive-debug")
                 .help("Avoid deriving Debug on any type."),
-            Arg::with_name("no-derive-default")
+            Arg::new("no-derive-default")
                 .long("no-derive-default")
-                .hidden(true)
+                .hide(true)
                 .help("Avoid deriving Default on any type."),
-            Arg::with_name("impl-debug").long("impl-debug").help(
+            Arg::new("impl-debug").long("impl-debug").help(
                 "Create Debug implementation, if it can not be derived \
                  automatically.",
             ),
-            Arg::with_name("impl-partialeq")
+            Arg::new("impl-partialeq")
                 .long("impl-partialeq")
                 .help(
                     "Create PartialEq implementation, if it can not be derived \
                      automatically.",
                 ),
-            Arg::with_name("with-derive-default")
+            Arg::new("with-derive-default")
                 .long("with-derive-default")
                 .help("Derive Default on any type."),
-            Arg::with_name("with-derive-hash")
+            Arg::new("with-derive-hash")
                 .long("with-derive-hash")
                 .help("Derive hash on any type."),
-            Arg::with_name("with-derive-partialeq")
+            Arg::new("with-derive-partialeq")
                 .long("with-derive-partialeq")
                 .help("Derive partialeq on any type."),
-            Arg::with_name("with-derive-partialord")
+            Arg::new("with-derive-partialord")
                 .long("with-derive-partialord")
                 .help("Derive partialord on any type."),
-            Arg::with_name("with-derive-eq")
+            Arg::new("with-derive-eq")
                 .long("with-derive-eq")
                 .help(
                     "Derive eq on any type. Enable this option also \
                      enables --with-derive-partialeq",
                 ),
-            Arg::with_name("with-derive-ord")
+            Arg::new("with-derive-ord")
                 .long("with-derive-ord")
                 .help(
                     "Derive ord on any type. Enable this option also \
                      enables --with-derive-partialord",
                 ),
-            Arg::with_name("no-doc-comments")
+            Arg::new("no-doc-comments")
                 .long("no-doc-comments")
                 .help(
                     "Avoid including doc comments in the output, see: \
                      https://github.com/rust-lang/rust-bindgen/issues/426",
                 ),
-            Arg::with_name("no-recursive-allowlist")
+            Arg::new("no-recursive-allowlist")
                 .long("no-recursive-allowlist")
                 .alias("no-recursive-whitelist")
                 .help(
@@ -226,23 +234,23 @@
                      `bindgen::Builder::allowlist_recursively` method's \
                      documentation for details.",
                 ),
-            Arg::with_name("objc-extern-crate")
+            Arg::new("objc-extern-crate")
                 .long("objc-extern-crate")
                 .help("Use extern crate instead of use for objc."),
-            Arg::with_name("generate-block")
+            Arg::new("generate-block")
                 .long("generate-block")
                 .help("Generate block signatures instead of void pointers."),
-            Arg::with_name("block-extern-crate")
+            Arg::new("block-extern-crate")
                 .long("block-extern-crate")
                 .help("Use extern crate instead of use for block."),
-            Arg::with_name("distrust-clang-mangling")
+            Arg::new("distrust-clang-mangling")
                 .long("distrust-clang-mangling")
                 .help("Do not trust the libclang-provided mangling"),
-            Arg::with_name("builtins").long("builtins").help(
+            Arg::new("builtins").long("builtins").help(
                 "Output bindings for builtin definitions, e.g. \
                  __builtin_va_list.",
             ),
-            Arg::with_name("ctypes-prefix")
+            Arg::new("ctypes-prefix")
                 .long("ctypes-prefix")
                 .help(
                     "Use the given prefix before raw types instead of \
@@ -250,61 +258,61 @@
                 )
                 .value_name("prefix")
                 .takes_value(true),
-            Arg::with_name("anon-fields-prefix")
+            Arg::new("anon-fields-prefix")
                 .long("anon-fields-prefix")
                 .help("Use the given prefix for the anon fields.")
                 .value_name("prefix")
                 .default_value(DEFAULT_ANON_FIELDS_PREFIX)
                 .takes_value(true),
-            Arg::with_name("time-phases")
+            Arg::new("time-phases")
                 .long("time-phases")
                 .help("Time the different bindgen phases and print to stderr"),
             // All positional arguments after the end of options marker, `--`
-            Arg::with_name("clang-args").last(true).multiple(true),
-            Arg::with_name("emit-clang-ast")
+            Arg::new("clang-args").last(true).multiple_occurrences(true),
+            Arg::new("emit-clang-ast")
                 .long("emit-clang-ast")
                 .help("Output the Clang AST for debugging purposes."),
-            Arg::with_name("emit-ir")
+            Arg::new("emit-ir")
                 .long("emit-ir")
                 .help("Output our internal IR for debugging purposes."),
-            Arg::with_name("emit-ir-graphviz")
+            Arg::new("emit-ir-graphviz")
                 .long("emit-ir-graphviz")
                 .help("Dump graphviz dot file.")
                 .value_name("path")
                 .takes_value(true),
-            Arg::with_name("enable-cxx-namespaces")
+            Arg::new("enable-cxx-namespaces")
                 .long("enable-cxx-namespaces")
                 .help("Enable support for C++ namespaces."),
-            Arg::with_name("disable-name-namespacing")
+            Arg::new("disable-name-namespacing")
                 .long("disable-name-namespacing")
                 .help(
                     "Disable namespacing via mangling, causing bindgen to \
                      generate names like \"Baz\" instead of \"foo_bar_Baz\" \
                      for an input name \"foo::bar::Baz\".",
                 ),
-            Arg::with_name("disable-nested-struct-naming")
+            Arg::new("disable-nested-struct-naming")
                 .long("disable-nested-struct-naming")
                 .help(
                     "Disable nested struct naming, causing bindgen to generate \
                      names like \"bar\" instead of \"foo_bar\" for a nested \
                      definition \"struct foo { struct bar { } b; };\"."
                 ),
-            Arg::with_name("disable-untagged-union")
+            Arg::new("disable-untagged-union")
                 .long("disable-untagged-union")
                 .help(
                     "Disable support for native Rust unions.",
                 ),
-            Arg::with_name("disable-header-comment")
+            Arg::new("disable-header-comment")
                 .long("disable-header-comment")
                 .help("Suppress insertion of bindgen's version identifier into generated bindings.")
-                .multiple(true),
-            Arg::with_name("ignore-functions")
+                .multiple_occurrences(true),
+            Arg::new("ignore-functions")
                 .long("ignore-functions")
                 .help(
                     "Do not generate bindings for functions or methods. This \
                      is useful when you only care about struct layouts.",
                 ),
-            Arg::with_name("generate")
+            Arg::new("generate")
                 .long("generate")
                 .help(
                     "Generate only given items, split by commas. \
@@ -312,67 +320,67 @@
                      \"methods\", \"constructors\" and \"destructors\".",
                 )
                 .takes_value(true),
-            Arg::with_name("ignore-methods")
+            Arg::new("ignore-methods")
                 .long("ignore-methods")
                 .help("Do not generate bindings for methods."),
-            Arg::with_name("no-convert-floats")
+            Arg::new("no-convert-floats")
                 .long("no-convert-floats")
                 .help("Do not automatically convert floats to f32/f64."),
-            Arg::with_name("no-prepend-enum-name")
+            Arg::new("no-prepend-enum-name")
                 .long("no-prepend-enum-name")
                 .help("Do not prepend the enum name to constant or newtype variants."),
-            Arg::with_name("no-include-path-detection")
+            Arg::new("no-include-path-detection")
                 .long("no-include-path-detection")
                 .help("Do not try to detect default include paths"),
-            Arg::with_name("fit-macro-constant-types")
+            Arg::new("fit-macro-constant-types")
                 .long("fit-macro-constant-types")
                 .help("Try to fit macro constants into types smaller than u32/i32"),
-            Arg::with_name("unstable-rust")
+            Arg::new("unstable-rust")
                 .long("unstable-rust")
                 .help("Generate unstable Rust code (deprecated; use --rust-target instead).")
-                .multiple(true), // FIXME: Pass legacy test suite
-            Arg::with_name("opaque-type")
+                .multiple_occurrences(true), // FIXME: Pass legacy test suite
+            Arg::new("opaque-type")
                 .long("opaque-type")
                 .help("Mark <type> as opaque.")
                 .value_name("type")
                 .takes_value(true)
-                .multiple(true)
+                .multiple_occurrences(true)
                 .number_of_values(1),
-            Arg::with_name("output")
-                .short("o")
+            Arg::new("output")
+                .short('o')
                 .long("output")
                 .help("Write Rust bindings to <output>.")
                 .takes_value(true),
-            Arg::with_name("raw-line")
+            Arg::new("raw-line")
                 .long("raw-line")
                 .help("Add a raw line of Rust code at the beginning of output.")
                 .takes_value(true)
-                .multiple(true)
+                .multiple_occurrences(true)
                 .number_of_values(1),
-            Arg::with_name("module-raw-line")
+            Arg::new("module-raw-line")
                 .long("module-raw-line")
                 .help("Add a raw line of Rust code to a given module.")
                 .takes_value(true)
-                .multiple(true)
+                .multiple_occurrences(true)
                 .number_of_values(2)
                 .value_names(&["module-name", "raw-line"]),
-            Arg::with_name("rust-target")
+            Arg::new("rust-target")
                 .long("rust-target")
-                .help(&rust_target_help)
+                .help(rust_target_help.as_ref())
                 .takes_value(true),
-            Arg::with_name("use-core")
+            Arg::new("use-core")
                 .long("use-core")
                 .help("Use types from Rust core instead of std."),
-            Arg::with_name("conservative-inline-namespaces")
+            Arg::new("conservative-inline-namespaces")
                 .long("conservative-inline-namespaces")
                 .help(
                     "Conservatively generate inline namespaces to avoid name \
                      conflicts.",
                 ),
-            Arg::with_name("use-msvc-mangling")
+            Arg::new("use-msvc-mangling")
                 .long("use-msvc-mangling")
                 .help("MSVC C++ ABI mangling. DEPRECATED: Has no effect."),
-            Arg::with_name("allowlist-function")
+            Arg::new("allowlist-function")
                 .long("allowlist-function")
                 .alias("whitelist-function")
                 .help(
@@ -382,12 +390,12 @@
                 )
                 .value_name("regex")
                 .takes_value(true)
-                .multiple(true)
+                .multiple_occurrences(true)
                 .number_of_values(1),
-            Arg::with_name("generate-inline-functions")
+            Arg::new("generate-inline-functions")
                 .long("generate-inline-functions")
                 .help("Generate inline functions."),
-            Arg::with_name("allowlist-type")
+            Arg::new("allowlist-type")
                 .long("allowlist-type")
                 .alias("whitelist-type")
                 .help(
@@ -396,9 +404,9 @@
                 )
                 .value_name("regex")
                 .takes_value(true)
-                .multiple(true)
+                .multiple_occurrences(true)
                 .number_of_values(1),
-            Arg::with_name("allowlist-var")
+            Arg::new("allowlist-var")
                 .long("allowlist-var")
                 .alias("whitelist-var")
                 .help(
@@ -408,12 +416,20 @@
                 )
                 .value_name("regex")
                 .takes_value(true)
-                .multiple(true)
+                .multiple_occurrences(true)
                 .number_of_values(1),
-            Arg::with_name("verbose")
+            Arg::new("allowlist-file")
+                .alias("allowlist-file")
+                .long("allowlist-file")
+                .help("Allowlist all contents of <path>.")
+                .value_name("path")
+                .takes_value(true)
+                .multiple_occurrences(true)
+                .number_of_values(1),
+            Arg::new("verbose")
                 .long("verbose")
                 .help("Print verbose error messages."),
-            Arg::with_name("dump-preprocessed-input")
+            Arg::new("dump-preprocessed-input")
                 .long("dump-preprocessed-input")
                 .help(
                     "Preprocess and dump the input header files to disk. \
@@ -421,26 +437,26 @@
                      filing issues. The resulting file will be named \
                      something like `__bindgen.i` or `__bindgen.ii`.",
                 ),
-            Arg::with_name("no-record-matches")
+            Arg::new("no-record-matches")
                 .long("no-record-matches")
                 .help(
                     "Do not record matching items in the regex sets. \
                      This disables reporting of unused items.",
                 ),
-            Arg::with_name("size_t-is-usize")
+            Arg::new("size_t-is-usize")
                 .long("size_t-is-usize")
                 .help("Translate size_t to usize."),
-            Arg::with_name("no-rustfmt-bindings")
+            Arg::new("no-rustfmt-bindings")
                 .long("no-rustfmt-bindings")
                 .help("Do not format the generated bindings with rustfmt."),
-            Arg::with_name("rustfmt-bindings")
+            Arg::new("rustfmt-bindings")
                 .long("rustfmt-bindings")
                 .help(
                     "Format the generated bindings with rustfmt. DEPRECATED: \
                      --rustfmt-bindings is now enabled by default. Disable \
                      with --no-rustfmt-bindings.",
                 ),
-            Arg::with_name("rustfmt-configuration-file")
+            Arg::new("rustfmt-configuration-file")
                 .long("rustfmt-configuration-file")
                 .help(
                     "The absolute path to the rustfmt configuration file. \
@@ -449,86 +465,104 @@
                 )
                 .value_name("path")
                 .takes_value(true)
-                .multiple(false)
+                .multiple_occurrences(false)
                 .number_of_values(1),
-            Arg::with_name("no-partialeq")
+            Arg::new("no-partialeq")
                 .long("no-partialeq")
                 .help("Avoid deriving PartialEq for types matching <regex>.")
                 .value_name("regex")
                 .takes_value(true)
-                .multiple(true)
+                .multiple_occurrences(true)
                 .number_of_values(1),
-            Arg::with_name("no-copy")
+            Arg::new("no-copy")
                 .long("no-copy")
                 .help("Avoid deriving Copy for types matching <regex>.")
                 .value_name("regex")
                 .takes_value(true)
-                .multiple(true)
+                .multiple_occurrences(true)
                 .number_of_values(1),
-            Arg::with_name("no-debug")
+            Arg::new("no-debug")
                 .long("no-debug")
                 .help("Avoid deriving Debug for types matching <regex>.")
                 .value_name("regex")
                 .takes_value(true)
-                .multiple(true)
+                .multiple_occurrences(true)
                 .number_of_values(1),
-            Arg::with_name("no-default")
+            Arg::new("no-default")
                 .long("no-default")
                 .help("Avoid deriving/implement Default for types matching <regex>.")
                 .value_name("regex")
                 .takes_value(true)
-                .multiple(true)
+                .multiple_occurrences(true)
                 .number_of_values(1),
-            Arg::with_name("no-hash")
+            Arg::new("no-hash")
                 .long("no-hash")
                 .help("Avoid deriving Hash for types matching <regex>.")
                 .value_name("regex")
                 .takes_value(true)
-                .multiple(true)
+                .multiple_occurrences(true)
                 .number_of_values(1),
-            Arg::with_name("must-use-type")
+            Arg::new("must-use-type")
                 .long("must-use-type")
                 .help("Add #[must_use] annotation to types matching <regex>.")
                 .value_name("regex")
                 .takes_value(true)
-                .multiple(true)
+                .multiple_occurrences(true)
                 .number_of_values(1),
-            Arg::with_name("enable-function-attribute-detection")
+            Arg::new("enable-function-attribute-detection")
                 .long("enable-function-attribute-detection")
                 .help(
                     "Enables detecting unexposed attributes in functions (slow).
                        Used to generate #[must_use] annotations.",
                 ),
-            Arg::with_name("use-array-pointers-in-arguments")
+            Arg::new("use-array-pointers-in-arguments")
                 .long("use-array-pointers-in-arguments")
                 .help("Use `*const [T; size]` instead of `*const T` for C arrays"),
-            Arg::with_name("wasm-import-module-name")
+            Arg::new("wasm-import-module-name")
                 .long("wasm-import-module-name")
                 .value_name("name")
                 .takes_value(true)
                 .help("The name to be used in a #[link(wasm_import_module = ...)] statement"),
-            Arg::with_name("dynamic-loading")
+            Arg::new("dynamic-loading")
                 .long("dynamic-loading")
                 .takes_value(true)
                 .help("Use dynamic loading mode with the given library name."),
-            Arg::with_name("dynamic-link-require-all")
+            Arg::new("dynamic-link-require-all")
                 .long("dynamic-link-require-all")
                 .help("Require successful linkage to all functions in the library."),
-            Arg::with_name("respect-cxx-access-specs")
+            Arg::new("respect-cxx-access-specs")
                 .long("respect-cxx-access-specs")
                 .help("Makes generated bindings `pub` only for items if the items are publically accessible in C++."),
-            Arg::with_name("translate-enum-integer-types")
+            Arg::new("translate-enum-integer-types")
                 .long("translate-enum-integer-types")
                 .help("Always translate enum integer types to native Rust integer types."),
-            Arg::with_name("c-naming")
+            Arg::new("c-naming")
                 .long("c-naming")
                 .help("Generate types with C style naming."),
-            Arg::with_name("explicit-padding")
+            Arg::new("explicit-padding")
                 .long("explicit-padding")
                 .help("Always output explicit padding fields."),
+            Arg::new("vtable-generation")
+                .long("vtable-generation")
+                .help("Enables generation of vtable functions."),
+            Arg::new("V")
+                .long("version")
+                .help("Prints the version, and exits"),
         ]) // .args()
         .get_matches_from(args);
 
+    let verbose = matches.is_present("verbose");
+    if matches.is_present("V") {
+        println!(
+            "bindgen {}",
+            option_env!("CARGO_PKG_VERSION").unwrap_or("unknown")
+        );
+        if verbose {
+            println!("Clang: {}", crate::clang_version().full);
+        }
+        std::process::exit(0);
+    }
+
     let mut builder = builder();
 
     if let Some(header) = matches.value_of("header") {
@@ -630,6 +664,12 @@
         }
     }
 
+    if let Some(hidden_files) = matches.values_of("blocklist-file") {
+        for file in hidden_files {
+            builder = builder.blocklist_file(file);
+        }
+    }
+
     if matches.is_present("builtins") {
         builder = builder.emit_builtins();
     }
@@ -857,6 +897,12 @@
         }
     }
 
+    if let Some(hidden_files) = matches.values_of("allowlist-file") {
+        for file in hidden_files {
+            builder = builder.allowlist_file(file);
+        }
+    }
+
     if let Some(args) = matches.values_of("clang-args") {
         for arg in args {
             builder = builder.clang_arg(arg);
@@ -980,7 +1026,9 @@
         builder = builder.explicit_padding(true);
     }
 
-    let verbose = matches.is_present("verbose");
+    if matches.is_present("vtable-generation") {
+        builder = builder.vtable_generation(true);
+    }
 
     Ok((builder, output, verbose))
 }
diff --git a/tests/.gitattributes b/tests/.gitattributes
new file mode 100644
index 0000000..96122eb
--- /dev/null
+++ b/tests/.gitattributes
@@ -0,0 +1,4 @@
+# Tell Github Linguist to avoid counting these C and C++ test inputs toward
+# statistics.
+*.h -linguist-detectable
+*.hpp -linguist-detectable
diff --git a/tests/expectations/Cargo.toml b/tests/expectations/Cargo.toml
index c78cc09..f8006af 100644
--- a/tests/expectations/Cargo.toml
+++ b/tests/expectations/Cargo.toml
@@ -7,6 +7,7 @@
   "Emilio Cobos Álvarez <emilio@crisal.io>",
   "The Servo project developers",
 ]
+edition = "2018"
 
 [dependencies]
 objc = "0.2"
diff --git a/tests/expectations/build.rs b/tests/expectations/build.rs
index 2b426a4..e44bcc8 100644
--- a/tests/expectations/build.rs
+++ b/tests/expectations/build.rs
@@ -9,8 +9,6 @@
 use std::path::Path;
 
 const LIBCLANG_VERSION_DIRS: &'static [&'static str] = &[
-    "libclang-3.9",
-    "libclang-4",
     "libclang-5",
     "libclang-9",
 ];
@@ -54,7 +52,7 @@
 #[path = "{}"]
 mod {};
 "###,
-                path.display(),
+                path.display().to_string().replace('\\', "\\\\"),
                 module_name,
             ));
         }
diff --git a/tests/expectations/tests/.gitattributes b/tests/expectations/tests/.gitattributes
new file mode 100644
index 0000000..9699dfa
--- /dev/null
+++ b/tests/expectations/tests/.gitattributes
@@ -0,0 +1,2 @@
+# Prevent Github Linguist from counting generated files in statistics.
+*.rs linguist-generated
diff --git a/tests/expectations/tests/16-byte-alignment.rs b/tests/expectations/tests/16-byte-alignment.rs
index 058568f..6aa491d 100644
--- a/tests/expectations/tests/16-byte-alignment.rs
+++ b/tests/expectations/tests/16-byte-alignment.rs
@@ -42,34 +42,44 @@
             stringify!(rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1)
         )
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1>(
-            )))
-            .dport as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1),
-            "::",
-            stringify!(dport)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1>(
-            )))
-            .sport as *const _ as usize
-        },
-        2usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1),
-            "::",
-            stringify!(sport)
-        )
-    );
+    fn test_field_dport() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).dport) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1),
+                "::",
+                stringify!(dport)
+            )
+        );
+    }
+    test_field_dport();
+    fn test_field_sport() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).sport) as usize - ptr as usize
+            },
+            2usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1),
+                "::",
+                stringify!(sport)
+            )
+        );
+    }
+    test_field_sport();
 }
 #[test]
 fn bindgen_test_layout_rte_ipv4_tuple__bindgen_ty_1() {
@@ -83,19 +93,25 @@
         4usize,
         concat!("Alignment of ", stringify!(rte_ipv4_tuple__bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_ipv4_tuple__bindgen_ty_1>())).sctp_tag
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_ipv4_tuple__bindgen_ty_1),
-            "::",
-            stringify!(sctp_tag)
-        )
-    );
+    fn test_field_sctp_tag() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    rte_ipv4_tuple__bindgen_ty_1,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).sctp_tag) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_ipv4_tuple__bindgen_ty_1),
+                "::",
+                stringify!(sctp_tag)
+            )
+        );
+    }
+    test_field_sctp_tag();
 }
 impl Default for rte_ipv4_tuple__bindgen_ty_1 {
     fn default() -> Self {
@@ -118,32 +134,42 @@
         4usize,
         concat!("Alignment of ", stringify!(rte_ipv4_tuple))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_ipv4_tuple>())).src_addr as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_ipv4_tuple),
-            "::",
-            stringify!(src_addr)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_ipv4_tuple>())).dst_addr as *const _
-                as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_ipv4_tuple),
-            "::",
-            stringify!(dst_addr)
-        )
-    );
+    fn test_field_src_addr() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_ipv4_tuple>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).src_addr) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_ipv4_tuple),
+                "::",
+                stringify!(src_addr)
+            )
+        );
+    }
+    test_field_src_addr();
+    fn test_field_dst_addr() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_ipv4_tuple>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).dst_addr) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_ipv4_tuple),
+                "::",
+                stringify!(dst_addr)
+            )
+        );
+    }
+    test_field_dst_addr();
 }
 impl Default for rte_ipv4_tuple {
     fn default() -> Self {
@@ -191,34 +217,44 @@
             stringify!(rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1)
         )
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1>(
-            )))
-            .dport as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1),
-            "::",
-            stringify!(dport)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1>(
-            )))
-            .sport as *const _ as usize
-        },
-        2usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1),
-            "::",
-            stringify!(sport)
-        )
-    );
+    fn test_field_dport() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).dport) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1),
+                "::",
+                stringify!(dport)
+            )
+        );
+    }
+    test_field_dport();
+    fn test_field_sport() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).sport) as usize - ptr as usize
+            },
+            2usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1),
+                "::",
+                stringify!(sport)
+            )
+        );
+    }
+    test_field_sport();
 }
 #[test]
 fn bindgen_test_layout_rte_ipv6_tuple__bindgen_ty_1() {
@@ -232,19 +268,25 @@
         4usize,
         concat!("Alignment of ", stringify!(rte_ipv6_tuple__bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_ipv6_tuple__bindgen_ty_1>())).sctp_tag
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_ipv6_tuple__bindgen_ty_1),
-            "::",
-            stringify!(sctp_tag)
-        )
-    );
+    fn test_field_sctp_tag() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    rte_ipv6_tuple__bindgen_ty_1,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).sctp_tag) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_ipv6_tuple__bindgen_ty_1),
+                "::",
+                stringify!(sctp_tag)
+            )
+        );
+    }
+    test_field_sctp_tag();
 }
 impl Default for rte_ipv6_tuple__bindgen_ty_1 {
     fn default() -> Self {
@@ -267,32 +309,42 @@
         4usize,
         concat!("Alignment of ", stringify!(rte_ipv6_tuple))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_ipv6_tuple>())).src_addr as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_ipv6_tuple),
-            "::",
-            stringify!(src_addr)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_ipv6_tuple>())).dst_addr as *const _
-                as usize
-        },
-        16usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_ipv6_tuple),
-            "::",
-            stringify!(dst_addr)
-        )
-    );
+    fn test_field_src_addr() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_ipv6_tuple>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).src_addr) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_ipv6_tuple),
+                "::",
+                stringify!(src_addr)
+            )
+        );
+    }
+    test_field_src_addr();
+    fn test_field_dst_addr() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_ipv6_tuple>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).dst_addr) as usize - ptr as usize
+            },
+            16usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_ipv6_tuple),
+                "::",
+                stringify!(dst_addr)
+            )
+        );
+    }
+    test_field_dst_addr();
 }
 impl Default for rte_ipv6_tuple {
     fn default() -> Self {
@@ -322,30 +374,42 @@
         16usize,
         concat!("Alignment of ", stringify!(rte_thash_tuple))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_thash_tuple>())).v4 as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_thash_tuple),
-            "::",
-            stringify!(v4)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_thash_tuple>())).v6 as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_thash_tuple),
-            "::",
-            stringify!(v6)
-        )
-    );
+    fn test_field_v4() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_thash_tuple>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).v4) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_thash_tuple),
+                "::",
+                stringify!(v4)
+            )
+        );
+    }
+    test_field_v4();
+    fn test_field_v6() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_thash_tuple>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).v6) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_thash_tuple),
+                "::",
+                stringify!(v6)
+            )
+        );
+    }
+    test_field_v6();
 }
 impl Default for rte_thash_tuple {
     fn default() -> Self {
diff --git a/tests/expectations/tests/16-byte-alignment_1_0.rs b/tests/expectations/tests/16-byte-alignment_1_0.rs
index 1df6778..b798697 100644
--- a/tests/expectations/tests/16-byte-alignment_1_0.rs
+++ b/tests/expectations/tests/16-byte-alignment_1_0.rs
@@ -87,34 +87,44 @@
             stringify!(rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1)
         )
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1>(
-            )))
-            .dport as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1),
-            "::",
-            stringify!(dport)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1>(
-            )))
-            .sport as *const _ as usize
-        },
-        2usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1),
-            "::",
-            stringify!(sport)
-        )
-    );
+    fn test_field_dport() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).dport) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1),
+                "::",
+                stringify!(dport)
+            )
+        );
+    }
+    test_field_dport();
+    fn test_field_sport() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).sport) as usize - ptr as usize
+            },
+            2usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1),
+                "::",
+                stringify!(sport)
+            )
+        );
+    }
+    test_field_sport();
 }
 impl Clone for rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1 {
     fn clone(&self) -> Self {
@@ -133,19 +143,25 @@
         4usize,
         concat!("Alignment of ", stringify!(rte_ipv4_tuple__bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_ipv4_tuple__bindgen_ty_1>())).sctp_tag
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_ipv4_tuple__bindgen_ty_1),
-            "::",
-            stringify!(sctp_tag)
-        )
-    );
+    fn test_field_sctp_tag() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    rte_ipv4_tuple__bindgen_ty_1,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).sctp_tag) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_ipv4_tuple__bindgen_ty_1),
+                "::",
+                stringify!(sctp_tag)
+            )
+        );
+    }
+    test_field_sctp_tag();
 }
 impl Clone for rte_ipv4_tuple__bindgen_ty_1 {
     fn clone(&self) -> Self {
@@ -164,32 +180,42 @@
         4usize,
         concat!("Alignment of ", stringify!(rte_ipv4_tuple))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_ipv4_tuple>())).src_addr as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_ipv4_tuple),
-            "::",
-            stringify!(src_addr)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_ipv4_tuple>())).dst_addr as *const _
-                as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_ipv4_tuple),
-            "::",
-            stringify!(dst_addr)
-        )
-    );
+    fn test_field_src_addr() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_ipv4_tuple>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).src_addr) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_ipv4_tuple),
+                "::",
+                stringify!(src_addr)
+            )
+        );
+    }
+    test_field_src_addr();
+    fn test_field_dst_addr() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_ipv4_tuple>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).dst_addr) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_ipv4_tuple),
+                "::",
+                stringify!(dst_addr)
+            )
+        );
+    }
+    test_field_dst_addr();
 }
 impl Clone for rte_ipv4_tuple {
     fn clone(&self) -> Self {
@@ -235,34 +261,44 @@
             stringify!(rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1)
         )
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1>(
-            )))
-            .dport as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1),
-            "::",
-            stringify!(dport)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1>(
-            )))
-            .sport as *const _ as usize
-        },
-        2usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1),
-            "::",
-            stringify!(sport)
-        )
-    );
+    fn test_field_dport() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).dport) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1),
+                "::",
+                stringify!(dport)
+            )
+        );
+    }
+    test_field_dport();
+    fn test_field_sport() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).sport) as usize - ptr as usize
+            },
+            2usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1),
+                "::",
+                stringify!(sport)
+            )
+        );
+    }
+    test_field_sport();
 }
 impl Clone for rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1 {
     fn clone(&self) -> Self {
@@ -281,19 +317,25 @@
         4usize,
         concat!("Alignment of ", stringify!(rte_ipv6_tuple__bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_ipv6_tuple__bindgen_ty_1>())).sctp_tag
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_ipv6_tuple__bindgen_ty_1),
-            "::",
-            stringify!(sctp_tag)
-        )
-    );
+    fn test_field_sctp_tag() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    rte_ipv6_tuple__bindgen_ty_1,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).sctp_tag) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_ipv6_tuple__bindgen_ty_1),
+                "::",
+                stringify!(sctp_tag)
+            )
+        );
+    }
+    test_field_sctp_tag();
 }
 impl Clone for rte_ipv6_tuple__bindgen_ty_1 {
     fn clone(&self) -> Self {
@@ -312,32 +354,42 @@
         4usize,
         concat!("Alignment of ", stringify!(rte_ipv6_tuple))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_ipv6_tuple>())).src_addr as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_ipv6_tuple),
-            "::",
-            stringify!(src_addr)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_ipv6_tuple>())).dst_addr as *const _
-                as usize
-        },
-        16usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_ipv6_tuple),
-            "::",
-            stringify!(dst_addr)
-        )
-    );
+    fn test_field_src_addr() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_ipv6_tuple>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).src_addr) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_ipv6_tuple),
+                "::",
+                stringify!(src_addr)
+            )
+        );
+    }
+    test_field_src_addr();
+    fn test_field_dst_addr() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_ipv6_tuple>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).dst_addr) as usize - ptr as usize
+            },
+            16usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_ipv6_tuple),
+                "::",
+                stringify!(dst_addr)
+            )
+        );
+    }
+    test_field_dst_addr();
 }
 impl Clone for rte_ipv6_tuple {
     fn clone(&self) -> Self {
@@ -358,30 +410,42 @@
         48usize,
         concat!("Size of: ", stringify!(rte_thash_tuple))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_thash_tuple>())).v4 as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_thash_tuple),
-            "::",
-            stringify!(v4)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_thash_tuple>())).v6 as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_thash_tuple),
-            "::",
-            stringify!(v6)
-        )
-    );
+    fn test_field_v4() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_thash_tuple>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).v4) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_thash_tuple),
+                "::",
+                stringify!(v4)
+            )
+        );
+    }
+    test_field_v4();
+    fn test_field_v6() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_thash_tuple>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).v6) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_thash_tuple),
+                "::",
+                stringify!(v6)
+            )
+        );
+    }
+    test_field_v6();
 }
 impl Clone for rte_thash_tuple {
     fn clone(&self) -> Self {
diff --git a/tests/expectations/tests/accessors.rs b/tests/expectations/tests/accessors.rs
index 9977baa..843b792 100644
--- a/tests/expectations/tests/accessors.rs
+++ b/tests/expectations/tests/accessors.rs
@@ -28,58 +28,77 @@
         4usize,
         concat!("Alignment of ", stringify!(SomeAccessors))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<SomeAccessors>())).mNoAccessor as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(SomeAccessors),
-            "::",
-            stringify!(mNoAccessor)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<SomeAccessors>())).mBothAccessors as *const _
-                as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(SomeAccessors),
-            "::",
-            stringify!(mBothAccessors)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<SomeAccessors>())).mUnsafeAccessors
-                as *const _ as usize
-        },
-        8usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(SomeAccessors),
-            "::",
-            stringify!(mUnsafeAccessors)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<SomeAccessors>())).mImmutableAccessor
-                as *const _ as usize
-        },
-        12usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(SomeAccessors),
-            "::",
-            stringify!(mImmutableAccessor)
-        )
-    );
+    fn test_field_mNoAccessor() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<SomeAccessors>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mNoAccessor) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(SomeAccessors),
+                "::",
+                stringify!(mNoAccessor)
+            )
+        );
+    }
+    test_field_mNoAccessor();
+    fn test_field_mBothAccessors() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<SomeAccessors>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mBothAccessors) as usize -
+                    ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(SomeAccessors),
+                "::",
+                stringify!(mBothAccessors)
+            )
+        );
+    }
+    test_field_mBothAccessors();
+    fn test_field_mUnsafeAccessors() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<SomeAccessors>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mUnsafeAccessors) as usize -
+                    ptr as usize
+            },
+            8usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(SomeAccessors),
+                "::",
+                stringify!(mUnsafeAccessors)
+            )
+        );
+    }
+    test_field_mUnsafeAccessors();
+    fn test_field_mImmutableAccessor() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<SomeAccessors>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mImmutableAccessor) as usize -
+                    ptr as usize
+            },
+            12usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(SomeAccessors),
+                "::",
+                stringify!(mImmutableAccessor)
+            )
+        );
+    }
+    test_field_mImmutableAccessor();
 }
 impl SomeAccessors {
     #[inline]
@@ -124,32 +143,42 @@
         4usize,
         concat!("Alignment of ", stringify!(AllAccessors))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<AllAccessors>())).mBothAccessors as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(AllAccessors),
-            "::",
-            stringify!(mBothAccessors)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<AllAccessors>())).mAlsoBothAccessors
-                as *const _ as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(AllAccessors),
-            "::",
-            stringify!(mAlsoBothAccessors)
-        )
-    );
+    fn test_field_mBothAccessors() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<AllAccessors>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mBothAccessors) as usize -
+                    ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(AllAccessors),
+                "::",
+                stringify!(mBothAccessors)
+            )
+        );
+    }
+    test_field_mBothAccessors();
+    fn test_field_mAlsoBothAccessors() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<AllAccessors>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mAlsoBothAccessors) as usize -
+                    ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(AllAccessors),
+                "::",
+                stringify!(mAlsoBothAccessors)
+            )
+        );
+    }
+    test_field_mAlsoBothAccessors();
 }
 impl AllAccessors {
     #[inline]
@@ -188,32 +217,44 @@
         4usize,
         concat!("Alignment of ", stringify!(AllUnsafeAccessors))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<AllUnsafeAccessors>())).mBothAccessors
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(AllUnsafeAccessors),
-            "::",
-            stringify!(mBothAccessors)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<AllUnsafeAccessors>())).mAlsoBothAccessors
-                as *const _ as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(AllUnsafeAccessors),
-            "::",
-            stringify!(mAlsoBothAccessors)
-        )
-    );
+    fn test_field_mBothAccessors() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<AllUnsafeAccessors>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mBothAccessors) as usize -
+                    ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(AllUnsafeAccessors),
+                "::",
+                stringify!(mBothAccessors)
+            )
+        );
+    }
+    test_field_mBothAccessors();
+    fn test_field_mAlsoBothAccessors() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<AllUnsafeAccessors>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mAlsoBothAccessors) as usize -
+                    ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(AllUnsafeAccessors),
+                "::",
+                stringify!(mAlsoBothAccessors)
+            )
+        );
+    }
+    test_field_mAlsoBothAccessors();
 }
 impl AllUnsafeAccessors {
     #[inline]
@@ -261,58 +302,82 @@
         4usize,
         concat!("Alignment of ", stringify!(ContradictAccessors))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ContradictAccessors>())).mBothAccessors
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(ContradictAccessors),
-            "::",
-            stringify!(mBothAccessors)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ContradictAccessors>())).mNoAccessors
-                as *const _ as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(ContradictAccessors),
-            "::",
-            stringify!(mNoAccessors)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ContradictAccessors>())).mUnsafeAccessors
-                as *const _ as usize
-        },
-        8usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(ContradictAccessors),
-            "::",
-            stringify!(mUnsafeAccessors)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ContradictAccessors>())).mImmutableAccessor
-                as *const _ as usize
-        },
-        12usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(ContradictAccessors),
-            "::",
-            stringify!(mImmutableAccessor)
-        )
-    );
+    fn test_field_mBothAccessors() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<ContradictAccessors>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mBothAccessors) as usize -
+                    ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(ContradictAccessors),
+                "::",
+                stringify!(mBothAccessors)
+            )
+        );
+    }
+    test_field_mBothAccessors();
+    fn test_field_mNoAccessors() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<ContradictAccessors>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mNoAccessors) as usize -
+                    ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(ContradictAccessors),
+                "::",
+                stringify!(mNoAccessors)
+            )
+        );
+    }
+    test_field_mNoAccessors();
+    fn test_field_mUnsafeAccessors() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<ContradictAccessors>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mUnsafeAccessors) as usize -
+                    ptr as usize
+            },
+            8usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(ContradictAccessors),
+                "::",
+                stringify!(mUnsafeAccessors)
+            )
+        );
+    }
+    test_field_mUnsafeAccessors();
+    fn test_field_mImmutableAccessor() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<ContradictAccessors>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mImmutableAccessor) as usize -
+                    ptr as usize
+            },
+            12usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(ContradictAccessors),
+                "::",
+                stringify!(mImmutableAccessor)
+            )
+        );
+    }
+    test_field_mImmutableAccessor();
 }
 impl ContradictAccessors {
     #[inline]
@@ -356,18 +421,23 @@
         4usize,
         concat!("Alignment of ", stringify!(Replaced))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<Replaced>())).mAccessor as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(Replaced),
-            "::",
-            stringify!(mAccessor)
-        )
-    );
+    fn test_field_mAccessor() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Replaced>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mAccessor) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Replaced),
+                "::",
+                stringify!(mAccessor)
+            )
+        );
+    }
+    test_field_mAccessor();
 }
 impl Replaced {
     #[inline]
@@ -397,18 +467,23 @@
         4usize,
         concat!("Alignment of ", stringify!(Wrapper))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<Wrapper>())).mReplaced as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(Wrapper),
-            "::",
-            stringify!(mReplaced)
-        )
-    );
+    fn test_field_mReplaced() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Wrapper>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mReplaced) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Wrapper),
+                "::",
+                stringify!(mReplaced)
+            )
+        );
+    }
+    test_field_mReplaced();
 }
 impl Wrapper {
     #[inline]
diff --git a/tests/expectations/tests/allowlist-file.rs b/tests/expectations/tests/allowlist-file.rs
new file mode 100644
index 0000000..e737fe8
--- /dev/null
+++ b/tests/expectations/tests/allowlist-file.rs
@@ -0,0 +1,171 @@
+#![allow(
+    dead_code,
+    non_snake_case,
+    non_camel_case_types,
+    non_upper_case_globals
+)]
+
+pub const SOME_DEFUN: u32 = 123;
+extern "C" {
+    #[link_name = "\u{1}_Z12SomeFunctionv"]
+    pub fn SomeFunction();
+}
+extern "C" {
+    pub static mut someVar: ::std::os::raw::c_int;
+}
+#[repr(C)]
+#[derive(Debug, Default, Copy, Clone)]
+pub struct someClass {
+    pub _address: u8,
+}
+#[test]
+fn bindgen_test_layout_someClass() {
+    assert_eq!(
+        ::std::mem::size_of::<someClass>(),
+        1usize,
+        concat!("Size of: ", stringify!(someClass))
+    );
+    assert_eq!(
+        ::std::mem::align_of::<someClass>(),
+        1usize,
+        concat!("Alignment of ", stringify!(someClass))
+    );
+}
+extern "C" {
+    #[link_name = "\u{1}_ZN9someClass16somePublicMethodEi"]
+    pub fn someClass_somePublicMethod(
+        this: *mut someClass,
+        foo: ::std::os::raw::c_int,
+    );
+}
+impl someClass {
+    #[inline]
+    pub unsafe fn somePublicMethod(&mut self, foo: ::std::os::raw::c_int) {
+        someClass_somePublicMethod(self, foo)
+    }
+}
+extern "C" {
+    pub fn ExternFunction();
+}
+extern "C" {
+    #[link_name = "\u{1}_ZN3foo18NamespacedFunctionEv"]
+    pub fn foo_NamespacedFunction();
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct StructWithAllowlistedDefinition {
+    pub other: *mut StructWithAllowlistedFwdDecl,
+}
+#[test]
+fn bindgen_test_layout_StructWithAllowlistedDefinition() {
+    assert_eq!(
+        ::std::mem::size_of::<StructWithAllowlistedDefinition>(),
+        8usize,
+        concat!("Size of: ", stringify!(StructWithAllowlistedDefinition))
+    );
+    assert_eq!(
+        ::std::mem::align_of::<StructWithAllowlistedDefinition>(),
+        8usize,
+        concat!("Alignment of ", stringify!(StructWithAllowlistedDefinition))
+    );
+    fn test_field_other() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    StructWithAllowlistedDefinition,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).other) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(StructWithAllowlistedDefinition),
+                "::",
+                stringify!(other)
+            )
+        );
+    }
+    test_field_other();
+}
+impl Default for StructWithAllowlistedDefinition {
+    fn default() -> Self {
+        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
+        unsafe {
+            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
+            s.assume_init()
+        }
+    }
+}
+#[repr(C)]
+#[derive(Debug, Default, Copy, Clone)]
+pub struct StructWithAllowlistedFwdDecl {
+    pub b: ::std::os::raw::c_int,
+}
+#[test]
+fn bindgen_test_layout_StructWithAllowlistedFwdDecl() {
+    assert_eq!(
+        ::std::mem::size_of::<StructWithAllowlistedFwdDecl>(),
+        4usize,
+        concat!("Size of: ", stringify!(StructWithAllowlistedFwdDecl))
+    );
+    assert_eq!(
+        ::std::mem::align_of::<StructWithAllowlistedFwdDecl>(),
+        4usize,
+        concat!("Alignment of ", stringify!(StructWithAllowlistedFwdDecl))
+    );
+    fn test_field_b() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    StructWithAllowlistedFwdDecl,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(StructWithAllowlistedFwdDecl),
+                "::",
+                stringify!(b)
+            )
+        );
+    }
+    test_field_b();
+}
+#[repr(C)]
+#[derive(Debug, Default, Copy, Clone)]
+pub struct AllowlistMe {
+    pub foo: ::std::os::raw::c_int,
+}
+#[test]
+fn bindgen_test_layout_AllowlistMe() {
+    assert_eq!(
+        ::std::mem::size_of::<AllowlistMe>(),
+        4usize,
+        concat!("Size of: ", stringify!(AllowlistMe))
+    );
+    assert_eq!(
+        ::std::mem::align_of::<AllowlistMe>(),
+        4usize,
+        concat!("Alignment of ", stringify!(AllowlistMe))
+    );
+    fn test_field_foo() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<AllowlistMe>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).foo) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(AllowlistMe),
+                "::",
+                stringify!(foo)
+            )
+        );
+    }
+    test_field_foo();
+}
diff --git a/tests/expectations/tests/allowlist-namespaces.rs b/tests/expectations/tests/allowlist-namespaces.rs
index 4236f63..ac868c6 100644
--- a/tests/expectations/tests/allowlist-namespaces.rs
+++ b/tests/expectations/tests/allowlist-namespaces.rs
@@ -51,18 +51,24 @@
                 1usize,
                 concat!("Alignment of ", stringify!(Test))
             );
-            assert_eq!(
-                unsafe {
-                    &(*(::std::ptr::null::<Test>())).helper as *const _ as usize
-                },
-                0usize,
-                concat!(
-                    "Offset of field: ",
-                    stringify!(Test),
-                    "::",
-                    stringify!(helper)
-                )
-            );
+            fn test_field_helper() {
+                assert_eq!(
+                    unsafe {
+                        let uninit = ::std::mem::MaybeUninit::<Test>::uninit();
+                        let ptr = uninit.as_ptr();
+                        ::std::ptr::addr_of!((*ptr).helper) as usize -
+                            ptr as usize
+                    },
+                    0usize,
+                    concat!(
+                        "Offset of field: ",
+                        stringify!(Test),
+                        "::",
+                        stringify!(helper)
+                    )
+                );
+            }
+            test_field_helper();
         }
     }
 }
diff --git a/tests/expectations/tests/allowlisted-item-references-no-hash.rs b/tests/expectations/tests/allowlisted-item-references-no-hash.rs
index bc3fde1..8270163 100644
--- a/tests/expectations/tests/allowlisted-item-references-no-hash.rs
+++ b/tests/expectations/tests/allowlisted-item-references-no-hash.rs
@@ -40,16 +40,21 @@
         1usize,
         concat!("Alignment of ", stringify!(AllowlistMe))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<AllowlistMe>())).a as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(AllowlistMe),
-            "::",
-            stringify!(a)
-        )
-    );
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<AllowlistMe>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(AllowlistMe),
+                "::",
+                stringify!(a)
+            )
+        );
+    }
+    test_field_a();
 }
diff --git a/tests/expectations/tests/allowlisted-item-references-no-partialeq.rs b/tests/expectations/tests/allowlisted-item-references-no-partialeq.rs
index f26f692..ec4e0c9 100644
--- a/tests/expectations/tests/allowlisted-item-references-no-partialeq.rs
+++ b/tests/expectations/tests/allowlisted-item-references-no-partialeq.rs
@@ -40,16 +40,21 @@
         1usize,
         concat!("Alignment of ", stringify!(AllowlistMe))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<AllowlistMe>())).a as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(AllowlistMe),
-            "::",
-            stringify!(a)
-        )
-    );
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<AllowlistMe>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(AllowlistMe),
+                "::",
+                stringify!(a)
+            )
+        );
+    }
+    test_field_a();
 }
diff --git a/tests/expectations/tests/allowlisted_item_references_no_copy.rs b/tests/expectations/tests/allowlisted_item_references_no_copy.rs
index a5cb17b..9f6685e 100644
--- a/tests/expectations/tests/allowlisted_item_references_no_copy.rs
+++ b/tests/expectations/tests/allowlisted_item_references_no_copy.rs
@@ -40,16 +40,21 @@
         1usize,
         concat!("Alignment of ", stringify!(AllowlistMe))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<AllowlistMe>())).a as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(AllowlistMe),
-            "::",
-            stringify!(a)
-        )
-    );
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<AllowlistMe>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(AllowlistMe),
+                "::",
+                stringify!(a)
+            )
+        );
+    }
+    test_field_a();
 }
diff --git a/tests/expectations/tests/annotation_hide.rs b/tests/expectations/tests/annotation_hide.rs
index 38435d0..a899195 100644
--- a/tests/expectations/tests/annotation_hide.rs
+++ b/tests/expectations/tests/annotation_hide.rs
@@ -42,16 +42,21 @@
         4usize,
         concat!("Alignment of ", stringify!(NotAnnotated))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<NotAnnotated>())).f as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(NotAnnotated),
-            "::",
-            stringify!(f)
-        )
-    );
+    fn test_field_f() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<NotAnnotated>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).f) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(NotAnnotated),
+                "::",
+                stringify!(f)
+            )
+        );
+    }
+    test_field_f();
 }
diff --git a/tests/expectations/tests/anon-fields-prefix.rs b/tests/expectations/tests/anon-fields-prefix.rs
index edd551d..a77bc8a 100644
--- a/tests/expectations/tests/anon-fields-prefix.rs
+++ b/tests/expectations/tests/anon-fields-prefix.rs
@@ -31,45 +31,60 @@
         1usize,
         concat!("Alignment of ", stringify!(color__bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<color__bindgen_ty_1>())).r as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(color__bindgen_ty_1),
-            "::",
-            stringify!(r)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<color__bindgen_ty_1>())).g as *const _
-                as usize
-        },
-        1usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(color__bindgen_ty_1),
-            "::",
-            stringify!(g)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<color__bindgen_ty_1>())).b as *const _
-                as usize
-        },
-        2usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(color__bindgen_ty_1),
-            "::",
-            stringify!(b)
-        )
-    );
+    fn test_field_r() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<color__bindgen_ty_1>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).r) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(color__bindgen_ty_1),
+                "::",
+                stringify!(r)
+            )
+        );
+    }
+    test_field_r();
+    fn test_field_g() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<color__bindgen_ty_1>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).g) as usize - ptr as usize
+            },
+            1usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(color__bindgen_ty_1),
+                "::",
+                stringify!(g)
+            )
+        );
+    }
+    test_field_g();
+    fn test_field_b() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<color__bindgen_ty_1>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize
+            },
+            2usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(color__bindgen_ty_1),
+                "::",
+                stringify!(b)
+            )
+        );
+    }
+    test_field_b();
 }
 #[repr(C)]
 #[derive(Debug, Default, Copy, Clone)]
@@ -90,45 +105,60 @@
         1usize,
         concat!("Alignment of ", stringify!(color__bindgen_ty_2))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<color__bindgen_ty_2>())).y as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(color__bindgen_ty_2),
-            "::",
-            stringify!(y)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<color__bindgen_ty_2>())).u as *const _
-                as usize
-        },
-        1usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(color__bindgen_ty_2),
-            "::",
-            stringify!(u)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<color__bindgen_ty_2>())).v as *const _
-                as usize
-        },
-        2usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(color__bindgen_ty_2),
-            "::",
-            stringify!(v)
-        )
-    );
+    fn test_field_y() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<color__bindgen_ty_2>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).y) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(color__bindgen_ty_2),
+                "::",
+                stringify!(y)
+            )
+        );
+    }
+    test_field_y();
+    fn test_field_u() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<color__bindgen_ty_2>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).u) as usize - ptr as usize
+            },
+            1usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(color__bindgen_ty_2),
+                "::",
+                stringify!(u)
+            )
+        );
+    }
+    test_field_u();
+    fn test_field_v() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<color__bindgen_ty_2>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).v) as usize - ptr as usize
+            },
+            2usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(color__bindgen_ty_2),
+                "::",
+                stringify!(v)
+            )
+        );
+    }
+    test_field_v();
 }
 #[test]
 fn bindgen_test_layout_color() {
@@ -142,11 +172,23 @@
         1usize,
         concat!("Alignment of ", stringify!(color))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<color>())).v3 as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(color), "::", stringify!(v3))
-    );
+    fn test_field_v3() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<color>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).v3) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(color),
+                "::",
+                stringify!(v3)
+            )
+        );
+    }
+    test_field_v3();
 }
 impl Default for color {
     fn default() -> Self {
diff --git a/tests/expectations/tests/anon_enum.rs b/tests/expectations/tests/anon_enum.rs
index 8cae632..06e98e7 100644
--- a/tests/expectations/tests/anon_enum.rs
+++ b/tests/expectations/tests/anon_enum.rs
@@ -29,16 +29,40 @@
         4usize,
         concat!("Alignment of ", stringify!(Test))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Test>())).foo as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(Test), "::", stringify!(foo))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Test>())).bar as *const _ as usize },
-        4usize,
-        concat!("Offset of field: ", stringify!(Test), "::", stringify!(bar))
-    );
+    fn test_field_foo() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Test>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).foo) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Test),
+                "::",
+                stringify!(foo)
+            )
+        );
+    }
+    test_field_foo();
+    fn test_field_bar() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Test>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Test),
+                "::",
+                stringify!(bar)
+            )
+        );
+    }
+    test_field_bar();
 }
 #[repr(u32)]
 #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
diff --git a/tests/expectations/tests/anon_struct_in_union.rs b/tests/expectations/tests/anon_struct_in_union.rs
index 1a40401..49caa13 100644
--- a/tests/expectations/tests/anon_struct_in_union.rs
+++ b/tests/expectations/tests/anon_struct_in_union.rs
@@ -32,19 +32,24 @@
         4usize,
         concat!("Alignment of ", stringify!(s__bindgen_ty_1_inner))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<s__bindgen_ty_1_inner>())).b as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(s__bindgen_ty_1_inner),
-            "::",
-            stringify!(b)
-        )
-    );
+    fn test_field_b() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<s__bindgen_ty_1_inner>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(s__bindgen_ty_1_inner),
+                "::",
+                stringify!(b)
+            )
+        );
+    }
+    test_field_b();
 }
 #[test]
 fn bindgen_test_layout_s__bindgen_ty_1() {
@@ -58,19 +63,24 @@
         4usize,
         concat!("Alignment of ", stringify!(s__bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<s__bindgen_ty_1>())).field as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(s__bindgen_ty_1),
-            "::",
-            stringify!(field)
-        )
-    );
+    fn test_field_field() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<s__bindgen_ty_1>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).field) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(s__bindgen_ty_1),
+                "::",
+                stringify!(field)
+            )
+        );
+    }
+    test_field_field();
 }
 impl Default for s__bindgen_ty_1 {
     fn default() -> Self {
@@ -93,11 +103,18 @@
         4usize,
         concat!("Alignment of ", stringify!(s))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<s>())).u as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(s), "::", stringify!(u))
-    );
+    fn test_field_u() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<s>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).u) as usize - ptr as usize
+            },
+            0usize,
+            concat!("Offset of field: ", stringify!(s), "::", stringify!(u))
+        );
+    }
+    test_field_u();
 }
 impl Default for s {
     fn default() -> Self {
diff --git a/tests/expectations/tests/anon_struct_in_union_1_0.rs b/tests/expectations/tests/anon_struct_in_union_1_0.rs
index 021f414..492ed6c 100644
--- a/tests/expectations/tests/anon_struct_in_union_1_0.rs
+++ b/tests/expectations/tests/anon_struct_in_union_1_0.rs
@@ -76,19 +76,24 @@
         4usize,
         concat!("Alignment of ", stringify!(s__bindgen_ty_1_inner))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<s__bindgen_ty_1_inner>())).b as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(s__bindgen_ty_1_inner),
-            "::",
-            stringify!(b)
-        )
-    );
+    fn test_field_b() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<s__bindgen_ty_1_inner>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(s__bindgen_ty_1_inner),
+                "::",
+                stringify!(b)
+            )
+        );
+    }
+    test_field_b();
 }
 impl Clone for s__bindgen_ty_1_inner {
     fn clone(&self) -> Self {
@@ -107,19 +112,24 @@
         4usize,
         concat!("Alignment of ", stringify!(s__bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<s__bindgen_ty_1>())).field as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(s__bindgen_ty_1),
-            "::",
-            stringify!(field)
-        )
-    );
+    fn test_field_field() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<s__bindgen_ty_1>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).field) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(s__bindgen_ty_1),
+                "::",
+                stringify!(field)
+            )
+        );
+    }
+    test_field_field();
 }
 impl Clone for s__bindgen_ty_1 {
     fn clone(&self) -> Self {
@@ -138,11 +148,18 @@
         4usize,
         concat!("Alignment of ", stringify!(s))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<s>())).u as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(s), "::", stringify!(u))
-    );
+    fn test_field_u() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<s>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).u) as usize - ptr as usize
+            },
+            0usize,
+            concat!("Offset of field: ", stringify!(s), "::", stringify!(u))
+        );
+    }
+    test_field_u();
 }
 impl Clone for s {
     fn clone(&self) -> Self {
diff --git a/tests/expectations/tests/array-of-zero-sized-types.rs b/tests/expectations/tests/array-of-zero-sized-types.rs
index 0c00cea..875aef1 100644
--- a/tests/expectations/tests/array-of-zero-sized-types.rs
+++ b/tests/expectations/tests/array-of-zero-sized-types.rs
@@ -43,17 +43,22 @@
         1usize,
         concat!("Alignment of ", stringify!(HasArrayOfEmpty))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<HasArrayOfEmpty>())).empties as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(HasArrayOfEmpty),
-            "::",
-            stringify!(empties)
-        )
-    );
+    fn test_field_empties() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<HasArrayOfEmpty>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).empties) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(HasArrayOfEmpty),
+                "::",
+                stringify!(empties)
+            )
+        );
+    }
+    test_field_empties();
 }
diff --git a/tests/expectations/tests/bindgen-union-inside-namespace.rs b/tests/expectations/tests/bindgen-union-inside-namespace.rs
index 6083313..04cdf0b 100644
--- a/tests/expectations/tests/bindgen-union-inside-namespace.rs
+++ b/tests/expectations/tests/bindgen-union-inside-namespace.rs
@@ -77,30 +77,40 @@
                 4usize,
                 concat!("Alignment of ", stringify!(Bar))
             );
-            assert_eq!(
-                unsafe {
-                    &(*(::std::ptr::null::<Bar>())).foo as *const _ as usize
-                },
-                0usize,
-                concat!(
-                    "Offset of field: ",
-                    stringify!(Bar),
-                    "::",
-                    stringify!(foo)
-                )
-            );
-            assert_eq!(
-                unsafe {
-                    &(*(::std::ptr::null::<Bar>())).bar as *const _ as usize
-                },
-                0usize,
-                concat!(
-                    "Offset of field: ",
-                    stringify!(Bar),
-                    "::",
-                    stringify!(bar)
-                )
-            );
+            fn test_field_foo() {
+                assert_eq!(
+                    unsafe {
+                        let uninit = ::std::mem::MaybeUninit::<Bar>::uninit();
+                        let ptr = uninit.as_ptr();
+                        ::std::ptr::addr_of!((*ptr).foo) as usize - ptr as usize
+                    },
+                    0usize,
+                    concat!(
+                        "Offset of field: ",
+                        stringify!(Bar),
+                        "::",
+                        stringify!(foo)
+                    )
+                );
+            }
+            test_field_foo();
+            fn test_field_bar() {
+                assert_eq!(
+                    unsafe {
+                        let uninit = ::std::mem::MaybeUninit::<Bar>::uninit();
+                        let ptr = uninit.as_ptr();
+                        ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize
+                    },
+                    0usize,
+                    concat!(
+                        "Offset of field: ",
+                        stringify!(Bar),
+                        "::",
+                        stringify!(bar)
+                    )
+                );
+            }
+            test_field_bar();
         }
         impl Clone for Bar {
             fn clone(&self) -> Self {
diff --git a/tests/expectations/tests/bitfield-linux-32.rs b/tests/expectations/tests/bitfield-linux-32.rs
index 15c35ce..dd41d92 100644
--- a/tests/expectations/tests/bitfield-linux-32.rs
+++ b/tests/expectations/tests/bitfield-linux-32.rs
@@ -110,11 +110,23 @@
         4usize,
         concat!("Alignment of ", stringify!(Test))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Test>())).foo as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(Test), "::", stringify!(foo))
-    );
+    fn test_field_foo() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Test>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).foo) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Test),
+                "::",
+                stringify!(foo)
+            )
+        );
+    }
+    test_field_foo();
 }
 impl Test {
     #[inline]
diff --git a/tests/expectations/tests/bitfield_align.rs b/tests/expectations/tests/bitfield_align.rs
index 509981a..1b95133 100644
--- a/tests/expectations/tests/bitfield_align.rs
+++ b/tests/expectations/tests/bitfield_align.rs
@@ -112,16 +112,30 @@
         4usize,
         concat!("Alignment of ", stringify!(A))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<A>())).x as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(A), "::", stringify!(x))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<A>())).y as *const _ as usize },
-        3usize,
-        concat!("Offset of field: ", stringify!(A), "::", stringify!(y))
-    );
+    fn test_field_x() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<A>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).x) as usize - ptr as usize
+            },
+            0usize,
+            concat!("Offset of field: ", stringify!(A), "::", stringify!(x))
+        );
+    }
+    test_field_x();
+    fn test_field_y() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<A>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).y) as usize - ptr as usize
+            },
+            3usize,
+            concat!("Offset of field: ", stringify!(A), "::", stringify!(y))
+        );
+    }
+    test_field_y();
 }
 impl A {
     #[inline]
@@ -397,16 +411,30 @@
         4usize,
         concat!("Alignment of ", stringify!(C))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<C>())).x as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(C), "::", stringify!(x))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<C>())).baz as *const _ as usize },
-        4usize,
-        concat!("Offset of field: ", stringify!(C), "::", stringify!(baz))
-    );
+    fn test_field_x() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<C>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).x) as usize - ptr as usize
+            },
+            0usize,
+            concat!("Offset of field: ", stringify!(C), "::", stringify!(x))
+        );
+    }
+    test_field_x();
+    fn test_field_baz() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<C>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).baz) as usize - ptr as usize
+            },
+            4usize,
+            concat!("Offset of field: ", stringify!(C), "::", stringify!(baz))
+        );
+    }
+    test_field_baz();
 }
 impl C {
     #[inline]
@@ -694,16 +722,23 @@
         2usize,
         concat!("Alignment of ", stringify!(Date3))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Date3>())).byte as *const _ as usize },
-        3usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(Date3),
-            "::",
-            stringify!(byte)
-        )
-    );
+    fn test_field_byte() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Date3>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).byte) as usize - ptr as usize
+            },
+            3usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Date3),
+                "::",
+                stringify!(byte)
+            )
+        );
+    }
+    test_field_byte();
 }
 impl Date3 {
     #[inline]
diff --git a/tests/expectations/tests/bitfield_align_2.rs b/tests/expectations/tests/bitfield_align_2.rs
index 1a1f7dd..aa11f80 100644
--- a/tests/expectations/tests/bitfield_align_2.rs
+++ b/tests/expectations/tests/bitfield_align_2.rs
@@ -4,6 +4,7 @@
     non_camel_case_types,
     non_upper_case_globals
 )]
+#![cfg(not(target_os = "windows"))]
 
 #[repr(C)]
 #[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
diff --git a/tests/expectations/tests/blocklist-and-impl-debug.rs b/tests/expectations/tests/blocklist-and-impl-debug.rs
index ba39fb1..055cca8 100644
--- a/tests/expectations/tests/blocklist-and-impl-debug.rs
+++ b/tests/expectations/tests/blocklist-and-impl-debug.rs
@@ -24,19 +24,25 @@
         1usize,
         concat!("Alignment of ", stringify!(ShouldManuallyImplDebug))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ShouldManuallyImplDebug>())).a as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(ShouldManuallyImplDebug),
-            "::",
-            stringify!(a)
-        )
-    );
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<ShouldManuallyImplDebug>::uninit(
+                    );
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(ShouldManuallyImplDebug),
+                "::",
+                stringify!(a)
+            )
+        );
+    }
+    test_field_a();
 }
 impl Default for ShouldManuallyImplDebug {
     fn default() -> Self {
diff --git a/tests/expectations/tests/blocklist-file.rs b/tests/expectations/tests/blocklist-file.rs
new file mode 100644
index 0000000..7843028
--- /dev/null
+++ b/tests/expectations/tests/blocklist-file.rs
@@ -0,0 +1,115 @@
+#![allow(
+    dead_code,
+    non_snake_case,
+    non_camel_case_types,
+    non_upper_case_globals
+)]
+
+#[repr(C)]
+#[derive(Debug, Default, Copy, Clone)]
+pub struct SizedIntegers {
+    pub x: u8,
+    pub y: u16,
+    pub z: u32,
+}
+#[test]
+fn bindgen_test_layout_SizedIntegers() {
+    assert_eq!(
+        ::std::mem::size_of::<SizedIntegers>(),
+        8usize,
+        concat!("Size of: ", stringify!(SizedIntegers))
+    );
+    assert_eq!(
+        ::std::mem::align_of::<SizedIntegers>(),
+        4usize,
+        concat!("Alignment of ", stringify!(SizedIntegers))
+    );
+    fn test_field_x() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<SizedIntegers>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).x) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(SizedIntegers),
+                "::",
+                stringify!(x)
+            )
+        );
+    }
+    test_field_x();
+    fn test_field_y() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<SizedIntegers>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).y) as usize - ptr as usize
+            },
+            2usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(SizedIntegers),
+                "::",
+                stringify!(y)
+            )
+        );
+    }
+    test_field_y();
+    fn test_field_z() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<SizedIntegers>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).z) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(SizedIntegers),
+                "::",
+                stringify!(z)
+            )
+        );
+    }
+    test_field_z();
+}
+#[repr(C)]
+#[derive(Debug, Default, Copy, Clone)]
+pub struct StructWithBlocklistedFwdDecl {
+    pub b: u8,
+}
+#[test]
+fn bindgen_test_layout_StructWithBlocklistedFwdDecl() {
+    assert_eq!(
+        ::std::mem::size_of::<StructWithBlocklistedFwdDecl>(),
+        1usize,
+        concat!("Size of: ", stringify!(StructWithBlocklistedFwdDecl))
+    );
+    assert_eq!(
+        ::std::mem::align_of::<StructWithBlocklistedFwdDecl>(),
+        1usize,
+        concat!("Alignment of ", stringify!(StructWithBlocklistedFwdDecl))
+    );
+    fn test_field_b() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    StructWithBlocklistedFwdDecl,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(StructWithBlocklistedFwdDecl),
+                "::",
+                stringify!(b)
+            )
+        );
+    }
+    test_field_b();
+}
diff --git a/tests/expectations/tests/blocks-signature.rs b/tests/expectations/tests/blocks-signature.rs
index 22136dd..048a0d4 100644
--- a/tests/expectations/tests/blocks-signature.rs
+++ b/tests/expectations/tests/blocks-signature.rs
@@ -47,32 +47,44 @@
         8usize,
         concat!("Alignment of ", stringify!(contains_block_pointers))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<contains_block_pointers>())).val as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(contains_block_pointers),
-            "::",
-            stringify!(val)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<contains_block_pointers>())).ptr_val
-                as *const _ as usize
-        },
-        8usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(contains_block_pointers),
-            "::",
-            stringify!(ptr_val)
-        )
-    );
+    fn test_field_val() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<contains_block_pointers>::uninit(
+                    );
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).val) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(contains_block_pointers),
+                "::",
+                stringify!(val)
+            )
+        );
+    }
+    test_field_val();
+    fn test_field_ptr_val() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<contains_block_pointers>::uninit(
+                    );
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).ptr_val) as usize - ptr as usize
+            },
+            8usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(contains_block_pointers),
+                "::",
+                stringify!(ptr_val)
+            )
+        );
+    }
+    test_field_ptr_val();
 }
 impl Default for contains_block_pointers {
     fn default() -> Self {
diff --git a/tests/expectations/tests/blocks.rs b/tests/expectations/tests/blocks.rs
index b2ae0b2..abeec80 100644
--- a/tests/expectations/tests/blocks.rs
+++ b/tests/expectations/tests/blocks.rs
@@ -46,32 +46,44 @@
         8usize,
         concat!("Alignment of ", stringify!(contains_block_pointers))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<contains_block_pointers>())).val as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(contains_block_pointers),
-            "::",
-            stringify!(val)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<contains_block_pointers>())).ptr_val
-                as *const _ as usize
-        },
-        8usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(contains_block_pointers),
-            "::",
-            stringify!(ptr_val)
-        )
-    );
+    fn test_field_val() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<contains_block_pointers>::uninit(
+                    );
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).val) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(contains_block_pointers),
+                "::",
+                stringify!(val)
+            )
+        );
+    }
+    test_field_val();
+    fn test_field_ptr_val() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<contains_block_pointers>::uninit(
+                    );
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).ptr_val) as usize - ptr as usize
+            },
+            8usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(contains_block_pointers),
+                "::",
+                stringify!(ptr_val)
+            )
+        );
+    }
+    test_field_ptr_val();
 }
 impl Default for contains_block_pointers {
     fn default() -> Self {
diff --git a/tests/expectations/tests/c_naming.rs b/tests/expectations/tests/c_naming.rs
index abcccf1..bc0955f 100644
--- a/tests/expectations/tests/c_naming.rs
+++ b/tests/expectations/tests/c_naming.rs
@@ -22,16 +22,23 @@
         4usize,
         concat!("Alignment of ", stringify!(struct_a))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<struct_a>())).a as *const _ as usize },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(struct_a),
-            "::",
-            stringify!(a)
-        )
-    );
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<struct_a>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(struct_a),
+                "::",
+                stringify!(a)
+            )
+        );
+    }
+    test_field_a();
 }
 pub type a = *const struct_a;
 #[repr(C)]
@@ -52,26 +59,40 @@
         4usize,
         concat!("Alignment of ", stringify!(union_b))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<union_b>())).a as *const _ as usize },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(union_b),
-            "::",
-            stringify!(a)
-        )
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<union_b>())).b as *const _ as usize },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(union_b),
-            "::",
-            stringify!(b)
-        )
-    );
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<union_b>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(union_b),
+                "::",
+                stringify!(a)
+            )
+        );
+    }
+    test_field_a();
+    fn test_field_b() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<union_b>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(union_b),
+                "::",
+                stringify!(b)
+            )
+        );
+    }
+    test_field_b();
 }
 impl Default for union_b {
     fn default() -> Self {
diff --git a/tests/expectations/tests/canonical-types.rs b/tests/expectations/tests/canonical-types.rs
index 80d7fec..effe7fe 100644
--- a/tests/expectations/tests/canonical-types.rs
+++ b/tests/expectations/tests/canonical-types.rs
@@ -176,18 +176,23 @@
         8usize,
         concat!("Alignment of ", stringify!(ClassAInner))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ClassAInner>())).x as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(ClassAInner),
-            "::",
-            stringify!(x)
-        )
-    );
+    fn test_field_x() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<ClassAInner>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).x) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(ClassAInner),
+                "::",
+                stringify!(x)
+            )
+        );
+    }
+    test_field_x();
 }
 impl Default for ClassAInner {
     fn default() -> Self {
@@ -215,18 +220,23 @@
         8usize,
         concat!("Alignment of ", stringify!(ClassCInnerA))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ClassCInnerA>())).member as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(ClassCInnerA),
-            "::",
-            stringify!(member)
-        )
-    );
+    fn test_field_member() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<ClassCInnerA>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).member) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(ClassCInnerA),
+                "::",
+                stringify!(member)
+            )
+        );
+    }
+    test_field_member();
 }
 impl Default for ClassCInnerA {
     fn default() -> Self {
@@ -254,18 +264,23 @@
         8usize,
         concat!("Alignment of ", stringify!(ClassCInnerB))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ClassCInnerB>())).cache as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(ClassCInnerB),
-            "::",
-            stringify!(cache)
-        )
-    );
+    fn test_field_cache() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<ClassCInnerB>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).cache) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(ClassCInnerB),
+                "::",
+                stringify!(cache)
+            )
+        );
+    }
+    test_field_cache();
 }
 impl Default for ClassCInnerB {
     fn default() -> Self {
diff --git a/tests/expectations/tests/char.rs b/tests/expectations/tests/char.rs
index 1e1a198..3b6e119 100644
--- a/tests/expectations/tests/char.rs
+++ b/tests/expectations/tests/char.rs
@@ -36,69 +36,198 @@
         1usize,
         concat!("Alignment of ", stringify!(Test))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Test>())).ch as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(Test), "::", stringify!(ch))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Test>())).u as *const _ as usize },
-        1usize,
-        concat!("Offset of field: ", stringify!(Test), "::", stringify!(u))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Test>())).d as *const _ as usize },
-        2usize,
-        concat!("Offset of field: ", stringify!(Test), "::", stringify!(d))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Test>())).cch as *const _ as usize },
-        3usize,
-        concat!("Offset of field: ", stringify!(Test), "::", stringify!(cch))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Test>())).cu as *const _ as usize },
-        4usize,
-        concat!("Offset of field: ", stringify!(Test), "::", stringify!(cu))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Test>())).cd as *const _ as usize },
-        5usize,
-        concat!("Offset of field: ", stringify!(Test), "::", stringify!(cd))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Test>())).Cch as *const _ as usize },
-        6usize,
-        concat!("Offset of field: ", stringify!(Test), "::", stringify!(Cch))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Test>())).Cu as *const _ as usize },
-        7usize,
-        concat!("Offset of field: ", stringify!(Test), "::", stringify!(Cu))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Test>())).Cd as *const _ as usize },
-        8usize,
-        concat!("Offset of field: ", stringify!(Test), "::", stringify!(Cd))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Test>())).Ccch as *const _ as usize },
-        9usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(Test),
-            "::",
-            stringify!(Ccch)
-        )
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Test>())).Ccu as *const _ as usize },
-        10usize,
-        concat!("Offset of field: ", stringify!(Test), "::", stringify!(Ccu))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Test>())).Ccd as *const _ as usize },
-        11usize,
-        concat!("Offset of field: ", stringify!(Test), "::", stringify!(Ccd))
-    );
+    fn test_field_ch() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Test>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).ch) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Test),
+                "::",
+                stringify!(ch)
+            )
+        );
+    }
+    test_field_ch();
+    fn test_field_u() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Test>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).u) as usize - ptr as usize
+            },
+            1usize,
+            concat!("Offset of field: ", stringify!(Test), "::", stringify!(u))
+        );
+    }
+    test_field_u();
+    fn test_field_d() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Test>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).d) as usize - ptr as usize
+            },
+            2usize,
+            concat!("Offset of field: ", stringify!(Test), "::", stringify!(d))
+        );
+    }
+    test_field_d();
+    fn test_field_cch() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Test>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).cch) as usize - ptr as usize
+            },
+            3usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Test),
+                "::",
+                stringify!(cch)
+            )
+        );
+    }
+    test_field_cch();
+    fn test_field_cu() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Test>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).cu) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Test),
+                "::",
+                stringify!(cu)
+            )
+        );
+    }
+    test_field_cu();
+    fn test_field_cd() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Test>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).cd) as usize - ptr as usize
+            },
+            5usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Test),
+                "::",
+                stringify!(cd)
+            )
+        );
+    }
+    test_field_cd();
+    fn test_field_Cch() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Test>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).Cch) as usize - ptr as usize
+            },
+            6usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Test),
+                "::",
+                stringify!(Cch)
+            )
+        );
+    }
+    test_field_Cch();
+    fn test_field_Cu() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Test>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).Cu) as usize - ptr as usize
+            },
+            7usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Test),
+                "::",
+                stringify!(Cu)
+            )
+        );
+    }
+    test_field_Cu();
+    fn test_field_Cd() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Test>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).Cd) as usize - ptr as usize
+            },
+            8usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Test),
+                "::",
+                stringify!(Cd)
+            )
+        );
+    }
+    test_field_Cd();
+    fn test_field_Ccch() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Test>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).Ccch) as usize - ptr as usize
+            },
+            9usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Test),
+                "::",
+                stringify!(Ccch)
+            )
+        );
+    }
+    test_field_Ccch();
+    fn test_field_Ccu() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Test>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).Ccu) as usize - ptr as usize
+            },
+            10usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Test),
+                "::",
+                stringify!(Ccu)
+            )
+        );
+    }
+    test_field_Ccu();
+    fn test_field_Ccd() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Test>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).Ccd) as usize - ptr as usize
+            },
+            11usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Test),
+                "::",
+                stringify!(Ccd)
+            )
+        );
+    }
+    test_field_Ccd();
 }
diff --git a/tests/expectations/tests/class.rs b/tests/expectations/tests/class.rs
index 3d3afb1..3bfba7e 100644
--- a/tests/expectations/tests/class.rs
+++ b/tests/expectations/tests/class.rs
@@ -53,21 +53,35 @@
         4usize,
         concat!("Alignment of ", stringify!(C))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<C>())).a as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(C), "::", stringify!(a))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<C>())).big_array as *const _ as usize },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C),
-            "::",
-            stringify!(big_array)
-        )
-    );
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<C>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            0usize,
+            concat!("Offset of field: ", stringify!(C), "::", stringify!(a))
+        );
+    }
+    test_field_a();
+    fn test_field_big_array() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<C>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).big_array) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C),
+                "::",
+                stringify!(big_array)
+            )
+        );
+    }
+    test_field_big_array();
 }
 impl Default for C {
     fn default() -> Self {
@@ -96,45 +110,64 @@
         4usize,
         concat!("Alignment of ", stringify!(C_with_zero_length_array))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C_with_zero_length_array>())).a as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C_with_zero_length_array),
-            "::",
-            stringify!(a)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C_with_zero_length_array>())).big_array
-                as *const _ as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C_with_zero_length_array),
-            "::",
-            stringify!(big_array)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C_with_zero_length_array>()))
-                .zero_length_array as *const _ as usize
-        },
-        37usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C_with_zero_length_array),
-            "::",
-            stringify!(zero_length_array)
-        )
-    );
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<C_with_zero_length_array>::uninit(
+                    );
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C_with_zero_length_array),
+                "::",
+                stringify!(a)
+            )
+        );
+    }
+    test_field_a();
+    fn test_field_big_array() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<C_with_zero_length_array>::uninit(
+                    );
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).big_array) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C_with_zero_length_array),
+                "::",
+                stringify!(big_array)
+            )
+        );
+    }
+    test_field_big_array();
+    fn test_field_zero_length_array() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<C_with_zero_length_array>::uninit(
+                    );
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).zero_length_array) as usize -
+                    ptr as usize
+            },
+            37usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C_with_zero_length_array),
+                "::",
+                stringify!(zero_length_array)
+            )
+        );
+    }
+    test_field_zero_length_array();
 }
 impl Default for C_with_zero_length_array {
     fn default() -> Self {
@@ -163,32 +196,45 @@
         4usize,
         concat!("Alignment of ", stringify!(C_with_zero_length_array_2))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C_with_zero_length_array_2>())).a as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C_with_zero_length_array_2),
-            "::",
-            stringify!(a)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C_with_zero_length_array_2>()))
-                .zero_length_array as *const _ as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C_with_zero_length_array_2),
-            "::",
-            stringify!(zero_length_array)
-        )
-    );
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    C_with_zero_length_array_2,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C_with_zero_length_array_2),
+                "::",
+                stringify!(a)
+            )
+        );
+    }
+    test_field_a();
+    fn test_field_zero_length_array() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    C_with_zero_length_array_2,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).zero_length_array) as usize -
+                    ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C_with_zero_length_array_2),
+                "::",
+                stringify!(zero_length_array)
+            )
+        );
+    }
+    test_field_zero_length_array();
 }
 #[repr(C)]
 pub struct C_with_incomplete_array {
@@ -317,16 +363,23 @@
         4usize,
         concat!("Alignment of ", stringify!(WithDtor))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<WithDtor>())).b as *const _ as usize },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(WithDtor),
-            "::",
-            stringify!(b)
-        )
-    );
+    fn test_field_b() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<WithDtor>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(WithDtor),
+                "::",
+                stringify!(b)
+            )
+        );
+    }
+    test_field_b();
 }
 #[repr(C)]
 pub struct IncompleteArrayNonCopiable {
@@ -373,16 +426,40 @@
         4usize,
         concat!("Alignment of ", stringify!(Union))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Union>())).d as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(Union), "::", stringify!(d))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Union>())).i as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(Union), "::", stringify!(i))
-    );
+    fn test_field_d() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Union>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).d) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Union),
+                "::",
+                stringify!(d)
+            )
+        );
+    }
+    test_field_d();
+    fn test_field_i() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Union>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).i) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Union),
+                "::",
+                stringify!(i)
+            )
+        );
+    }
+    test_field_i();
 }
 impl Default for Union {
     fn default() -> Self {
@@ -410,18 +487,23 @@
         4usize,
         concat!("Alignment of ", stringify!(WithUnion))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<WithUnion>())).data as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(WithUnion),
-            "::",
-            stringify!(data)
-        )
-    );
+    fn test_field_data() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<WithUnion>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).data) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(WithUnion),
+                "::",
+                stringify!(data)
+            )
+        );
+    }
+    test_field_data();
 }
 impl Default for WithUnion {
     fn default() -> Self {
diff --git a/tests/expectations/tests/class_1_0.rs b/tests/expectations/tests/class_1_0.rs
index 3f948bb..5415500 100644
--- a/tests/expectations/tests/class_1_0.rs
+++ b/tests/expectations/tests/class_1_0.rs
@@ -96,21 +96,35 @@
         4usize,
         concat!("Alignment of ", stringify!(C))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<C>())).a as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(C), "::", stringify!(a))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<C>())).big_array as *const _ as usize },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C),
-            "::",
-            stringify!(big_array)
-        )
-    );
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<C>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            0usize,
+            concat!("Offset of field: ", stringify!(C), "::", stringify!(a))
+        );
+    }
+    test_field_a();
+    fn test_field_big_array() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<C>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).big_array) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C),
+                "::",
+                stringify!(big_array)
+            )
+        );
+    }
+    test_field_big_array();
 }
 impl Clone for C {
     fn clone(&self) -> Self {
@@ -149,45 +163,64 @@
         4usize,
         concat!("Alignment of ", stringify!(C_with_zero_length_array))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C_with_zero_length_array>())).a as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C_with_zero_length_array),
-            "::",
-            stringify!(a)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C_with_zero_length_array>())).big_array
-                as *const _ as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C_with_zero_length_array),
-            "::",
-            stringify!(big_array)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C_with_zero_length_array>()))
-                .zero_length_array as *const _ as usize
-        },
-        37usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C_with_zero_length_array),
-            "::",
-            stringify!(zero_length_array)
-        )
-    );
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<C_with_zero_length_array>::uninit(
+                    );
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C_with_zero_length_array),
+                "::",
+                stringify!(a)
+            )
+        );
+    }
+    test_field_a();
+    fn test_field_big_array() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<C_with_zero_length_array>::uninit(
+                    );
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).big_array) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C_with_zero_length_array),
+                "::",
+                stringify!(big_array)
+            )
+        );
+    }
+    test_field_big_array();
+    fn test_field_zero_length_array() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<C_with_zero_length_array>::uninit(
+                    );
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).zero_length_array) as usize -
+                    ptr as usize
+            },
+            37usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C_with_zero_length_array),
+                "::",
+                stringify!(zero_length_array)
+            )
+        );
+    }
+    test_field_zero_length_array();
 }
 impl Default for C_with_zero_length_array {
     fn default() -> Self {
@@ -216,32 +249,45 @@
         4usize,
         concat!("Alignment of ", stringify!(C_with_zero_length_array_2))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C_with_zero_length_array_2>())).a as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C_with_zero_length_array_2),
-            "::",
-            stringify!(a)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C_with_zero_length_array_2>()))
-                .zero_length_array as *const _ as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C_with_zero_length_array_2),
-            "::",
-            stringify!(zero_length_array)
-        )
-    );
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    C_with_zero_length_array_2,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C_with_zero_length_array_2),
+                "::",
+                stringify!(a)
+            )
+        );
+    }
+    test_field_a();
+    fn test_field_zero_length_array() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    C_with_zero_length_array_2,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).zero_length_array) as usize -
+                    ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C_with_zero_length_array_2),
+                "::",
+                stringify!(zero_length_array)
+            )
+        );
+    }
+    test_field_zero_length_array();
 }
 #[repr(C)]
 pub struct C_with_incomplete_array {
@@ -370,16 +416,23 @@
         4usize,
         concat!("Alignment of ", stringify!(WithDtor))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<WithDtor>())).b as *const _ as usize },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(WithDtor),
-            "::",
-            stringify!(b)
-        )
-    );
+    fn test_field_b() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<WithDtor>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(WithDtor),
+                "::",
+                stringify!(b)
+            )
+        );
+    }
+    test_field_b();
 }
 #[repr(C)]
 pub struct IncompleteArrayNonCopiable {
@@ -427,16 +480,40 @@
         4usize,
         concat!("Alignment of ", stringify!(Union))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Union>())).d as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(Union), "::", stringify!(d))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Union>())).i as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(Union), "::", stringify!(i))
-    );
+    fn test_field_d() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Union>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).d) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Union),
+                "::",
+                stringify!(d)
+            )
+        );
+    }
+    test_field_d();
+    fn test_field_i() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Union>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).i) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Union),
+                "::",
+                stringify!(i)
+            )
+        );
+    }
+    test_field_i();
 }
 impl Clone for Union {
     fn clone(&self) -> Self {
@@ -460,18 +537,23 @@
         4usize,
         concat!("Alignment of ", stringify!(WithUnion))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<WithUnion>())).data as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(WithUnion),
-            "::",
-            stringify!(data)
-        )
-    );
+    fn test_field_data() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<WithUnion>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).data) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(WithUnion),
+                "::",
+                stringify!(data)
+            )
+        );
+    }
+    test_field_data();
 }
 impl Clone for WithUnion {
     fn clone(&self) -> Self {
diff --git a/tests/expectations/tests/class_nested.rs b/tests/expectations/tests/class_nested.rs
index ecc5c20..7ea2fe8 100644
--- a/tests/expectations/tests/class_nested.rs
+++ b/tests/expectations/tests/class_nested.rs
@@ -27,18 +27,23 @@
         4usize,
         concat!("Alignment of ", stringify!(A_B))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<A_B>())).member_b as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(A_B),
-            "::",
-            stringify!(member_b)
-        )
-    );
+    fn test_field_member_b() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<A_B>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).member_b) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(A_B),
+                "::",
+                stringify!(member_b)
+            )
+        );
+    }
+    test_field_member_b();
 }
 #[repr(C)]
 #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
@@ -67,16 +72,23 @@
         4usize,
         concat!("Alignment of ", stringify!(A))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<A>())).member_a as *const _ as usize },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(A),
-            "::",
-            stringify!(member_a)
-        )
-    );
+    fn test_field_member_a() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<A>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).member_a) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(A),
+                "::",
+                stringify!(member_a)
+            )
+        );
+    }
+    test_field_member_a();
 }
 #[repr(C)]
 #[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
@@ -95,11 +107,23 @@
         4usize,
         concat!("Alignment of ", stringify!(A_C))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<A_C>())).baz as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(A_C), "::", stringify!(baz))
-    );
+    fn test_field_baz() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<A_C>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).baz) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(A_C),
+                "::",
+                stringify!(baz)
+            )
+        );
+    }
+    test_field_baz();
 }
 extern "C" {
     pub static mut var: A_B;
@@ -143,11 +167,23 @@
         4usize,
         concat!("Alignment of ", stringify!(D))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<D>())).member as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(D), "::", stringify!(member))
-    );
+    fn test_field_member() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<D>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).member) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(D),
+                "::",
+                stringify!(member)
+            )
+        );
+    }
+    test_field_member();
 }
 #[repr(C)]
 #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
diff --git a/tests/expectations/tests/class_no_members.rs b/tests/expectations/tests/class_no_members.rs
index 6c1e488..75487a4 100644
--- a/tests/expectations/tests/class_no_members.rs
+++ b/tests/expectations/tests/class_no_members.rs
@@ -58,17 +58,23 @@
         4usize,
         concat!("Alignment of ", stringify!(whatever_child_with_member))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<whatever_child_with_member>())).m_member
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(whatever_child_with_member),
-            "::",
-            stringify!(m_member)
-        )
-    );
+    fn test_field_m_member() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    whatever_child_with_member,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).m_member) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(whatever_child_with_member),
+                "::",
+                stringify!(m_member)
+            )
+        );
+    }
+    test_field_m_member();
 }
diff --git a/tests/expectations/tests/class_use_as.rs b/tests/expectations/tests/class_use_as.rs
index d6a71ac..12a51bd 100644
--- a/tests/expectations/tests/class_use_as.rs
+++ b/tests/expectations/tests/class_use_as.rs
@@ -23,19 +23,23 @@
         4usize,
         concat!("Alignment of ", stringify!(whatever))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<whatever>())).replacement as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(whatever),
-            "::",
-            stringify!(replacement)
-        )
-    );
+    fn test_field_replacement() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<whatever>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).replacement) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(whatever),
+                "::",
+                stringify!(replacement)
+            )
+        );
+    }
+    test_field_replacement();
 }
 #[repr(C)]
 #[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
@@ -54,14 +58,21 @@
         4usize,
         concat!("Alignment of ", stringify!(container))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<container>())).c as *const _ as usize },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(container),
-            "::",
-            stringify!(c)
-        )
-    );
+    fn test_field_c() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<container>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).c) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(container),
+                "::",
+                stringify!(c)
+            )
+        );
+    }
+    test_field_c();
 }
diff --git a/tests/expectations/tests/class_with_dtor.rs b/tests/expectations/tests/class_with_dtor.rs
index 0cf2d8d..a6e7586 100644
--- a/tests/expectations/tests/class_with_dtor.rs
+++ b/tests/expectations/tests/class_with_dtor.rs
@@ -38,19 +38,24 @@
         8usize,
         concat!("Alignment of ", stringify!(WithoutDtor))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<WithoutDtor>())).shouldBeWithDtor as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(WithoutDtor),
-            "::",
-            stringify!(shouldBeWithDtor)
-        )
-    );
+    fn test_field_shouldBeWithDtor() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<WithoutDtor>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).shouldBeWithDtor) as usize -
+                    ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(WithoutDtor),
+                "::",
+                stringify!(shouldBeWithDtor)
+            )
+        );
+    }
+    test_field_shouldBeWithDtor();
 }
 impl Default for WithoutDtor {
     fn default() -> Self {
diff --git a/tests/expectations/tests/class_with_inner_struct.rs b/tests/expectations/tests/class_with_inner_struct.rs
index 35ed765..ba1373b 100644
--- a/tests/expectations/tests/class_with_inner_struct.rs
+++ b/tests/expectations/tests/class_with_inner_struct.rs
@@ -30,30 +30,40 @@
         4usize,
         concat!("Alignment of ", stringify!(A_Segment))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<A_Segment>())).begin as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(A_Segment),
-            "::",
-            stringify!(begin)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<A_Segment>())).end as *const _ as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(A_Segment),
-            "::",
-            stringify!(end)
-        )
-    );
+    fn test_field_begin() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<A_Segment>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).begin) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(A_Segment),
+                "::",
+                stringify!(begin)
+            )
+        );
+    }
+    test_field_begin();
+    fn test_field_end() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<A_Segment>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).end) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(A_Segment),
+                "::",
+                stringify!(end)
+            )
+        );
+    }
+    test_field_end();
 }
 #[repr(C)]
 #[derive(Copy, Clone)]
@@ -72,18 +82,24 @@
         4usize,
         concat!("Alignment of ", stringify!(A__bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<A__bindgen_ty_1>())).f as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(A__bindgen_ty_1),
-            "::",
-            stringify!(f)
-        )
-    );
+    fn test_field_f() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<A__bindgen_ty_1>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).f) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(A__bindgen_ty_1),
+                "::",
+                stringify!(f)
+            )
+        );
+    }
+    test_field_f();
 }
 impl Default for A__bindgen_ty_1 {
     fn default() -> Self {
@@ -111,18 +127,24 @@
         4usize,
         concat!("Alignment of ", stringify!(A__bindgen_ty_2))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<A__bindgen_ty_2>())).d as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(A__bindgen_ty_2),
-            "::",
-            stringify!(d)
-        )
-    );
+    fn test_field_d() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<A__bindgen_ty_2>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).d) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(A__bindgen_ty_2),
+                "::",
+                stringify!(d)
+            )
+        );
+    }
+    test_field_d();
 }
 impl Default for A__bindgen_ty_2 {
     fn default() -> Self {
@@ -145,23 +167,35 @@
         4usize,
         concat!("Alignment of ", stringify!(A))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<A>())).c as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(A), "::", stringify!(c))
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<A>())).named_union as *const _ as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(A),
-            "::",
-            stringify!(named_union)
-        )
-    );
+    fn test_field_c() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<A>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).c) as usize - ptr as usize
+            },
+            0usize,
+            concat!("Offset of field: ", stringify!(A), "::", stringify!(c))
+        );
+    }
+    test_field_c();
+    fn test_field_named_union() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<A>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).named_union) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(A),
+                "::",
+                stringify!(named_union)
+            )
+        );
+    }
+    test_field_named_union();
 }
 impl Default for A {
     fn default() -> Self {
@@ -195,30 +229,40 @@
         4usize,
         concat!("Alignment of ", stringify!(B_Segment))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<B_Segment>())).begin as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(B_Segment),
-            "::",
-            stringify!(begin)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<B_Segment>())).end as *const _ as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(B_Segment),
-            "::",
-            stringify!(end)
-        )
-    );
+    fn test_field_begin() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<B_Segment>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).begin) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(B_Segment),
+                "::",
+                stringify!(begin)
+            )
+        );
+    }
+    test_field_begin();
+    fn test_field_end() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<B_Segment>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).end) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(B_Segment),
+                "::",
+                stringify!(end)
+            )
+        );
+    }
+    test_field_end();
 }
 #[test]
 fn bindgen_test_layout_B() {
@@ -232,11 +276,18 @@
         4usize,
         concat!("Alignment of ", stringify!(B))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<B>())).d as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(B), "::", stringify!(d))
-    );
+    fn test_field_d() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<B>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).d) as usize - ptr as usize
+            },
+            0usize,
+            concat!("Offset of field: ", stringify!(B), "::", stringify!(d))
+        );
+    }
+    test_field_d();
 }
 #[repr(i32)]
 #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
@@ -278,58 +329,82 @@
         4usize,
         concat!("Alignment of ", stringify!(C__bindgen_ty_1__bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C__bindgen_ty_1__bindgen_ty_1>())).mX1
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C__bindgen_ty_1__bindgen_ty_1),
-            "::",
-            stringify!(mX1)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C__bindgen_ty_1__bindgen_ty_1>())).mY1
-                as *const _ as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C__bindgen_ty_1__bindgen_ty_1),
-            "::",
-            stringify!(mY1)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C__bindgen_ty_1__bindgen_ty_1>())).mX2
-                as *const _ as usize
-        },
-        8usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C__bindgen_ty_1__bindgen_ty_1),
-            "::",
-            stringify!(mX2)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C__bindgen_ty_1__bindgen_ty_1>())).mY2
-                as *const _ as usize
-        },
-        12usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C__bindgen_ty_1__bindgen_ty_1),
-            "::",
-            stringify!(mY2)
-        )
-    );
+    fn test_field_mX1() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    C__bindgen_ty_1__bindgen_ty_1,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mX1) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C__bindgen_ty_1__bindgen_ty_1),
+                "::",
+                stringify!(mX1)
+            )
+        );
+    }
+    test_field_mX1();
+    fn test_field_mY1() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    C__bindgen_ty_1__bindgen_ty_1,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mY1) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C__bindgen_ty_1__bindgen_ty_1),
+                "::",
+                stringify!(mY1)
+            )
+        );
+    }
+    test_field_mY1();
+    fn test_field_mX2() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    C__bindgen_ty_1__bindgen_ty_1,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mX2) as usize - ptr as usize
+            },
+            8usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C__bindgen_ty_1__bindgen_ty_1),
+                "::",
+                stringify!(mX2)
+            )
+        );
+    }
+    test_field_mX2();
+    fn test_field_mY2() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    C__bindgen_ty_1__bindgen_ty_1,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mY2) as usize - ptr as usize
+            },
+            12usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C__bindgen_ty_1__bindgen_ty_1),
+                "::",
+                stringify!(mY2)
+            )
+        );
+    }
+    test_field_mY2();
 }
 #[repr(C)]
 #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
@@ -349,32 +424,44 @@
         4usize,
         concat!("Alignment of ", stringify!(C__bindgen_ty_1__bindgen_ty_2))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C__bindgen_ty_1__bindgen_ty_2>()))
-                .mStepSyntax as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C__bindgen_ty_1__bindgen_ty_2),
-            "::",
-            stringify!(mStepSyntax)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C__bindgen_ty_1__bindgen_ty_2>())).mSteps
-                as *const _ as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C__bindgen_ty_1__bindgen_ty_2),
-            "::",
-            stringify!(mSteps)
-        )
-    );
+    fn test_field_mStepSyntax() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    C__bindgen_ty_1__bindgen_ty_2,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mStepSyntax) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C__bindgen_ty_1__bindgen_ty_2),
+                "::",
+                stringify!(mStepSyntax)
+            )
+        );
+    }
+    test_field_mStepSyntax();
+    fn test_field_mSteps() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    C__bindgen_ty_1__bindgen_ty_2,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mSteps) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C__bindgen_ty_1__bindgen_ty_2),
+                "::",
+                stringify!(mSteps)
+            )
+        );
+    }
+    test_field_mSteps();
 }
 impl Default for C__bindgen_ty_1__bindgen_ty_2 {
     fn default() -> Self {
@@ -397,19 +484,24 @@
         4usize,
         concat!("Alignment of ", stringify!(C__bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C__bindgen_ty_1>())).mFunc as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C__bindgen_ty_1),
-            "::",
-            stringify!(mFunc)
-        )
-    );
+    fn test_field_mFunc() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<C__bindgen_ty_1>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mFunc) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C__bindgen_ty_1),
+                "::",
+                stringify!(mFunc)
+            )
+        );
+    }
+    test_field_mFunc();
 }
 impl Default for C__bindgen_ty_1 {
     fn default() -> Self {
@@ -438,30 +530,40 @@
         4usize,
         concat!("Alignment of ", stringify!(C_Segment))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C_Segment>())).begin as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C_Segment),
-            "::",
-            stringify!(begin)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C_Segment>())).end as *const _ as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C_Segment),
-            "::",
-            stringify!(end)
-        )
-    );
+    fn test_field_begin() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<C_Segment>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).begin) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C_Segment),
+                "::",
+                stringify!(begin)
+            )
+        );
+    }
+    test_field_begin();
+    fn test_field_end() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<C_Segment>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).end) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C_Segment),
+                "::",
+                stringify!(end)
+            )
+        );
+    }
+    test_field_end();
 }
 #[test]
 fn bindgen_test_layout_C() {
@@ -475,11 +577,18 @@
         4usize,
         concat!("Alignment of ", stringify!(C))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<C>())).d as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(C), "::", stringify!(d))
-    );
+    fn test_field_d() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<C>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).d) as usize - ptr as usize
+            },
+            0usize,
+            concat!("Offset of field: ", stringify!(C), "::", stringify!(d))
+        );
+    }
+    test_field_d();
 }
 impl Default for C {
     fn default() -> Self {
diff --git a/tests/expectations/tests/class_with_inner_struct_1_0.rs b/tests/expectations/tests/class_with_inner_struct_1_0.rs
index 52cd590..3774c14 100644
--- a/tests/expectations/tests/class_with_inner_struct_1_0.rs
+++ b/tests/expectations/tests/class_with_inner_struct_1_0.rs
@@ -73,30 +73,40 @@
         4usize,
         concat!("Alignment of ", stringify!(A_Segment))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<A_Segment>())).begin as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(A_Segment),
-            "::",
-            stringify!(begin)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<A_Segment>())).end as *const _ as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(A_Segment),
-            "::",
-            stringify!(end)
-        )
-    );
+    fn test_field_begin() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<A_Segment>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).begin) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(A_Segment),
+                "::",
+                stringify!(begin)
+            )
+        );
+    }
+    test_field_begin();
+    fn test_field_end() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<A_Segment>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).end) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(A_Segment),
+                "::",
+                stringify!(end)
+            )
+        );
+    }
+    test_field_end();
 }
 impl Clone for A_Segment {
     fn clone(&self) -> Self {
@@ -121,18 +131,24 @@
         4usize,
         concat!("Alignment of ", stringify!(A__bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<A__bindgen_ty_1>())).f as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(A__bindgen_ty_1),
-            "::",
-            stringify!(f)
-        )
-    );
+    fn test_field_f() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<A__bindgen_ty_1>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).f) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(A__bindgen_ty_1),
+                "::",
+                stringify!(f)
+            )
+        );
+    }
+    test_field_f();
 }
 impl Clone for A__bindgen_ty_1 {
     fn clone(&self) -> Self {
@@ -157,18 +173,24 @@
         4usize,
         concat!("Alignment of ", stringify!(A__bindgen_ty_2))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<A__bindgen_ty_2>())).d as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(A__bindgen_ty_2),
-            "::",
-            stringify!(d)
-        )
-    );
+    fn test_field_d() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<A__bindgen_ty_2>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).d) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(A__bindgen_ty_2),
+                "::",
+                stringify!(d)
+            )
+        );
+    }
+    test_field_d();
 }
 impl Clone for A__bindgen_ty_2 {
     fn clone(&self) -> Self {
@@ -187,23 +209,35 @@
         4usize,
         concat!("Alignment of ", stringify!(A))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<A>())).c as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(A), "::", stringify!(c))
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<A>())).named_union as *const _ as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(A),
-            "::",
-            stringify!(named_union)
-        )
-    );
+    fn test_field_c() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<A>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).c) as usize - ptr as usize
+            },
+            0usize,
+            concat!("Offset of field: ", stringify!(A), "::", stringify!(c))
+        );
+    }
+    test_field_c();
+    fn test_field_named_union() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<A>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).named_union) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(A),
+                "::",
+                stringify!(named_union)
+            )
+        );
+    }
+    test_field_named_union();
 }
 impl Clone for A {
     fn clone(&self) -> Self {
@@ -233,30 +267,40 @@
         4usize,
         concat!("Alignment of ", stringify!(B_Segment))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<B_Segment>())).begin as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(B_Segment),
-            "::",
-            stringify!(begin)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<B_Segment>())).end as *const _ as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(B_Segment),
-            "::",
-            stringify!(end)
-        )
-    );
+    fn test_field_begin() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<B_Segment>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).begin) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(B_Segment),
+                "::",
+                stringify!(begin)
+            )
+        );
+    }
+    test_field_begin();
+    fn test_field_end() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<B_Segment>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).end) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(B_Segment),
+                "::",
+                stringify!(end)
+            )
+        );
+    }
+    test_field_end();
 }
 impl Clone for B_Segment {
     fn clone(&self) -> Self {
@@ -275,11 +319,18 @@
         4usize,
         concat!("Alignment of ", stringify!(B))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<B>())).d as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(B), "::", stringify!(d))
-    );
+    fn test_field_d() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<B>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).d) as usize - ptr as usize
+            },
+            0usize,
+            concat!("Offset of field: ", stringify!(B), "::", stringify!(d))
+        );
+    }
+    test_field_d();
 }
 impl Clone for B {
     fn clone(&self) -> Self {
@@ -327,58 +378,82 @@
         4usize,
         concat!("Alignment of ", stringify!(C__bindgen_ty_1__bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C__bindgen_ty_1__bindgen_ty_1>())).mX1
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C__bindgen_ty_1__bindgen_ty_1),
-            "::",
-            stringify!(mX1)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C__bindgen_ty_1__bindgen_ty_1>())).mY1
-                as *const _ as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C__bindgen_ty_1__bindgen_ty_1),
-            "::",
-            stringify!(mY1)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C__bindgen_ty_1__bindgen_ty_1>())).mX2
-                as *const _ as usize
-        },
-        8usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C__bindgen_ty_1__bindgen_ty_1),
-            "::",
-            stringify!(mX2)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C__bindgen_ty_1__bindgen_ty_1>())).mY2
-                as *const _ as usize
-        },
-        12usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C__bindgen_ty_1__bindgen_ty_1),
-            "::",
-            stringify!(mY2)
-        )
-    );
+    fn test_field_mX1() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    C__bindgen_ty_1__bindgen_ty_1,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mX1) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C__bindgen_ty_1__bindgen_ty_1),
+                "::",
+                stringify!(mX1)
+            )
+        );
+    }
+    test_field_mX1();
+    fn test_field_mY1() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    C__bindgen_ty_1__bindgen_ty_1,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mY1) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C__bindgen_ty_1__bindgen_ty_1),
+                "::",
+                stringify!(mY1)
+            )
+        );
+    }
+    test_field_mY1();
+    fn test_field_mX2() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    C__bindgen_ty_1__bindgen_ty_1,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mX2) as usize - ptr as usize
+            },
+            8usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C__bindgen_ty_1__bindgen_ty_1),
+                "::",
+                stringify!(mX2)
+            )
+        );
+    }
+    test_field_mX2();
+    fn test_field_mY2() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    C__bindgen_ty_1__bindgen_ty_1,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mY2) as usize - ptr as usize
+            },
+            12usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C__bindgen_ty_1__bindgen_ty_1),
+                "::",
+                stringify!(mY2)
+            )
+        );
+    }
+    test_field_mY2();
 }
 impl Clone for C__bindgen_ty_1__bindgen_ty_1 {
     fn clone(&self) -> Self {
@@ -403,32 +478,44 @@
         4usize,
         concat!("Alignment of ", stringify!(C__bindgen_ty_1__bindgen_ty_2))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C__bindgen_ty_1__bindgen_ty_2>()))
-                .mStepSyntax as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C__bindgen_ty_1__bindgen_ty_2),
-            "::",
-            stringify!(mStepSyntax)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C__bindgen_ty_1__bindgen_ty_2>())).mSteps
-                as *const _ as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C__bindgen_ty_1__bindgen_ty_2),
-            "::",
-            stringify!(mSteps)
-        )
-    );
+    fn test_field_mStepSyntax() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    C__bindgen_ty_1__bindgen_ty_2,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mStepSyntax) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C__bindgen_ty_1__bindgen_ty_2),
+                "::",
+                stringify!(mStepSyntax)
+            )
+        );
+    }
+    test_field_mStepSyntax();
+    fn test_field_mSteps() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    C__bindgen_ty_1__bindgen_ty_2,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mSteps) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C__bindgen_ty_1__bindgen_ty_2),
+                "::",
+                stringify!(mSteps)
+            )
+        );
+    }
+    test_field_mSteps();
 }
 impl Clone for C__bindgen_ty_1__bindgen_ty_2 {
     fn clone(&self) -> Self {
@@ -456,19 +543,24 @@
         4usize,
         concat!("Alignment of ", stringify!(C__bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C__bindgen_ty_1>())).mFunc as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C__bindgen_ty_1),
-            "::",
-            stringify!(mFunc)
-        )
-    );
+    fn test_field_mFunc() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<C__bindgen_ty_1>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mFunc) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C__bindgen_ty_1),
+                "::",
+                stringify!(mFunc)
+            )
+        );
+    }
+    test_field_mFunc();
 }
 impl Clone for C__bindgen_ty_1 {
     fn clone(&self) -> Self {
@@ -493,30 +585,40 @@
         4usize,
         concat!("Alignment of ", stringify!(C_Segment))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C_Segment>())).begin as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C_Segment),
-            "::",
-            stringify!(begin)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C_Segment>())).end as *const _ as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C_Segment),
-            "::",
-            stringify!(end)
-        )
-    );
+    fn test_field_begin() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<C_Segment>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).begin) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C_Segment),
+                "::",
+                stringify!(begin)
+            )
+        );
+    }
+    test_field_begin();
+    fn test_field_end() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<C_Segment>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).end) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C_Segment),
+                "::",
+                stringify!(end)
+            )
+        );
+    }
+    test_field_end();
 }
 impl Clone for C_Segment {
     fn clone(&self) -> Self {
@@ -535,11 +637,18 @@
         4usize,
         concat!("Alignment of ", stringify!(C))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<C>())).d as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(C), "::", stringify!(d))
-    );
+    fn test_field_d() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<C>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).d) as usize - ptr as usize
+            },
+            0usize,
+            concat!("Offset of field: ", stringify!(C), "::", stringify!(d))
+        );
+    }
+    test_field_d();
 }
 impl Clone for C {
     fn clone(&self) -> Self {
diff --git a/tests/expectations/tests/class_with_typedef.rs b/tests/expectations/tests/class_with_typedef.rs
index 31faa49..6df675b 100644
--- a/tests/expectations/tests/class_with_typedef.rs
+++ b/tests/expectations/tests/class_with_typedef.rs
@@ -29,36 +29,71 @@
         8usize,
         concat!("Alignment of ", stringify!(C))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<C>())).c as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(C), "::", stringify!(c))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<C>())).ptr as *const _ as usize },
-        8usize,
-        concat!("Offset of field: ", stringify!(C), "::", stringify!(ptr))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<C>())).arr as *const _ as usize },
-        16usize,
-        concat!("Offset of field: ", stringify!(C), "::", stringify!(arr))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<C>())).d as *const _ as usize },
-        56usize,
-        concat!("Offset of field: ", stringify!(C), "::", stringify!(d))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<C>())).other_ptr as *const _ as usize },
-        64usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C),
-            "::",
-            stringify!(other_ptr)
-        )
-    );
+    fn test_field_c() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<C>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).c) as usize - ptr as usize
+            },
+            0usize,
+            concat!("Offset of field: ", stringify!(C), "::", stringify!(c))
+        );
+    }
+    test_field_c();
+    fn test_field_ptr() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<C>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).ptr) as usize - ptr as usize
+            },
+            8usize,
+            concat!("Offset of field: ", stringify!(C), "::", stringify!(ptr))
+        );
+    }
+    test_field_ptr();
+    fn test_field_arr() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<C>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).arr) as usize - ptr as usize
+            },
+            16usize,
+            concat!("Offset of field: ", stringify!(C), "::", stringify!(arr))
+        );
+    }
+    test_field_arr();
+    fn test_field_d() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<C>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).d) as usize - ptr as usize
+            },
+            56usize,
+            concat!("Offset of field: ", stringify!(C), "::", stringify!(d))
+        );
+    }
+    test_field_d();
+    fn test_field_other_ptr() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<C>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).other_ptr) as usize - ptr as usize
+            },
+            64usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C),
+                "::",
+                stringify!(other_ptr)
+            )
+        );
+    }
+    test_field_other_ptr();
 }
 extern "C" {
     #[link_name = "\u{1}_ZN1C6methodEi"]
@@ -121,11 +156,18 @@
         8usize,
         concat!("Alignment of ", stringify!(D))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<D>())).ptr as *const _ as usize },
-        72usize,
-        concat!("Offset of field: ", stringify!(D), "::", stringify!(ptr))
-    );
+    fn test_field_ptr() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<D>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).ptr) as usize - ptr as usize
+            },
+            72usize,
+            concat!("Offset of field: ", stringify!(D), "::", stringify!(ptr))
+        );
+    }
+    test_field_ptr();
 }
 impl Default for D {
     fn default() -> Self {
diff --git a/tests/expectations/tests/comment-indent.rs b/tests/expectations/tests/comment-indent.rs
index c381b73..93412f2 100644
--- a/tests/expectations/tests/comment-indent.rs
+++ b/tests/expectations/tests/comment-indent.rs
@@ -80,18 +80,24 @@
                 4usize,
                 concat!("Alignment of ", stringify!(Baz))
             );
-            assert_eq!(
-                unsafe {
-                    &(*(::std::ptr::null::<Baz>())).member as *const _ as usize
-                },
-                0usize,
-                concat!(
-                    "Offset of field: ",
-                    stringify!(Baz),
-                    "::",
-                    stringify!(member)
-                )
-            );
+            fn test_field_member() {
+                assert_eq!(
+                    unsafe {
+                        let uninit = ::std::mem::MaybeUninit::<Baz>::uninit();
+                        let ptr = uninit.as_ptr();
+                        ::std::ptr::addr_of!((*ptr).member) as usize -
+                            ptr as usize
+                    },
+                    0usize,
+                    concat!(
+                        "Offset of field: ",
+                        stringify!(Baz),
+                        "::",
+                        stringify!(member)
+                    )
+                );
+            }
+            test_field_member();
         }
         /// I'm in an inline namespace, and as such I shouldn't get generated inside
         /// a rust module, except when the relevant option is specified. Also, this
diff --git a/tests/expectations/tests/complex.rs b/tests/expectations/tests/complex.rs
index 4dae071..ba1d4ae 100644
--- a/tests/expectations/tests/complex.rs
+++ b/tests/expectations/tests/complex.rs
@@ -28,18 +28,23 @@
         8usize,
         concat!("Alignment of ", stringify!(TestDouble))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<TestDouble>())).mMember as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(TestDouble),
-            "::",
-            stringify!(mMember)
-        )
-    );
+    fn test_field_mMember() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<TestDouble>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mMember) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(TestDouble),
+                "::",
+                stringify!(mMember)
+            )
+        );
+    }
+    test_field_mMember();
 }
 #[repr(C)]
 #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
@@ -58,19 +63,23 @@
         8usize,
         concat!("Alignment of ", stringify!(TestDoublePtr))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<TestDoublePtr>())).mMember as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(TestDoublePtr),
-            "::",
-            stringify!(mMember)
-        )
-    );
+    fn test_field_mMember() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<TestDoublePtr>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mMember) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(TestDoublePtr),
+                "::",
+                stringify!(mMember)
+            )
+        );
+    }
+    test_field_mMember();
 }
 impl Default for TestDoublePtr {
     fn default() -> Self {
@@ -98,18 +107,23 @@
         4usize,
         concat!("Alignment of ", stringify!(TestFloat))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<TestFloat>())).mMember as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(TestFloat),
-            "::",
-            stringify!(mMember)
-        )
-    );
+    fn test_field_mMember() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<TestFloat>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mMember) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(TestFloat),
+                "::",
+                stringify!(mMember)
+            )
+        );
+    }
+    test_field_mMember();
 }
 #[repr(C)]
 #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
@@ -128,19 +142,23 @@
         8usize,
         concat!("Alignment of ", stringify!(TestFloatPtr))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<TestFloatPtr>())).mMember as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(TestFloatPtr),
-            "::",
-            stringify!(mMember)
-        )
-    );
+    fn test_field_mMember() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<TestFloatPtr>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mMember) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(TestFloatPtr),
+                "::",
+                stringify!(mMember)
+            )
+        );
+    }
+    test_field_mMember();
 }
 impl Default for TestFloatPtr {
     fn default() -> Self {
diff --git a/tests/expectations/tests/const-const-mut-ptr.rs b/tests/expectations/tests/const-const-mut-ptr.rs
index bc1e762..b6b3bdb 100644
--- a/tests/expectations/tests/const-const-mut-ptr.rs
+++ b/tests/expectations/tests/const-const-mut-ptr.rs
@@ -22,11 +22,23 @@
         8usize,
         concat!("Alignment of ", stringify!(foo))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<foo>())).bar as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(foo), "::", stringify!(bar))
-    );
+    fn test_field_bar() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<foo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo),
+                "::",
+                stringify!(bar)
+            )
+        );
+    }
+    test_field_bar();
 }
 impl Default for foo {
     fn default() -> Self {
diff --git a/tests/expectations/tests/constified-enum-module-overflow.rs b/tests/expectations/tests/constified-enum-module-overflow.rs
index 4a799ef..df11298 100644
--- a/tests/expectations/tests/constified-enum-module-overflow.rs
+++ b/tests/expectations/tests/constified-enum-module-overflow.rs
@@ -33,11 +33,18 @@
         1usize,
         concat!("Alignment of ", stringify!(A))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<A>())).u as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(A), "::", stringify!(u))
-    );
+    fn test_field_u() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<A>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).u) as usize - ptr as usize
+            },
+            0usize,
+            concat!("Offset of field: ", stringify!(A), "::", stringify!(u))
+        );
+    }
+    test_field_u();
 }
 #[test]
 fn __bindgen_test_layout_C_open0_A_close0_instantiation() {
diff --git a/tests/expectations/tests/constify-all-enums.rs b/tests/expectations/tests/constify-all-enums.rs
index 78bb99f..c926d85 100644
--- a/tests/expectations/tests/constify-all-enums.rs
+++ b/tests/expectations/tests/constify-all-enums.rs
@@ -26,19 +26,24 @@
         4usize,
         concat!("Alignment of ", stringify!(bar))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<bar>())).this_should_work as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(bar),
-            "::",
-            stringify!(this_should_work)
-        )
-    );
+    fn test_field_this_should_work() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<bar>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).this_should_work) as usize -
+                    ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(bar),
+                "::",
+                stringify!(this_should_work)
+            )
+        );
+    }
+    test_field_this_should_work();
 }
 impl Default for bar {
     fn default() -> Self {
diff --git a/tests/expectations/tests/constify-module-enums-basic.rs b/tests/expectations/tests/constify-module-enums-basic.rs
index 59e9ba1..6078ef2 100644
--- a/tests/expectations/tests/constify-module-enums-basic.rs
+++ b/tests/expectations/tests/constify-module-enums-basic.rs
@@ -30,19 +30,24 @@
         4usize,
         concat!("Alignment of ", stringify!(bar))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<bar>())).this_should_work as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(bar),
-            "::",
-            stringify!(this_should_work)
-        )
-    );
+    fn test_field_this_should_work() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<bar>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).this_should_work) as usize -
+                    ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(bar),
+                "::",
+                stringify!(this_should_work)
+            )
+        );
+    }
+    test_field_this_should_work();
 }
 impl Default for bar {
     fn default() -> Self {
diff --git a/tests/expectations/tests/constify-module-enums-namespace.rs b/tests/expectations/tests/constify-module-enums-namespace.rs
index e434291..326c219 100644
--- a/tests/expectations/tests/constify-module-enums-namespace.rs
+++ b/tests/expectations/tests/constify-module-enums-namespace.rs
@@ -42,19 +42,26 @@
                     4usize,
                     concat!("Alignment of ", stringify!(bar))
                 );
-                assert_eq!(
-                    unsafe {
-                        &(*(::std::ptr::null::<bar>())).this_should_work
-                            as *const _ as usize
-                    },
-                    0usize,
-                    concat!(
-                        "Offset of field: ",
-                        stringify!(bar),
-                        "::",
-                        stringify!(this_should_work)
-                    )
-                );
+                fn test_field_this_should_work() {
+                    assert_eq!(
+                        unsafe {
+                            let uninit =
+                                ::std::mem::MaybeUninit::<bar>::uninit();
+                            let ptr = uninit.as_ptr();
+                            ::std::ptr::addr_of!((*ptr).this_should_work)
+                                as usize -
+                                ptr as usize
+                        },
+                        0usize,
+                        concat!(
+                            "Offset of field: ",
+                            stringify!(bar),
+                            "::",
+                            stringify!(this_should_work)
+                        )
+                    );
+                }
+                test_field_this_should_work();
             }
             impl Default for bar {
                 fn default() -> Self {
diff --git a/tests/expectations/tests/constify-module-enums-shadow-name.rs b/tests/expectations/tests/constify-module-enums-shadow-name.rs
index 60401dc..a5340e6 100644
--- a/tests/expectations/tests/constify-module-enums-shadow-name.rs
+++ b/tests/expectations/tests/constify-module-enums-shadow-name.rs
@@ -29,16 +29,23 @@
         4usize,
         concat!("Alignment of ", stringify!(bar))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<bar>())).member as *const _ as usize },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(bar),
-            "::",
-            stringify!(member)
-        )
-    );
+    fn test_field_member() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<bar>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).member) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(bar),
+                "::",
+                stringify!(member)
+            )
+        );
+    }
+    test_field_member();
 }
 impl Default for bar {
     fn default() -> Self {
diff --git a/tests/expectations/tests/constify-module-enums-simple-alias.rs b/tests/expectations/tests/constify-module-enums-simple-alias.rs
index 317697d..52d4651 100644
--- a/tests/expectations/tests/constify-module-enums-simple-alias.rs
+++ b/tests/expectations/tests/constify-module-enums-simple-alias.rs
@@ -38,74 +38,142 @@
         8usize,
         concat!("Alignment of ", stringify!(Bar))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Bar>())).baz1 as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(Bar), "::", stringify!(baz1))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Bar>())).baz2 as *const _ as usize },
-        4usize,
-        concat!("Offset of field: ", stringify!(Bar), "::", stringify!(baz2))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Bar>())).baz3 as *const _ as usize },
-        8usize,
-        concat!("Offset of field: ", stringify!(Bar), "::", stringify!(baz3))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Bar>())).baz4 as *const _ as usize },
-        12usize,
-        concat!("Offset of field: ", stringify!(Bar), "::", stringify!(baz4))
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<Bar>())).baz_ptr1 as *const _ as usize
-        },
-        16usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(Bar),
-            "::",
-            stringify!(baz_ptr1)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<Bar>())).baz_ptr2 as *const _ as usize
-        },
-        24usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(Bar),
-            "::",
-            stringify!(baz_ptr2)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<Bar>())).baz_ptr3 as *const _ as usize
-        },
-        32usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(Bar),
-            "::",
-            stringify!(baz_ptr3)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<Bar>())).baz_ptr4 as *const _ as usize
-        },
-        40usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(Bar),
-            "::",
-            stringify!(baz_ptr4)
-        )
-    );
+    fn test_field_baz1() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Bar>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).baz1) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Bar),
+                "::",
+                stringify!(baz1)
+            )
+        );
+    }
+    test_field_baz1();
+    fn test_field_baz2() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Bar>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).baz2) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Bar),
+                "::",
+                stringify!(baz2)
+            )
+        );
+    }
+    test_field_baz2();
+    fn test_field_baz3() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Bar>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).baz3) as usize - ptr as usize
+            },
+            8usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Bar),
+                "::",
+                stringify!(baz3)
+            )
+        );
+    }
+    test_field_baz3();
+    fn test_field_baz4() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Bar>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).baz4) as usize - ptr as usize
+            },
+            12usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Bar),
+                "::",
+                stringify!(baz4)
+            )
+        );
+    }
+    test_field_baz4();
+    fn test_field_baz_ptr1() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Bar>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).baz_ptr1) as usize - ptr as usize
+            },
+            16usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Bar),
+                "::",
+                stringify!(baz_ptr1)
+            )
+        );
+    }
+    test_field_baz_ptr1();
+    fn test_field_baz_ptr2() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Bar>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).baz_ptr2) as usize - ptr as usize
+            },
+            24usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Bar),
+                "::",
+                stringify!(baz_ptr2)
+            )
+        );
+    }
+    test_field_baz_ptr2();
+    fn test_field_baz_ptr3() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Bar>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).baz_ptr3) as usize - ptr as usize
+            },
+            32usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Bar),
+                "::",
+                stringify!(baz_ptr3)
+            )
+        );
+    }
+    test_field_baz_ptr3();
+    fn test_field_baz_ptr4() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Bar>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).baz_ptr4) as usize - ptr as usize
+            },
+            40usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Bar),
+                "::",
+                stringify!(baz_ptr4)
+            )
+        );
+    }
+    test_field_baz_ptr4();
 }
 impl Default for Bar {
     fn default() -> Self {
diff --git a/tests/expectations/tests/constify-module-enums-simple-nonamespace.rs b/tests/expectations/tests/constify-module-enums-simple-nonamespace.rs
index b664479..c2032b2 100644
--- a/tests/expectations/tests/constify-module-enums-simple-nonamespace.rs
+++ b/tests/expectations/tests/constify-module-enums-simple-nonamespace.rs
@@ -28,16 +28,40 @@
         8usize,
         concat!("Alignment of ", stringify!(Bar))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Bar>())).baz1 as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(Bar), "::", stringify!(baz1))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Bar>())).baz2 as *const _ as usize },
-        8usize,
-        concat!("Offset of field: ", stringify!(Bar), "::", stringify!(baz2))
-    );
+    fn test_field_baz1() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Bar>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).baz1) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Bar),
+                "::",
+                stringify!(baz1)
+            )
+        );
+    }
+    test_field_baz1();
+    fn test_field_baz2() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Bar>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).baz2) as usize - ptr as usize
+            },
+            8usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Bar),
+                "::",
+                stringify!(baz2)
+            )
+        );
+    }
+    test_field_baz2();
 }
 impl Default for Bar {
     fn default() -> Self {
diff --git a/tests/expectations/tests/constify-module-enums-types.rs b/tests/expectations/tests/constify-module-enums-types.rs
index ec7e6c0..7319ec7 100644
--- a/tests/expectations/tests/constify-module-enums-types.rs
+++ b/tests/expectations/tests/constify-module-enums-types.rs
@@ -63,108 +63,176 @@
         8usize,
         concat!("Alignment of ", stringify!(bar))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<bar>())).member1 as *const _ as usize },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(bar),
-            "::",
-            stringify!(member1)
-        )
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<bar>())).member2 as *const _ as usize },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(bar),
-            "::",
-            stringify!(member2)
-        )
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<bar>())).member3 as *const _ as usize },
-        8usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(bar),
-            "::",
-            stringify!(member3)
-        )
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<bar>())).member4 as *const _ as usize },
-        12usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(bar),
-            "::",
-            stringify!(member4)
-        )
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<bar>())).member5 as *const _ as usize },
-        16usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(bar),
-            "::",
-            stringify!(member5)
-        )
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<bar>())).member6 as *const _ as usize },
-        24usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(bar),
-            "::",
-            stringify!(member6)
-        )
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<bar>())).member7 as *const _ as usize },
-        32usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(bar),
-            "::",
-            stringify!(member7)
-        )
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<bar>())).member8 as *const _ as usize },
-        36usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(bar),
-            "::",
-            stringify!(member8)
-        )
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<bar>())).member9 as *const _ as usize },
-        40usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(bar),
-            "::",
-            stringify!(member9)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<bar>())).member10 as *const _ as usize
-        },
-        44usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(bar),
-            "::",
-            stringify!(member10)
-        )
-    );
+    fn test_field_member1() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<bar>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).member1) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(bar),
+                "::",
+                stringify!(member1)
+            )
+        );
+    }
+    test_field_member1();
+    fn test_field_member2() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<bar>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).member2) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(bar),
+                "::",
+                stringify!(member2)
+            )
+        );
+    }
+    test_field_member2();
+    fn test_field_member3() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<bar>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).member3) as usize - ptr as usize
+            },
+            8usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(bar),
+                "::",
+                stringify!(member3)
+            )
+        );
+    }
+    test_field_member3();
+    fn test_field_member4() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<bar>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).member4) as usize - ptr as usize
+            },
+            12usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(bar),
+                "::",
+                stringify!(member4)
+            )
+        );
+    }
+    test_field_member4();
+    fn test_field_member5() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<bar>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).member5) as usize - ptr as usize
+            },
+            16usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(bar),
+                "::",
+                stringify!(member5)
+            )
+        );
+    }
+    test_field_member5();
+    fn test_field_member6() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<bar>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).member6) as usize - ptr as usize
+            },
+            24usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(bar),
+                "::",
+                stringify!(member6)
+            )
+        );
+    }
+    test_field_member6();
+    fn test_field_member7() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<bar>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).member7) as usize - ptr as usize
+            },
+            32usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(bar),
+                "::",
+                stringify!(member7)
+            )
+        );
+    }
+    test_field_member7();
+    fn test_field_member8() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<bar>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).member8) as usize - ptr as usize
+            },
+            36usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(bar),
+                "::",
+                stringify!(member8)
+            )
+        );
+    }
+    test_field_member8();
+    fn test_field_member9() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<bar>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).member9) as usize - ptr as usize
+            },
+            40usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(bar),
+                "::",
+                stringify!(member9)
+            )
+        );
+    }
+    test_field_member9();
+    fn test_field_member10() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<bar>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).member10) as usize - ptr as usize
+            },
+            44usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(bar),
+                "::",
+                stringify!(member10)
+            )
+        );
+    }
+    test_field_member10();
 }
 impl Default for bar {
     fn default() -> Self {
@@ -192,16 +260,23 @@
         4usize,
         concat!("Alignment of ", stringify!(Baz))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Baz>())).member1 as *const _ as usize },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(Baz),
-            "::",
-            stringify!(member1)
-        )
-    );
+    fn test_field_member1() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Baz>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).member1) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Baz),
+                "::",
+                stringify!(member1)
+            )
+        );
+    }
+    test_field_member1();
 }
 impl Default for Baz {
     fn default() -> Self {
@@ -234,11 +309,23 @@
         8usize,
         concat!("Alignment of ", stringify!(Bar))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Bar>())).baz as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(Bar), "::", stringify!(baz))
-    );
+    fn test_field_baz() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Bar>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).baz) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Bar),
+                "::",
+                stringify!(baz)
+            )
+        );
+    }
+    test_field_baz();
 }
 impl Default for Bar {
     fn default() -> Self {
diff --git a/tests/expectations/tests/contains-vs-inherits-zero-sized.rs b/tests/expectations/tests/contains-vs-inherits-zero-sized.rs
index 2882fa8..b218a62 100644
--- a/tests/expectations/tests/contains-vs-inherits-zero-sized.rs
+++ b/tests/expectations/tests/contains-vs-inherits-zero-sized.rs
@@ -43,16 +43,23 @@
         1usize,
         concat!("Alignment of ", stringify!(Inherits))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Inherits>())).b as *const _ as usize },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(Inherits),
-            "::",
-            stringify!(b)
-        )
-    );
+    fn test_field_b() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Inherits>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Inherits),
+                "::",
+                stringify!(b)
+            )
+        );
+    }
+    test_field_b();
 }
 /// This should not get an `_address` byte, but contains `Empty` which *does* get
 /// one, so `sizeof(Contains)` should be `1 + 1`.
@@ -74,26 +81,38 @@
         1usize,
         concat!("Alignment of ", stringify!(Contains))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<Contains>())).empty as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(Contains),
-            "::",
-            stringify!(empty)
-        )
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Contains>())).b as *const _ as usize },
-        1usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(Contains),
-            "::",
-            stringify!(b)
-        )
-    );
+    fn test_field_empty() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Contains>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).empty) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Contains),
+                "::",
+                stringify!(empty)
+            )
+        );
+    }
+    test_field_empty();
+    fn test_field_b() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Contains>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize
+            },
+            1usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Contains),
+                "::",
+                stringify!(b)
+            )
+        );
+    }
+    test_field_b();
 }
diff --git a/tests/expectations/tests/convert-cpp-comment-to-rust.rs b/tests/expectations/tests/convert-cpp-comment-to-rust.rs
index 86279ca..09a22c4 100644
--- a/tests/expectations/tests/convert-cpp-comment-to-rust.rs
+++ b/tests/expectations/tests/convert-cpp-comment-to-rust.rs
@@ -17,55 +17,6 @@
     ///<  pointer to limbs
     pub p: *mut mbedtls_mpi_uint,
 }
-#[test]
-fn bindgen_test_layout_mbedtls_mpi() {
-    assert_eq!(
-        ::std::mem::size_of::<mbedtls_mpi>(),
-        24usize,
-        concat!("Size of: ", stringify!(mbedtls_mpi))
-    );
-    assert_eq!(
-        ::std::mem::align_of::<mbedtls_mpi>(),
-        8usize,
-        concat!("Alignment of ", stringify!(mbedtls_mpi))
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<mbedtls_mpi>())).s as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(mbedtls_mpi),
-            "::",
-            stringify!(s)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<mbedtls_mpi>())).n as *const _ as usize
-        },
-        8usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(mbedtls_mpi),
-            "::",
-            stringify!(n)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<mbedtls_mpi>())).p as *const _ as usize
-        },
-        16usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(mbedtls_mpi),
-            "::",
-            stringify!(p)
-        )
-    );
-}
 impl Default for mbedtls_mpi {
     fn default() -> Self {
         let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
diff --git a/tests/expectations/tests/convert-floats.rs b/tests/expectations/tests/convert-floats.rs
index 6623159..6e6d1c6 100644
--- a/tests/expectations/tests/convert-floats.rs
+++ b/tests/expectations/tests/convert-floats.rs
@@ -33,55 +33,110 @@
         8usize,
         concat!("Alignment of ", stringify!(foo))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<foo>())).bar as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(foo), "::", stringify!(bar))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<foo>())).baz as *const _ as usize },
-        4usize,
-        concat!("Offset of field: ", stringify!(foo), "::", stringify!(baz))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<foo>())).bazz as *const _ as usize },
-        8usize,
-        concat!("Offset of field: ", stringify!(foo), "::", stringify!(bazz))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<foo>())).bazzz as *const _ as usize },
-        16usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo),
-            "::",
-            stringify!(bazzz)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo>())).complexFloat as *const _ as usize
-        },
-        24usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo),
-            "::",
-            stringify!(complexFloat)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo>())).complexDouble as *const _ as usize
-        },
-        32usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo),
-            "::",
-            stringify!(complexDouble)
-        )
-    );
+    fn test_field_bar() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<foo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo),
+                "::",
+                stringify!(bar)
+            )
+        );
+    }
+    test_field_bar();
+    fn test_field_baz() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<foo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).baz) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo),
+                "::",
+                stringify!(baz)
+            )
+        );
+    }
+    test_field_baz();
+    fn test_field_bazz() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<foo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).bazz) as usize - ptr as usize
+            },
+            8usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo),
+                "::",
+                stringify!(bazz)
+            )
+        );
+    }
+    test_field_bazz();
+    fn test_field_bazzz() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<foo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).bazzz) as usize - ptr as usize
+            },
+            16usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo),
+                "::",
+                stringify!(bazzz)
+            )
+        );
+    }
+    test_field_bazzz();
+    fn test_field_complexFloat() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<foo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).complexFloat) as usize -
+                    ptr as usize
+            },
+            24usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo),
+                "::",
+                stringify!(complexFloat)
+            )
+        );
+    }
+    test_field_complexFloat();
+    fn test_field_complexDouble() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<foo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).complexDouble) as usize -
+                    ptr as usize
+            },
+            32usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo),
+                "::",
+                stringify!(complexDouble)
+            )
+        );
+    }
+    test_field_complexDouble();
 }
 impl Default for foo {
     fn default() -> Self {
diff --git a/tests/expectations/tests/ctypes-prefix-path.rs b/tests/expectations/tests/ctypes-prefix-path.rs
index 12cedac..0dc4909 100644
--- a/tests/expectations/tests/ctypes-prefix-path.rs
+++ b/tests/expectations/tests/ctypes-prefix-path.rs
@@ -31,21 +31,47 @@
         8usize,
         concat!("Alignment of ", stringify!(foo))
     );
-    assert_eq!(
-        unsafe { &(*(::core::ptr::null::<foo>())).a as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(foo), "::", stringify!(a))
-    );
-    assert_eq!(
-        unsafe { &(*(::core::ptr::null::<foo>())).b as *const _ as usize },
-        4usize,
-        concat!("Offset of field: ", stringify!(foo), "::", stringify!(b))
-    );
-    assert_eq!(
-        unsafe { &(*(::core::ptr::null::<foo>())).bar as *const _ as usize },
-        8usize,
-        concat!("Offset of field: ", stringify!(foo), "::", stringify!(bar))
-    );
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::core::mem::MaybeUninit::<foo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::core::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            0usize,
+            concat!("Offset of field: ", stringify!(foo), "::", stringify!(a))
+        );
+    }
+    test_field_a();
+    fn test_field_b() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::core::mem::MaybeUninit::<foo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::core::ptr::addr_of!((*ptr).b) as usize - ptr as usize
+            },
+            4usize,
+            concat!("Offset of field: ", stringify!(foo), "::", stringify!(b))
+        );
+    }
+    test_field_b();
+    fn test_field_bar() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::core::mem::MaybeUninit::<foo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::core::ptr::addr_of!((*ptr).bar) as usize - ptr as usize
+            },
+            8usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo),
+                "::",
+                stringify!(bar)
+            )
+        );
+    }
+    test_field_bar();
 }
 impl Default for foo {
     fn default() -> Self {
diff --git a/tests/expectations/tests/derive-bitfield-method-same-name.rs b/tests/expectations/tests/derive-bitfield-method-same-name.rs
index 1dc1d6e..56bbdc5 100644
--- a/tests/expectations/tests/derive-bitfield-method-same-name.rs
+++ b/tests/expectations/tests/derive-bitfield-method-same-name.rs
@@ -114,16 +114,23 @@
         4usize,
         concat!("Alignment of ", stringify!(Foo))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Foo>())).large as *const _ as usize },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(Foo),
-            "::",
-            stringify!(large)
-        )
-    );
+    fn test_field_large() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Foo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).large) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Foo),
+                "::",
+                stringify!(large)
+            )
+        );
+    }
+    test_field_large();
 }
 extern "C" {
     #[link_name = "\u{1}_ZN3Foo4typeEv"]
diff --git a/tests/expectations/tests/derive-clone.rs b/tests/expectations/tests/derive-clone.rs
index e589a29..4a80a85 100644
--- a/tests/expectations/tests/derive-clone.rs
+++ b/tests/expectations/tests/derive-clone.rs
@@ -23,19 +23,24 @@
         4usize,
         concat!("Alignment of ", stringify!(ShouldDeriveClone))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ShouldDeriveClone>())).large as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(ShouldDeriveClone),
-            "::",
-            stringify!(large)
-        )
-    );
+    fn test_field_large() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<ShouldDeriveClone>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).large) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(ShouldDeriveClone),
+                "::",
+                stringify!(large)
+            )
+        );
+    }
+    test_field_large();
 }
 impl Default for ShouldDeriveClone {
     fn default() -> Self {
diff --git a/tests/expectations/tests/derive-clone_1_0.rs b/tests/expectations/tests/derive-clone_1_0.rs
index a437d5c..90c8c72 100644
--- a/tests/expectations/tests/derive-clone_1_0.rs
+++ b/tests/expectations/tests/derive-clone_1_0.rs
@@ -24,19 +24,24 @@
         4usize,
         concat!("Alignment of ", stringify!(ShouldImplClone))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ShouldImplClone>())).large as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(ShouldImplClone),
-            "::",
-            stringify!(large)
-        )
-    );
+    fn test_field_large() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<ShouldImplClone>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).large) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(ShouldImplClone),
+                "::",
+                stringify!(large)
+            )
+        );
+    }
+    test_field_large();
 }
 impl Clone for ShouldImplClone {
     fn clone(&self) -> Self {
diff --git a/tests/expectations/tests/derive-custom.rs b/tests/expectations/tests/derive-custom.rs
index 1cae9af..542b6bb 100644
--- a/tests/expectations/tests/derive-custom.rs
+++ b/tests/expectations/tests/derive-custom.rs
@@ -11,29 +11,6 @@
 pub struct my_type {
     pub a: ::std::os::raw::c_int,
 }
-#[test]
-fn bindgen_test_layout_my_type() {
-    assert_eq!(
-        ::std::mem::size_of::<my_type>(),
-        4usize,
-        concat!("Size of: ", stringify!(my_type))
-    );
-    assert_eq!(
-        ::std::mem::align_of::<my_type>(),
-        4usize,
-        concat!("Alignment of ", stringify!(my_type))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<my_type>())).a as *const _ as usize },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(my_type),
-            "::",
-            stringify!(a)
-        )
-    );
-}
 /// <div rustbindgen derive="Debug"></div>
 /// <div rustbindgen derive="Clone"></div>
 #[repr(C)]
@@ -41,55 +18,9 @@
 pub struct my_type2 {
     pub a: ::std::os::raw::c_uint,
 }
-#[test]
-fn bindgen_test_layout_my_type2() {
-    assert_eq!(
-        ::std::mem::size_of::<my_type2>(),
-        4usize,
-        concat!("Size of: ", stringify!(my_type2))
-    );
-    assert_eq!(
-        ::std::mem::align_of::<my_type2>(),
-        4usize,
-        concat!("Alignment of ", stringify!(my_type2))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<my_type2>())).a as *const _ as usize },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(my_type2),
-            "::",
-            stringify!(a)
-        )
-    );
-}
 /// <div rustbindgen derive="Debug" derive="Clone"></div>
 #[repr(C)]
 #[derive(Default, Debug, Clone)]
 pub struct my_type3 {
     pub a: ::std::os::raw::c_ulong,
 }
-#[test]
-fn bindgen_test_layout_my_type3() {
-    assert_eq!(
-        ::std::mem::size_of::<my_type3>(),
-        8usize,
-        concat!("Size of: ", stringify!(my_type3))
-    );
-    assert_eq!(
-        ::std::mem::align_of::<my_type3>(),
-        8usize,
-        concat!("Alignment of ", stringify!(my_type3))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<my_type3>())).a as *const _ as usize },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(my_type3),
-            "::",
-            stringify!(a)
-        )
-    );
-}
diff --git a/tests/expectations/tests/derive-debug-bitfield-core.rs b/tests/expectations/tests/derive-debug-bitfield-core.rs
index 33f0f2f..249df3d 100644
--- a/tests/expectations/tests/derive-debug-bitfield-core.rs
+++ b/tests/expectations/tests/derive-debug-bitfield-core.rs
@@ -112,18 +112,24 @@
         4usize,
         concat!("Alignment of ", stringify!(C))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::core::ptr::null::<C>())).large_array as *const _ as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C),
-            "::",
-            stringify!(large_array)
-        )
-    );
+    fn test_field_large_array() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::core::mem::MaybeUninit::<C>::uninit();
+                let ptr = uninit.as_ptr();
+                ::core::ptr::addr_of!((*ptr).large_array) as usize -
+                    ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C),
+                "::",
+                stringify!(large_array)
+            )
+        );
+    }
+    test_field_large_array();
 }
 impl Default for C {
     fn default() -> Self {
diff --git a/tests/expectations/tests/derive-debug-bitfield.rs b/tests/expectations/tests/derive-debug-bitfield.rs
index 00976b5..4ca28af 100644
--- a/tests/expectations/tests/derive-debug-bitfield.rs
+++ b/tests/expectations/tests/derive-debug-bitfield.rs
@@ -110,18 +110,23 @@
         4usize,
         concat!("Alignment of ", stringify!(C))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C>())).large_array as *const _ as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C),
-            "::",
-            stringify!(large_array)
-        )
-    );
+    fn test_field_large_array() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<C>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).large_array) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C),
+                "::",
+                stringify!(large_array)
+            )
+        );
+    }
+    test_field_large_array();
 }
 impl Default for C {
     fn default() -> Self {
diff --git a/tests/expectations/tests/derive-debug-function-pointer.rs b/tests/expectations/tests/derive-debug-function-pointer.rs
index c031897..9f4cece 100644
--- a/tests/expectations/tests/derive-debug-function-pointer.rs
+++ b/tests/expectations/tests/derive-debug-function-pointer.rs
@@ -25,30 +25,40 @@
         8usize,
         concat!("Alignment of ", stringify!(Nice))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<Nice>())).pointer as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(Nice),
-            "::",
-            stringify!(pointer)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<Nice>())).large_array as *const _ as usize
-        },
-        8usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(Nice),
-            "::",
-            stringify!(large_array)
-        )
-    );
+    fn test_field_pointer() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Nice>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).pointer) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Nice),
+                "::",
+                stringify!(pointer)
+            )
+        );
+    }
+    test_field_pointer();
+    fn test_field_large_array() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Nice>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).large_array) as usize - ptr as usize
+            },
+            8usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Nice),
+                "::",
+                stringify!(large_array)
+            )
+        );
+    }
+    test_field_large_array();
 }
 impl Default for Nice {
     fn default() -> Self {
diff --git a/tests/expectations/tests/derive-debug-mangle-name.rs b/tests/expectations/tests/derive-debug-mangle-name.rs
index ed54164..8e66efc 100644
--- a/tests/expectations/tests/derive-debug-mangle-name.rs
+++ b/tests/expectations/tests/derive-debug-mangle-name.rs
@@ -30,32 +30,44 @@
         4usize,
         concat!("Alignment of ", stringify!(perf_event_attr__bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<perf_event_attr__bindgen_ty_1>())).b
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(perf_event_attr__bindgen_ty_1),
-            "::",
-            stringify!(b)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<perf_event_attr__bindgen_ty_1>())).c
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(perf_event_attr__bindgen_ty_1),
-            "::",
-            stringify!(c)
-        )
-    );
+    fn test_field_b() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    perf_event_attr__bindgen_ty_1,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(perf_event_attr__bindgen_ty_1),
+                "::",
+                stringify!(b)
+            )
+        );
+    }
+    test_field_b();
+    fn test_field_c() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    perf_event_attr__bindgen_ty_1,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).c) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(perf_event_attr__bindgen_ty_1),
+                "::",
+                stringify!(c)
+            )
+        );
+    }
+    test_field_c();
 }
 impl Default for perf_event_attr__bindgen_ty_1 {
     fn default() -> Self {
@@ -83,31 +95,42 @@
         4usize,
         concat!("Alignment of ", stringify!(perf_event_attr))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<perf_event_attr>())).type_ as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(perf_event_attr),
-            "::",
-            stringify!(type_)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<perf_event_attr>())).a as *const _ as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(perf_event_attr),
-            "::",
-            stringify!(a)
-        )
-    );
+    fn test_field_type() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<perf_event_attr>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).type_) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(perf_event_attr),
+                "::",
+                stringify!(type_)
+            )
+        );
+    }
+    test_field_type();
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<perf_event_attr>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(perf_event_attr),
+                "::",
+                stringify!(a)
+            )
+        );
+    }
+    test_field_a();
 }
 impl Default for perf_event_attr {
     fn default() -> Self {
diff --git a/tests/expectations/tests/derive-debug-opaque-template-instantiation.rs b/tests/expectations/tests/derive-debug-opaque-template-instantiation.rs
index ceb70ff..78101ad 100644
--- a/tests/expectations/tests/derive-debug-opaque-template-instantiation.rs
+++ b/tests/expectations/tests/derive-debug-opaque-template-instantiation.rs
@@ -21,18 +21,23 @@
         4usize,
         concat!("Alignment of ", stringify!(Instance))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<Instance>())).val as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(Instance),
-            "::",
-            stringify!(val)
-        )
-    );
+    fn test_field_val() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Instance>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).val) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Instance),
+                "::",
+                stringify!(val)
+            )
+        );
+    }
+    test_field_val();
 }
 impl Default for Instance {
     fn default() -> Self {
diff --git a/tests/expectations/tests/derive-debug-opaque.rs b/tests/expectations/tests/derive-debug-opaque.rs
index 411c7a7..06f3395 100644
--- a/tests/expectations/tests/derive-debug-opaque.rs
+++ b/tests/expectations/tests/derive-debug-opaque.rs
@@ -53,18 +53,23 @@
         4usize,
         concat!("Alignment of ", stringify!(OpaqueUser))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<OpaqueUser>())).opaque as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(OpaqueUser),
-            "::",
-            stringify!(opaque)
-        )
-    );
+    fn test_field_opaque() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<OpaqueUser>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).opaque) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(OpaqueUser),
+                "::",
+                stringify!(opaque)
+            )
+        );
+    }
+    test_field_opaque();
 }
 impl Default for OpaqueUser {
     fn default() -> Self {
diff --git a/tests/expectations/tests/derive-default-and-blocklist.rs b/tests/expectations/tests/derive-default-and-blocklist.rs
index 5d53ede..4b8ecf9 100644
--- a/tests/expectations/tests/derive-default-and-blocklist.rs
+++ b/tests/expectations/tests/derive-default-and-blocklist.rs
@@ -25,19 +25,24 @@
         1usize,
         concat!("Alignment of ", stringify!(ShouldNotDeriveDefault))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ShouldNotDeriveDefault>())).a as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(ShouldNotDeriveDefault),
-            "::",
-            stringify!(a)
-        )
-    );
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<ShouldNotDeriveDefault>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(ShouldNotDeriveDefault),
+                "::",
+                stringify!(a)
+            )
+        );
+    }
+    test_field_a();
 }
 impl Default for ShouldNotDeriveDefault {
     fn default() -> Self {
diff --git a/tests/expectations/tests/derive-fn-ptr.rs b/tests/expectations/tests/derive-fn-ptr.rs
index 7c9f426..bab7f6b 100644
--- a/tests/expectations/tests/derive-fn-ptr.rs
+++ b/tests/expectations/tests/derive-fn-ptr.rs
@@ -42,18 +42,23 @@
         8usize,
         concat!("Alignment of ", stringify!(Foo))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<Foo>())).callback as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(Foo),
-            "::",
-            stringify!(callback)
-        )
-    );
+    fn test_field_callback() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Foo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).callback) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Foo),
+                "::",
+                stringify!(callback)
+            )
+        );
+    }
+    test_field_callback();
 }
 pub type my_fun2_t = ::std::option::Option<
     unsafe extern "C" fn(
@@ -88,16 +93,21 @@
         8usize,
         concat!("Alignment of ", stringify!(Bar))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<Bar>())).callback as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(Bar),
-            "::",
-            stringify!(callback)
-        )
-    );
+    fn test_field_callback() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Bar>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).callback) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Bar),
+                "::",
+                stringify!(callback)
+            )
+        );
+    }
+    test_field_callback();
 }
diff --git a/tests/expectations/tests/derive-hash-and-blocklist.rs b/tests/expectations/tests/derive-hash-and-blocklist.rs
index 8e1190e..ca436fa 100644
--- a/tests/expectations/tests/derive-hash-and-blocklist.rs
+++ b/tests/expectations/tests/derive-hash-and-blocklist.rs
@@ -24,19 +24,24 @@
         1usize,
         concat!("Alignment of ", stringify!(ShouldNotDeriveHash))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ShouldNotDeriveHash>())).a as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(ShouldNotDeriveHash),
-            "::",
-            stringify!(a)
-        )
-    );
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<ShouldNotDeriveHash>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(ShouldNotDeriveHash),
+                "::",
+                stringify!(a)
+            )
+        );
+    }
+    test_field_a();
 }
 impl Default for ShouldNotDeriveHash {
     fn default() -> Self {
diff --git a/tests/expectations/tests/derive-hash-blocklisting.rs b/tests/expectations/tests/derive-hash-blocklisting.rs
index 7cd29c2..e2aaf03 100644
--- a/tests/expectations/tests/derive-hash-blocklisting.rs
+++ b/tests/expectations/tests/derive-hash-blocklisting.rs
@@ -30,18 +30,24 @@
         4usize,
         concat!("Alignment of ", stringify!(AllowlistedOne))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<AllowlistedOne>())).a as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(AllowlistedOne),
-            "::",
-            stringify!(a)
-        )
-    );
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<AllowlistedOne>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(AllowlistedOne),
+                "::",
+                stringify!(a)
+            )
+        );
+    }
+    test_field_a();
 }
 impl Default for AllowlistedOne {
     fn default() -> Self {
@@ -69,18 +75,24 @@
         4usize,
         concat!("Alignment of ", stringify!(AllowlistedTwo))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<AllowlistedTwo>())).b as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(AllowlistedTwo),
-            "::",
-            stringify!(b)
-        )
-    );
+    fn test_field_b() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<AllowlistedTwo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(AllowlistedTwo),
+                "::",
+                stringify!(b)
+            )
+        );
+    }
+    test_field_b();
 }
 impl Default for AllowlistedTwo {
     fn default() -> Self {
diff --git a/tests/expectations/tests/derive-hash-struct-with-anon-struct-float.rs b/tests/expectations/tests/derive-hash-struct-with-anon-struct-float.rs
index 92846f3..c519885 100644
--- a/tests/expectations/tests/derive-hash-struct-with-anon-struct-float.rs
+++ b/tests/expectations/tests/derive-hash-struct-with-anon-struct-float.rs
@@ -29,30 +29,42 @@
         4usize,
         concat!("Alignment of ", stringify!(foo__bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1>())).a as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1),
-            "::",
-            stringify!(a)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1>())).b as *const _ as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1),
-            "::",
-            stringify!(b)
-        )
-    );
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<foo__bindgen_ty_1>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo__bindgen_ty_1),
+                "::",
+                stringify!(a)
+            )
+        );
+    }
+    test_field_a();
+    fn test_field_b() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<foo__bindgen_ty_1>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo__bindgen_ty_1),
+                "::",
+                stringify!(b)
+            )
+        );
+    }
+    test_field_b();
 }
 #[test]
 fn bindgen_test_layout_foo() {
@@ -66,9 +78,21 @@
         4usize,
         concat!("Alignment of ", stringify!(foo))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<foo>())).bar as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(foo), "::", stringify!(bar))
-    );
+    fn test_field_bar() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<foo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo),
+                "::",
+                stringify!(bar)
+            )
+        );
+    }
+    test_field_bar();
 }
diff --git a/tests/expectations/tests/derive-hash-struct-with-float-array.rs b/tests/expectations/tests/derive-hash-struct-with-float-array.rs
index e2e1bcef..b561cc3 100644
--- a/tests/expectations/tests/derive-hash-struct-with-float-array.rs
+++ b/tests/expectations/tests/derive-hash-struct-with-float-array.rs
@@ -23,9 +23,21 @@
         4usize,
         concat!("Alignment of ", stringify!(foo))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<foo>())).bar as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(foo), "::", stringify!(bar))
-    );
+    fn test_field_bar() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<foo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo),
+                "::",
+                stringify!(bar)
+            )
+        );
+    }
+    test_field_bar();
 }
diff --git a/tests/expectations/tests/derive-hash-struct-with-incomplete-array.rs b/tests/expectations/tests/derive-hash-struct-with-incomplete-array.rs
index 8510807..abba4b2 100644
--- a/tests/expectations/tests/derive-hash-struct-with-incomplete-array.rs
+++ b/tests/expectations/tests/derive-hash-struct-with-incomplete-array.rs
@@ -53,24 +53,36 @@
         4usize,
         concat!("Alignment of ", stringify!(test))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<test>())).a as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(test), "::", stringify!(a))
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<test>())).zero_length_array as *const _
-                as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(test),
-            "::",
-            stringify!(zero_length_array)
-        )
-    );
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<test>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            0usize,
+            concat!("Offset of field: ", stringify!(test), "::", stringify!(a))
+        );
+    }
+    test_field_a();
+    fn test_field_zero_length_array() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<test>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).zero_length_array) as usize -
+                    ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(test),
+                "::",
+                stringify!(zero_length_array)
+            )
+        );
+    }
+    test_field_zero_length_array();
 }
 #[repr(C)]
 #[derive(Debug, Default)]
diff --git a/tests/expectations/tests/derive-hash-struct-with-pointer.rs b/tests/expectations/tests/derive-hash-struct-with-pointer.rs
index e98bbf0..6588100 100644
--- a/tests/expectations/tests/derive-hash-struct-with-pointer.rs
+++ b/tests/expectations/tests/derive-hash-struct-with-pointer.rs
@@ -23,18 +23,24 @@
         8usize,
         concat!("Alignment of ", stringify!(ConstPtrMutObj))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ConstPtrMutObj>())).bar as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(ConstPtrMutObj),
-            "::",
-            stringify!(bar)
-        )
-    );
+    fn test_field_bar() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<ConstPtrMutObj>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(ConstPtrMutObj),
+                "::",
+                stringify!(bar)
+            )
+        );
+    }
+    test_field_bar();
 }
 impl Default for ConstPtrMutObj {
     fn default() -> Self {
@@ -62,18 +68,23 @@
         8usize,
         concat!("Alignment of ", stringify!(MutPtrMutObj))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<MutPtrMutObj>())).bar as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(MutPtrMutObj),
-            "::",
-            stringify!(bar)
-        )
-    );
+    fn test_field_bar() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<MutPtrMutObj>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(MutPtrMutObj),
+                "::",
+                stringify!(bar)
+            )
+        );
+    }
+    test_field_bar();
 }
 impl Default for MutPtrMutObj {
     fn default() -> Self {
@@ -101,18 +112,24 @@
         8usize,
         concat!("Alignment of ", stringify!(MutPtrConstObj))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<MutPtrConstObj>())).bar as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(MutPtrConstObj),
-            "::",
-            stringify!(bar)
-        )
-    );
+    fn test_field_bar() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<MutPtrConstObj>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(MutPtrConstObj),
+                "::",
+                stringify!(bar)
+            )
+        );
+    }
+    test_field_bar();
 }
 impl Default for MutPtrConstObj {
     fn default() -> Self {
@@ -140,19 +157,24 @@
         8usize,
         concat!("Alignment of ", stringify!(ConstPtrConstObj))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ConstPtrConstObj>())).bar as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(ConstPtrConstObj),
-            "::",
-            stringify!(bar)
-        )
-    );
+    fn test_field_bar() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<ConstPtrConstObj>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(ConstPtrConstObj),
+                "::",
+                stringify!(bar)
+            )
+        );
+    }
+    test_field_bar();
 }
 impl Default for ConstPtrConstObj {
     fn default() -> Self {
diff --git a/tests/expectations/tests/derive-hash-template-inst-float.rs b/tests/expectations/tests/derive-hash-template-inst-float.rs
index f861815..18cccb3 100644
--- a/tests/expectations/tests/derive-hash-template-inst-float.rs
+++ b/tests/expectations/tests/derive-hash-template-inst-float.rs
@@ -39,11 +39,23 @@
         4usize,
         concat!("Alignment of ", stringify!(IntStr))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<IntStr>())).a as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(IntStr), "::", stringify!(a))
-    );
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<IntStr>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(IntStr),
+                "::",
+                stringify!(a)
+            )
+        );
+    }
+    test_field_a();
 }
 impl Default for IntStr {
     fn default() -> Self {
@@ -72,16 +84,23 @@
         4usize,
         concat!("Alignment of ", stringify!(FloatStr))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<FloatStr>())).a as *const _ as usize },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(FloatStr),
-            "::",
-            stringify!(a)
-        )
-    );
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<FloatStr>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(FloatStr),
+                "::",
+                stringify!(a)
+            )
+        );
+    }
+    test_field_a();
 }
 impl Default for FloatStr {
     fn default() -> Self {
diff --git a/tests/expectations/tests/derive-partialeq-and-blocklist.rs b/tests/expectations/tests/derive-partialeq-and-blocklist.rs
index d9dfb44..23c493d 100644
--- a/tests/expectations/tests/derive-partialeq-and-blocklist.rs
+++ b/tests/expectations/tests/derive-partialeq-and-blocklist.rs
@@ -25,19 +25,25 @@
         1usize,
         concat!("Alignment of ", stringify!(ShouldNotDerivePartialEq))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ShouldNotDerivePartialEq>())).a as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(ShouldNotDerivePartialEq),
-            "::",
-            stringify!(a)
-        )
-    );
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<ShouldNotDerivePartialEq>::uninit(
+                    );
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(ShouldNotDerivePartialEq),
+                "::",
+                stringify!(a)
+            )
+        );
+    }
+    test_field_a();
 }
 impl Default for ShouldNotDerivePartialEq {
     fn default() -> Self {
diff --git a/tests/expectations/tests/derive-partialeq-base.rs b/tests/expectations/tests/derive-partialeq-base.rs
index cdf8dff..25f3754 100644
--- a/tests/expectations/tests/derive-partialeq-base.rs
+++ b/tests/expectations/tests/derive-partialeq-base.rs
@@ -22,16 +22,23 @@
         4usize,
         concat!("Alignment of ", stringify!(Base))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Base>())).large as *const _ as usize },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(Base),
-            "::",
-            stringify!(large)
-        )
-    );
+    fn test_field_large() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Base>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).large) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Base),
+                "::",
+                stringify!(large)
+            )
+        );
+    }
+    test_field_large();
 }
 impl Default for Base {
     fn default() -> Self {
diff --git a/tests/expectations/tests/derive-partialeq-bitfield.rs b/tests/expectations/tests/derive-partialeq-bitfield.rs
index cffffca..b27f1cb 100644
--- a/tests/expectations/tests/derive-partialeq-bitfield.rs
+++ b/tests/expectations/tests/derive-partialeq-bitfield.rs
@@ -110,18 +110,23 @@
         4usize,
         concat!("Alignment of ", stringify!(C))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C>())).large_array as *const _ as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C),
-            "::",
-            stringify!(large_array)
-        )
-    );
+    fn test_field_large_array() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<C>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).large_array) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C),
+                "::",
+                stringify!(large_array)
+            )
+        );
+    }
+    test_field_large_array();
 }
 impl Default for C {
     fn default() -> Self {
diff --git a/tests/expectations/tests/derive-partialeq-core.rs b/tests/expectations/tests/derive-partialeq-core.rs
index 8cdfb92..eec0232 100644
--- a/tests/expectations/tests/derive-partialeq-core.rs
+++ b/tests/expectations/tests/derive-partialeq-core.rs
@@ -24,18 +24,24 @@
         4usize,
         concat!("Alignment of ", stringify!(C))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::core::ptr::null::<C>())).large_array as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C),
-            "::",
-            stringify!(large_array)
-        )
-    );
+    fn test_field_large_array() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::core::mem::MaybeUninit::<C>::uninit();
+                let ptr = uninit.as_ptr();
+                ::core::ptr::addr_of!((*ptr).large_array) as usize -
+                    ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C),
+                "::",
+                stringify!(large_array)
+            )
+        );
+    }
+    test_field_large_array();
 }
 impl Default for C {
     fn default() -> Self {
diff --git a/tests/expectations/tests/derive-partialeq-pointer.rs b/tests/expectations/tests/derive-partialeq-pointer.rs
index 17a5edc..4b29a5d 100644
--- a/tests/expectations/tests/derive-partialeq-pointer.rs
+++ b/tests/expectations/tests/derive-partialeq-pointer.rs
@@ -22,11 +22,18 @@
         8usize,
         concat!("Alignment of ", stringify!(Bar))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Bar>())).b as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(Bar), "::", stringify!(b))
-    );
+    fn test_field_b() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Bar>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize
+            },
+            0usize,
+            concat!("Offset of field: ", stringify!(Bar), "::", stringify!(b))
+        );
+    }
+    test_field_b();
 }
 impl Default for Bar {
     fn default() -> Self {
@@ -108,11 +115,18 @@
         1usize,
         concat!("Alignment of ", stringify!(a))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<a>())).d as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(a), "::", stringify!(d))
-    );
+    fn test_field_d() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<a>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).d) as usize - ptr as usize
+            },
+            0usize,
+            concat!("Offset of field: ", stringify!(a), "::", stringify!(d))
+        );
+    }
+    test_field_d();
 }
 impl Default for a {
     fn default() -> Self {
diff --git a/tests/expectations/tests/derive-partialeq-union.rs b/tests/expectations/tests/derive-partialeq-union.rs
index b97c053..0007477 100644
--- a/tests/expectations/tests/derive-partialeq-union.rs
+++ b/tests/expectations/tests/derive-partialeq-union.rs
@@ -24,32 +24,44 @@
         4usize,
         concat!("Alignment of ", stringify!(ShouldNotDerivePartialEq))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ShouldNotDerivePartialEq>())).a as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(ShouldNotDerivePartialEq),
-            "::",
-            stringify!(a)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ShouldNotDerivePartialEq>())).b as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(ShouldNotDerivePartialEq),
-            "::",
-            stringify!(b)
-        )
-    );
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<ShouldNotDerivePartialEq>::uninit(
+                    );
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(ShouldNotDerivePartialEq),
+                "::",
+                stringify!(a)
+            )
+        );
+    }
+    test_field_a();
+    fn test_field_b() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<ShouldNotDerivePartialEq>::uninit(
+                    );
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(ShouldNotDerivePartialEq),
+                "::",
+                stringify!(b)
+            )
+        );
+    }
+    test_field_b();
 }
 impl Default for ShouldNotDerivePartialEq {
     fn default() -> Self {
diff --git a/tests/expectations/tests/derive-partialeq-union_1_0.rs b/tests/expectations/tests/derive-partialeq-union_1_0.rs
index 2098849..dd6f756 100644
--- a/tests/expectations/tests/derive-partialeq-union_1_0.rs
+++ b/tests/expectations/tests/derive-partialeq-union_1_0.rs
@@ -68,32 +68,42 @@
         4usize,
         concat!("Alignment of ", stringify!(ShouldDerivePartialEq))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ShouldDerivePartialEq>())).a as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(ShouldDerivePartialEq),
-            "::",
-            stringify!(a)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ShouldDerivePartialEq>())).b as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(ShouldDerivePartialEq),
-            "::",
-            stringify!(b)
-        )
-    );
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<ShouldDerivePartialEq>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(ShouldDerivePartialEq),
+                "::",
+                stringify!(a)
+            )
+        );
+    }
+    test_field_a();
+    fn test_field_b() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<ShouldDerivePartialEq>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(ShouldDerivePartialEq),
+                "::",
+                stringify!(b)
+            )
+        );
+    }
+    test_field_b();
 }
 impl Clone for ShouldDerivePartialEq {
     fn clone(&self) -> Self {
diff --git a/tests/expectations/tests/disable-nested-struct-naming.rs b/tests/expectations/tests/disable-nested-struct-naming.rs
index a9ad26a..2339104 100644
--- a/tests/expectations/tests/disable-nested-struct-naming.rs
+++ b/tests/expectations/tests/disable-nested-struct-naming.rs
@@ -45,11 +45,23 @@
         4usize,
         concat!("Alignment of ", stringify!(bar4))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<bar4>())).x4 as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(bar4), "::", stringify!(x4))
-    );
+    fn test_field_x4() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<bar4>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).x4) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(bar4),
+                "::",
+                stringify!(x4)
+            )
+        );
+    }
+    test_field_x4();
 }
 #[test]
 fn bindgen_test_layout_bar1__bindgen_ty_1__bindgen_ty_1() {
@@ -66,32 +78,44 @@
             stringify!(bar1__bindgen_ty_1__bindgen_ty_1)
         )
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<bar1__bindgen_ty_1__bindgen_ty_1>())).x3
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(bar1__bindgen_ty_1__bindgen_ty_1),
-            "::",
-            stringify!(x3)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<bar1__bindgen_ty_1__bindgen_ty_1>())).b4
-                as *const _ as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(bar1__bindgen_ty_1__bindgen_ty_1),
-            "::",
-            stringify!(b4)
-        )
-    );
+    fn test_field_x3() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    bar1__bindgen_ty_1__bindgen_ty_1,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).x3) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(bar1__bindgen_ty_1__bindgen_ty_1),
+                "::",
+                stringify!(x3)
+            )
+        );
+    }
+    test_field_x3();
+    fn test_field_b4() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    bar1__bindgen_ty_1__bindgen_ty_1,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).b4) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(bar1__bindgen_ty_1__bindgen_ty_1),
+                "::",
+                stringify!(b4)
+            )
+        );
+    }
+    test_field_b4();
 }
 #[test]
 fn bindgen_test_layout_bar1__bindgen_ty_1() {
@@ -105,32 +129,42 @@
         4usize,
         concat!("Alignment of ", stringify!(bar1__bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<bar1__bindgen_ty_1>())).x2 as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(bar1__bindgen_ty_1),
-            "::",
-            stringify!(x2)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<bar1__bindgen_ty_1>())).b3 as *const _
-                as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(bar1__bindgen_ty_1),
-            "::",
-            stringify!(b3)
-        )
-    );
+    fn test_field_x2() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<bar1__bindgen_ty_1>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).x2) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(bar1__bindgen_ty_1),
+                "::",
+                stringify!(x2)
+            )
+        );
+    }
+    test_field_x2();
+    fn test_field_b3() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<bar1__bindgen_ty_1>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).b3) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(bar1__bindgen_ty_1),
+                "::",
+                stringify!(b3)
+            )
+        );
+    }
+    test_field_b3();
 }
 #[test]
 fn bindgen_test_layout_bar1() {
@@ -144,16 +178,40 @@
         4usize,
         concat!("Alignment of ", stringify!(bar1))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<bar1>())).x1 as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(bar1), "::", stringify!(x1))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<bar1>())).b2 as *const _ as usize },
-        4usize,
-        concat!("Offset of field: ", stringify!(bar1), "::", stringify!(b2))
-    );
+    fn test_field_x1() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<bar1>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).x1) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(bar1),
+                "::",
+                stringify!(x1)
+            )
+        );
+    }
+    test_field_x1();
+    fn test_field_b2() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<bar1>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).b2) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(bar1),
+                "::",
+                stringify!(b2)
+            )
+        );
+    }
+    test_field_b2();
 }
 #[test]
 fn bindgen_test_layout_foo() {
@@ -167,11 +225,18 @@
         4usize,
         concat!("Alignment of ", stringify!(foo))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<foo>())).b1 as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(foo), "::", stringify!(b1))
-    );
+    fn test_field_b1() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<foo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).b1) as usize - ptr as usize
+            },
+            0usize,
+            concat!("Offset of field: ", stringify!(foo), "::", stringify!(b1))
+        );
+    }
+    test_field_b1();
 }
 #[repr(C)]
 #[derive(Debug, Default, Copy, Clone)]
@@ -200,11 +265,18 @@
         4usize,
         concat!("Alignment of ", stringify!(baz))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<baz>())).x as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(baz), "::", stringify!(x))
-    );
+    fn test_field_x() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<baz>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).x) as usize - ptr as usize
+            },
+            0usize,
+            concat!("Offset of field: ", stringify!(baz), "::", stringify!(x))
+        );
+    }
+    test_field_x();
 }
 #[test]
 fn bindgen_test_layout__bindgen_ty_1__bindgen_ty_1() {
@@ -218,19 +290,25 @@
         4usize,
         concat!("Alignment of ", stringify!(_bindgen_ty_1__bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<_bindgen_ty_1__bindgen_ty_1>())).b
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(_bindgen_ty_1__bindgen_ty_1),
-            "::",
-            stringify!(b)
-        )
-    );
+    fn test_field_b() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    _bindgen_ty_1__bindgen_ty_1,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(_bindgen_ty_1__bindgen_ty_1),
+                "::",
+                stringify!(b)
+            )
+        );
+    }
+    test_field_b();
 }
 #[test]
 fn bindgen_test_layout__bindgen_ty_1() {
@@ -244,18 +322,23 @@
         4usize,
         concat!("Alignment of ", stringify!(_bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<_bindgen_ty_1>())).anon2 as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(_bindgen_ty_1),
-            "::",
-            stringify!(anon2)
-        )
-    );
+    fn test_field_anon2() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<_bindgen_ty_1>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).anon2) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(_bindgen_ty_1),
+                "::",
+                stringify!(anon2)
+            )
+        );
+    }
+    test_field_anon2();
 }
 extern "C" {
     pub static mut anon1: _bindgen_ty_1;
diff --git a/tests/expectations/tests/disable-untagged-union.rs b/tests/expectations/tests/disable-untagged-union.rs
index 5300273..912238b 100644
--- a/tests/expectations/tests/disable-untagged-union.rs
+++ b/tests/expectations/tests/disable-untagged-union.rs
@@ -67,14 +67,38 @@
         4usize,
         concat!("Alignment of ", stringify!(Foo))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Foo>())).bar as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(Foo), "::", stringify!(bar))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Foo>())).baz as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(Foo), "::", stringify!(baz))
-    );
+    fn test_field_bar() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Foo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Foo),
+                "::",
+                stringify!(bar)
+            )
+        );
+    }
+    test_field_bar();
+    fn test_field_baz() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Foo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).baz) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Foo),
+                "::",
+                stringify!(baz)
+            )
+        );
+    }
+    test_field_baz();
 }
diff --git a/tests/expectations/tests/do-not-derive-copy.rs b/tests/expectations/tests/do-not-derive-copy.rs
index 4112d88..2e02cc5 100644
--- a/tests/expectations/tests/do-not-derive-copy.rs
+++ b/tests/expectations/tests/do-not-derive-copy.rs
@@ -25,17 +25,23 @@
             stringify!(WouldBeCopyButWeAreNotDerivingCopy)
         )
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<WouldBeCopyButWeAreNotDerivingCopy>())).x
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(WouldBeCopyButWeAreNotDerivingCopy),
-            "::",
-            stringify!(x)
-        )
-    );
+    fn test_field_x() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    WouldBeCopyButWeAreNotDerivingCopy,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).x) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(WouldBeCopyButWeAreNotDerivingCopy),
+                "::",
+                stringify!(x)
+            )
+        );
+    }
+    test_field_x();
 }
diff --git a/tests/expectations/tests/doggo-or-null.rs b/tests/expectations/tests/doggo-or-null.rs
index fa7a5e8..0b34b3d 100644
--- a/tests/expectations/tests/doggo-or-null.rs
+++ b/tests/expectations/tests/doggo-or-null.rs
@@ -22,11 +22,23 @@
         4usize,
         concat!("Alignment of ", stringify!(Doggo))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Doggo>())).x as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(Doggo), "::", stringify!(x))
-    );
+    fn test_field_x() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Doggo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).x) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Doggo),
+                "::",
+                stringify!(x)
+            )
+        );
+    }
+    test_field_x();
 }
 #[repr(C)]
 #[derive(Debug, Default, Copy, Clone, Hash, PartialEq)]
diff --git a/tests/expectations/tests/duplicated-namespaces-definitions.rs b/tests/expectations/tests/duplicated-namespaces-definitions.rs
index 324fe2a..2322aa8 100644
--- a/tests/expectations/tests/duplicated-namespaces-definitions.rs
+++ b/tests/expectations/tests/duplicated-namespaces-definitions.rs
@@ -30,30 +30,40 @@
                 4usize,
                 concat!("Alignment of ", stringify!(Bar))
             );
-            assert_eq!(
-                unsafe {
-                    &(*(::std::ptr::null::<Bar>())).foo as *const _ as usize
-                },
-                0usize,
-                concat!(
-                    "Offset of field: ",
-                    stringify!(Bar),
-                    "::",
-                    stringify!(foo)
-                )
-            );
-            assert_eq!(
-                unsafe {
-                    &(*(::std::ptr::null::<Bar>())).baz as *const _ as usize
-                },
-                4usize,
-                concat!(
-                    "Offset of field: ",
-                    stringify!(Bar),
-                    "::",
-                    stringify!(baz)
-                )
-            );
+            fn test_field_foo() {
+                assert_eq!(
+                    unsafe {
+                        let uninit = ::std::mem::MaybeUninit::<Bar>::uninit();
+                        let ptr = uninit.as_ptr();
+                        ::std::ptr::addr_of!((*ptr).foo) as usize - ptr as usize
+                    },
+                    0usize,
+                    concat!(
+                        "Offset of field: ",
+                        stringify!(Bar),
+                        "::",
+                        stringify!(foo)
+                    )
+                );
+            }
+            test_field_foo();
+            fn test_field_baz() {
+                assert_eq!(
+                    unsafe {
+                        let uninit = ::std::mem::MaybeUninit::<Bar>::uninit();
+                        let ptr = uninit.as_ptr();
+                        ::std::ptr::addr_of!((*ptr).baz) as usize - ptr as usize
+                    },
+                    4usize,
+                    concat!(
+                        "Offset of field: ",
+                        stringify!(Bar),
+                        "::",
+                        stringify!(baz)
+                    )
+                );
+            }
+            test_field_baz();
         }
     }
     pub mod bar {
@@ -76,18 +86,23 @@
                 8usize,
                 concat!("Alignment of ", stringify!(Foo))
             );
-            assert_eq!(
-                unsafe {
-                    &(*(::std::ptr::null::<Foo>())).ptr as *const _ as usize
-                },
-                0usize,
-                concat!(
-                    "Offset of field: ",
-                    stringify!(Foo),
-                    "::",
-                    stringify!(ptr)
-                )
-            );
+            fn test_field_ptr() {
+                assert_eq!(
+                    unsafe {
+                        let uninit = ::std::mem::MaybeUninit::<Foo>::uninit();
+                        let ptr = uninit.as_ptr();
+                        ::std::ptr::addr_of!((*ptr).ptr) as usize - ptr as usize
+                    },
+                    0usize,
+                    concat!(
+                        "Offset of field: ",
+                        stringify!(Foo),
+                        "::",
+                        stringify!(ptr)
+                    )
+                );
+            }
+            test_field_ptr();
         }
         impl Default for Foo {
             fn default() -> Self {
diff --git a/tests/expectations/tests/dynamic_loading_attributes.rs b/tests/expectations/tests/dynamic_loading_attributes.rs
new file mode 100644
index 0000000..b50fbd0
--- /dev/null
+++ b/tests/expectations/tests/dynamic_loading_attributes.rs
@@ -0,0 +1,56 @@
+#![allow(
+    dead_code,
+    non_snake_case,
+    non_camel_case_types,
+    non_upper_case_globals
+)]
+
+extern crate libloading;
+pub struct TestLib {
+    __library: ::libloading::Library,
+    pub foo: unsafe extern "C" fn(
+        x: ::std::os::raw::c_int,
+        y: ::std::os::raw::c_int,
+    ) -> ::std::os::raw::c_int,
+    pub baz: unsafe extern "C" fn() -> ::std::os::raw::c_int,
+}
+impl TestLib {
+    pub unsafe fn new<P>(path: P) -> Result<Self, ::libloading::Error>
+    where
+        P: AsRef<::std::ffi::OsStr>,
+    {
+        let library = ::libloading::Library::new(path)?;
+        Self::from_library(library)
+    }
+    pub unsafe fn from_library<L>(
+        library: L,
+    ) -> Result<Self, ::libloading::Error>
+    where
+        L: Into<::libloading::Library>,
+    {
+        let __library = library.into();
+        let foo = __library.get(b"foo\0").map(|sym| *sym)?;
+        let baz = __library.get(b"baz\0").map(|sym| *sym)?;
+        Ok(TestLib {
+            __library,
+            foo,
+            baz,
+        })
+    }
+    #[must_use]
+    #[doc = " @brief A function"]
+    #[doc = ""]
+    #[doc = " @param x"]
+    #[doc = " @param y"]
+    #[doc = " @return int"]
+    pub unsafe fn foo(
+        &self,
+        x: ::std::os::raw::c_int,
+        y: ::std::os::raw::c_int,
+    ) -> ::std::os::raw::c_int {
+        (self.foo)(x, y)
+    }
+    pub unsafe fn baz(&self) -> ::std::os::raw::c_int {
+        (self.baz)()
+    }
+}
diff --git a/tests/expectations/tests/dynamic_loading_with_blocklist.rs b/tests/expectations/tests/dynamic_loading_with_blocklist.rs
index b06a6cf..f2ffe67 100644
--- a/tests/expectations/tests/dynamic_loading_with_blocklist.rs
+++ b/tests/expectations/tests/dynamic_loading_with_blocklist.rs
@@ -22,11 +22,18 @@
         4usize,
         concat!("Alignment of ", stringify!(X))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<X>()))._x as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(X), "::", stringify!(_x))
-    );
+    fn test_field__x() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<X>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr)._x) as usize - ptr as usize
+            },
+            0usize,
+            concat!("Offset of field: ", stringify!(X), "::", stringify!(_x))
+        );
+    }
+    test_field__x();
 }
 extern "C" {
     #[link_name = "\u{1}_ZN1X13some_functionEv"]
diff --git a/tests/expectations/tests/dynamic_loading_with_class.rs b/tests/expectations/tests/dynamic_loading_with_class.rs
index 8a66dc3..03655c8 100644
--- a/tests/expectations/tests/dynamic_loading_with_class.rs
+++ b/tests/expectations/tests/dynamic_loading_with_class.rs
@@ -22,11 +22,18 @@
         4usize,
         concat!("Alignment of ", stringify!(A))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<A>()))._x as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(A), "::", stringify!(_x))
-    );
+    fn test_field__x() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<A>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr)._x) as usize - ptr as usize
+            },
+            0usize,
+            concat!("Offset of field: ", stringify!(A), "::", stringify!(_x))
+        );
+    }
+    test_field__x();
 }
 extern "C" {
     #[link_name = "\u{1}_ZN1A13some_functionEv"]
diff --git a/tests/expectations/tests/enum-default-bitfield.rs b/tests/expectations/tests/enum-default-bitfield.rs
index 1dc27fd..6ea42d0 100644
--- a/tests/expectations/tests/enum-default-bitfield.rs
+++ b/tests/expectations/tests/enum-default-bitfield.rs
@@ -53,16 +53,23 @@
         4usize,
         concat!("Alignment of ", stringify!(foo))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<foo>())).member as *const _ as usize },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo),
-            "::",
-            stringify!(member)
-        )
-    );
+    fn test_field_member() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<foo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).member) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo),
+                "::",
+                stringify!(member)
+            )
+        );
+    }
+    test_field_member();
 }
 impl Default for foo {
     fn default() -> Self {
@@ -184,4 +191,4 @@
 #[repr(transparent)]
 /// <div rustbindgen derive="Debug"></div>
 #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
-pub struct Debug(pub ::std::os::raw::c_uint);
\ No newline at end of file
+pub struct Debug(pub ::std::os::raw::c_uint);
diff --git a/tests/expectations/tests/enum-default-consts.rs b/tests/expectations/tests/enum-default-consts.rs
index 5c023a3..631617b 100644
--- a/tests/expectations/tests/enum-default-consts.rs
+++ b/tests/expectations/tests/enum-default-consts.rs
@@ -10,8 +10,8 @@
 pub struct foo {
     pub member: foo__bindgen_ty_1,
 }
-pub const foo_FOO_A: ::std::os::raw::c_uint = 0;
-pub const foo_FOO_B: ::std::os::raw::c_uint = 1;
+pub const foo_FOO_A: foo__bindgen_ty_1 = 0;
+pub const foo_FOO_B: foo__bindgen_ty_1 = 1;
 pub type foo__bindgen_ty_1 = ::std::os::raw::c_uint;
 #[test]
 fn bindgen_test_layout_foo() {
@@ -25,16 +25,23 @@
         4usize,
         concat!("Alignment of ", stringify!(foo))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<foo>())).member as *const _ as usize },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo),
-            "::",
-            stringify!(member)
-        )
-    );
+    fn test_field_member() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<foo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).member) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo),
+                "::",
+                stringify!(member)
+            )
+        );
+    }
+    test_field_member();
 }
 impl Default for foo {
     fn default() -> Self {
@@ -60,4 +67,4 @@
 pub const Debug_Debug1: Debug = 0;
 pub const Debug_Debug2: Debug = 1;
 /// <div rustbindgen derive="Debug"></div>
-pub type Debug = ::std::os::raw::c_uint;
\ No newline at end of file
+pub type Debug = ::std::os::raw::c_uint;
diff --git a/tests/expectations/tests/enum-default-module.rs b/tests/expectations/tests/enum-default-module.rs
index 156bbca..e74e9fc 100644
--- a/tests/expectations/tests/enum-default-module.rs
+++ b/tests/expectations/tests/enum-default-module.rs
@@ -27,16 +27,23 @@
         4usize,
         concat!("Alignment of ", stringify!(foo))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<foo>())).member as *const _ as usize },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo),
-            "::",
-            stringify!(member)
-        )
-    );
+    fn test_field_member() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<foo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).member) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo),
+                "::",
+                stringify!(member)
+            )
+        );
+    }
+    test_field_member();
 }
 impl Default for foo {
     fn default() -> Self {
@@ -68,4 +75,4 @@
     pub type Type = ::std::os::raw::c_uint;
     pub const Debug1: Type = 0;
     pub const Debug2: Type = 1;
-}
\ No newline at end of file
+}
diff --git a/tests/expectations/tests/enum-default-rust.rs b/tests/expectations/tests/enum-default-rust.rs
index 045330a..8cc843a 100644
--- a/tests/expectations/tests/enum-default-rust.rs
+++ b/tests/expectations/tests/enum-default-rust.rs
@@ -30,16 +30,23 @@
         4usize,
         concat!("Alignment of ", stringify!(foo))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<foo>())).member as *const _ as usize },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo),
-            "::",
-            stringify!(member)
-        )
-    );
+    fn test_field_member() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<foo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).member) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo),
+                "::",
+                stringify!(member)
+            )
+        );
+    }
+    test_field_member();
 }
 impl Default for foo {
     fn default() -> Self {
@@ -74,4 +81,4 @@
 pub enum Debug {
     Debug1 = 0,
     Debug2 = 1,
-}
\ No newline at end of file
+}
diff --git a/tests/expectations/tests/enum-no-debug-rust.rs b/tests/expectations/tests/enum-no-debug-rust.rs
index fa06fbc..6291137 100644
--- a/tests/expectations/tests/enum-no-debug-rust.rs
+++ b/tests/expectations/tests/enum-no-debug-rust.rs
@@ -13,7 +13,7 @@
 pub const foo_FOO_A: foo__bindgen_ty_1 = foo__bindgen_ty_1::FOO_A;
 pub const foo_FOO_B: foo__bindgen_ty_1 = foo__bindgen_ty_1::FOO_B;
 #[repr(u32)]
-#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
+#[derive(Copy, Clone, Hash, PartialEq, Eq)]
 pub enum foo__bindgen_ty_1 {
     FOO_A = 0,
     FOO_B = 1,
@@ -30,16 +30,23 @@
         4usize,
         concat!("Alignment of ", stringify!(foo))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<foo>())).member as *const _ as usize },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo),
-            "::",
-            stringify!(member)
-        )
-    );
+    fn test_field_member() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<foo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).member) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo),
+                "::",
+                stringify!(member)
+            )
+        );
+    }
+    test_field_member();
 }
 impl Default for foo {
     fn default() -> Self {
@@ -51,7 +58,7 @@
     }
 }
 #[repr(u32)]
-#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
+#[derive(Copy, Clone, Hash, PartialEq, Eq)]
 pub enum Foo {
     Bar = 0,
     Qux = 1,
@@ -70,8 +77,8 @@
 }
 #[repr(u32)]
 /// <div rustbindgen derive="Debug"></div>
-#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
+#[derive(Copy, Clone, Hash, PartialEq, Eq, Debug)]
 pub enum Debug {
     Debug1 = 0,
     Debug2 = 1,
-}
\ No newline at end of file
+}
diff --git a/tests/expectations/tests/enum.rs b/tests/expectations/tests/enum.rs
index cc3f493..484adf5 100644
--- a/tests/expectations/tests/enum.rs
+++ b/tests/expectations/tests/enum.rs
@@ -10,8 +10,8 @@
 pub struct foo {
     pub member: foo__bindgen_ty_1,
 }
-pub const foo_FOO_A: ::std::os::raw::c_uint = 0;
-pub const foo_FOO_B: ::std::os::raw::c_uint = 1;
+pub const foo_FOO_A: foo__bindgen_ty_1 = 0;
+pub const foo_FOO_B: foo__bindgen_ty_1 = 1;
 pub type foo__bindgen_ty_1 = ::std::os::raw::c_uint;
 #[test]
 fn bindgen_test_layout_foo() {
@@ -25,16 +25,23 @@
         4usize,
         concat!("Alignment of ", stringify!(foo))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<foo>())).member as *const _ as usize },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo),
-            "::",
-            stringify!(member)
-        )
-    );
+    fn test_field_member() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<foo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).member) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo),
+                "::",
+                stringify!(member)
+            )
+        );
+    }
+    test_field_member();
 }
 impl Default for foo {
     fn default() -> Self {
@@ -58,4 +65,4 @@
 pub const Debug_Debug1: Debug = 0;
 pub const Debug_Debug2: Debug = 1;
 /// <div rustbindgen derive="Debug"></div>
-pub type Debug = ::std::os::raw::c_uint;
\ No newline at end of file
+pub type Debug = ::std::os::raw::c_uint;
diff --git a/tests/expectations/tests/enum_and_vtable_mangling.rs b/tests/expectations/tests/enum_and_vtable_mangling.rs
index 9e9c6bc..5f41a62 100644
--- a/tests/expectations/tests/enum_and_vtable_mangling.rs
+++ b/tests/expectations/tests/enum_and_vtable_mangling.rs
@@ -14,7 +14,9 @@
     whatever_else = 1,
 }
 #[repr(C)]
-pub struct C__bindgen_vtable(::std::os::raw::c_void);
+pub struct C__bindgen_vtable {
+    pub C_match: unsafe extern "C" fn(this: *mut C),
+}
 #[repr(C)]
 #[derive(Debug, Copy, Clone)]
 pub struct C {
@@ -33,11 +35,18 @@
         8usize,
         concat!("Alignment of ", stringify!(C))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<C>())).i as *const _ as usize },
-        8usize,
-        concat!("Offset of field: ", stringify!(C), "::", stringify!(i))
-    );
+    fn test_field_i() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<C>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).i) as usize - ptr as usize
+            },
+            8usize,
+            concat!("Offset of field: ", stringify!(C), "::", stringify!(i))
+        );
+    }
+    test_field_i();
 }
 impl Default for C {
     fn default() -> Self {
diff --git a/tests/expectations/tests/enum_explicit_type_constants.rs b/tests/expectations/tests/enum_explicit_type_constants.rs
index 030d64b..0c833b6 100644
--- a/tests/expectations/tests/enum_explicit_type_constants.rs
+++ b/tests/expectations/tests/enum_explicit_type_constants.rs
@@ -4,6 +4,7 @@
     non_camel_case_types,
     non_upper_case_globals
 )]
+#![cfg(not(target_os = "windows"))]
 
 pub const Foo_Bar: Foo = 0;
 pub const Foo_Qux: Foo = 1;
@@ -25,6 +26,6 @@
 pub type MyType = bool;
 pub const BoolEnumsAreFun2_Value2: BoolEnumsAreFun2 = true;
 pub type BoolEnumsAreFun2 = MyType;
-pub const AnonymousVariantOne: ::std::os::raw::c_uchar = 0;
-pub const AnonymousVariantTwo: ::std::os::raw::c_uchar = 1;
+pub const AnonymousVariantOne: _bindgen_ty_1 = 0;
+pub const AnonymousVariantTwo: _bindgen_ty_1 = 1;
 pub type _bindgen_ty_1 = ::std::os::raw::c_uchar;
diff --git a/tests/expectations/tests/explicit-padding.rs b/tests/expectations/tests/explicit-padding.rs
index 3c42975..508c6b5 100644
--- a/tests/expectations/tests/explicit-padding.rs
+++ b/tests/expectations/tests/explicit-padding.rs
@@ -26,42 +26,57 @@
         4usize,
         concat!("Alignment of ", stringify!(pad_me))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<pad_me>())).first as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(pad_me),
-            "::",
-            stringify!(first)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<pad_me>())).second as *const _ as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(pad_me),
-            "::",
-            stringify!(second)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<pad_me>())).third as *const _ as usize
-        },
-        8usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(pad_me),
-            "::",
-            stringify!(third)
-        )
-    );
+    fn test_field_first() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<pad_me>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).first) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(pad_me),
+                "::",
+                stringify!(first)
+            )
+        );
+    }
+    test_field_first();
+    fn test_field_second() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<pad_me>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).second) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(pad_me),
+                "::",
+                stringify!(second)
+            )
+        );
+    }
+    test_field_second();
+    fn test_field_third() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<pad_me>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).third) as usize - ptr as usize
+            },
+            8usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(pad_me),
+                "::",
+                stringify!(third)
+            )
+        );
+    }
+    test_field_third();
 }
 #[repr(C)]
 #[derive(Copy, Clone)]
@@ -82,42 +97,57 @@
         4usize,
         concat!("Alignment of ", stringify!(dont_pad_me))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<dont_pad_me>())).first as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(dont_pad_me),
-            "::",
-            stringify!(first)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<dont_pad_me>())).second as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(dont_pad_me),
-            "::",
-            stringify!(second)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<dont_pad_me>())).third as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(dont_pad_me),
-            "::",
-            stringify!(third)
-        )
-    );
+    fn test_field_first() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<dont_pad_me>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).first) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(dont_pad_me),
+                "::",
+                stringify!(first)
+            )
+        );
+    }
+    test_field_first();
+    fn test_field_second() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<dont_pad_me>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).second) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(dont_pad_me),
+                "::",
+                stringify!(second)
+            )
+        );
+    }
+    test_field_second();
+    fn test_field_third() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<dont_pad_me>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).third) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(dont_pad_me),
+                "::",
+                stringify!(third)
+            )
+        );
+    }
+    test_field_third();
 }
 impl Default for dont_pad_me {
     fn default() -> Self {
diff --git a/tests/expectations/tests/extern-const-struct.rs b/tests/expectations/tests/extern-const-struct.rs
index fa0018b..ab2b3a6 100644
--- a/tests/expectations/tests/extern-const-struct.rs
+++ b/tests/expectations/tests/extern-const-struct.rs
@@ -22,18 +22,23 @@
         4usize,
         concat!("Alignment of ", stringify!(nsFoo))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<nsFoo>())).details as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(nsFoo),
-            "::",
-            stringify!(details)
-        )
-    );
+    fn test_field_details() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<nsFoo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).details) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(nsFoo),
+                "::",
+                stringify!(details)
+            )
+        );
+    }
+    test_field_details();
 }
 impl Default for nsFoo {
     fn default() -> Self {
diff --git a/tests/expectations/tests/forward-declaration-autoptr.rs b/tests/expectations/tests/forward-declaration-autoptr.rs
index bf0b692..f46f73b 100644
--- a/tests/expectations/tests/forward-declaration-autoptr.rs
+++ b/tests/expectations/tests/forward-declaration-autoptr.rs
@@ -42,18 +42,23 @@
         8usize,
         concat!("Alignment of ", stringify!(Bar))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<Bar>())).m_member as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(Bar),
-            "::",
-            stringify!(m_member)
-        )
-    );
+    fn test_field_m_member() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Bar>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).m_member) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Bar),
+                "::",
+                stringify!(m_member)
+            )
+        );
+    }
+    test_field_m_member();
 }
 impl Default for Bar {
     fn default() -> Self {
diff --git a/tests/expectations/tests/forward_declared_complex_types.rs b/tests/expectations/tests/forward_declared_complex_types.rs
index e185e83..9c3d7c6 100644
--- a/tests/expectations/tests/forward_declared_complex_types.rs
+++ b/tests/expectations/tests/forward_declared_complex_types.rs
@@ -45,11 +45,18 @@
         8usize,
         concat!("Alignment of ", stringify!(Bar))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Bar>())).f as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(Bar), "::", stringify!(f))
-    );
+    fn test_field_f() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Bar>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).f) as usize - ptr as usize
+            },
+            0usize,
+            concat!("Offset of field: ", stringify!(Bar), "::", stringify!(f))
+        );
+    }
+    test_field_f();
 }
 impl Default for Bar {
     fn default() -> Self {
diff --git a/tests/expectations/tests/forward_declared_complex_types_1_0.rs b/tests/expectations/tests/forward_declared_complex_types_1_0.rs
index c6331c6..0e79263 100644
--- a/tests/expectations/tests/forward_declared_complex_types_1_0.rs
+++ b/tests/expectations/tests/forward_declared_complex_types_1_0.rs
@@ -55,11 +55,18 @@
         8usize,
         concat!("Alignment of ", stringify!(Bar))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Bar>())).f as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(Bar), "::", stringify!(f))
-    );
+    fn test_field_f() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Bar>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).f) as usize - ptr as usize
+            },
+            0usize,
+            concat!("Offset of field: ", stringify!(Bar), "::", stringify!(f))
+        );
+    }
+    test_field_f();
 }
 impl Clone for Bar {
     fn clone(&self) -> Self {
diff --git a/tests/expectations/tests/forward_declared_struct.rs b/tests/expectations/tests/forward_declared_struct.rs
index 2ecfc60..eee7da7 100644
--- a/tests/expectations/tests/forward_declared_struct.rs
+++ b/tests/expectations/tests/forward_declared_struct.rs
@@ -22,11 +22,18 @@
         4usize,
         concat!("Alignment of ", stringify!(a))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<a>())).b as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(a), "::", stringify!(b))
-    );
+    fn test_field_b() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<a>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize
+            },
+            0usize,
+            concat!("Offset of field: ", stringify!(a), "::", stringify!(b))
+        );
+    }
+    test_field_b();
 }
 #[repr(C)]
 #[derive(Debug, Default, Copy, Clone)]
@@ -45,9 +52,16 @@
         4usize,
         concat!("Alignment of ", stringify!(c))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<c>())).d as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(c), "::", stringify!(d))
-    );
+    fn test_field_d() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<c>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).d) as usize - ptr as usize
+            },
+            0usize,
+            concat!("Offset of field: ", stringify!(c), "::", stringify!(d))
+        );
+    }
+    test_field_d();
 }
diff --git a/tests/expectations/tests/func_ptr_in_struct.rs b/tests/expectations/tests/func_ptr_in_struct.rs
index 8f98763..8709ee2 100644
--- a/tests/expectations/tests/func_ptr_in_struct.rs
+++ b/tests/expectations/tests/func_ptr_in_struct.rs
@@ -32,9 +32,21 @@
         8usize,
         concat!("Alignment of ", stringify!(Foo))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Foo>())).bar as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(Foo), "::", stringify!(bar))
-    );
+    fn test_field_bar() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Foo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Foo),
+                "::",
+                stringify!(bar)
+            )
+        );
+    }
+    test_field_bar();
 }
diff --git a/tests/expectations/tests/func_return_must_use.rs b/tests/expectations/tests/func_return_must_use.rs
new file mode 100644
index 0000000..6ea6c70
--- /dev/null
+++ b/tests/expectations/tests/func_return_must_use.rs
@@ -0,0 +1,78 @@
+#![allow(
+    dead_code,
+    non_snake_case,
+    non_camel_case_types,
+    non_upper_case_globals
+)]
+
+pub type MustUseInt = ::std::os::raw::c_int;
+extern "C" {
+    #[must_use]
+    pub fn return_int() -> MustUseInt;
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+#[must_use]
+pub struct MustUseStruct {
+    _unused: [u8; 0],
+}
+extern "C" {
+    #[must_use]
+    pub fn return_struct() -> MustUseStruct;
+}
+/// <div rustbindgen mustusetype></div>
+pub type AnnotatedInt = ::std::os::raw::c_int;
+extern "C" {
+    #[must_use]
+    pub fn return_annotated_int() -> AnnotatedInt;
+}
+extern "C" {
+    pub fn return_plain_int() -> ::std::os::raw::c_int;
+}
+/// <div rustbindgen mustusetype></div>
+#[repr(C)]
+#[derive(Debug, Default, Copy, Clone)]
+#[must_use]
+pub struct AnnotatedStruct {}
+#[test]
+fn bindgen_test_layout_AnnotatedStruct() {
+    assert_eq!(
+        ::std::mem::size_of::<AnnotatedStruct>(),
+        0usize,
+        concat!("Size of: ", stringify!(AnnotatedStruct))
+    );
+    assert_eq!(
+        ::std::mem::align_of::<AnnotatedStruct>(),
+        1usize,
+        concat!("Alignment of ", stringify!(AnnotatedStruct))
+    );
+}
+extern "C" {
+    #[must_use]
+    pub fn return_annotated_struct() -> AnnotatedStruct;
+}
+#[repr(C)]
+#[derive(Debug, Default, Copy, Clone)]
+pub struct PlainStruct {}
+#[test]
+fn bindgen_test_layout_PlainStruct() {
+    assert_eq!(
+        ::std::mem::size_of::<PlainStruct>(),
+        0usize,
+        concat!("Size of: ", stringify!(PlainStruct))
+    );
+    assert_eq!(
+        ::std::mem::align_of::<PlainStruct>(),
+        1usize,
+        concat!("Alignment of ", stringify!(PlainStruct))
+    );
+}
+/// <div rustbindgen mustusetype></div>
+pub type TypedefPlainStruct = PlainStruct;
+extern "C" {
+    pub fn return_plain_struct() -> PlainStruct;
+}
+extern "C" {
+    #[must_use]
+    pub fn return_typedef_struct() -> TypedefPlainStruct;
+}
diff --git a/tests/expectations/tests/gen-destructors-neg.rs b/tests/expectations/tests/gen-destructors-neg.rs
index 67b6d70..09c1486 100644
--- a/tests/expectations/tests/gen-destructors-neg.rs
+++ b/tests/expectations/tests/gen-destructors-neg.rs
@@ -22,9 +22,21 @@
         4usize,
         concat!("Alignment of ", stringify!(Foo))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Foo>())).bar as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(Foo), "::", stringify!(bar))
-    );
+    fn test_field_bar() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Foo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Foo),
+                "::",
+                stringify!(bar)
+            )
+        );
+    }
+    test_field_bar();
 }
diff --git a/tests/expectations/tests/gen-destructors.rs b/tests/expectations/tests/gen-destructors.rs
index 7d96870..79f4ed8 100644
--- a/tests/expectations/tests/gen-destructors.rs
+++ b/tests/expectations/tests/gen-destructors.rs
@@ -22,11 +22,23 @@
         4usize,
         concat!("Alignment of ", stringify!(Foo))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Foo>())).bar as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(Foo), "::", stringify!(bar))
-    );
+    fn test_field_bar() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Foo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Foo),
+                "::",
+                stringify!(bar)
+            )
+        );
+    }
+    test_field_bar();
 }
 extern "C" {
     #[link_name = "\u{1}_ZN3FooD1Ev"]
diff --git a/tests/expectations/tests/i128.rs b/tests/expectations/tests/i128.rs
index 1a23969..545198c 100644
--- a/tests/expectations/tests/i128.rs
+++ b/tests/expectations/tests/i128.rs
@@ -24,28 +24,38 @@
         16usize,
         concat!("Alignment of ", stringify!(foo))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo>())).my_signed as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo),
-            "::",
-            stringify!(my_signed)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo>())).my_unsigned as *const _ as usize
-        },
-        16usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo),
-            "::",
-            stringify!(my_unsigned)
-        )
-    );
+    fn test_field_my_signed() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<foo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).my_signed) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo),
+                "::",
+                stringify!(my_signed)
+            )
+        );
+    }
+    test_field_my_signed();
+    fn test_field_my_unsigned() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<foo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).my_unsigned) as usize - ptr as usize
+            },
+            16usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo),
+                "::",
+                stringify!(my_unsigned)
+            )
+        );
+    }
+    test_field_my_unsigned();
 }
diff --git a/tests/expectations/tests/inherit-from-template-instantiation-with-vtable.rs b/tests/expectations/tests/inherit-from-template-instantiation-with-vtable.rs
index f292125..0876878 100644
--- a/tests/expectations/tests/inherit-from-template-instantiation-with-vtable.rs
+++ b/tests/expectations/tests/inherit-from-template-instantiation-with-vtable.rs
@@ -6,7 +6,7 @@
 )]
 
 #[repr(C)]
-pub struct BaseWithVtable__bindgen_vtable(::std::os::raw::c_void);
+pub struct BaseWithVtable__bindgen_vtable {}
 /// This should have an explicit vtable.
 #[repr(C)]
 #[derive(Debug, Copy, Clone)]
diff --git a/tests/expectations/tests/inline_namespace.rs b/tests/expectations/tests/inline_namespace.rs
index 036d2da..daa0868 100644
--- a/tests/expectations/tests/inline_namespace.rs
+++ b/tests/expectations/tests/inline_namespace.rs
@@ -31,15 +31,22 @@
             4usize,
             concat!("Alignment of ", stringify!(Bar))
         );
-        assert_eq!(
-            unsafe { &(*(::std::ptr::null::<Bar>())).baz as *const _ as usize },
-            0usize,
-            concat!(
-                "Offset of field: ",
-                stringify!(Bar),
-                "::",
-                stringify!(baz)
-            )
-        );
+        fn test_field_baz() {
+            assert_eq!(
+                unsafe {
+                    let uninit = ::std::mem::MaybeUninit::<Bar>::uninit();
+                    let ptr = uninit.as_ptr();
+                    ::std::ptr::addr_of!((*ptr).baz) as usize - ptr as usize
+                },
+                0usize,
+                concat!(
+                    "Offset of field: ",
+                    stringify!(Bar),
+                    "::",
+                    stringify!(baz)
+                )
+            );
+        }
+        test_field_baz();
     }
 }
diff --git a/tests/expectations/tests/inline_namespace_conservative.rs b/tests/expectations/tests/inline_namespace_conservative.rs
index 3d2ce0c..d855e06 100644
--- a/tests/expectations/tests/inline_namespace_conservative.rs
+++ b/tests/expectations/tests/inline_namespace_conservative.rs
@@ -36,15 +36,22 @@
             4usize,
             concat!("Alignment of ", stringify!(Bar))
         );
-        assert_eq!(
-            unsafe { &(*(::std::ptr::null::<Bar>())).baz as *const _ as usize },
-            0usize,
-            concat!(
-                "Offset of field: ",
-                stringify!(Bar),
-                "::",
-                stringify!(baz)
-            )
-        );
+        fn test_field_baz() {
+            assert_eq!(
+                unsafe {
+                    let uninit = ::std::mem::MaybeUninit::<Bar>::uninit();
+                    let ptr = uninit.as_ptr();
+                    ::std::ptr::addr_of!((*ptr).baz) as usize - ptr as usize
+                },
+                0usize,
+                concat!(
+                    "Offset of field: ",
+                    stringify!(Bar),
+                    "::",
+                    stringify!(baz)
+                )
+            );
+        }
+        test_field_baz();
     }
 }
diff --git a/tests/expectations/tests/inner_const.rs b/tests/expectations/tests/inner_const.rs
index 912ae02..41c9904 100644
--- a/tests/expectations/tests/inner_const.rs
+++ b/tests/expectations/tests/inner_const.rs
@@ -30,9 +30,21 @@
         4usize,
         concat!("Alignment of ", stringify!(Foo))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Foo>())).bar as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(Foo), "::", stringify!(bar))
-    );
+    fn test_field_bar() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Foo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Foo),
+                "::",
+                stringify!(bar)
+            )
+        );
+    }
+    test_field_bar();
 }
diff --git a/tests/expectations/tests/inner_template_self.rs b/tests/expectations/tests/inner_template_self.rs
index 3361a1f..033dc57 100644
--- a/tests/expectations/tests/inner_template_self.rs
+++ b/tests/expectations/tests/inner_template_self.rs
@@ -37,19 +37,23 @@
         8usize,
         concat!("Alignment of ", stringify!(InstantiateIt))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<InstantiateIt>())).m_list as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(InstantiateIt),
-            "::",
-            stringify!(m_list)
-        )
-    );
+    fn test_field_m_list() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<InstantiateIt>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).m_list) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(InstantiateIt),
+                "::",
+                stringify!(m_list)
+            )
+        );
+    }
+    test_field_m_list();
 }
 impl Default for InstantiateIt {
     fn default() -> Self {
diff --git a/tests/expectations/tests/issue-1118-using-forward-decl.rs b/tests/expectations/tests/issue-1118-using-forward-decl.rs
index 99f0341..121c086 100644
--- a/tests/expectations/tests/issue-1118-using-forward-decl.rs
+++ b/tests/expectations/tests/issue-1118-using-forward-decl.rs
@@ -23,18 +23,23 @@
         8usize,
         concat!("Alignment of ", stringify!(nsTArray_base))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<nsTArray_base>())).d as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(nsTArray_base),
-            "::",
-            stringify!(d)
-        )
-    );
+    fn test_field_d() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<nsTArray_base>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).d) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(nsTArray_base),
+                "::",
+                stringify!(d)
+            )
+        );
+    }
+    test_field_d();
 }
 impl Default for nsTArray_base {
     fn default() -> Self {
@@ -76,18 +81,23 @@
         8usize,
         concat!("Alignment of ", stringify!(nsIContent))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<nsIContent>())).foo as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(nsIContent),
-            "::",
-            stringify!(foo)
-        )
-    );
+    fn test_field_foo() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<nsIContent>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).foo) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(nsIContent),
+                "::",
+                stringify!(foo)
+            )
+        );
+    }
+    test_field_foo();
 }
 impl Default for nsIContent {
     fn default() -> Self {
diff --git a/tests/expectations/tests/issue-1216-variadic-member.rs b/tests/expectations/tests/issue-1216-variadic-member.rs
index 5bca809..792586b 100644
--- a/tests/expectations/tests/issue-1216-variadic-member.rs
+++ b/tests/expectations/tests/issue-1216-variadic-member.rs
@@ -32,9 +32,16 @@
         8usize,
         concat!("Alignment of ", stringify!(Foo))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Foo>())).f as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(Foo), "::", stringify!(f))
-    );
+    fn test_field_f() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Foo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).f) as usize - ptr as usize
+            },
+            0usize,
+            concat!("Offset of field: ", stringify!(Foo), "::", stringify!(f))
+        );
+    }
+    test_field_f();
 }
diff --git a/tests/expectations/tests/issue-1281.rs b/tests/expectations/tests/issue-1281.rs
index fe18fb1..9da4c95 100644
--- a/tests/expectations/tests/issue-1281.rs
+++ b/tests/expectations/tests/issue-1281.rs
@@ -27,11 +27,23 @@
         4usize,
         concat!("Alignment of ", stringify!(foo))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<foo>())).foo as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(foo), "::", stringify!(foo))
-    );
+    fn test_field_foo() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<foo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).foo) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo),
+                "::",
+                stringify!(foo)
+            )
+        );
+    }
+    test_field_foo();
 }
 #[test]
 fn bindgen_test_layout_bar() {
@@ -45,11 +57,18 @@
         4usize,
         concat!("Alignment of ", stringify!(bar))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<bar>())).u as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(bar), "::", stringify!(u))
-    );
+    fn test_field_u() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<bar>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).u) as usize - ptr as usize
+            },
+            0usize,
+            concat!("Offset of field: ", stringify!(bar), "::", stringify!(u))
+        );
+    }
+    test_field_u();
 }
 pub type bar_t = bar;
 #[repr(C)]
@@ -69,9 +88,16 @@
         4usize,
         concat!("Alignment of ", stringify!(baz))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<baz>())).f as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(baz), "::", stringify!(f))
-    );
+    fn test_field_f() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<baz>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).f) as usize - ptr as usize
+            },
+            0usize,
+            concat!("Offset of field: ", stringify!(baz), "::", stringify!(f))
+        );
+    }
+    test_field_f();
 }
diff --git a/tests/expectations/tests/issue-1285.rs b/tests/expectations/tests/issue-1285.rs
index 15b8c9e..37f0747 100644
--- a/tests/expectations/tests/issue-1285.rs
+++ b/tests/expectations/tests/issue-1285.rs
@@ -28,30 +28,42 @@
         4usize,
         concat!("Alignment of ", stringify!(foo__bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1>())).a as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1),
-            "::",
-            stringify!(a)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1>())).b as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1),
-            "::",
-            stringify!(b)
-        )
-    );
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<foo__bindgen_ty_1>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo__bindgen_ty_1),
+                "::",
+                stringify!(a)
+            )
+        );
+    }
+    test_field_a();
+    fn test_field_b() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<foo__bindgen_ty_1>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo__bindgen_ty_1),
+                "::",
+                stringify!(b)
+            )
+        );
+    }
+    test_field_b();
 }
 impl Default for foo__bindgen_ty_1 {
     fn default() -> Self {
@@ -74,11 +86,23 @@
         4usize,
         concat!("Alignment of ", stringify!(foo))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<foo>())).bar as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(foo), "::", stringify!(bar))
-    );
+    fn test_field_bar() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<foo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo),
+                "::",
+                stringify!(bar)
+            )
+        );
+    }
+    test_field_bar();
 }
 impl Default for foo {
     fn default() -> Self {
diff --git a/tests/expectations/tests/issue-1291.rs b/tests/expectations/tests/issue-1291.rs
index 5680c34..6776a19 100644
--- a/tests/expectations/tests/issue-1291.rs
+++ b/tests/expectations/tests/issue-1291.rs
@@ -37,158 +37,259 @@
         16usize,
         concat!("Alignment of ", stringify!(RTCRay))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<RTCRay>())).org as *const _ as usize },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(RTCRay),
-            "::",
-            stringify!(org)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<RTCRay>())).align0 as *const _ as usize
-        },
-        12usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(RTCRay),
-            "::",
-            stringify!(align0)
-        )
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<RTCRay>())).dir as *const _ as usize },
-        16usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(RTCRay),
-            "::",
-            stringify!(dir)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<RTCRay>())).align1 as *const _ as usize
-        },
-        28usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(RTCRay),
-            "::",
-            stringify!(align1)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<RTCRay>())).tnear as *const _ as usize
-        },
-        32usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(RTCRay),
-            "::",
-            stringify!(tnear)
-        )
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<RTCRay>())).tfar as *const _ as usize },
-        36usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(RTCRay),
-            "::",
-            stringify!(tfar)
-        )
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<RTCRay>())).time as *const _ as usize },
-        40usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(RTCRay),
-            "::",
-            stringify!(time)
-        )
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<RTCRay>())).mask as *const _ as usize },
-        44usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(RTCRay),
-            "::",
-            stringify!(mask)
-        )
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<RTCRay>())).Ng as *const _ as usize },
-        48usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(RTCRay),
-            "::",
-            stringify!(Ng)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<RTCRay>())).align2 as *const _ as usize
-        },
-        60usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(RTCRay),
-            "::",
-            stringify!(align2)
-        )
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<RTCRay>())).u as *const _ as usize },
-        64usize,
-        concat!("Offset of field: ", stringify!(RTCRay), "::", stringify!(u))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<RTCRay>())).v as *const _ as usize },
-        68usize,
-        concat!("Offset of field: ", stringify!(RTCRay), "::", stringify!(v))
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<RTCRay>())).geomID as *const _ as usize
-        },
-        72usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(RTCRay),
-            "::",
-            stringify!(geomID)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<RTCRay>())).primID as *const _ as usize
-        },
-        76usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(RTCRay),
-            "::",
-            stringify!(primID)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<RTCRay>())).instID as *const _ as usize
-        },
-        80usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(RTCRay),
-            "::",
-            stringify!(instID)
-        )
-    );
+    fn test_field_org() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<RTCRay>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).org) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(RTCRay),
+                "::",
+                stringify!(org)
+            )
+        );
+    }
+    test_field_org();
+    fn test_field_align0() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<RTCRay>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).align0) as usize - ptr as usize
+            },
+            12usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(RTCRay),
+                "::",
+                stringify!(align0)
+            )
+        );
+    }
+    test_field_align0();
+    fn test_field_dir() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<RTCRay>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).dir) as usize - ptr as usize
+            },
+            16usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(RTCRay),
+                "::",
+                stringify!(dir)
+            )
+        );
+    }
+    test_field_dir();
+    fn test_field_align1() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<RTCRay>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).align1) as usize - ptr as usize
+            },
+            28usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(RTCRay),
+                "::",
+                stringify!(align1)
+            )
+        );
+    }
+    test_field_align1();
+    fn test_field_tnear() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<RTCRay>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).tnear) as usize - ptr as usize
+            },
+            32usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(RTCRay),
+                "::",
+                stringify!(tnear)
+            )
+        );
+    }
+    test_field_tnear();
+    fn test_field_tfar() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<RTCRay>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).tfar) as usize - ptr as usize
+            },
+            36usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(RTCRay),
+                "::",
+                stringify!(tfar)
+            )
+        );
+    }
+    test_field_tfar();
+    fn test_field_time() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<RTCRay>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).time) as usize - ptr as usize
+            },
+            40usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(RTCRay),
+                "::",
+                stringify!(time)
+            )
+        );
+    }
+    test_field_time();
+    fn test_field_mask() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<RTCRay>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mask) as usize - ptr as usize
+            },
+            44usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(RTCRay),
+                "::",
+                stringify!(mask)
+            )
+        );
+    }
+    test_field_mask();
+    fn test_field_Ng() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<RTCRay>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).Ng) as usize - ptr as usize
+            },
+            48usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(RTCRay),
+                "::",
+                stringify!(Ng)
+            )
+        );
+    }
+    test_field_Ng();
+    fn test_field_align2() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<RTCRay>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).align2) as usize - ptr as usize
+            },
+            60usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(RTCRay),
+                "::",
+                stringify!(align2)
+            )
+        );
+    }
+    test_field_align2();
+    fn test_field_u() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<RTCRay>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).u) as usize - ptr as usize
+            },
+            64usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(RTCRay),
+                "::",
+                stringify!(u)
+            )
+        );
+    }
+    test_field_u();
+    fn test_field_v() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<RTCRay>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).v) as usize - ptr as usize
+            },
+            68usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(RTCRay),
+                "::",
+                stringify!(v)
+            )
+        );
+    }
+    test_field_v();
+    fn test_field_geomID() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<RTCRay>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).geomID) as usize - ptr as usize
+            },
+            72usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(RTCRay),
+                "::",
+                stringify!(geomID)
+            )
+        );
+    }
+    test_field_geomID();
+    fn test_field_primID() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<RTCRay>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).primID) as usize - ptr as usize
+            },
+            76usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(RTCRay),
+                "::",
+                stringify!(primID)
+            )
+        );
+    }
+    test_field_primID();
+    fn test_field_instID() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<RTCRay>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).instID) as usize - ptr as usize
+            },
+            80usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(RTCRay),
+                "::",
+                stringify!(instID)
+            )
+        );
+    }
+    test_field_instID();
 }
diff --git a/tests/expectations/tests/issue-1382-rust-primitive-types.rs b/tests/expectations/tests/issue-1382-rust-primitive-types.rs
index 6f5aec4..4ef922c 100644
--- a/tests/expectations/tests/issue-1382-rust-primitive-types.rs
+++ b/tests/expectations/tests/issue-1382-rust-primitive-types.rs
@@ -43,94 +43,242 @@
         4usize,
         concat!("Alignment of ", stringify!(Foo))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Foo>())).i8_ as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(Foo), "::", stringify!(i8_))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Foo>())).u8_ as *const _ as usize },
-        4usize,
-        concat!("Offset of field: ", stringify!(Foo), "::", stringify!(u8_))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Foo>())).i16_ as *const _ as usize },
-        8usize,
-        concat!("Offset of field: ", stringify!(Foo), "::", stringify!(i16_))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Foo>())).u16_ as *const _ as usize },
-        12usize,
-        concat!("Offset of field: ", stringify!(Foo), "::", stringify!(u16_))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Foo>())).i32_ as *const _ as usize },
-        16usize,
-        concat!("Offset of field: ", stringify!(Foo), "::", stringify!(i32_))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Foo>())).u32_ as *const _ as usize },
-        20usize,
-        concat!("Offset of field: ", stringify!(Foo), "::", stringify!(u32_))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Foo>())).i64_ as *const _ as usize },
-        24usize,
-        concat!("Offset of field: ", stringify!(Foo), "::", stringify!(i64_))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Foo>())).u64_ as *const _ as usize },
-        28usize,
-        concat!("Offset of field: ", stringify!(Foo), "::", stringify!(u64_))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Foo>())).i128_ as *const _ as usize },
-        32usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(Foo),
-            "::",
-            stringify!(i128_)
-        )
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Foo>())).u128_ as *const _ as usize },
-        36usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(Foo),
-            "::",
-            stringify!(u128_)
-        )
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Foo>())).isize_ as *const _ as usize },
-        40usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(Foo),
-            "::",
-            stringify!(isize_)
-        )
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Foo>())).usize_ as *const _ as usize },
-        44usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(Foo),
-            "::",
-            stringify!(usize_)
-        )
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Foo>())).f32_ as *const _ as usize },
-        48usize,
-        concat!("Offset of field: ", stringify!(Foo), "::", stringify!(f32_))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Foo>())).f64_ as *const _ as usize },
-        52usize,
-        concat!("Offset of field: ", stringify!(Foo), "::", stringify!(f64_))
-    );
+    fn test_field_i8() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Foo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).i8_) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Foo),
+                "::",
+                stringify!(i8_)
+            )
+        );
+    }
+    test_field_i8();
+    fn test_field_u8() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Foo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).u8_) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Foo),
+                "::",
+                stringify!(u8_)
+            )
+        );
+    }
+    test_field_u8();
+    fn test_field_i16() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Foo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).i16_) as usize - ptr as usize
+            },
+            8usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Foo),
+                "::",
+                stringify!(i16_)
+            )
+        );
+    }
+    test_field_i16();
+    fn test_field_u16() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Foo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).u16_) as usize - ptr as usize
+            },
+            12usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Foo),
+                "::",
+                stringify!(u16_)
+            )
+        );
+    }
+    test_field_u16();
+    fn test_field_i32() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Foo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).i32_) as usize - ptr as usize
+            },
+            16usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Foo),
+                "::",
+                stringify!(i32_)
+            )
+        );
+    }
+    test_field_i32();
+    fn test_field_u32() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Foo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).u32_) as usize - ptr as usize
+            },
+            20usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Foo),
+                "::",
+                stringify!(u32_)
+            )
+        );
+    }
+    test_field_u32();
+    fn test_field_i64() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Foo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).i64_) as usize - ptr as usize
+            },
+            24usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Foo),
+                "::",
+                stringify!(i64_)
+            )
+        );
+    }
+    test_field_i64();
+    fn test_field_u64() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Foo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).u64_) as usize - ptr as usize
+            },
+            28usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Foo),
+                "::",
+                stringify!(u64_)
+            )
+        );
+    }
+    test_field_u64();
+    fn test_field_i128() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Foo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).i128_) as usize - ptr as usize
+            },
+            32usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Foo),
+                "::",
+                stringify!(i128_)
+            )
+        );
+    }
+    test_field_i128();
+    fn test_field_u128() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Foo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).u128_) as usize - ptr as usize
+            },
+            36usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Foo),
+                "::",
+                stringify!(u128_)
+            )
+        );
+    }
+    test_field_u128();
+    fn test_field_isize() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Foo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).isize_) as usize - ptr as usize
+            },
+            40usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Foo),
+                "::",
+                stringify!(isize_)
+            )
+        );
+    }
+    test_field_isize();
+    fn test_field_usize() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Foo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).usize_) as usize - ptr as usize
+            },
+            44usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Foo),
+                "::",
+                stringify!(usize_)
+            )
+        );
+    }
+    test_field_usize();
+    fn test_field_f32() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Foo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).f32_) as usize - ptr as usize
+            },
+            48usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Foo),
+                "::",
+                stringify!(f32_)
+            )
+        );
+    }
+    test_field_f32();
+    fn test_field_f64() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Foo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).f64_) as usize - ptr as usize
+            },
+            52usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Foo),
+                "::",
+                stringify!(f64_)
+            )
+        );
+    }
+    test_field_f64();
 }
diff --git a/tests/expectations/tests/issue-1443.rs b/tests/expectations/tests/issue-1443.rs
index f422f4c..92a1c7d 100644
--- a/tests/expectations/tests/issue-1443.rs
+++ b/tests/expectations/tests/issue-1443.rs
@@ -28,16 +28,30 @@
         8usize,
         concat!("Alignment of ", stringify!(Bar))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Bar>())).f as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(Bar), "::", stringify!(f))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Bar>())).m as *const _ as usize },
-        8usize,
-        concat!("Offset of field: ", stringify!(Bar), "::", stringify!(m))
-    );
+    fn test_field_f() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Bar>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).f) as usize - ptr as usize
+            },
+            0usize,
+            concat!("Offset of field: ", stringify!(Bar), "::", stringify!(f))
+        );
+    }
+    test_field_f();
+    fn test_field_m() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Bar>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).m) as usize - ptr as usize
+            },
+            8usize,
+            concat!("Offset of field: ", stringify!(Bar), "::", stringify!(m))
+        );
+    }
+    test_field_m();
 }
 impl Default for Bar {
     fn default() -> Self {
@@ -66,16 +80,30 @@
         8usize,
         concat!("Alignment of ", stringify!(Baz))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Baz>())).f as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(Baz), "::", stringify!(f))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Baz>())).m as *const _ as usize },
-        8usize,
-        concat!("Offset of field: ", stringify!(Baz), "::", stringify!(m))
-    );
+    fn test_field_f() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Baz>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).f) as usize - ptr as usize
+            },
+            0usize,
+            concat!("Offset of field: ", stringify!(Baz), "::", stringify!(f))
+        );
+    }
+    test_field_f();
+    fn test_field_m() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Baz>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).m) as usize - ptr as usize
+            },
+            8usize,
+            concat!("Offset of field: ", stringify!(Baz), "::", stringify!(m))
+        );
+    }
+    test_field_m();
 }
 impl Default for Baz {
     fn default() -> Self {
@@ -104,16 +132,30 @@
         8usize,
         concat!("Alignment of ", stringify!(Tar))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Tar>())).f as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(Tar), "::", stringify!(f))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Tar>())).m as *const _ as usize },
-        8usize,
-        concat!("Offset of field: ", stringify!(Tar), "::", stringify!(m))
-    );
+    fn test_field_f() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Tar>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).f) as usize - ptr as usize
+            },
+            0usize,
+            concat!("Offset of field: ", stringify!(Tar), "::", stringify!(f))
+        );
+    }
+    test_field_f();
+    fn test_field_m() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Tar>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).m) as usize - ptr as usize
+            },
+            8usize,
+            concat!("Offset of field: ", stringify!(Tar), "::", stringify!(m))
+        );
+    }
+    test_field_m();
 }
 impl Default for Tar {
     fn default() -> Self {
@@ -142,16 +184,30 @@
         8usize,
         concat!("Alignment of ", stringify!(Taz))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Taz>())).f as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(Taz), "::", stringify!(f))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Taz>())).m as *const _ as usize },
-        8usize,
-        concat!("Offset of field: ", stringify!(Taz), "::", stringify!(m))
-    );
+    fn test_field_f() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Taz>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).f) as usize - ptr as usize
+            },
+            0usize,
+            concat!("Offset of field: ", stringify!(Taz), "::", stringify!(f))
+        );
+    }
+    test_field_f();
+    fn test_field_m() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Taz>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).m) as usize - ptr as usize
+            },
+            8usize,
+            concat!("Offset of field: ", stringify!(Taz), "::", stringify!(m))
+        );
+    }
+    test_field_m();
 }
 impl Default for Taz {
     fn default() -> Self {
diff --git a/tests/expectations/tests/issue-1454.rs b/tests/expectations/tests/issue-1454.rs
index e88e469..e0ad1d7 100644
--- a/tests/expectations/tests/issue-1454.rs
+++ b/tests/expectations/tests/issue-1454.rs
@@ -26,16 +26,21 @@
         1usize,
         concat!("Alignment of ", stringify!(local_type))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<local_type>())).inner as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(local_type),
-            "::",
-            stringify!(inner)
-        )
-    );
+    fn test_field_inner() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<local_type>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).inner) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(local_type),
+                "::",
+                stringify!(inner)
+            )
+        );
+    }
+    test_field_inner();
 }
diff --git a/tests/expectations/tests/issue-1498.rs b/tests/expectations/tests/issue-1498.rs
index 4f8a893..b3064e6 100644
--- a/tests/expectations/tests/issue-1498.rs
+++ b/tests/expectations/tests/issue-1498.rs
@@ -43,32 +43,44 @@
         8usize,
         concat!("Alignment of ", stringify!(rte_memseg__bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_memseg__bindgen_ty_1>())).addr
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_memseg__bindgen_ty_1),
-            "::",
-            stringify!(addr)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_memseg__bindgen_ty_1>())).addr_64
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_memseg__bindgen_ty_1),
-            "::",
-            stringify!(addr_64)
-        )
-    );
+    fn test_field_addr() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_memseg__bindgen_ty_1>::uninit(
+                    );
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).addr) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_memseg__bindgen_ty_1),
+                "::",
+                stringify!(addr)
+            )
+        );
+    }
+    test_field_addr();
+    fn test_field_addr_64() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_memseg__bindgen_ty_1>::uninit(
+                    );
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).addr_64) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_memseg__bindgen_ty_1),
+                "::",
+                stringify!(addr_64)
+            )
+        );
+    }
+    test_field_addr_64();
 }
 impl Default for rte_memseg__bindgen_ty_1 {
     fn default() -> Self {
@@ -91,81 +103,108 @@
         1usize,
         concat!("Alignment of ", stringify!(rte_memseg))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_memseg>())).phys_addr as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_memseg),
-            "::",
-            stringify!(phys_addr)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_memseg>())).len as *const _ as usize
-        },
-        16usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_memseg),
-            "::",
-            stringify!(len)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_memseg>())).hugepage_sz as *const _
-                as usize
-        },
-        24usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_memseg),
-            "::",
-            stringify!(hugepage_sz)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_memseg>())).socket_id as *const _
-                as usize
-        },
-        32usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_memseg),
-            "::",
-            stringify!(socket_id)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_memseg>())).nchannel as *const _ as usize
-        },
-        36usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_memseg),
-            "::",
-            stringify!(nchannel)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_memseg>())).nrank as *const _ as usize
-        },
-        40usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_memseg),
-            "::",
-            stringify!(nrank)
-        )
-    );
+    fn test_field_phys_addr() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_memseg>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).phys_addr) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_memseg),
+                "::",
+                stringify!(phys_addr)
+            )
+        );
+    }
+    test_field_phys_addr();
+    fn test_field_len() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_memseg>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).len) as usize - ptr as usize
+            },
+            16usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_memseg),
+                "::",
+                stringify!(len)
+            )
+        );
+    }
+    test_field_len();
+    fn test_field_hugepage_sz() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_memseg>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).hugepage_sz) as usize - ptr as usize
+            },
+            24usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_memseg),
+                "::",
+                stringify!(hugepage_sz)
+            )
+        );
+    }
+    test_field_hugepage_sz();
+    fn test_field_socket_id() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_memseg>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).socket_id) as usize - ptr as usize
+            },
+            32usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_memseg),
+                "::",
+                stringify!(socket_id)
+            )
+        );
+    }
+    test_field_socket_id();
+    fn test_field_nchannel() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_memseg>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).nchannel) as usize - ptr as usize
+            },
+            36usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_memseg),
+                "::",
+                stringify!(nchannel)
+            )
+        );
+    }
+    test_field_nchannel();
+    fn test_field_nrank() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_memseg>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).nrank) as usize - ptr as usize
+            },
+            40usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_memseg),
+                "::",
+                stringify!(nrank)
+            )
+        );
+    }
+    test_field_nrank();
 }
 impl Default for rte_memseg {
     fn default() -> Self {
diff --git a/tests/expectations/tests/issue-1947.rs b/tests/expectations/tests/issue-1947.rs
index 1753ef8..e32b7f5 100644
--- a/tests/expectations/tests/issue-1947.rs
+++ b/tests/expectations/tests/issue-1947.rs
@@ -117,42 +117,57 @@
         2usize,
         concat!("Alignment of ", stringify!(V56AMDY))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<V56AMDY>())).MADK as *const _ as usize
-        },
-        2usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(V56AMDY),
-            "::",
-            stringify!(MADK)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<V56AMDY>())).MABR as *const _ as usize
-        },
-        3usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(V56AMDY),
-            "::",
-            stringify!(MABR)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<V56AMDY>()))._rB_ as *const _ as usize
-        },
-        7usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(V56AMDY),
-            "::",
-            stringify!(_rB_)
-        )
-    );
+    fn test_field_MADK() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<V56AMDY>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).MADK) as usize - ptr as usize
+            },
+            2usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(V56AMDY),
+                "::",
+                stringify!(MADK)
+            )
+        );
+    }
+    test_field_MADK();
+    fn test_field_MABR() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<V56AMDY>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).MABR) as usize - ptr as usize
+            },
+            3usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(V56AMDY),
+                "::",
+                stringify!(MABR)
+            )
+        );
+    }
+    test_field_MABR();
+    fn test_field__rB_() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<V56AMDY>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr)._rB_) as usize - ptr as usize
+            },
+            7usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(V56AMDY),
+                "::",
+                stringify!(_rB_)
+            )
+        );
+    }
+    test_field__rB_();
 }
 impl V56AMDY {
     #[inline]
diff --git a/tests/expectations/tests/issue-1977-larger-arrays.rs b/tests/expectations/tests/issue-1977-larger-arrays.rs
index 54e5b43..be4723f 100644
--- a/tests/expectations/tests/issue-1977-larger-arrays.rs
+++ b/tests/expectations/tests/issue-1977-larger-arrays.rs
@@ -22,18 +22,23 @@
         1usize,
         concat!("Alignment of ", stringify!(S))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<S>())).large_array as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(S),
-            "::",
-            stringify!(large_array)
-        )
-    );
+    fn test_field_large_array() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<S>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).large_array) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(S),
+                "::",
+                stringify!(large_array)
+            )
+        );
+    }
+    test_field_large_array();
 }
 impl Default for S {
     fn default() -> Self {
diff --git a/tests/expectations/tests/issue-1995.rs b/tests/expectations/tests/issue-1995.rs
index 58e11eb..a0f10c0 100644
--- a/tests/expectations/tests/issue-1995.rs
+++ b/tests/expectations/tests/issue-1995.rs
@@ -29,9 +29,21 @@
         4usize,
         concat!("Alignment of ", stringify!(Bar))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Bar>())).baz as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(Bar), "::", stringify!(baz))
-    );
+    fn test_field_baz() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Bar>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).baz) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Bar),
+                "::",
+                stringify!(baz)
+            )
+        );
+    }
+    test_field_baz();
 }
diff --git a/tests/expectations/tests/issue-2019.rs b/tests/expectations/tests/issue-2019.rs
index 383bd57..6140dfd 100644
--- a/tests/expectations/tests/issue-2019.rs
+++ b/tests/expectations/tests/issue-2019.rs
@@ -22,11 +22,18 @@
         4usize,
         concat!("Alignment of ", stringify!(A))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<A>())).a as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(A), "::", stringify!(a))
-    );
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<A>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            0usize,
+            concat!("Offset of field: ", stringify!(A), "::", stringify!(a))
+        );
+    }
+    test_field_a();
 }
 extern "C" {
     #[link_name = "\u{1}_ZN1A4makeEv"]
@@ -55,11 +62,18 @@
         4usize,
         concat!("Alignment of ", stringify!(B))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<B>())).b as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(B), "::", stringify!(b))
-    );
+    fn test_field_b() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<B>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize
+            },
+            0usize,
+            concat!("Offset of field: ", stringify!(B), "::", stringify!(b))
+        );
+    }
+    test_field_b();
 }
 extern "C" {
     #[link_name = "\u{1}_ZN1B4makeEv"]
diff --git a/tests/expectations/tests/issue-372.rs b/tests/expectations/tests/issue-372.rs
index 0cd9f7a..f46d2c9 100644
--- a/tests/expectations/tests/issue-372.rs
+++ b/tests/expectations/tests/issue-372.rs
@@ -28,21 +28,57 @@
             8usize,
             concat!("Alignment of ", stringify!(i))
         );
-        assert_eq!(
-            unsafe { &(*(::std::ptr::null::<i>())).j as *const _ as usize },
-            0usize,
-            concat!("Offset of field: ", stringify!(i), "::", stringify!(j))
-        );
-        assert_eq!(
-            unsafe { &(*(::std::ptr::null::<i>())).k as *const _ as usize },
-            8usize,
-            concat!("Offset of field: ", stringify!(i), "::", stringify!(k))
-        );
-        assert_eq!(
-            unsafe { &(*(::std::ptr::null::<i>())).l as *const _ as usize },
-            16usize,
-            concat!("Offset of field: ", stringify!(i), "::", stringify!(l))
-        );
+        fn test_field_j() {
+            assert_eq!(
+                unsafe {
+                    let uninit = ::std::mem::MaybeUninit::<i>::uninit();
+                    let ptr = uninit.as_ptr();
+                    ::std::ptr::addr_of!((*ptr).j) as usize - ptr as usize
+                },
+                0usize,
+                concat!(
+                    "Offset of field: ",
+                    stringify!(i),
+                    "::",
+                    stringify!(j)
+                )
+            );
+        }
+        test_field_j();
+        fn test_field_k() {
+            assert_eq!(
+                unsafe {
+                    let uninit = ::std::mem::MaybeUninit::<i>::uninit();
+                    let ptr = uninit.as_ptr();
+                    ::std::ptr::addr_of!((*ptr).k) as usize - ptr as usize
+                },
+                8usize,
+                concat!(
+                    "Offset of field: ",
+                    stringify!(i),
+                    "::",
+                    stringify!(k)
+                )
+            );
+        }
+        test_field_k();
+        fn test_field_l() {
+            assert_eq!(
+                unsafe {
+                    let uninit = ::std::mem::MaybeUninit::<i>::uninit();
+                    let ptr = uninit.as_ptr();
+                    ::std::ptr::addr_of!((*ptr).l) as usize - ptr as usize
+                },
+                16usize,
+                concat!(
+                    "Offset of field: ",
+                    stringify!(i),
+                    "::",
+                    stringify!(l)
+                )
+            );
+        }
+        test_field_l();
     }
     impl Default for i {
         fn default() -> Self {
@@ -70,11 +106,23 @@
             8usize,
             concat!("Alignment of ", stringify!(d))
         );
-        assert_eq!(
-            unsafe { &(*(::std::ptr::null::<d>())).m as *const _ as usize },
-            0usize,
-            concat!("Offset of field: ", stringify!(d), "::", stringify!(m))
-        );
+        fn test_field_m() {
+            assert_eq!(
+                unsafe {
+                    let uninit = ::std::mem::MaybeUninit::<d>::uninit();
+                    let ptr = uninit.as_ptr();
+                    ::std::ptr::addr_of!((*ptr).m) as usize - ptr as usize
+                },
+                0usize,
+                concat!(
+                    "Offset of field: ",
+                    stringify!(d),
+                    "::",
+                    stringify!(m)
+                )
+            );
+        }
+        test_field_m();
     }
     impl Default for d {
         fn default() -> Self {
@@ -117,11 +165,23 @@
             8usize,
             concat!("Alignment of ", stringify!(F))
         );
-        assert_eq!(
-            unsafe { &(*(::std::ptr::null::<F>())).w as *const _ as usize },
-            0usize,
-            concat!("Offset of field: ", stringify!(F), "::", stringify!(w))
-        );
+        fn test_field_w() {
+            assert_eq!(
+                unsafe {
+                    let uninit = ::std::mem::MaybeUninit::<F>::uninit();
+                    let ptr = uninit.as_ptr();
+                    ::std::ptr::addr_of!((*ptr).w) as usize - ptr as usize
+                },
+                0usize,
+                concat!(
+                    "Offset of field: ",
+                    stringify!(F),
+                    "::",
+                    stringify!(w)
+                )
+            );
+        }
+        test_field_w();
     }
     impl Default for F {
         fn default() -> Self {
diff --git a/tests/expectations/tests/issue-537-repr-packed-n.rs b/tests/expectations/tests/issue-537-repr-packed-n.rs
index 13e1482..55ff25a 100644
--- a/tests/expectations/tests/issue-537-repr-packed-n.rs
+++ b/tests/expectations/tests/issue-537-repr-packed-n.rs
@@ -25,18 +25,23 @@
         1usize,
         concat!("Alignment of ", stringify!(AlignedToOne))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<AlignedToOne>())).i as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(AlignedToOne),
-            "::",
-            stringify!(i)
-        )
-    );
+    fn test_field_i() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<AlignedToOne>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).i) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(AlignedToOne),
+                "::",
+                stringify!(i)
+            )
+        );
+    }
+    test_field_i();
 }
 /// This should be be packed because Rust 1.33 has `#[repr(packed(N))]`.
 #[repr(C, packed(2))]
@@ -56,18 +61,23 @@
         2usize,
         concat!("Alignment of ", stringify!(AlignedToTwo))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<AlignedToTwo>())).i as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(AlignedToTwo),
-            "::",
-            stringify!(i)
-        )
-    );
+    fn test_field_i() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<AlignedToTwo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).i) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(AlignedToTwo),
+                "::",
+                stringify!(i)
+            )
+        );
+    }
+    test_field_i();
 }
 /// This should not be opaque because although `libclang` doesn't give us the
 /// `#pragma pack(1)`, we can detect that alignment is 1 and add
@@ -90,30 +100,40 @@
         1usize,
         concat!("Alignment of ", stringify!(PackedToOne))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<PackedToOne>())).x as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(PackedToOne),
-            "::",
-            stringify!(x)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<PackedToOne>())).y as *const _ as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(PackedToOne),
-            "::",
-            stringify!(y)
-        )
-    );
+    fn test_field_x() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<PackedToOne>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).x) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(PackedToOne),
+                "::",
+                stringify!(x)
+            )
+        );
+    }
+    test_field_x();
+    fn test_field_y() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<PackedToOne>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).y) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(PackedToOne),
+                "::",
+                stringify!(y)
+            )
+        );
+    }
+    test_field_y();
 }
 /// This should be be packed because Rust 1.33 has `#[repr(packed(N))]`.
 #[repr(C, packed(2))]
@@ -134,28 +154,38 @@
         2usize,
         concat!("Alignment of ", stringify!(PackedToTwo))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<PackedToTwo>())).x as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(PackedToTwo),
-            "::",
-            stringify!(x)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<PackedToTwo>())).y as *const _ as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(PackedToTwo),
-            "::",
-            stringify!(y)
-        )
-    );
+    fn test_field_x() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<PackedToTwo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).x) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(PackedToTwo),
+                "::",
+                stringify!(x)
+            )
+        );
+    }
+    test_field_x();
+    fn test_field_y() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<PackedToTwo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).y) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(PackedToTwo),
+                "::",
+                stringify!(y)
+            )
+        );
+    }
+    test_field_y();
 }
diff --git a/tests/expectations/tests/issue-537.rs b/tests/expectations/tests/issue-537.rs
index e67c0e9..d3a0e8c 100644
--- a/tests/expectations/tests/issue-537.rs
+++ b/tests/expectations/tests/issue-537.rs
@@ -24,18 +24,23 @@
         1usize,
         concat!("Alignment of ", stringify!(AlignedToOne))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<AlignedToOne>())).i as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(AlignedToOne),
-            "::",
-            stringify!(i)
-        )
-    );
+    fn test_field_i() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<AlignedToOne>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).i) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(AlignedToOne),
+                "::",
+                stringify!(i)
+            )
+        );
+    }
+    test_field_i();
 }
 /// This should be opaque because although we can see the attributes, Rust before
 /// 1.33 doesn't have `#[repr(packed(N))]`.
@@ -56,18 +61,23 @@
         2usize,
         concat!("Alignment of ", stringify!(AlignedToTwo))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<AlignedToTwo>())).i as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(AlignedToTwo),
-            "::",
-            stringify!(i)
-        )
-    );
+    fn test_field_i() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<AlignedToTwo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).i) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(AlignedToTwo),
+                "::",
+                stringify!(i)
+            )
+        );
+    }
+    test_field_i();
 }
 /// This should not be opaque because although `libclang` doesn't give us the
 /// `#pragma pack(1)`, we can detect that alignment is 1 and add
@@ -90,30 +100,40 @@
         1usize,
         concat!("Alignment of ", stringify!(PackedToOne))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<PackedToOne>())).x as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(PackedToOne),
-            "::",
-            stringify!(x)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<PackedToOne>())).y as *const _ as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(PackedToOne),
-            "::",
-            stringify!(y)
-        )
-    );
+    fn test_field_x() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<PackedToOne>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).x) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(PackedToOne),
+                "::",
+                stringify!(x)
+            )
+        );
+    }
+    test_field_x();
+    fn test_field_y() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<PackedToOne>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).y) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(PackedToOne),
+                "::",
+                stringify!(y)
+            )
+        );
+    }
+    test_field_y();
 }
 /// In this case, even if we can detect the weird alignment triggered by
 /// `#pragma pack(2)`, we can't do anything about it because Rust before 1.33
@@ -136,28 +156,38 @@
         2usize,
         concat!("Alignment of ", stringify!(PackedToTwo))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<PackedToTwo>())).x as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(PackedToTwo),
-            "::",
-            stringify!(x)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<PackedToTwo>())).y as *const _ as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(PackedToTwo),
-            "::",
-            stringify!(y)
-        )
-    );
+    fn test_field_x() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<PackedToTwo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).x) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(PackedToTwo),
+                "::",
+                stringify!(x)
+            )
+        );
+    }
+    test_field_x();
+    fn test_field_y() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<PackedToTwo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).y) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(PackedToTwo),
+                "::",
+                stringify!(y)
+            )
+        );
+    }
+    test_field_y();
 }
diff --git a/tests/expectations/tests/issue-573-layout-test-failures.rs b/tests/expectations/tests/issue-573-layout-test-failures.rs
index 871849a..1c94f94 100644
--- a/tests/expectations/tests/issue-573-layout-test-failures.rs
+++ b/tests/expectations/tests/issue-573-layout-test-failures.rs
@@ -27,18 +27,23 @@
         1usize,
         concat!("Alignment of ", stringify!(AutoIdVector))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<AutoIdVector>())).ar as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(AutoIdVector),
-            "::",
-            stringify!(ar)
-        )
-    );
+    fn test_field_ar() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<AutoIdVector>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).ar) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(AutoIdVector),
+                "::",
+                stringify!(ar)
+            )
+        );
+    }
+    test_field_ar();
 }
 #[test]
 fn __bindgen_test_layout_Outer_open0_int_close0_instantiation() {
diff --git a/tests/expectations/tests/issue-574-assertion-failure-in-codegen.rs b/tests/expectations/tests/issue-574-assertion-failure-in-codegen.rs
index e04ff24..66407d8 100644
--- a/tests/expectations/tests/issue-574-assertion-failure-in-codegen.rs
+++ b/tests/expectations/tests/issue-574-assertion-failure-in-codegen.rs
@@ -27,18 +27,23 @@
         1usize,
         concat!("Alignment of ", stringify!(_bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<_bindgen_ty_1>())).ar as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(_bindgen_ty_1),
-            "::",
-            stringify!(ar)
-        )
-    );
+    fn test_field_ar() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<_bindgen_ty_1>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).ar) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(_bindgen_ty_1),
+                "::",
+                stringify!(ar)
+            )
+        );
+    }
+    test_field_ar();
 }
 extern "C" {
     pub static mut AutoIdVector: _bindgen_ty_1;
diff --git a/tests/expectations/tests/issue-584-stylo-template-analysis-panic.rs b/tests/expectations/tests/issue-584-stylo-template-analysis-panic.rs
index 01abdcc..2a1d045 100644
--- a/tests/expectations/tests/issue-584-stylo-template-analysis-panic.rs
+++ b/tests/expectations/tests/issue-584-stylo-template-analysis-panic.rs
@@ -61,11 +61,18 @@
         1usize,
         concat!("Alignment of ", stringify!(g))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<g>())).h as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(g), "::", stringify!(h))
-    );
+    fn test_field_h() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<g>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).h) as usize - ptr as usize
+            },
+            0usize,
+            concat!("Offset of field: ", stringify!(g), "::", stringify!(h))
+        );
+    }
+    test_field_h();
 }
 impl Default for g {
     fn default() -> Self {
diff --git a/tests/expectations/tests/issue-639-typedef-anon-field.rs b/tests/expectations/tests/issue-639-typedef-anon-field.rs
index 4147c1d..8f4b2a5 100644
--- a/tests/expectations/tests/issue-639-typedef-anon-field.rs
+++ b/tests/expectations/tests/issue-639-typedef-anon-field.rs
@@ -27,16 +27,23 @@
         4usize,
         concat!("Alignment of ", stringify!(Foo_Bar))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Foo_Bar>())).abc as *const _ as usize },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(Foo_Bar),
-            "::",
-            stringify!(abc)
-        )
-    );
+    fn test_field_abc() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Foo_Bar>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).abc) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Foo_Bar),
+                "::",
+                stringify!(abc)
+            )
+        );
+    }
+    test_field_abc();
 }
 #[test]
 fn bindgen_test_layout_Foo() {
@@ -50,11 +57,23 @@
         4usize,
         concat!("Alignment of ", stringify!(Foo))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Foo>())).bar as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(Foo), "::", stringify!(bar))
-    );
+    fn test_field_bar() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Foo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Foo),
+                "::",
+                stringify!(bar)
+            )
+        );
+    }
+    test_field_bar();
 }
 #[repr(C)]
 #[derive(Debug, Default, Copy, Clone)]
@@ -78,16 +97,23 @@
         4usize,
         concat!("Alignment of ", stringify!(Baz_Bar))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Baz_Bar>())).abc as *const _ as usize },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(Baz_Bar),
-            "::",
-            stringify!(abc)
-        )
-    );
+    fn test_field_abc() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Baz_Bar>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).abc) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Baz_Bar),
+                "::",
+                stringify!(abc)
+            )
+        );
+    }
+    test_field_abc();
 }
 #[test]
 fn bindgen_test_layout_Baz() {
diff --git a/tests/expectations/tests/issue-643-inner-struct.rs b/tests/expectations/tests/issue-643-inner-struct.rs
index 0728500..0fb586c 100644
--- a/tests/expectations/tests/issue-643-inner-struct.rs
+++ b/tests/expectations/tests/issue-643-inner-struct.rs
@@ -60,19 +60,23 @@
         4usize,
         concat!("Alignment of ", stringify!(rte_ring_prod))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_ring_prod>())).watermark as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_ring_prod),
-            "::",
-            stringify!(watermark)
-        )
-    );
+    fn test_field_watermark() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_ring_prod>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).watermark) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_ring_prod),
+                "::",
+                stringify!(watermark)
+            )
+        );
+    }
+    test_field_watermark();
 }
 #[repr(C)]
 #[derive(Debug, Default, Copy, Clone)]
@@ -91,19 +95,23 @@
         4usize,
         concat!("Alignment of ", stringify!(rte_ring_cons))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_ring_cons>())).sc_dequeue as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_ring_cons),
-            "::",
-            stringify!(sc_dequeue)
-        )
-    );
+    fn test_field_sc_dequeue() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_ring_cons>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).sc_dequeue) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_ring_cons),
+                "::",
+                stringify!(sc_dequeue)
+            )
+        );
+    }
+    test_field_sc_dequeue();
 }
 #[test]
 fn bindgen_test_layout_rte_ring() {
diff --git a/tests/expectations/tests/issue-648-derive-debug-with-padding.rs b/tests/expectations/tests/issue-648-derive-debug-with-padding.rs
index 4355486..f91bd46 100644
--- a/tests/expectations/tests/issue-648-derive-debug-with-padding.rs
+++ b/tests/expectations/tests/issue-648-derive-debug-with-padding.rs
@@ -25,16 +25,23 @@
         64usize,
         concat!("Alignment of ", stringify!(NoDebug))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<NoDebug>())).c as *const _ as usize },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(NoDebug),
-            "::",
-            stringify!(c)
-        )
-    );
+    fn test_field_c() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<NoDebug>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).c) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(NoDebug),
+                "::",
+                stringify!(c)
+            )
+        );
+    }
+    test_field_c();
 }
 impl Default for NoDebug {
     fn default() -> Self {
@@ -73,32 +80,44 @@
         64usize,
         concat!("Alignment of ", stringify!(ShouldDeriveDebugButDoesNot))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ShouldDeriveDebugButDoesNot>())).c
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(ShouldDeriveDebugButDoesNot),
-            "::",
-            stringify!(c)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ShouldDeriveDebugButDoesNot>())).d
-                as *const _ as usize
-        },
-        32usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(ShouldDeriveDebugButDoesNot),
-            "::",
-            stringify!(d)
-        )
-    );
+    fn test_field_c() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    ShouldDeriveDebugButDoesNot,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).c) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(ShouldDeriveDebugButDoesNot),
+                "::",
+                stringify!(c)
+            )
+        );
+    }
+    test_field_c();
+    fn test_field_d() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    ShouldDeriveDebugButDoesNot,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).d) as usize - ptr as usize
+            },
+            32usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(ShouldDeriveDebugButDoesNot),
+                "::",
+                stringify!(d)
+            )
+        );
+    }
+    test_field_d();
 }
 impl Default for ShouldDeriveDebugButDoesNot {
     fn default() -> Self {
diff --git a/tests/expectations/tests/issue-674-1.rs b/tests/expectations/tests/issue-674-1.rs
index 5ad6694..e3e7a54 100644
--- a/tests/expectations/tests/issue-674-1.rs
+++ b/tests/expectations/tests/issue-674-1.rs
@@ -36,18 +36,24 @@
             1usize,
             concat!("Alignment of ", stringify!(CapturingContentInfo))
         );
-        assert_eq!(
-            unsafe {
-                &(*(::std::ptr::null::<CapturingContentInfo>())).a as *const _
-                    as usize
-            },
-            0usize,
-            concat!(
-                "Offset of field: ",
-                stringify!(CapturingContentInfo),
-                "::",
-                stringify!(a)
-            )
-        );
+        fn test_field_a() {
+            assert_eq!(
+                unsafe {
+                    let uninit =
+                        ::std::mem::MaybeUninit::<CapturingContentInfo>::uninit(
+                        );
+                    let ptr = uninit.as_ptr();
+                    ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+                },
+                0usize,
+                concat!(
+                    "Offset of field: ",
+                    stringify!(CapturingContentInfo),
+                    "::",
+                    stringify!(a)
+                )
+            );
+        }
+        test_field_a();
     }
 }
diff --git a/tests/expectations/tests/issue-674-2.rs b/tests/expectations/tests/issue-674-2.rs
index 4ccc450..61a456f 100644
--- a/tests/expectations/tests/issue-674-2.rs
+++ b/tests/expectations/tests/issue-674-2.rs
@@ -36,11 +36,23 @@
             1usize,
             concat!("Alignment of ", stringify!(c))
         );
-        assert_eq!(
-            unsafe { &(*(::std::ptr::null::<c>())).b as *const _ as usize },
-            0usize,
-            concat!("Offset of field: ", stringify!(c), "::", stringify!(b))
-        );
+        fn test_field_b() {
+            assert_eq!(
+                unsafe {
+                    let uninit = ::std::mem::MaybeUninit::<c>::uninit();
+                    let ptr = uninit.as_ptr();
+                    ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize
+                },
+                0usize,
+                concat!(
+                    "Offset of field: ",
+                    stringify!(c),
+                    "::",
+                    stringify!(b)
+                )
+            );
+        }
+        test_field_b();
     }
     #[repr(C)]
     #[derive(Debug, Default, Copy, Clone)]
@@ -59,11 +71,23 @@
             1usize,
             concat!("Alignment of ", stringify!(B))
         );
-        assert_eq!(
-            unsafe { &(*(::std::ptr::null::<B>())).a as *const _ as usize },
-            0usize,
-            concat!("Offset of field: ", stringify!(B), "::", stringify!(a))
-        );
+        fn test_field_a() {
+            assert_eq!(
+                unsafe {
+                    let uninit = ::std::mem::MaybeUninit::<B>::uninit();
+                    let ptr = uninit.as_ptr();
+                    ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+                },
+                0usize,
+                concat!(
+                    "Offset of field: ",
+                    stringify!(B),
+                    "::",
+                    stringify!(a)
+                )
+            );
+        }
+        test_field_a();
     }
     #[repr(C)]
     #[derive(Debug, Default, Copy, Clone)]
diff --git a/tests/expectations/tests/issue-674-3.rs b/tests/expectations/tests/issue-674-3.rs
index 99c96b9..b45a953 100644
--- a/tests/expectations/tests/issue-674-3.rs
+++ b/tests/expectations/tests/issue-674-3.rs
@@ -32,11 +32,23 @@
             1usize,
             concat!("Alignment of ", stringify!(a))
         );
-        assert_eq!(
-            unsafe { &(*(::std::ptr::null::<a>())).b as *const _ as usize },
-            0usize,
-            concat!("Offset of field: ", stringify!(a), "::", stringify!(b))
-        );
+        fn test_field_b() {
+            assert_eq!(
+                unsafe {
+                    let uninit = ::std::mem::MaybeUninit::<a>::uninit();
+                    let ptr = uninit.as_ptr();
+                    ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize
+                },
+                0usize,
+                concat!(
+                    "Offset of field: ",
+                    stringify!(a),
+                    "::",
+                    stringify!(b)
+                )
+            );
+        }
+        test_field_b();
     }
     #[repr(C)]
     #[derive(Debug, Default, Copy, Clone)]
@@ -55,17 +67,23 @@
             1usize,
             concat!("Alignment of ", stringify!(nsCSSValue))
         );
-        assert_eq!(
-            unsafe {
-                &(*(::std::ptr::null::<nsCSSValue>())).c as *const _ as usize
-            },
-            0usize,
-            concat!(
-                "Offset of field: ",
-                stringify!(nsCSSValue),
-                "::",
-                stringify!(c)
-            )
-        );
+        fn test_field_c() {
+            assert_eq!(
+                unsafe {
+                    let uninit =
+                        ::std::mem::MaybeUninit::<nsCSSValue>::uninit();
+                    let ptr = uninit.as_ptr();
+                    ::std::ptr::addr_of!((*ptr).c) as usize - ptr as usize
+                },
+                0usize,
+                concat!(
+                    "Offset of field: ",
+                    stringify!(nsCSSValue),
+                    "::",
+                    stringify!(c)
+                )
+            );
+        }
+        test_field_c();
     }
 }
diff --git a/tests/expectations/tests/issue-691-template-parameter-virtual.rs b/tests/expectations/tests/issue-691-template-parameter-virtual.rs
index 4747b95..e71b2aa 100644
--- a/tests/expectations/tests/issue-691-template-parameter-virtual.rs
+++ b/tests/expectations/tests/issue-691-template-parameter-virtual.rs
@@ -6,7 +6,7 @@
 )]
 
 #[repr(C)]
-pub struct VirtualMethods__bindgen_vtable(::std::os::raw::c_void);
+pub struct VirtualMethods__bindgen_vtable {}
 #[repr(C)]
 #[derive(Debug, Copy, Clone)]
 pub struct VirtualMethods {
diff --git a/tests/expectations/tests/issue-739-pointer-wide-bitfield.rs b/tests/expectations/tests/issue-739-pointer-wide-bitfield.rs
index 7d7b792..1a63384 100644
--- a/tests/expectations/tests/issue-739-pointer-wide-bitfield.rs
+++ b/tests/expectations/tests/issue-739-pointer-wide-bitfield.rs
@@ -4,6 +4,7 @@
     non_camel_case_types,
     non_upper_case_globals
 )]
+#![cfg(not(target_os = "windows"))]
 
 #[repr(C)]
 #[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
diff --git a/tests/expectations/tests/issue-801-opaque-sloppiness.rs b/tests/expectations/tests/issue-801-opaque-sloppiness.rs
index 6fe3cc6..cd89eec 100644
--- a/tests/expectations/tests/issue-801-opaque-sloppiness.rs
+++ b/tests/expectations/tests/issue-801-opaque-sloppiness.rs
@@ -50,9 +50,16 @@
         1usize,
         concat!("Alignment of ", stringify!(C))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<C>())).b as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(C), "::", stringify!(b))
-    );
+    fn test_field_b() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<C>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize
+            },
+            0usize,
+            concat!("Offset of field: ", stringify!(C), "::", stringify!(b))
+        );
+    }
+    test_field_b();
 }
diff --git a/tests/expectations/tests/issue-807-opaque-types-methods-being-generated.rs b/tests/expectations/tests/issue-807-opaque-types-methods-being-generated.rs
index 7fd9caa..584bd00 100644
--- a/tests/expectations/tests/issue-807-opaque-types-methods-being-generated.rs
+++ b/tests/expectations/tests/issue-807-opaque-types-methods-being-generated.rs
@@ -119,17 +119,21 @@
         1usize,
         concat!("Alignment of ", stringify!(Allowlisted))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<Allowlisted>())).some_member as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(Allowlisted),
-            "::",
-            stringify!(some_member)
-        )
-    );
+    fn test_field_some_member() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Allowlisted>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).some_member) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Allowlisted),
+                "::",
+                stringify!(some_member)
+            )
+        );
+    }
+    test_field_some_member();
 }
diff --git a/tests/expectations/tests/issue-944-derive-copy-and-blocklisting.rs b/tests/expectations/tests/issue-944-derive-copy-and-blocklisting.rs
index dc50fe1..af00cb2 100644
--- a/tests/expectations/tests/issue-944-derive-copy-and-blocklisting.rs
+++ b/tests/expectations/tests/issue-944-derive-copy-and-blocklisting.rs
@@ -24,18 +24,24 @@
         1usize,
         concat!("Alignment of ", stringify!(ShouldNotBeCopy))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ShouldNotBeCopy>())).a as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(ShouldNotBeCopy),
-            "::",
-            stringify!(a)
-        )
-    );
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<ShouldNotBeCopy>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(ShouldNotBeCopy),
+                "::",
+                stringify!(a)
+            )
+        );
+    }
+    test_field_a();
 }
 impl Default for ShouldNotBeCopy {
     fn default() -> Self {
diff --git a/tests/expectations/tests/jsval_layout_opaque.rs b/tests/expectations/tests/jsval_layout_opaque.rs
index 5b84279..383410b 100644
--- a/tests/expectations/tests/jsval_layout_opaque.rs
+++ b/tests/expectations/tests/jsval_layout_opaque.rs
@@ -293,45 +293,63 @@
             stringify!(jsval_layout__bindgen_ty_2__bindgen_ty_1)
         )
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<jsval_layout__bindgen_ty_2__bindgen_ty_1>()))
-                .i32_ as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(jsval_layout__bindgen_ty_2__bindgen_ty_1),
-            "::",
-            stringify!(i32_)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<jsval_layout__bindgen_ty_2__bindgen_ty_1>()))
-                .u32_ as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(jsval_layout__bindgen_ty_2__bindgen_ty_1),
-            "::",
-            stringify!(u32_)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<jsval_layout__bindgen_ty_2__bindgen_ty_1>()))
-                .why as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(jsval_layout__bindgen_ty_2__bindgen_ty_1),
-            "::",
-            stringify!(why)
-        )
-    );
+    fn test_field_i32() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    jsval_layout__bindgen_ty_2__bindgen_ty_1,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).i32_) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(jsval_layout__bindgen_ty_2__bindgen_ty_1),
+                "::",
+                stringify!(i32_)
+            )
+        );
+    }
+    test_field_i32();
+    fn test_field_u32() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    jsval_layout__bindgen_ty_2__bindgen_ty_1,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).u32_) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(jsval_layout__bindgen_ty_2__bindgen_ty_1),
+                "::",
+                stringify!(u32_)
+            )
+        );
+    }
+    test_field_u32();
+    fn test_field_why() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    jsval_layout__bindgen_ty_2__bindgen_ty_1,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).why) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(jsval_layout__bindgen_ty_2__bindgen_ty_1),
+                "::",
+                stringify!(why)
+            )
+        );
+    }
+    test_field_why();
 }
 impl Default for jsval_layout__bindgen_ty_2__bindgen_ty_1 {
     fn default() -> Self {
@@ -354,19 +372,25 @@
         4usize,
         concat!("Alignment of ", stringify!(jsval_layout__bindgen_ty_2))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<jsval_layout__bindgen_ty_2>())).payload
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(jsval_layout__bindgen_ty_2),
-            "::",
-            stringify!(payload)
-        )
-    );
+    fn test_field_payload() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    jsval_layout__bindgen_ty_2,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).payload) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(jsval_layout__bindgen_ty_2),
+                "::",
+                stringify!(payload)
+            )
+        );
+    }
+    test_field_payload();
 }
 impl Default for jsval_layout__bindgen_ty_2 {
     fn default() -> Self {
@@ -389,93 +413,125 @@
         8usize,
         concat!("Alignment of ", stringify!(jsval_layout))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<jsval_layout>())).asBits as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(jsval_layout),
-            "::",
-            stringify!(asBits)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<jsval_layout>())).debugView as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(jsval_layout),
-            "::",
-            stringify!(debugView)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<jsval_layout>())).s as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(jsval_layout),
-            "::",
-            stringify!(s)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<jsval_layout>())).asDouble as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(jsval_layout),
-            "::",
-            stringify!(asDouble)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<jsval_layout>())).asPtr as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(jsval_layout),
-            "::",
-            stringify!(asPtr)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<jsval_layout>())).asWord as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(jsval_layout),
-            "::",
-            stringify!(asWord)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<jsval_layout>())).asUIntPtr as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(jsval_layout),
-            "::",
-            stringify!(asUIntPtr)
-        )
-    );
+    fn test_field_asBits() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<jsval_layout>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).asBits) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(jsval_layout),
+                "::",
+                stringify!(asBits)
+            )
+        );
+    }
+    test_field_asBits();
+    fn test_field_debugView() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<jsval_layout>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).debugView) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(jsval_layout),
+                "::",
+                stringify!(debugView)
+            )
+        );
+    }
+    test_field_debugView();
+    fn test_field_s() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<jsval_layout>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).s) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(jsval_layout),
+                "::",
+                stringify!(s)
+            )
+        );
+    }
+    test_field_s();
+    fn test_field_asDouble() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<jsval_layout>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).asDouble) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(jsval_layout),
+                "::",
+                stringify!(asDouble)
+            )
+        );
+    }
+    test_field_asDouble();
+    fn test_field_asPtr() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<jsval_layout>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).asPtr) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(jsval_layout),
+                "::",
+                stringify!(asPtr)
+            )
+        );
+    }
+    test_field_asPtr();
+    fn test_field_asWord() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<jsval_layout>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).asWord) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(jsval_layout),
+                "::",
+                stringify!(asWord)
+            )
+        );
+    }
+    test_field_asWord();
+    fn test_field_asUIntPtr() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<jsval_layout>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).asUIntPtr) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(jsval_layout),
+                "::",
+                stringify!(asUIntPtr)
+            )
+        );
+    }
+    test_field_asUIntPtr();
 }
 impl Default for jsval_layout {
     fn default() -> Self {
@@ -503,16 +559,23 @@
         8usize,
         concat!("Alignment of ", stringify!(Value))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Value>())).data as *const _ as usize },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(Value),
-            "::",
-            stringify!(data)
-        )
-    );
+    fn test_field_data() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Value>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).data) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Value),
+                "::",
+                stringify!(data)
+            )
+        );
+    }
+    test_field_data();
 }
 impl Default for Value {
     fn default() -> Self {
diff --git a/tests/expectations/tests/jsval_layout_opaque_1_0.rs b/tests/expectations/tests/jsval_layout_opaque_1_0.rs
index 260282d..bdb4110 100644
--- a/tests/expectations/tests/jsval_layout_opaque_1_0.rs
+++ b/tests/expectations/tests/jsval_layout_opaque_1_0.rs
@@ -343,45 +343,63 @@
             stringify!(jsval_layout__bindgen_ty_2__bindgen_ty_1)
         )
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<jsval_layout__bindgen_ty_2__bindgen_ty_1>()))
-                .i32_ as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(jsval_layout__bindgen_ty_2__bindgen_ty_1),
-            "::",
-            stringify!(i32_)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<jsval_layout__bindgen_ty_2__bindgen_ty_1>()))
-                .u32_ as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(jsval_layout__bindgen_ty_2__bindgen_ty_1),
-            "::",
-            stringify!(u32_)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<jsval_layout__bindgen_ty_2__bindgen_ty_1>()))
-                .why as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(jsval_layout__bindgen_ty_2__bindgen_ty_1),
-            "::",
-            stringify!(why)
-        )
-    );
+    fn test_field_i32() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    jsval_layout__bindgen_ty_2__bindgen_ty_1,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).i32_) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(jsval_layout__bindgen_ty_2__bindgen_ty_1),
+                "::",
+                stringify!(i32_)
+            )
+        );
+    }
+    test_field_i32();
+    fn test_field_u32() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    jsval_layout__bindgen_ty_2__bindgen_ty_1,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).u32_) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(jsval_layout__bindgen_ty_2__bindgen_ty_1),
+                "::",
+                stringify!(u32_)
+            )
+        );
+    }
+    test_field_u32();
+    fn test_field_why() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    jsval_layout__bindgen_ty_2__bindgen_ty_1,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).why) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(jsval_layout__bindgen_ty_2__bindgen_ty_1),
+                "::",
+                stringify!(why)
+            )
+        );
+    }
+    test_field_why();
 }
 impl Clone for jsval_layout__bindgen_ty_2__bindgen_ty_1 {
     fn clone(&self) -> Self {
@@ -400,19 +418,25 @@
         4usize,
         concat!("Alignment of ", stringify!(jsval_layout__bindgen_ty_2))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<jsval_layout__bindgen_ty_2>())).payload
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(jsval_layout__bindgen_ty_2),
-            "::",
-            stringify!(payload)
-        )
-    );
+    fn test_field_payload() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    jsval_layout__bindgen_ty_2,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).payload) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(jsval_layout__bindgen_ty_2),
+                "::",
+                stringify!(payload)
+            )
+        );
+    }
+    test_field_payload();
 }
 impl Clone for jsval_layout__bindgen_ty_2 {
     fn clone(&self) -> Self {
@@ -431,93 +455,125 @@
         8usize,
         concat!("Alignment of ", stringify!(jsval_layout))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<jsval_layout>())).asBits as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(jsval_layout),
-            "::",
-            stringify!(asBits)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<jsval_layout>())).debugView as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(jsval_layout),
-            "::",
-            stringify!(debugView)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<jsval_layout>())).s as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(jsval_layout),
-            "::",
-            stringify!(s)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<jsval_layout>())).asDouble as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(jsval_layout),
-            "::",
-            stringify!(asDouble)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<jsval_layout>())).asPtr as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(jsval_layout),
-            "::",
-            stringify!(asPtr)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<jsval_layout>())).asWord as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(jsval_layout),
-            "::",
-            stringify!(asWord)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<jsval_layout>())).asUIntPtr as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(jsval_layout),
-            "::",
-            stringify!(asUIntPtr)
-        )
-    );
+    fn test_field_asBits() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<jsval_layout>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).asBits) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(jsval_layout),
+                "::",
+                stringify!(asBits)
+            )
+        );
+    }
+    test_field_asBits();
+    fn test_field_debugView() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<jsval_layout>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).debugView) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(jsval_layout),
+                "::",
+                stringify!(debugView)
+            )
+        );
+    }
+    test_field_debugView();
+    fn test_field_s() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<jsval_layout>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).s) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(jsval_layout),
+                "::",
+                stringify!(s)
+            )
+        );
+    }
+    test_field_s();
+    fn test_field_asDouble() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<jsval_layout>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).asDouble) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(jsval_layout),
+                "::",
+                stringify!(asDouble)
+            )
+        );
+    }
+    test_field_asDouble();
+    fn test_field_asPtr() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<jsval_layout>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).asPtr) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(jsval_layout),
+                "::",
+                stringify!(asPtr)
+            )
+        );
+    }
+    test_field_asPtr();
+    fn test_field_asWord() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<jsval_layout>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).asWord) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(jsval_layout),
+                "::",
+                stringify!(asWord)
+            )
+        );
+    }
+    test_field_asWord();
+    fn test_field_asUIntPtr() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<jsval_layout>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).asUIntPtr) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(jsval_layout),
+                "::",
+                stringify!(asUIntPtr)
+            )
+        );
+    }
+    test_field_asUIntPtr();
 }
 impl Clone for jsval_layout {
     fn clone(&self) -> Self {
@@ -541,16 +597,23 @@
         8usize,
         concat!("Alignment of ", stringify!(Value))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Value>())).data as *const _ as usize },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(Value),
-            "::",
-            stringify!(data)
-        )
-    );
+    fn test_field_data() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Value>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).data) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Value),
+                "::",
+                stringify!(data)
+            )
+        );
+    }
+    test_field_data();
 }
 impl Clone for Value {
     fn clone(&self) -> Self {
diff --git a/tests/expectations/tests/keywords.rs b/tests/expectations/tests/keywords.rs
index f77bda0..055b0f0 100644
--- a/tests/expectations/tests/keywords.rs
+++ b/tests/expectations/tests/keywords.rs
@@ -146,6 +146,10 @@
     pub static mut true_: ::std::os::raw::c_int;
 }
 extern "C" {
+    #[link_name = "\u{1}try"]
+    pub static mut try_: ::std::os::raw::c_int;
+}
+extern "C" {
     #[link_name = "\u{1}type"]
     pub static mut type_: ::std::os::raw::c_int;
 }
diff --git a/tests/expectations/tests/layout_align.rs b/tests/expectations/tests/layout_align.rs
index cb34df3..44df4c1 100644
--- a/tests/expectations/tests/layout_align.rs
+++ b/tests/expectations/tests/layout_align.rs
@@ -179,19 +179,23 @@
         8usize,
         concat!("Alignment of ", stringify!(rte_eth_link))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_link>())).link_speed as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_link),
-            "::",
-            stringify!(link_speed)
-        )
-    );
+    fn test_field_link_speed() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_eth_link>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).link_speed) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_link),
+                "::",
+                stringify!(link_speed)
+            )
+        );
+    }
+    test_field_link_speed();
 }
 impl rte_eth_link {
     #[inline]
diff --git a/tests/expectations/tests/layout_arp.rs b/tests/expectations/tests/layout_arp.rs
index d6642d7..fc3aa5d 100644
--- a/tests/expectations/tests/layout_arp.rs
+++ b/tests/expectations/tests/layout_arp.rs
@@ -40,19 +40,23 @@
         1usize,
         concat!("Alignment of ", stringify!(ether_addr))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ether_addr>())).addr_bytes as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(ether_addr),
-            "::",
-            stringify!(addr_bytes)
-        )
-    );
+    fn test_field_addr_bytes() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<ether_addr>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).addr_bytes) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(ether_addr),
+                "::",
+                stringify!(addr_bytes)
+            )
+        );
+    }
+    test_field_addr_bytes();
 }
 /// ARP header IPv4 payload.
 #[repr(C, packed)]
@@ -79,54 +83,74 @@
         1usize,
         concat!("Alignment of ", stringify!(arp_ipv4))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<arp_ipv4>())).arp_sha as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(arp_ipv4),
-            "::",
-            stringify!(arp_sha)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<arp_ipv4>())).arp_sip as *const _ as usize
-        },
-        6usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(arp_ipv4),
-            "::",
-            stringify!(arp_sip)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<arp_ipv4>())).arp_tha as *const _ as usize
-        },
-        10usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(arp_ipv4),
-            "::",
-            stringify!(arp_tha)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<arp_ipv4>())).arp_tip as *const _ as usize
-        },
-        16usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(arp_ipv4),
-            "::",
-            stringify!(arp_tip)
-        )
-    );
+    fn test_field_arp_sha() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<arp_ipv4>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).arp_sha) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(arp_ipv4),
+                "::",
+                stringify!(arp_sha)
+            )
+        );
+    }
+    test_field_arp_sha();
+    fn test_field_arp_sip() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<arp_ipv4>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).arp_sip) as usize - ptr as usize
+            },
+            6usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(arp_ipv4),
+                "::",
+                stringify!(arp_sip)
+            )
+        );
+    }
+    test_field_arp_sip();
+    fn test_field_arp_tha() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<arp_ipv4>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).arp_tha) as usize - ptr as usize
+            },
+            10usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(arp_ipv4),
+                "::",
+                stringify!(arp_tha)
+            )
+        );
+    }
+    test_field_arp_tha();
+    fn test_field_arp_tip() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<arp_ipv4>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).arp_tip) as usize - ptr as usize
+            },
+            16usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(arp_ipv4),
+                "::",
+                stringify!(arp_tip)
+            )
+        );
+    }
+    test_field_arp_tip();
 }
 /// ARP header.
 #[repr(C, packed)]
@@ -151,76 +175,106 @@
         1usize,
         concat!("Alignment of ", stringify!(arp_hdr))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<arp_hdr>())).arp_hrd as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(arp_hdr),
-            "::",
-            stringify!(arp_hrd)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<arp_hdr>())).arp_pro as *const _ as usize
-        },
-        2usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(arp_hdr),
-            "::",
-            stringify!(arp_pro)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<arp_hdr>())).arp_hln as *const _ as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(arp_hdr),
-            "::",
-            stringify!(arp_hln)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<arp_hdr>())).arp_pln as *const _ as usize
-        },
-        5usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(arp_hdr),
-            "::",
-            stringify!(arp_pln)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<arp_hdr>())).arp_op as *const _ as usize
-        },
-        6usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(arp_hdr),
-            "::",
-            stringify!(arp_op)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<arp_hdr>())).arp_data as *const _ as usize
-        },
-        8usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(arp_hdr),
-            "::",
-            stringify!(arp_data)
-        )
-    );
+    fn test_field_arp_hrd() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<arp_hdr>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).arp_hrd) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(arp_hdr),
+                "::",
+                stringify!(arp_hrd)
+            )
+        );
+    }
+    test_field_arp_hrd();
+    fn test_field_arp_pro() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<arp_hdr>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).arp_pro) as usize - ptr as usize
+            },
+            2usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(arp_hdr),
+                "::",
+                stringify!(arp_pro)
+            )
+        );
+    }
+    test_field_arp_pro();
+    fn test_field_arp_hln() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<arp_hdr>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).arp_hln) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(arp_hdr),
+                "::",
+                stringify!(arp_hln)
+            )
+        );
+    }
+    test_field_arp_hln();
+    fn test_field_arp_pln() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<arp_hdr>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).arp_pln) as usize - ptr as usize
+            },
+            5usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(arp_hdr),
+                "::",
+                stringify!(arp_pln)
+            )
+        );
+    }
+    test_field_arp_pln();
+    fn test_field_arp_op() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<arp_hdr>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).arp_op) as usize - ptr as usize
+            },
+            6usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(arp_hdr),
+                "::",
+                stringify!(arp_op)
+            )
+        );
+    }
+    test_field_arp_op();
+    fn test_field_arp_data() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<arp_hdr>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).arp_data) as usize - ptr as usize
+            },
+            8usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(arp_hdr),
+                "::",
+                stringify!(arp_data)
+            )
+        );
+    }
+    test_field_arp_data();
 }
diff --git a/tests/expectations/tests/layout_array.rs b/tests/expectations/tests/layout_array.rs
index 3ba1b6d..c8ee421 100644
--- a/tests/expectations/tests/layout_array.rs
+++ b/tests/expectations/tests/layout_array.rs
@@ -79,84 +79,114 @@
         64usize,
         concat!("Alignment of ", stringify!(rte_mempool_ops))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mempool_ops>())).name as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mempool_ops),
-            "::",
-            stringify!(name)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mempool_ops>())).alloc as *const _
-                as usize
-        },
-        32usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mempool_ops),
-            "::",
-            stringify!(alloc)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mempool_ops>())).free as *const _
-                as usize
-        },
-        40usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mempool_ops),
-            "::",
-            stringify!(free)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mempool_ops>())).enqueue as *const _
-                as usize
-        },
-        48usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mempool_ops),
-            "::",
-            stringify!(enqueue)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mempool_ops>())).dequeue as *const _
-                as usize
-        },
-        56usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mempool_ops),
-            "::",
-            stringify!(dequeue)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mempool_ops>())).get_count as *const _
-                as usize
-        },
-        64usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mempool_ops),
-            "::",
-            stringify!(get_count)
-        )
-    );
+    fn test_field_name() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_mempool_ops>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).name) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_mempool_ops),
+                "::",
+                stringify!(name)
+            )
+        );
+    }
+    test_field_name();
+    fn test_field_alloc() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_mempool_ops>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).alloc) as usize - ptr as usize
+            },
+            32usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_mempool_ops),
+                "::",
+                stringify!(alloc)
+            )
+        );
+    }
+    test_field_alloc();
+    fn test_field_free() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_mempool_ops>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).free) as usize - ptr as usize
+            },
+            40usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_mempool_ops),
+                "::",
+                stringify!(free)
+            )
+        );
+    }
+    test_field_free();
+    fn test_field_enqueue() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_mempool_ops>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).enqueue) as usize - ptr as usize
+            },
+            48usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_mempool_ops),
+                "::",
+                stringify!(enqueue)
+            )
+        );
+    }
+    test_field_enqueue();
+    fn test_field_dequeue() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_mempool_ops>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).dequeue) as usize - ptr as usize
+            },
+            56usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_mempool_ops),
+                "::",
+                stringify!(dequeue)
+            )
+        );
+    }
+    test_field_dequeue();
+    fn test_field_get_count() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_mempool_ops>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).get_count) as usize - ptr as usize
+            },
+            64usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_mempool_ops),
+                "::",
+                stringify!(get_count)
+            )
+        );
+    }
+    test_field_get_count();
 }
 impl Default for rte_mempool_ops {
     fn default() -> Self {
@@ -196,19 +226,24 @@
         4usize,
         concat!("Alignment of ", stringify!(rte_spinlock_t))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_spinlock_t>())).locked as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_spinlock_t),
-            "::",
-            stringify!(locked)
-        )
-    );
+    fn test_field_locked() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_spinlock_t>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).locked) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_spinlock_t),
+                "::",
+                stringify!(locked)
+            )
+        );
+    }
+    test_field_locked();
 }
 /// Structure storing the table of registered ops structs, each of which contain
 /// the function pointers for the mempool ops functions.
@@ -241,45 +276,60 @@
         64usize,
         concat!("Alignment of ", stringify!(rte_mempool_ops_table))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mempool_ops_table>())).sl as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mempool_ops_table),
-            "::",
-            stringify!(sl)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mempool_ops_table>())).num_ops
-                as *const _ as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mempool_ops_table),
-            "::",
-            stringify!(num_ops)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mempool_ops_table>())).ops as *const _
-                as usize
-        },
-        64usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mempool_ops_table),
-            "::",
-            stringify!(ops)
-        )
-    );
+    fn test_field_sl() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_mempool_ops_table>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).sl) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_mempool_ops_table),
+                "::",
+                stringify!(sl)
+            )
+        );
+    }
+    test_field_sl();
+    fn test_field_num_ops() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_mempool_ops_table>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).num_ops) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_mempool_ops_table),
+                "::",
+                stringify!(num_ops)
+            )
+        );
+    }
+    test_field_num_ops();
+    fn test_field_ops() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_mempool_ops_table>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).ops) as usize - ptr as usize
+            },
+            64usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_mempool_ops_table),
+                "::",
+                stringify!(ops)
+            )
+        );
+    }
+    test_field_ops();
 }
 impl Default for rte_mempool_ops_table {
     fn default() -> Self {
@@ -317,19 +367,23 @@
         8usize,
         concat!("Alignment of ", stringify!(malloc_heap__bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<malloc_heap__bindgen_ty_1>())).lh_first
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(malloc_heap__bindgen_ty_1),
-            "::",
-            stringify!(lh_first)
-        )
-    );
+    fn test_field_lh_first() {
+        assert_eq!(
+            unsafe {
+                let uninit = :: std :: mem :: MaybeUninit :: < malloc_heap__bindgen_ty_1 > :: uninit () ;
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).lh_first) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(malloc_heap__bindgen_ty_1),
+                "::",
+                stringify!(lh_first)
+            )
+        );
+    }
+    test_field_lh_first();
 }
 impl Default for malloc_heap__bindgen_ty_1 {
     fn default() -> Self {
@@ -352,57 +406,74 @@
         64usize,
         concat!("Alignment of ", stringify!(malloc_heap))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<malloc_heap>())).lock as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(malloc_heap),
-            "::",
-            stringify!(lock)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<malloc_heap>())).free_head as *const _
-                as usize
-        },
-        8usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(malloc_heap),
-            "::",
-            stringify!(free_head)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<malloc_heap>())).alloc_count as *const _
-                as usize
-        },
-        112usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(malloc_heap),
-            "::",
-            stringify!(alloc_count)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<malloc_heap>())).total_size as *const _
-                as usize
-        },
-        120usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(malloc_heap),
-            "::",
-            stringify!(total_size)
-        )
-    );
+    fn test_field_lock() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<malloc_heap>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).lock) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(malloc_heap),
+                "::",
+                stringify!(lock)
+            )
+        );
+    }
+    test_field_lock();
+    fn test_field_free_head() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<malloc_heap>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).free_head) as usize - ptr as usize
+            },
+            8usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(malloc_heap),
+                "::",
+                stringify!(free_head)
+            )
+        );
+    }
+    test_field_free_head();
+    fn test_field_alloc_count() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<malloc_heap>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).alloc_count) as usize - ptr as usize
+            },
+            112usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(malloc_heap),
+                "::",
+                stringify!(alloc_count)
+            )
+        );
+    }
+    test_field_alloc_count();
+    fn test_field_total_size() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<malloc_heap>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).total_size) as usize - ptr as usize
+            },
+            120usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(malloc_heap),
+                "::",
+                stringify!(total_size)
+            )
+        );
+    }
+    test_field_total_size();
 }
 impl Default for malloc_heap {
     fn default() -> Self {
diff --git a/tests/expectations/tests/layout_array_too_long.rs b/tests/expectations/tests/layout_array_too_long.rs
index c9880ea..586d35e 100644
--- a/tests/expectations/tests/layout_array_too_long.rs
+++ b/tests/expectations/tests/layout_array_too_long.rs
@@ -45,36 +45,57 @@
         8usize,
         concat!("Alignment of ", stringify!(ip_frag))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<ip_frag>())).ofs as *const _ as usize },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(ip_frag),
-            "::",
-            stringify!(ofs)
-        )
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<ip_frag>())).len as *const _ as usize },
-        2usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(ip_frag),
-            "::",
-            stringify!(len)
-        )
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<ip_frag>())).mb as *const _ as usize },
-        8usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(ip_frag),
-            "::",
-            stringify!(mb)
-        )
-    );
+    fn test_field_ofs() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<ip_frag>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).ofs) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(ip_frag),
+                "::",
+                stringify!(ofs)
+            )
+        );
+    }
+    test_field_ofs();
+    fn test_field_len() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<ip_frag>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).len) as usize - ptr as usize
+            },
+            2usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(ip_frag),
+                "::",
+                stringify!(len)
+            )
+        );
+    }
+    test_field_len();
+    fn test_field_mb() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<ip_frag>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mb) as usize - ptr as usize
+            },
+            8usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(ip_frag),
+                "::",
+                stringify!(mb)
+            )
+        );
+    }
+    test_field_mb();
 }
 impl Default for ip_frag {
     fn default() -> Self {
@@ -108,42 +129,57 @@
         8usize,
         concat!("Alignment of ", stringify!(ip_frag_key))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ip_frag_key>())).src_dst as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(ip_frag_key),
-            "::",
-            stringify!(src_dst)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ip_frag_key>())).id as *const _ as usize
-        },
-        32usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(ip_frag_key),
-            "::",
-            stringify!(id)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ip_frag_key>())).key_len as *const _ as usize
-        },
-        36usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(ip_frag_key),
-            "::",
-            stringify!(key_len)
-        )
-    );
+    fn test_field_src_dst() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<ip_frag_key>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).src_dst) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(ip_frag_key),
+                "::",
+                stringify!(src_dst)
+            )
+        );
+    }
+    test_field_src_dst();
+    fn test_field_id() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<ip_frag_key>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).id) as usize - ptr as usize
+            },
+            32usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(ip_frag_key),
+                "::",
+                stringify!(id)
+            )
+        );
+    }
+    test_field_id();
+    fn test_field_key_len() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<ip_frag_key>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).key_len) as usize - ptr as usize
+            },
+            36usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(ip_frag_key),
+                "::",
+                stringify!(key_len)
+            )
+        );
+    }
+    test_field_key_len();
 }
 /// @internal Fragmented packet to reassemble.
 /// First two entries in the frags[] array are for the last and first fragments.
@@ -184,32 +220,40 @@
         8usize,
         concat!("Alignment of ", stringify!(ip_frag_pkt__bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ip_frag_pkt__bindgen_ty_1>())).tqe_next
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(ip_frag_pkt__bindgen_ty_1),
-            "::",
-            stringify!(tqe_next)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ip_frag_pkt__bindgen_ty_1>())).tqe_prev
-                as *const _ as usize
-        },
-        8usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(ip_frag_pkt__bindgen_ty_1),
-            "::",
-            stringify!(tqe_prev)
-        )
-    );
+    fn test_field_tqe_next() {
+        assert_eq!(
+            unsafe {
+                let uninit = :: std :: mem :: MaybeUninit :: < ip_frag_pkt__bindgen_ty_1 > :: uninit () ;
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).tqe_next) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(ip_frag_pkt__bindgen_ty_1),
+                "::",
+                stringify!(tqe_next)
+            )
+        );
+    }
+    test_field_tqe_next();
+    fn test_field_tqe_prev() {
+        assert_eq!(
+            unsafe {
+                let uninit = :: std :: mem :: MaybeUninit :: < ip_frag_pkt__bindgen_ty_1 > :: uninit () ;
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).tqe_prev) as usize - ptr as usize
+            },
+            8usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(ip_frag_pkt__bindgen_ty_1),
+                "::",
+                stringify!(tqe_prev)
+            )
+        );
+    }
+    test_field_tqe_prev();
 }
 impl Default for ip_frag_pkt__bindgen_ty_1 {
     fn default() -> Self {
@@ -232,93 +276,125 @@
         64usize,
         concat!("Alignment of ", stringify!(ip_frag_pkt))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ip_frag_pkt>())).lru as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(ip_frag_pkt),
-            "::",
-            stringify!(lru)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ip_frag_pkt>())).key as *const _ as usize
-        },
-        16usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(ip_frag_pkt),
-            "::",
-            stringify!(key)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ip_frag_pkt>())).start as *const _ as usize
-        },
-        56usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(ip_frag_pkt),
-            "::",
-            stringify!(start)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ip_frag_pkt>())).total_size as *const _
-                as usize
-        },
-        64usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(ip_frag_pkt),
-            "::",
-            stringify!(total_size)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ip_frag_pkt>())).frag_size as *const _
-                as usize
-        },
-        68usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(ip_frag_pkt),
-            "::",
-            stringify!(frag_size)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ip_frag_pkt>())).last_idx as *const _
-                as usize
-        },
-        72usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(ip_frag_pkt),
-            "::",
-            stringify!(last_idx)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ip_frag_pkt>())).frags as *const _ as usize
-        },
-        80usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(ip_frag_pkt),
-            "::",
-            stringify!(frags)
-        )
-    );
+    fn test_field_lru() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<ip_frag_pkt>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).lru) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(ip_frag_pkt),
+                "::",
+                stringify!(lru)
+            )
+        );
+    }
+    test_field_lru();
+    fn test_field_key() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<ip_frag_pkt>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).key) as usize - ptr as usize
+            },
+            16usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(ip_frag_pkt),
+                "::",
+                stringify!(key)
+            )
+        );
+    }
+    test_field_key();
+    fn test_field_start() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<ip_frag_pkt>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).start) as usize - ptr as usize
+            },
+            56usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(ip_frag_pkt),
+                "::",
+                stringify!(start)
+            )
+        );
+    }
+    test_field_start();
+    fn test_field_total_size() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<ip_frag_pkt>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).total_size) as usize - ptr as usize
+            },
+            64usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(ip_frag_pkt),
+                "::",
+                stringify!(total_size)
+            )
+        );
+    }
+    test_field_total_size();
+    fn test_field_frag_size() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<ip_frag_pkt>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).frag_size) as usize - ptr as usize
+            },
+            68usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(ip_frag_pkt),
+                "::",
+                stringify!(frag_size)
+            )
+        );
+    }
+    test_field_frag_size();
+    fn test_field_last_idx() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<ip_frag_pkt>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).last_idx) as usize - ptr as usize
+            },
+            72usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(ip_frag_pkt),
+                "::",
+                stringify!(last_idx)
+            )
+        );
+    }
+    test_field_last_idx();
+    fn test_field_frags() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<ip_frag_pkt>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).frags) as usize - ptr as usize
+            },
+            80usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(ip_frag_pkt),
+                "::",
+                stringify!(frags)
+            )
+        );
+    }
+    test_field_frags();
 }
 impl Default for ip_frag_pkt {
     fn default() -> Self {
diff --git a/tests/expectations/tests/layout_cmdline_token.rs b/tests/expectations/tests/layout_cmdline_token.rs
index 47170dd..a4360cd 100644
--- a/tests/expectations/tests/layout_cmdline_token.rs
+++ b/tests/expectations/tests/layout_cmdline_token.rs
@@ -25,32 +25,42 @@
         8usize,
         concat!("Alignment of ", stringify!(cmdline_token_hdr))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<cmdline_token_hdr>())).ops as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(cmdline_token_hdr),
-            "::",
-            stringify!(ops)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<cmdline_token_hdr>())).offset as *const _
-                as usize
-        },
-        8usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(cmdline_token_hdr),
-            "::",
-            stringify!(offset)
-        )
-    );
+    fn test_field_ops() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<cmdline_token_hdr>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).ops) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(cmdline_token_hdr),
+                "::",
+                stringify!(ops)
+            )
+        );
+    }
+    test_field_ops();
+    fn test_field_offset() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<cmdline_token_hdr>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).offset) as usize - ptr as usize
+            },
+            8usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(cmdline_token_hdr),
+                "::",
+                stringify!(offset)
+            )
+        );
+    }
+    test_field_offset();
 }
 impl Default for cmdline_token_hdr {
     fn default() -> Self {
@@ -129,58 +139,80 @@
         8usize,
         concat!("Alignment of ", stringify!(cmdline_token_ops))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<cmdline_token_ops>())).parse as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(cmdline_token_ops),
-            "::",
-            stringify!(parse)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<cmdline_token_ops>())).complete_get_nb
-                as *const _ as usize
-        },
-        8usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(cmdline_token_ops),
-            "::",
-            stringify!(complete_get_nb)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<cmdline_token_ops>())).complete_get_elt
-                as *const _ as usize
-        },
-        16usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(cmdline_token_ops),
-            "::",
-            stringify!(complete_get_elt)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<cmdline_token_ops>())).get_help as *const _
-                as usize
-        },
-        24usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(cmdline_token_ops),
-            "::",
-            stringify!(get_help)
-        )
-    );
+    fn test_field_parse() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<cmdline_token_ops>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).parse) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(cmdline_token_ops),
+                "::",
+                stringify!(parse)
+            )
+        );
+    }
+    test_field_parse();
+    fn test_field_complete_get_nb() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<cmdline_token_ops>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).complete_get_nb) as usize -
+                    ptr as usize
+            },
+            8usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(cmdline_token_ops),
+                "::",
+                stringify!(complete_get_nb)
+            )
+        );
+    }
+    test_field_complete_get_nb();
+    fn test_field_complete_get_elt() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<cmdline_token_ops>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).complete_get_elt) as usize -
+                    ptr as usize
+            },
+            16usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(cmdline_token_ops),
+                "::",
+                stringify!(complete_get_elt)
+            )
+        );
+    }
+    test_field_complete_get_elt();
+    fn test_field_get_help() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<cmdline_token_ops>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).get_help) as usize - ptr as usize
+            },
+            24usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(cmdline_token_ops),
+                "::",
+                stringify!(get_help)
+            )
+        );
+    }
+    test_field_get_help();
 }
 #[repr(u32)]
 #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
@@ -211,19 +243,24 @@
         4usize,
         concat!("Alignment of ", stringify!(cmdline_token_num_data))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<cmdline_token_num_data>())).type_ as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(cmdline_token_num_data),
-            "::",
-            stringify!(type_)
-        )
-    );
+    fn test_field_type() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<cmdline_token_num_data>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).type_) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(cmdline_token_num_data),
+                "::",
+                stringify!(type_)
+            )
+        );
+    }
+    test_field_type();
 }
 impl Default for cmdline_token_num_data {
     fn default() -> Self {
@@ -252,32 +289,42 @@
         8usize,
         concat!("Alignment of ", stringify!(cmdline_token_num))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<cmdline_token_num>())).hdr as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(cmdline_token_num),
-            "::",
-            stringify!(hdr)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<cmdline_token_num>())).num_data as *const _
-                as usize
-        },
-        16usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(cmdline_token_num),
-            "::",
-            stringify!(num_data)
-        )
-    );
+    fn test_field_hdr() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<cmdline_token_num>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).hdr) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(cmdline_token_num),
+                "::",
+                stringify!(hdr)
+            )
+        );
+    }
+    test_field_hdr();
+    fn test_field_num_data() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<cmdline_token_num>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).num_data) as usize - ptr as usize
+            },
+            16usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(cmdline_token_num),
+                "::",
+                stringify!(num_data)
+            )
+        );
+    }
+    test_field_num_data();
 }
 impl Default for cmdline_token_num {
     fn default() -> Self {
diff --git a/tests/expectations/tests/layout_eth_conf.rs b/tests/expectations/tests/layout_eth_conf.rs
index e880608..3296a0f 100644
--- a/tests/expectations/tests/layout_eth_conf.rs
+++ b/tests/expectations/tests/layout_eth_conf.rs
@@ -170,45 +170,62 @@
         4usize,
         concat!("Alignment of ", stringify!(rte_eth_rxmode))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_rxmode>())).mq_mode as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_rxmode),
-            "::",
-            stringify!(mq_mode)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_rxmode>())).max_rx_pkt_len
-                as *const _ as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_rxmode),
-            "::",
-            stringify!(max_rx_pkt_len)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_rxmode>())).split_hdr_size
-                as *const _ as usize
-        },
-        8usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_rxmode),
-            "::",
-            stringify!(split_hdr_size)
-        )
-    );
+    fn test_field_mq_mode() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_rxmode>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mq_mode) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_rxmode),
+                "::",
+                stringify!(mq_mode)
+            )
+        );
+    }
+    test_field_mq_mode();
+    fn test_field_max_rx_pkt_len() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_rxmode>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).max_rx_pkt_len) as usize -
+                    ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_rxmode),
+                "::",
+                stringify!(max_rx_pkt_len)
+            )
+        );
+    }
+    test_field_max_rx_pkt_len();
+    fn test_field_split_hdr_size() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_rxmode>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).split_hdr_size) as usize -
+                    ptr as usize
+            },
+            8usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_rxmode),
+                "::",
+                stringify!(split_hdr_size)
+            )
+        );
+    }
+    test_field_split_hdr_size();
 }
 impl Default for rte_eth_rxmode {
     fn default() -> Self {
@@ -435,31 +452,42 @@
         4usize,
         concat!("Alignment of ", stringify!(rte_eth_txmode))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_txmode>())).mq_mode as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_txmode),
-            "::",
-            stringify!(mq_mode)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_txmode>())).pvid as *const _ as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_txmode),
-            "::",
-            stringify!(pvid)
-        )
-    );
+    fn test_field_mq_mode() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_txmode>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mq_mode) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_txmode),
+                "::",
+                stringify!(mq_mode)
+            )
+        );
+    }
+    test_field_mq_mode();
+    fn test_field_pvid() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_txmode>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).pvid) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_txmode),
+                "::",
+                stringify!(pvid)
+            )
+        );
+    }
+    test_field_pvid();
 }
 impl Default for rte_eth_txmode {
     fn default() -> Self {
@@ -573,45 +601,60 @@
         8usize,
         concat!("Alignment of ", stringify!(rte_eth_rss_conf))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_rss_conf>())).rss_key as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_rss_conf),
-            "::",
-            stringify!(rss_key)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_rss_conf>())).rss_key_len as *const _
-                as usize
-        },
-        8usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_rss_conf),
-            "::",
-            stringify!(rss_key_len)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_rss_conf>())).rss_hf as *const _
-                as usize
-        },
-        16usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_rss_conf),
-            "::",
-            stringify!(rss_hf)
-        )
-    );
+    fn test_field_rss_key() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_rss_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).rss_key) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_rss_conf),
+                "::",
+                stringify!(rss_key)
+            )
+        );
+    }
+    test_field_rss_key();
+    fn test_field_rss_key_len() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_rss_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).rss_key_len) as usize - ptr as usize
+            },
+            8usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_rss_conf),
+                "::",
+                stringify!(rss_key_len)
+            )
+        );
+    }
+    test_field_rss_key_len();
+    fn test_field_rss_hf() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_rss_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).rss_hf) as usize - ptr as usize
+            },
+            16usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_rss_conf),
+                "::",
+                stringify!(rss_hf)
+            )
+        );
+    }
+    test_field_rss_hf();
 }
 impl Default for rte_eth_rss_conf {
     fn default() -> Self {
@@ -693,32 +736,44 @@
             stringify!(rte_eth_vmdq_dcb_conf__bindgen_ty_1)
         )
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_vmdq_dcb_conf__bindgen_ty_1>()))
-                .vlan_id as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_vmdq_dcb_conf__bindgen_ty_1),
-            "::",
-            stringify!(vlan_id)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_vmdq_dcb_conf__bindgen_ty_1>()))
-                .pools as *const _ as usize
-        },
-        8usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_vmdq_dcb_conf__bindgen_ty_1),
-            "::",
-            stringify!(pools)
-        )
-    );
+    fn test_field_vlan_id() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    rte_eth_vmdq_dcb_conf__bindgen_ty_1,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).vlan_id) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_vmdq_dcb_conf__bindgen_ty_1),
+                "::",
+                stringify!(vlan_id)
+            )
+        );
+    }
+    test_field_vlan_id();
+    fn test_field_pools() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    rte_eth_vmdq_dcb_conf__bindgen_ty_1,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).pools) as usize - ptr as usize
+            },
+            8usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_vmdq_dcb_conf__bindgen_ty_1),
+                "::",
+                stringify!(pools)
+            )
+        );
+    }
+    test_field_pools();
 }
 #[test]
 fn bindgen_test_layout_rte_eth_vmdq_dcb_conf() {
@@ -732,84 +787,118 @@
         8usize,
         concat!("Alignment of ", stringify!(rte_eth_vmdq_dcb_conf))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_vmdq_dcb_conf>())).nb_queue_pools
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_vmdq_dcb_conf),
-            "::",
-            stringify!(nb_queue_pools)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_vmdq_dcb_conf>()))
-                .enable_default_pool as *const _ as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_vmdq_dcb_conf),
-            "::",
-            stringify!(enable_default_pool)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_vmdq_dcb_conf>())).default_pool
-                as *const _ as usize
-        },
-        5usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_vmdq_dcb_conf),
-            "::",
-            stringify!(default_pool)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_vmdq_dcb_conf>())).nb_pool_maps
-                as *const _ as usize
-        },
-        6usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_vmdq_dcb_conf),
-            "::",
-            stringify!(nb_pool_maps)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_vmdq_dcb_conf>())).pool_map
-                as *const _ as usize
-        },
-        8usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_vmdq_dcb_conf),
-            "::",
-            stringify!(pool_map)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_vmdq_dcb_conf>())).dcb_tc as *const _
-                as usize
-        },
-        1032usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_vmdq_dcb_conf),
-            "::",
-            stringify!(dcb_tc)
-        )
-    );
+    fn test_field_nb_queue_pools() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_vmdq_dcb_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).nb_queue_pools) as usize -
+                    ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_vmdq_dcb_conf),
+                "::",
+                stringify!(nb_queue_pools)
+            )
+        );
+    }
+    test_field_nb_queue_pools();
+    fn test_field_enable_default_pool() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_vmdq_dcb_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).enable_default_pool) as usize -
+                    ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_vmdq_dcb_conf),
+                "::",
+                stringify!(enable_default_pool)
+            )
+        );
+    }
+    test_field_enable_default_pool();
+    fn test_field_default_pool() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_vmdq_dcb_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).default_pool) as usize -
+                    ptr as usize
+            },
+            5usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_vmdq_dcb_conf),
+                "::",
+                stringify!(default_pool)
+            )
+        );
+    }
+    test_field_default_pool();
+    fn test_field_nb_pool_maps() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_vmdq_dcb_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).nb_pool_maps) as usize -
+                    ptr as usize
+            },
+            6usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_vmdq_dcb_conf),
+                "::",
+                stringify!(nb_pool_maps)
+            )
+        );
+    }
+    test_field_nb_pool_maps();
+    fn test_field_pool_map() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_vmdq_dcb_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).pool_map) as usize - ptr as usize
+            },
+            8usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_vmdq_dcb_conf),
+                "::",
+                stringify!(pool_map)
+            )
+        );
+    }
+    test_field_pool_map();
+    fn test_field_dcb_tc() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_vmdq_dcb_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).dcb_tc) as usize - ptr as usize
+            },
+            1032usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_vmdq_dcb_conf),
+                "::",
+                stringify!(dcb_tc)
+            )
+        );
+    }
+    test_field_dcb_tc();
 }
 impl Default for rte_eth_vmdq_dcb_conf {
     fn default() -> Self {
@@ -840,32 +929,42 @@
         4usize,
         concat!("Alignment of ", stringify!(rte_eth_dcb_rx_conf))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_dcb_rx_conf>())).nb_tcs as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_dcb_rx_conf),
-            "::",
-            stringify!(nb_tcs)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_dcb_rx_conf>())).dcb_tc as *const _
-                as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_dcb_rx_conf),
-            "::",
-            stringify!(dcb_tc)
-        )
-    );
+    fn test_field_nb_tcs() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_dcb_rx_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).nb_tcs) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_dcb_rx_conf),
+                "::",
+                stringify!(nb_tcs)
+            )
+        );
+    }
+    test_field_nb_tcs();
+    fn test_field_dcb_tc() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_dcb_rx_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).dcb_tc) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_dcb_rx_conf),
+                "::",
+                stringify!(dcb_tc)
+            )
+        );
+    }
+    test_field_dcb_tc();
 }
 impl Default for rte_eth_dcb_rx_conf {
     fn default() -> Self {
@@ -896,32 +995,45 @@
         4usize,
         concat!("Alignment of ", stringify!(rte_eth_vmdq_dcb_tx_conf))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_vmdq_dcb_tx_conf>())).nb_queue_pools
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_vmdq_dcb_tx_conf),
-            "::",
-            stringify!(nb_queue_pools)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_vmdq_dcb_tx_conf>())).dcb_tc
-                as *const _ as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_vmdq_dcb_tx_conf),
-            "::",
-            stringify!(dcb_tc)
-        )
-    );
+    fn test_field_nb_queue_pools() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_vmdq_dcb_tx_conf>::uninit(
+                    );
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).nb_queue_pools) as usize -
+                    ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_vmdq_dcb_tx_conf),
+                "::",
+                stringify!(nb_queue_pools)
+            )
+        );
+    }
+    test_field_nb_queue_pools();
+    fn test_field_dcb_tc() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_vmdq_dcb_tx_conf>::uninit(
+                    );
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).dcb_tc) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_vmdq_dcb_tx_conf),
+                "::",
+                stringify!(dcb_tc)
+            )
+        );
+    }
+    test_field_dcb_tc();
 }
 impl Default for rte_eth_vmdq_dcb_tx_conf {
     fn default() -> Self {
@@ -952,32 +1064,42 @@
         4usize,
         concat!("Alignment of ", stringify!(rte_eth_dcb_tx_conf))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_dcb_tx_conf>())).nb_tcs as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_dcb_tx_conf),
-            "::",
-            stringify!(nb_tcs)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_dcb_tx_conf>())).dcb_tc as *const _
-                as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_dcb_tx_conf),
-            "::",
-            stringify!(dcb_tc)
-        )
-    );
+    fn test_field_nb_tcs() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_dcb_tx_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).nb_tcs) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_dcb_tx_conf),
+                "::",
+                stringify!(nb_tcs)
+            )
+        );
+    }
+    test_field_nb_tcs();
+    fn test_field_dcb_tc() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_dcb_tx_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).dcb_tc) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_dcb_tx_conf),
+                "::",
+                stringify!(dcb_tc)
+            )
+        );
+    }
+    test_field_dcb_tc();
 }
 impl Default for rte_eth_dcb_tx_conf {
     fn default() -> Self {
@@ -1006,19 +1128,25 @@
         4usize,
         concat!("Alignment of ", stringify!(rte_eth_vmdq_tx_conf))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_vmdq_tx_conf>())).nb_queue_pools
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_vmdq_tx_conf),
-            "::",
-            stringify!(nb_queue_pools)
-        )
-    );
+    fn test_field_nb_queue_pools() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_vmdq_tx_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).nb_queue_pools) as usize -
+                    ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_vmdq_tx_conf),
+                "::",
+                stringify!(nb_queue_pools)
+            )
+        );
+    }
+    test_field_nb_queue_pools();
 }
 impl Default for rte_eth_vmdq_tx_conf {
     fn default() -> Self {
@@ -1070,32 +1198,44 @@
             stringify!(rte_eth_vmdq_rx_conf__bindgen_ty_1)
         )
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_vmdq_rx_conf__bindgen_ty_1>()))
-                .vlan_id as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_vmdq_rx_conf__bindgen_ty_1),
-            "::",
-            stringify!(vlan_id)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_vmdq_rx_conf__bindgen_ty_1>())).pools
-                as *const _ as usize
-        },
-        8usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_vmdq_rx_conf__bindgen_ty_1),
-            "::",
-            stringify!(pools)
-        )
-    );
+    fn test_field_vlan_id() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    rte_eth_vmdq_rx_conf__bindgen_ty_1,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).vlan_id) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_vmdq_rx_conf__bindgen_ty_1),
+                "::",
+                stringify!(vlan_id)
+            )
+        );
+    }
+    test_field_vlan_id();
+    fn test_field_pools() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    rte_eth_vmdq_rx_conf__bindgen_ty_1,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).pools) as usize - ptr as usize
+            },
+            8usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_vmdq_rx_conf__bindgen_ty_1),
+                "::",
+                stringify!(pools)
+            )
+        );
+    }
+    test_field_pools();
 }
 #[test]
 fn bindgen_test_layout_rte_eth_vmdq_rx_conf() {
@@ -1109,97 +1249,137 @@
         8usize,
         concat!("Alignment of ", stringify!(rte_eth_vmdq_rx_conf))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_vmdq_rx_conf>())).nb_queue_pools
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_vmdq_rx_conf),
-            "::",
-            stringify!(nb_queue_pools)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_vmdq_rx_conf>())).enable_default_pool
-                as *const _ as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_vmdq_rx_conf),
-            "::",
-            stringify!(enable_default_pool)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_vmdq_rx_conf>())).default_pool
-                as *const _ as usize
-        },
-        5usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_vmdq_rx_conf),
-            "::",
-            stringify!(default_pool)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_vmdq_rx_conf>())).enable_loop_back
-                as *const _ as usize
-        },
-        6usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_vmdq_rx_conf),
-            "::",
-            stringify!(enable_loop_back)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_vmdq_rx_conf>())).nb_pool_maps
-                as *const _ as usize
-        },
-        7usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_vmdq_rx_conf),
-            "::",
-            stringify!(nb_pool_maps)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_vmdq_rx_conf>())).rx_mode as *const _
-                as usize
-        },
-        8usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_vmdq_rx_conf),
-            "::",
-            stringify!(rx_mode)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_vmdq_rx_conf>())).pool_map
-                as *const _ as usize
-        },
-        16usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_vmdq_rx_conf),
-            "::",
-            stringify!(pool_map)
-        )
-    );
+    fn test_field_nb_queue_pools() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_vmdq_rx_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).nb_queue_pools) as usize -
+                    ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_vmdq_rx_conf),
+                "::",
+                stringify!(nb_queue_pools)
+            )
+        );
+    }
+    test_field_nb_queue_pools();
+    fn test_field_enable_default_pool() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_vmdq_rx_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).enable_default_pool) as usize -
+                    ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_vmdq_rx_conf),
+                "::",
+                stringify!(enable_default_pool)
+            )
+        );
+    }
+    test_field_enable_default_pool();
+    fn test_field_default_pool() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_vmdq_rx_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).default_pool) as usize -
+                    ptr as usize
+            },
+            5usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_vmdq_rx_conf),
+                "::",
+                stringify!(default_pool)
+            )
+        );
+    }
+    test_field_default_pool();
+    fn test_field_enable_loop_back() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_vmdq_rx_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).enable_loop_back) as usize -
+                    ptr as usize
+            },
+            6usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_vmdq_rx_conf),
+                "::",
+                stringify!(enable_loop_back)
+            )
+        );
+    }
+    test_field_enable_loop_back();
+    fn test_field_nb_pool_maps() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_vmdq_rx_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).nb_pool_maps) as usize -
+                    ptr as usize
+            },
+            7usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_vmdq_rx_conf),
+                "::",
+                stringify!(nb_pool_maps)
+            )
+        );
+    }
+    test_field_nb_pool_maps();
+    fn test_field_rx_mode() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_vmdq_rx_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).rx_mode) as usize - ptr as usize
+            },
+            8usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_vmdq_rx_conf),
+                "::",
+                stringify!(rx_mode)
+            )
+        );
+    }
+    test_field_rx_mode();
+    fn test_field_pool_map() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_vmdq_rx_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).pool_map) as usize - ptr as usize
+            },
+            16usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_vmdq_rx_conf),
+                "::",
+                stringify!(pool_map)
+            )
+        );
+    }
+    test_field_pool_map();
 }
 impl Default for rte_eth_vmdq_rx_conf {
     fn default() -> Self {
@@ -1275,71 +1455,96 @@
         4usize,
         concat!("Alignment of ", stringify!(rte_eth_ipv4_flow))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_ipv4_flow>())).src_ip as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_ipv4_flow),
-            "::",
-            stringify!(src_ip)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_ipv4_flow>())).dst_ip as *const _
-                as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_ipv4_flow),
-            "::",
-            stringify!(dst_ip)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_ipv4_flow>())).tos as *const _
-                as usize
-        },
-        8usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_ipv4_flow),
-            "::",
-            stringify!(tos)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_ipv4_flow>())).ttl as *const _
-                as usize
-        },
-        9usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_ipv4_flow),
-            "::",
-            stringify!(ttl)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_ipv4_flow>())).proto as *const _
-                as usize
-        },
-        10usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_ipv4_flow),
-            "::",
-            stringify!(proto)
-        )
-    );
+    fn test_field_src_ip() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_ipv4_flow>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).src_ip) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_ipv4_flow),
+                "::",
+                stringify!(src_ip)
+            )
+        );
+    }
+    test_field_src_ip();
+    fn test_field_dst_ip() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_ipv4_flow>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).dst_ip) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_ipv4_flow),
+                "::",
+                stringify!(dst_ip)
+            )
+        );
+    }
+    test_field_dst_ip();
+    fn test_field_tos() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_ipv4_flow>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).tos) as usize - ptr as usize
+            },
+            8usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_ipv4_flow),
+                "::",
+                stringify!(tos)
+            )
+        );
+    }
+    test_field_tos();
+    fn test_field_ttl() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_ipv4_flow>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).ttl) as usize - ptr as usize
+            },
+            9usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_ipv4_flow),
+                "::",
+                stringify!(ttl)
+            )
+        );
+    }
+    test_field_ttl();
+    fn test_field_proto() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_ipv4_flow>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).proto) as usize - ptr as usize
+            },
+            10usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_ipv4_flow),
+                "::",
+                stringify!(proto)
+            )
+        );
+    }
+    test_field_proto();
 }
 /// A structure used to define the input for IPV6 flow
 #[repr(C)]
@@ -1368,71 +1573,96 @@
         4usize,
         concat!("Alignment of ", stringify!(rte_eth_ipv6_flow))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_ipv6_flow>())).src_ip as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_ipv6_flow),
-            "::",
-            stringify!(src_ip)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_ipv6_flow>())).dst_ip as *const _
-                as usize
-        },
-        16usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_ipv6_flow),
-            "::",
-            stringify!(dst_ip)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_ipv6_flow>())).tc as *const _
-                as usize
-        },
-        32usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_ipv6_flow),
-            "::",
-            stringify!(tc)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_ipv6_flow>())).proto as *const _
-                as usize
-        },
-        33usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_ipv6_flow),
-            "::",
-            stringify!(proto)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_ipv6_flow>())).hop_limits as *const _
-                as usize
-        },
-        34usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_ipv6_flow),
-            "::",
-            stringify!(hop_limits)
-        )
-    );
+    fn test_field_src_ip() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_ipv6_flow>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).src_ip) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_ipv6_flow),
+                "::",
+                stringify!(src_ip)
+            )
+        );
+    }
+    test_field_src_ip();
+    fn test_field_dst_ip() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_ipv6_flow>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).dst_ip) as usize - ptr as usize
+            },
+            16usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_ipv6_flow),
+                "::",
+                stringify!(dst_ip)
+            )
+        );
+    }
+    test_field_dst_ip();
+    fn test_field_tc() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_ipv6_flow>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).tc) as usize - ptr as usize
+            },
+            32usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_ipv6_flow),
+                "::",
+                stringify!(tc)
+            )
+        );
+    }
+    test_field_tc();
+    fn test_field_proto() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_ipv6_flow>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).proto) as usize - ptr as usize
+            },
+            33usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_ipv6_flow),
+                "::",
+                stringify!(proto)
+            )
+        );
+    }
+    test_field_proto();
+    fn test_field_hop_limits() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_ipv6_flow>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).hop_limits) as usize - ptr as usize
+            },
+            34usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_ipv6_flow),
+                "::",
+                stringify!(hop_limits)
+            )
+        );
+    }
+    test_field_hop_limits();
 }
 ///  A structure used to configure FDIR masks that are used by the device
 ///  to match the various fields of RX packet headers.
@@ -1470,110 +1700,156 @@
         4usize,
         concat!("Alignment of ", stringify!(rte_eth_fdir_masks))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_fdir_masks>())).vlan_tci_mask
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_fdir_masks),
-            "::",
-            stringify!(vlan_tci_mask)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_fdir_masks>())).ipv4_mask as *const _
-                as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_fdir_masks),
-            "::",
-            stringify!(ipv4_mask)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_fdir_masks>())).ipv6_mask as *const _
-                as usize
-        },
-        16usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_fdir_masks),
-            "::",
-            stringify!(ipv6_mask)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_fdir_masks>())).src_port_mask
-                as *const _ as usize
-        },
-        52usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_fdir_masks),
-            "::",
-            stringify!(src_port_mask)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_fdir_masks>())).dst_port_mask
-                as *const _ as usize
-        },
-        54usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_fdir_masks),
-            "::",
-            stringify!(dst_port_mask)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_fdir_masks>())).mac_addr_byte_mask
-                as *const _ as usize
-        },
-        56usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_fdir_masks),
-            "::",
-            stringify!(mac_addr_byte_mask)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_fdir_masks>())).tunnel_id_mask
-                as *const _ as usize
-        },
-        60usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_fdir_masks),
-            "::",
-            stringify!(tunnel_id_mask)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_fdir_masks>())).tunnel_type_mask
-                as *const _ as usize
-        },
-        64usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_fdir_masks),
-            "::",
-            stringify!(tunnel_type_mask)
-        )
-    );
+    fn test_field_vlan_tci_mask() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_fdir_masks>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).vlan_tci_mask) as usize -
+                    ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_fdir_masks),
+                "::",
+                stringify!(vlan_tci_mask)
+            )
+        );
+    }
+    test_field_vlan_tci_mask();
+    fn test_field_ipv4_mask() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_fdir_masks>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).ipv4_mask) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_fdir_masks),
+                "::",
+                stringify!(ipv4_mask)
+            )
+        );
+    }
+    test_field_ipv4_mask();
+    fn test_field_ipv6_mask() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_fdir_masks>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).ipv6_mask) as usize - ptr as usize
+            },
+            16usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_fdir_masks),
+                "::",
+                stringify!(ipv6_mask)
+            )
+        );
+    }
+    test_field_ipv6_mask();
+    fn test_field_src_port_mask() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_fdir_masks>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).src_port_mask) as usize -
+                    ptr as usize
+            },
+            52usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_fdir_masks),
+                "::",
+                stringify!(src_port_mask)
+            )
+        );
+    }
+    test_field_src_port_mask();
+    fn test_field_dst_port_mask() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_fdir_masks>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).dst_port_mask) as usize -
+                    ptr as usize
+            },
+            54usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_fdir_masks),
+                "::",
+                stringify!(dst_port_mask)
+            )
+        );
+    }
+    test_field_dst_port_mask();
+    fn test_field_mac_addr_byte_mask() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_fdir_masks>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mac_addr_byte_mask) as usize -
+                    ptr as usize
+            },
+            56usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_fdir_masks),
+                "::",
+                stringify!(mac_addr_byte_mask)
+            )
+        );
+    }
+    test_field_mac_addr_byte_mask();
+    fn test_field_tunnel_id_mask() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_fdir_masks>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).tunnel_id_mask) as usize -
+                    ptr as usize
+            },
+            60usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_fdir_masks),
+                "::",
+                stringify!(tunnel_id_mask)
+            )
+        );
+    }
+    test_field_tunnel_id_mask();
+    fn test_field_tunnel_type_mask() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_fdir_masks>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).tunnel_type_mask) as usize -
+                    ptr as usize
+            },
+            64usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_fdir_masks),
+                "::",
+                stringify!(tunnel_type_mask)
+            )
+        );
+    }
+    test_field_tunnel_type_mask();
 }
 #[repr(u32)]
 /// Payload type
@@ -1607,32 +1883,44 @@
         4usize,
         concat!("Alignment of ", stringify!(rte_eth_flex_payload_cfg))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_flex_payload_cfg>())).type_
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_flex_payload_cfg),
-            "::",
-            stringify!(type_)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_flex_payload_cfg>())).src_offset
-                as *const _ as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_flex_payload_cfg),
-            "::",
-            stringify!(src_offset)
-        )
-    );
+    fn test_field_type() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_flex_payload_cfg>::uninit(
+                    );
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).type_) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_flex_payload_cfg),
+                "::",
+                stringify!(type_)
+            )
+        );
+    }
+    test_field_type();
+    fn test_field_src_offset() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_flex_payload_cfg>::uninit(
+                    );
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).src_offset) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_flex_payload_cfg),
+                "::",
+                stringify!(src_offset)
+            )
+        );
+    }
+    test_field_src_offset();
 }
 impl Default for rte_eth_flex_payload_cfg {
     fn default() -> Self {
@@ -1663,32 +1951,42 @@
         2usize,
         concat!("Alignment of ", stringify!(rte_eth_fdir_flex_mask))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_fdir_flex_mask>())).flow_type
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_fdir_flex_mask),
-            "::",
-            stringify!(flow_type)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_fdir_flex_mask>())).mask as *const _
-                as usize
-        },
-        2usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_fdir_flex_mask),
-            "::",
-            stringify!(mask)
-        )
-    );
+    fn test_field_flow_type() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_fdir_flex_mask>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).flow_type) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_fdir_flex_mask),
+                "::",
+                stringify!(flow_type)
+            )
+        );
+    }
+    test_field_flow_type();
+    fn test_field_mask() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_fdir_flex_mask>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mask) as usize - ptr as usize
+            },
+            2usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_fdir_flex_mask),
+                "::",
+                stringify!(mask)
+            )
+        );
+    }
+    test_field_mask();
 }
 /// A structure used to define all flexible payload related setting
 /// include flex payload and flex mask
@@ -1714,58 +2012,79 @@
         4usize,
         concat!("Alignment of ", stringify!(rte_eth_fdir_flex_conf))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_fdir_flex_conf>())).nb_payloads
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_fdir_flex_conf),
-            "::",
-            stringify!(nb_payloads)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_fdir_flex_conf>())).nb_flexmasks
-                as *const _ as usize
-        },
-        2usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_fdir_flex_conf),
-            "::",
-            stringify!(nb_flexmasks)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_fdir_flex_conf>())).flex_set
-                as *const _ as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_fdir_flex_conf),
-            "::",
-            stringify!(flex_set)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_fdir_flex_conf>())).flex_mask
-                as *const _ as usize
-        },
-        292usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_fdir_flex_conf),
-            "::",
-            stringify!(flex_mask)
-        )
-    );
+    fn test_field_nb_payloads() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_fdir_flex_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).nb_payloads) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_fdir_flex_conf),
+                "::",
+                stringify!(nb_payloads)
+            )
+        );
+    }
+    test_field_nb_payloads();
+    fn test_field_nb_flexmasks() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_fdir_flex_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).nb_flexmasks) as usize -
+                    ptr as usize
+            },
+            2usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_fdir_flex_conf),
+                "::",
+                stringify!(nb_flexmasks)
+            )
+        );
+    }
+    test_field_nb_flexmasks();
+    fn test_field_flex_set() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_fdir_flex_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).flex_set) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_fdir_flex_conf),
+                "::",
+                stringify!(flex_set)
+            )
+        );
+    }
+    test_field_flex_set();
+    fn test_field_flex_mask() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_fdir_flex_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).flex_mask) as usize - ptr as usize
+            },
+            292usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_fdir_flex_conf),
+                "::",
+                stringify!(flex_mask)
+            )
+        );
+    }
+    test_field_flex_mask();
 }
 impl Default for rte_eth_fdir_flex_conf {
     fn default() -> Self {
@@ -1806,82 +2125,108 @@
         4usize,
         concat!("Alignment of ", stringify!(rte_fdir_conf))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_fdir_conf>())).mode as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_fdir_conf),
-            "::",
-            stringify!(mode)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_fdir_conf>())).pballoc as *const _
-                as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_fdir_conf),
-            "::",
-            stringify!(pballoc)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_fdir_conf>())).status as *const _
-                as usize
-        },
-        8usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_fdir_conf),
-            "::",
-            stringify!(status)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_fdir_conf>())).drop_queue as *const _
-                as usize
-        },
-        12usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_fdir_conf),
-            "::",
-            stringify!(drop_queue)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_fdir_conf>())).mask as *const _ as usize
-        },
-        16usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_fdir_conf),
-            "::",
-            stringify!(mask)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_fdir_conf>())).flex_conf as *const _
-                as usize
-        },
-        84usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_fdir_conf),
-            "::",
-            stringify!(flex_conf)
-        )
-    );
+    fn test_field_mode() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_fdir_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mode) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_fdir_conf),
+                "::",
+                stringify!(mode)
+            )
+        );
+    }
+    test_field_mode();
+    fn test_field_pballoc() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_fdir_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).pballoc) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_fdir_conf),
+                "::",
+                stringify!(pballoc)
+            )
+        );
+    }
+    test_field_pballoc();
+    fn test_field_status() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_fdir_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).status) as usize - ptr as usize
+            },
+            8usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_fdir_conf),
+                "::",
+                stringify!(status)
+            )
+        );
+    }
+    test_field_status();
+    fn test_field_drop_queue() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_fdir_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).drop_queue) as usize - ptr as usize
+            },
+            12usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_fdir_conf),
+                "::",
+                stringify!(drop_queue)
+            )
+        );
+    }
+    test_field_drop_queue();
+    fn test_field_mask() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_fdir_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mask) as usize - ptr as usize
+            },
+            16usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_fdir_conf),
+                "::",
+                stringify!(mask)
+            )
+        );
+    }
+    test_field_mask();
+    fn test_field_flex_conf() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_fdir_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).flex_conf) as usize - ptr as usize
+            },
+            84usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_fdir_conf),
+                "::",
+                stringify!(flex_conf)
+            )
+        );
+    }
+    test_field_flex_conf();
 }
 impl Default for rte_fdir_conf {
     fn default() -> Self {
@@ -1913,30 +2258,40 @@
         2usize,
         concat!("Alignment of ", stringify!(rte_intr_conf))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_intr_conf>())).lsc as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_intr_conf),
-            "::",
-            stringify!(lsc)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_intr_conf>())).rxq as *const _ as usize
-        },
-        2usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_intr_conf),
-            "::",
-            stringify!(rxq)
-        )
-    );
+    fn test_field_lsc() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_intr_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).lsc) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_intr_conf),
+                "::",
+                stringify!(lsc)
+            )
+        );
+    }
+    test_field_lsc();
+    fn test_field_rxq() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_intr_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).rxq) as usize - ptr as usize
+            },
+            2usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_intr_conf),
+                "::",
+                stringify!(rxq)
+            )
+        );
+    }
+    test_field_rxq();
 }
 /// A structure used to configure an Ethernet port.
 /// Depending upon the RX multi-queue mode, extra advanced
@@ -1995,58 +2350,84 @@
         8usize,
         concat!("Alignment of ", stringify!(rte_eth_conf__bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_conf__bindgen_ty_1>())).rss_conf
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_conf__bindgen_ty_1),
-            "::",
-            stringify!(rss_conf)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_conf__bindgen_ty_1>())).vmdq_dcb_conf
-                as *const _ as usize
-        },
-        24usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_conf__bindgen_ty_1),
-            "::",
-            stringify!(vmdq_dcb_conf)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_conf__bindgen_ty_1>())).dcb_rx_conf
-                as *const _ as usize
-        },
-        1064usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_conf__bindgen_ty_1),
-            "::",
-            stringify!(dcb_rx_conf)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_conf__bindgen_ty_1>())).vmdq_rx_conf
-                as *const _ as usize
-        },
-        1080usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_conf__bindgen_ty_1),
-            "::",
-            stringify!(vmdq_rx_conf)
-        )
-    );
+    fn test_field_rss_conf() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    rte_eth_conf__bindgen_ty_1,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).rss_conf) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_conf__bindgen_ty_1),
+                "::",
+                stringify!(rss_conf)
+            )
+        );
+    }
+    test_field_rss_conf();
+    fn test_field_vmdq_dcb_conf() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    rte_eth_conf__bindgen_ty_1,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).vmdq_dcb_conf) as usize -
+                    ptr as usize
+            },
+            24usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_conf__bindgen_ty_1),
+                "::",
+                stringify!(vmdq_dcb_conf)
+            )
+        );
+    }
+    test_field_vmdq_dcb_conf();
+    fn test_field_dcb_rx_conf() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    rte_eth_conf__bindgen_ty_1,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).dcb_rx_conf) as usize - ptr as usize
+            },
+            1064usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_conf__bindgen_ty_1),
+                "::",
+                stringify!(dcb_rx_conf)
+            )
+        );
+    }
+    test_field_dcb_rx_conf();
+    fn test_field_vmdq_rx_conf() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    rte_eth_conf__bindgen_ty_1,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).vmdq_rx_conf) as usize -
+                    ptr as usize
+            },
+            1080usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_conf__bindgen_ty_1),
+                "::",
+                stringify!(vmdq_rx_conf)
+            )
+        );
+    }
+    test_field_vmdq_rx_conf();
 }
 impl Default for rte_eth_conf__bindgen_ty_1 {
     fn default() -> Self {
@@ -2076,45 +2457,65 @@
         4usize,
         concat!("Alignment of ", stringify!(rte_eth_conf__bindgen_ty_2))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_conf__bindgen_ty_2>()))
-                .vmdq_dcb_tx_conf as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_conf__bindgen_ty_2),
-            "::",
-            stringify!(vmdq_dcb_tx_conf)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_conf__bindgen_ty_2>())).dcb_tx_conf
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_conf__bindgen_ty_2),
-            "::",
-            stringify!(dcb_tx_conf)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_conf__bindgen_ty_2>())).vmdq_tx_conf
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_conf__bindgen_ty_2),
-            "::",
-            stringify!(vmdq_tx_conf)
-        )
-    );
+    fn test_field_vmdq_dcb_tx_conf() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    rte_eth_conf__bindgen_ty_2,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).vmdq_dcb_tx_conf) as usize -
+                    ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_conf__bindgen_ty_2),
+                "::",
+                stringify!(vmdq_dcb_tx_conf)
+            )
+        );
+    }
+    test_field_vmdq_dcb_tx_conf();
+    fn test_field_dcb_tx_conf() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    rte_eth_conf__bindgen_ty_2,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).dcb_tx_conf) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_conf__bindgen_ty_2),
+                "::",
+                stringify!(dcb_tx_conf)
+            )
+        );
+    }
+    test_field_dcb_tx_conf();
+    fn test_field_vmdq_tx_conf() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    rte_eth_conf__bindgen_ty_2,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).vmdq_tx_conf) as usize -
+                    ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_conf__bindgen_ty_2),
+                "::",
+                stringify!(vmdq_tx_conf)
+            )
+        );
+    }
+    test_field_vmdq_tx_conf();
 }
 impl Default for rte_eth_conf__bindgen_ty_2 {
     fn default() -> Self {
@@ -2137,121 +2538,160 @@
         8usize,
         concat!("Alignment of ", stringify!(rte_eth_conf))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_conf>())).link_speeds as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_conf),
-            "::",
-            stringify!(link_speeds)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_conf>())).rxmode as *const _ as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_conf),
-            "::",
-            stringify!(rxmode)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_conf>())).txmode as *const _ as usize
-        },
-        16usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_conf),
-            "::",
-            stringify!(txmode)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_conf>())).lpbk_mode as *const _
-                as usize
-        },
-        24usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_conf),
-            "::",
-            stringify!(lpbk_mode)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_conf>())).rx_adv_conf as *const _
-                as usize
-        },
-        32usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_conf),
-            "::",
-            stringify!(rx_adv_conf)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_conf>())).tx_adv_conf as *const _
-                as usize
-        },
-        2152usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_conf),
-            "::",
-            stringify!(tx_adv_conf)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_conf>())).dcb_capability_en
-                as *const _ as usize
-        },
-        2164usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_conf),
-            "::",
-            stringify!(dcb_capability_en)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_conf>())).fdir_conf as *const _
-                as usize
-        },
-        2168usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_conf),
-            "::",
-            stringify!(fdir_conf)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_conf>())).intr_conf as *const _
-                as usize
-        },
-        2940usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_conf),
-            "::",
-            stringify!(intr_conf)
-        )
-    );
+    fn test_field_link_speeds() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_eth_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).link_speeds) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_conf),
+                "::",
+                stringify!(link_speeds)
+            )
+        );
+    }
+    test_field_link_speeds();
+    fn test_field_rxmode() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_eth_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).rxmode) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_conf),
+                "::",
+                stringify!(rxmode)
+            )
+        );
+    }
+    test_field_rxmode();
+    fn test_field_txmode() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_eth_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).txmode) as usize - ptr as usize
+            },
+            16usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_conf),
+                "::",
+                stringify!(txmode)
+            )
+        );
+    }
+    test_field_txmode();
+    fn test_field_lpbk_mode() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_eth_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).lpbk_mode) as usize - ptr as usize
+            },
+            24usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_conf),
+                "::",
+                stringify!(lpbk_mode)
+            )
+        );
+    }
+    test_field_lpbk_mode();
+    fn test_field_rx_adv_conf() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_eth_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).rx_adv_conf) as usize - ptr as usize
+            },
+            32usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_conf),
+                "::",
+                stringify!(rx_adv_conf)
+            )
+        );
+    }
+    test_field_rx_adv_conf();
+    fn test_field_tx_adv_conf() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_eth_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).tx_adv_conf) as usize - ptr as usize
+            },
+            2152usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_conf),
+                "::",
+                stringify!(tx_adv_conf)
+            )
+        );
+    }
+    test_field_tx_adv_conf();
+    fn test_field_dcb_capability_en() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_eth_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).dcb_capability_en) as usize -
+                    ptr as usize
+            },
+            2164usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_conf),
+                "::",
+                stringify!(dcb_capability_en)
+            )
+        );
+    }
+    test_field_dcb_capability_en();
+    fn test_field_fdir_conf() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_eth_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).fdir_conf) as usize - ptr as usize
+            },
+            2168usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_conf),
+                "::",
+                stringify!(fdir_conf)
+            )
+        );
+    }
+    test_field_fdir_conf();
+    fn test_field_intr_conf() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_eth_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).intr_conf) as usize - ptr as usize
+            },
+            2940usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_conf),
+                "::",
+                stringify!(intr_conf)
+            )
+        );
+    }
+    test_field_intr_conf();
 }
 impl Default for rte_eth_conf {
     fn default() -> Self {
diff --git a/tests/expectations/tests/layout_eth_conf_1_0.rs b/tests/expectations/tests/layout_eth_conf_1_0.rs
index fde1c67..0458a3a 100644
--- a/tests/expectations/tests/layout_eth_conf_1_0.rs
+++ b/tests/expectations/tests/layout_eth_conf_1_0.rs
@@ -213,45 +213,62 @@
         4usize,
         concat!("Alignment of ", stringify!(rte_eth_rxmode))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_rxmode>())).mq_mode as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_rxmode),
-            "::",
-            stringify!(mq_mode)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_rxmode>())).max_rx_pkt_len
-                as *const _ as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_rxmode),
-            "::",
-            stringify!(max_rx_pkt_len)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_rxmode>())).split_hdr_size
-                as *const _ as usize
-        },
-        8usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_rxmode),
-            "::",
-            stringify!(split_hdr_size)
-        )
-    );
+    fn test_field_mq_mode() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_rxmode>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mq_mode) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_rxmode),
+                "::",
+                stringify!(mq_mode)
+            )
+        );
+    }
+    test_field_mq_mode();
+    fn test_field_max_rx_pkt_len() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_rxmode>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).max_rx_pkt_len) as usize -
+                    ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_rxmode),
+                "::",
+                stringify!(max_rx_pkt_len)
+            )
+        );
+    }
+    test_field_max_rx_pkt_len();
+    fn test_field_split_hdr_size() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_rxmode>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).split_hdr_size) as usize -
+                    ptr as usize
+            },
+            8usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_rxmode),
+                "::",
+                stringify!(split_hdr_size)
+            )
+        );
+    }
+    test_field_split_hdr_size();
 }
 impl Clone for rte_eth_rxmode {
     fn clone(&self) -> Self {
@@ -483,31 +500,42 @@
         4usize,
         concat!("Alignment of ", stringify!(rte_eth_txmode))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_txmode>())).mq_mode as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_txmode),
-            "::",
-            stringify!(mq_mode)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_txmode>())).pvid as *const _ as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_txmode),
-            "::",
-            stringify!(pvid)
-        )
-    );
+    fn test_field_mq_mode() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_txmode>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mq_mode) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_txmode),
+                "::",
+                stringify!(mq_mode)
+            )
+        );
+    }
+    test_field_mq_mode();
+    fn test_field_pvid() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_txmode>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).pvid) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_txmode),
+                "::",
+                stringify!(pvid)
+            )
+        );
+    }
+    test_field_pvid();
 }
 impl Clone for rte_eth_txmode {
     fn clone(&self) -> Self {
@@ -626,45 +654,60 @@
         8usize,
         concat!("Alignment of ", stringify!(rte_eth_rss_conf))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_rss_conf>())).rss_key as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_rss_conf),
-            "::",
-            stringify!(rss_key)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_rss_conf>())).rss_key_len as *const _
-                as usize
-        },
-        8usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_rss_conf),
-            "::",
-            stringify!(rss_key_len)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_rss_conf>())).rss_hf as *const _
-                as usize
-        },
-        16usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_rss_conf),
-            "::",
-            stringify!(rss_hf)
-        )
-    );
+    fn test_field_rss_key() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_rss_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).rss_key) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_rss_conf),
+                "::",
+                stringify!(rss_key)
+            )
+        );
+    }
+    test_field_rss_key();
+    fn test_field_rss_key_len() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_rss_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).rss_key_len) as usize - ptr as usize
+            },
+            8usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_rss_conf),
+                "::",
+                stringify!(rss_key_len)
+            )
+        );
+    }
+    test_field_rss_key_len();
+    fn test_field_rss_hf() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_rss_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).rss_hf) as usize - ptr as usize
+            },
+            16usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_rss_conf),
+                "::",
+                stringify!(rss_hf)
+            )
+        );
+    }
+    test_field_rss_hf();
 }
 impl Clone for rte_eth_rss_conf {
     fn clone(&self) -> Self {
@@ -751,32 +794,44 @@
             stringify!(rte_eth_vmdq_dcb_conf__bindgen_ty_1)
         )
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_vmdq_dcb_conf__bindgen_ty_1>()))
-                .vlan_id as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_vmdq_dcb_conf__bindgen_ty_1),
-            "::",
-            stringify!(vlan_id)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_vmdq_dcb_conf__bindgen_ty_1>()))
-                .pools as *const _ as usize
-        },
-        8usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_vmdq_dcb_conf__bindgen_ty_1),
-            "::",
-            stringify!(pools)
-        )
-    );
+    fn test_field_vlan_id() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    rte_eth_vmdq_dcb_conf__bindgen_ty_1,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).vlan_id) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_vmdq_dcb_conf__bindgen_ty_1),
+                "::",
+                stringify!(vlan_id)
+            )
+        );
+    }
+    test_field_vlan_id();
+    fn test_field_pools() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    rte_eth_vmdq_dcb_conf__bindgen_ty_1,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).pools) as usize - ptr as usize
+            },
+            8usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_vmdq_dcb_conf__bindgen_ty_1),
+                "::",
+                stringify!(pools)
+            )
+        );
+    }
+    test_field_pools();
 }
 impl Clone for rte_eth_vmdq_dcb_conf__bindgen_ty_1 {
     fn clone(&self) -> Self {
@@ -795,84 +850,118 @@
         8usize,
         concat!("Alignment of ", stringify!(rte_eth_vmdq_dcb_conf))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_vmdq_dcb_conf>())).nb_queue_pools
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_vmdq_dcb_conf),
-            "::",
-            stringify!(nb_queue_pools)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_vmdq_dcb_conf>()))
-                .enable_default_pool as *const _ as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_vmdq_dcb_conf),
-            "::",
-            stringify!(enable_default_pool)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_vmdq_dcb_conf>())).default_pool
-                as *const _ as usize
-        },
-        5usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_vmdq_dcb_conf),
-            "::",
-            stringify!(default_pool)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_vmdq_dcb_conf>())).nb_pool_maps
-                as *const _ as usize
-        },
-        6usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_vmdq_dcb_conf),
-            "::",
-            stringify!(nb_pool_maps)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_vmdq_dcb_conf>())).pool_map
-                as *const _ as usize
-        },
-        8usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_vmdq_dcb_conf),
-            "::",
-            stringify!(pool_map)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_vmdq_dcb_conf>())).dcb_tc as *const _
-                as usize
-        },
-        1032usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_vmdq_dcb_conf),
-            "::",
-            stringify!(dcb_tc)
-        )
-    );
+    fn test_field_nb_queue_pools() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_vmdq_dcb_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).nb_queue_pools) as usize -
+                    ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_vmdq_dcb_conf),
+                "::",
+                stringify!(nb_queue_pools)
+            )
+        );
+    }
+    test_field_nb_queue_pools();
+    fn test_field_enable_default_pool() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_vmdq_dcb_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).enable_default_pool) as usize -
+                    ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_vmdq_dcb_conf),
+                "::",
+                stringify!(enable_default_pool)
+            )
+        );
+    }
+    test_field_enable_default_pool();
+    fn test_field_default_pool() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_vmdq_dcb_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).default_pool) as usize -
+                    ptr as usize
+            },
+            5usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_vmdq_dcb_conf),
+                "::",
+                stringify!(default_pool)
+            )
+        );
+    }
+    test_field_default_pool();
+    fn test_field_nb_pool_maps() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_vmdq_dcb_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).nb_pool_maps) as usize -
+                    ptr as usize
+            },
+            6usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_vmdq_dcb_conf),
+                "::",
+                stringify!(nb_pool_maps)
+            )
+        );
+    }
+    test_field_nb_pool_maps();
+    fn test_field_pool_map() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_vmdq_dcb_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).pool_map) as usize - ptr as usize
+            },
+            8usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_vmdq_dcb_conf),
+                "::",
+                stringify!(pool_map)
+            )
+        );
+    }
+    test_field_pool_map();
+    fn test_field_dcb_tc() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_vmdq_dcb_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).dcb_tc) as usize - ptr as usize
+            },
+            1032usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_vmdq_dcb_conf),
+                "::",
+                stringify!(dcb_tc)
+            )
+        );
+    }
+    test_field_dcb_tc();
 }
 impl Clone for rte_eth_vmdq_dcb_conf {
     fn clone(&self) -> Self {
@@ -908,32 +997,42 @@
         4usize,
         concat!("Alignment of ", stringify!(rte_eth_dcb_rx_conf))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_dcb_rx_conf>())).nb_tcs as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_dcb_rx_conf),
-            "::",
-            stringify!(nb_tcs)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_dcb_rx_conf>())).dcb_tc as *const _
-                as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_dcb_rx_conf),
-            "::",
-            stringify!(dcb_tc)
-        )
-    );
+    fn test_field_nb_tcs() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_dcb_rx_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).nb_tcs) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_dcb_rx_conf),
+                "::",
+                stringify!(nb_tcs)
+            )
+        );
+    }
+    test_field_nb_tcs();
+    fn test_field_dcb_tc() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_dcb_rx_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).dcb_tc) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_dcb_rx_conf),
+                "::",
+                stringify!(dcb_tc)
+            )
+        );
+    }
+    test_field_dcb_tc();
 }
 impl Clone for rte_eth_dcb_rx_conf {
     fn clone(&self) -> Self {
@@ -969,32 +1068,45 @@
         4usize,
         concat!("Alignment of ", stringify!(rte_eth_vmdq_dcb_tx_conf))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_vmdq_dcb_tx_conf>())).nb_queue_pools
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_vmdq_dcb_tx_conf),
-            "::",
-            stringify!(nb_queue_pools)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_vmdq_dcb_tx_conf>())).dcb_tc
-                as *const _ as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_vmdq_dcb_tx_conf),
-            "::",
-            stringify!(dcb_tc)
-        )
-    );
+    fn test_field_nb_queue_pools() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_vmdq_dcb_tx_conf>::uninit(
+                    );
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).nb_queue_pools) as usize -
+                    ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_vmdq_dcb_tx_conf),
+                "::",
+                stringify!(nb_queue_pools)
+            )
+        );
+    }
+    test_field_nb_queue_pools();
+    fn test_field_dcb_tc() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_vmdq_dcb_tx_conf>::uninit(
+                    );
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).dcb_tc) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_vmdq_dcb_tx_conf),
+                "::",
+                stringify!(dcb_tc)
+            )
+        );
+    }
+    test_field_dcb_tc();
 }
 impl Clone for rte_eth_vmdq_dcb_tx_conf {
     fn clone(&self) -> Self {
@@ -1030,32 +1142,42 @@
         4usize,
         concat!("Alignment of ", stringify!(rte_eth_dcb_tx_conf))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_dcb_tx_conf>())).nb_tcs as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_dcb_tx_conf),
-            "::",
-            stringify!(nb_tcs)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_dcb_tx_conf>())).dcb_tc as *const _
-                as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_dcb_tx_conf),
-            "::",
-            stringify!(dcb_tc)
-        )
-    );
+    fn test_field_nb_tcs() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_dcb_tx_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).nb_tcs) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_dcb_tx_conf),
+                "::",
+                stringify!(nb_tcs)
+            )
+        );
+    }
+    test_field_nb_tcs();
+    fn test_field_dcb_tc() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_dcb_tx_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).dcb_tc) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_dcb_tx_conf),
+                "::",
+                stringify!(dcb_tc)
+            )
+        );
+    }
+    test_field_dcb_tc();
 }
 impl Clone for rte_eth_dcb_tx_conf {
     fn clone(&self) -> Self {
@@ -1089,19 +1211,25 @@
         4usize,
         concat!("Alignment of ", stringify!(rte_eth_vmdq_tx_conf))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_vmdq_tx_conf>())).nb_queue_pools
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_vmdq_tx_conf),
-            "::",
-            stringify!(nb_queue_pools)
-        )
-    );
+    fn test_field_nb_queue_pools() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_vmdq_tx_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).nb_queue_pools) as usize -
+                    ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_vmdq_tx_conf),
+                "::",
+                stringify!(nb_queue_pools)
+            )
+        );
+    }
+    test_field_nb_queue_pools();
 }
 impl Clone for rte_eth_vmdq_tx_conf {
     fn clone(&self) -> Self {
@@ -1158,32 +1286,44 @@
             stringify!(rte_eth_vmdq_rx_conf__bindgen_ty_1)
         )
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_vmdq_rx_conf__bindgen_ty_1>()))
-                .vlan_id as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_vmdq_rx_conf__bindgen_ty_1),
-            "::",
-            stringify!(vlan_id)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_vmdq_rx_conf__bindgen_ty_1>())).pools
-                as *const _ as usize
-        },
-        8usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_vmdq_rx_conf__bindgen_ty_1),
-            "::",
-            stringify!(pools)
-        )
-    );
+    fn test_field_vlan_id() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    rte_eth_vmdq_rx_conf__bindgen_ty_1,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).vlan_id) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_vmdq_rx_conf__bindgen_ty_1),
+                "::",
+                stringify!(vlan_id)
+            )
+        );
+    }
+    test_field_vlan_id();
+    fn test_field_pools() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    rte_eth_vmdq_rx_conf__bindgen_ty_1,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).pools) as usize - ptr as usize
+            },
+            8usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_vmdq_rx_conf__bindgen_ty_1),
+                "::",
+                stringify!(pools)
+            )
+        );
+    }
+    test_field_pools();
 }
 impl Clone for rte_eth_vmdq_rx_conf__bindgen_ty_1 {
     fn clone(&self) -> Self {
@@ -1202,97 +1342,137 @@
         8usize,
         concat!("Alignment of ", stringify!(rte_eth_vmdq_rx_conf))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_vmdq_rx_conf>())).nb_queue_pools
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_vmdq_rx_conf),
-            "::",
-            stringify!(nb_queue_pools)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_vmdq_rx_conf>())).enable_default_pool
-                as *const _ as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_vmdq_rx_conf),
-            "::",
-            stringify!(enable_default_pool)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_vmdq_rx_conf>())).default_pool
-                as *const _ as usize
-        },
-        5usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_vmdq_rx_conf),
-            "::",
-            stringify!(default_pool)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_vmdq_rx_conf>())).enable_loop_back
-                as *const _ as usize
-        },
-        6usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_vmdq_rx_conf),
-            "::",
-            stringify!(enable_loop_back)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_vmdq_rx_conf>())).nb_pool_maps
-                as *const _ as usize
-        },
-        7usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_vmdq_rx_conf),
-            "::",
-            stringify!(nb_pool_maps)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_vmdq_rx_conf>())).rx_mode as *const _
-                as usize
-        },
-        8usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_vmdq_rx_conf),
-            "::",
-            stringify!(rx_mode)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_vmdq_rx_conf>())).pool_map
-                as *const _ as usize
-        },
-        16usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_vmdq_rx_conf),
-            "::",
-            stringify!(pool_map)
-        )
-    );
+    fn test_field_nb_queue_pools() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_vmdq_rx_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).nb_queue_pools) as usize -
+                    ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_vmdq_rx_conf),
+                "::",
+                stringify!(nb_queue_pools)
+            )
+        );
+    }
+    test_field_nb_queue_pools();
+    fn test_field_enable_default_pool() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_vmdq_rx_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).enable_default_pool) as usize -
+                    ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_vmdq_rx_conf),
+                "::",
+                stringify!(enable_default_pool)
+            )
+        );
+    }
+    test_field_enable_default_pool();
+    fn test_field_default_pool() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_vmdq_rx_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).default_pool) as usize -
+                    ptr as usize
+            },
+            5usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_vmdq_rx_conf),
+                "::",
+                stringify!(default_pool)
+            )
+        );
+    }
+    test_field_default_pool();
+    fn test_field_enable_loop_back() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_vmdq_rx_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).enable_loop_back) as usize -
+                    ptr as usize
+            },
+            6usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_vmdq_rx_conf),
+                "::",
+                stringify!(enable_loop_back)
+            )
+        );
+    }
+    test_field_enable_loop_back();
+    fn test_field_nb_pool_maps() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_vmdq_rx_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).nb_pool_maps) as usize -
+                    ptr as usize
+            },
+            7usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_vmdq_rx_conf),
+                "::",
+                stringify!(nb_pool_maps)
+            )
+        );
+    }
+    test_field_nb_pool_maps();
+    fn test_field_rx_mode() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_vmdq_rx_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).rx_mode) as usize - ptr as usize
+            },
+            8usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_vmdq_rx_conf),
+                "::",
+                stringify!(rx_mode)
+            )
+        );
+    }
+    test_field_rx_mode();
+    fn test_field_pool_map() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_vmdq_rx_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).pool_map) as usize - ptr as usize
+            },
+            16usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_vmdq_rx_conf),
+                "::",
+                stringify!(pool_map)
+            )
+        );
+    }
+    test_field_pool_map();
 }
 impl Clone for rte_eth_vmdq_rx_conf {
     fn clone(&self) -> Self {
@@ -1373,71 +1553,96 @@
         4usize,
         concat!("Alignment of ", stringify!(rte_eth_ipv4_flow))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_ipv4_flow>())).src_ip as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_ipv4_flow),
-            "::",
-            stringify!(src_ip)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_ipv4_flow>())).dst_ip as *const _
-                as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_ipv4_flow),
-            "::",
-            stringify!(dst_ip)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_ipv4_flow>())).tos as *const _
-                as usize
-        },
-        8usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_ipv4_flow),
-            "::",
-            stringify!(tos)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_ipv4_flow>())).ttl as *const _
-                as usize
-        },
-        9usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_ipv4_flow),
-            "::",
-            stringify!(ttl)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_ipv4_flow>())).proto as *const _
-                as usize
-        },
-        10usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_ipv4_flow),
-            "::",
-            stringify!(proto)
-        )
-    );
+    fn test_field_src_ip() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_ipv4_flow>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).src_ip) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_ipv4_flow),
+                "::",
+                stringify!(src_ip)
+            )
+        );
+    }
+    test_field_src_ip();
+    fn test_field_dst_ip() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_ipv4_flow>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).dst_ip) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_ipv4_flow),
+                "::",
+                stringify!(dst_ip)
+            )
+        );
+    }
+    test_field_dst_ip();
+    fn test_field_tos() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_ipv4_flow>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).tos) as usize - ptr as usize
+            },
+            8usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_ipv4_flow),
+                "::",
+                stringify!(tos)
+            )
+        );
+    }
+    test_field_tos();
+    fn test_field_ttl() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_ipv4_flow>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).ttl) as usize - ptr as usize
+            },
+            9usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_ipv4_flow),
+                "::",
+                stringify!(ttl)
+            )
+        );
+    }
+    test_field_ttl();
+    fn test_field_proto() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_ipv4_flow>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).proto) as usize - ptr as usize
+            },
+            10usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_ipv4_flow),
+                "::",
+                stringify!(proto)
+            )
+        );
+    }
+    test_field_proto();
 }
 impl Clone for rte_eth_ipv4_flow {
     fn clone(&self) -> Self {
@@ -1471,71 +1676,96 @@
         4usize,
         concat!("Alignment of ", stringify!(rte_eth_ipv6_flow))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_ipv6_flow>())).src_ip as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_ipv6_flow),
-            "::",
-            stringify!(src_ip)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_ipv6_flow>())).dst_ip as *const _
-                as usize
-        },
-        16usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_ipv6_flow),
-            "::",
-            stringify!(dst_ip)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_ipv6_flow>())).tc as *const _
-                as usize
-        },
-        32usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_ipv6_flow),
-            "::",
-            stringify!(tc)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_ipv6_flow>())).proto as *const _
-                as usize
-        },
-        33usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_ipv6_flow),
-            "::",
-            stringify!(proto)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_ipv6_flow>())).hop_limits as *const _
-                as usize
-        },
-        34usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_ipv6_flow),
-            "::",
-            stringify!(hop_limits)
-        )
-    );
+    fn test_field_src_ip() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_ipv6_flow>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).src_ip) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_ipv6_flow),
+                "::",
+                stringify!(src_ip)
+            )
+        );
+    }
+    test_field_src_ip();
+    fn test_field_dst_ip() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_ipv6_flow>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).dst_ip) as usize - ptr as usize
+            },
+            16usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_ipv6_flow),
+                "::",
+                stringify!(dst_ip)
+            )
+        );
+    }
+    test_field_dst_ip();
+    fn test_field_tc() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_ipv6_flow>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).tc) as usize - ptr as usize
+            },
+            32usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_ipv6_flow),
+                "::",
+                stringify!(tc)
+            )
+        );
+    }
+    test_field_tc();
+    fn test_field_proto() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_ipv6_flow>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).proto) as usize - ptr as usize
+            },
+            33usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_ipv6_flow),
+                "::",
+                stringify!(proto)
+            )
+        );
+    }
+    test_field_proto();
+    fn test_field_hop_limits() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_ipv6_flow>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).hop_limits) as usize - ptr as usize
+            },
+            34usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_ipv6_flow),
+                "::",
+                stringify!(hop_limits)
+            )
+        );
+    }
+    test_field_hop_limits();
 }
 impl Clone for rte_eth_ipv6_flow {
     fn clone(&self) -> Self {
@@ -1578,110 +1808,156 @@
         4usize,
         concat!("Alignment of ", stringify!(rte_eth_fdir_masks))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_fdir_masks>())).vlan_tci_mask
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_fdir_masks),
-            "::",
-            stringify!(vlan_tci_mask)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_fdir_masks>())).ipv4_mask as *const _
-                as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_fdir_masks),
-            "::",
-            stringify!(ipv4_mask)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_fdir_masks>())).ipv6_mask as *const _
-                as usize
-        },
-        16usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_fdir_masks),
-            "::",
-            stringify!(ipv6_mask)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_fdir_masks>())).src_port_mask
-                as *const _ as usize
-        },
-        52usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_fdir_masks),
-            "::",
-            stringify!(src_port_mask)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_fdir_masks>())).dst_port_mask
-                as *const _ as usize
-        },
-        54usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_fdir_masks),
-            "::",
-            stringify!(dst_port_mask)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_fdir_masks>())).mac_addr_byte_mask
-                as *const _ as usize
-        },
-        56usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_fdir_masks),
-            "::",
-            stringify!(mac_addr_byte_mask)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_fdir_masks>())).tunnel_id_mask
-                as *const _ as usize
-        },
-        60usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_fdir_masks),
-            "::",
-            stringify!(tunnel_id_mask)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_fdir_masks>())).tunnel_type_mask
-                as *const _ as usize
-        },
-        64usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_fdir_masks),
-            "::",
-            stringify!(tunnel_type_mask)
-        )
-    );
+    fn test_field_vlan_tci_mask() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_fdir_masks>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).vlan_tci_mask) as usize -
+                    ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_fdir_masks),
+                "::",
+                stringify!(vlan_tci_mask)
+            )
+        );
+    }
+    test_field_vlan_tci_mask();
+    fn test_field_ipv4_mask() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_fdir_masks>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).ipv4_mask) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_fdir_masks),
+                "::",
+                stringify!(ipv4_mask)
+            )
+        );
+    }
+    test_field_ipv4_mask();
+    fn test_field_ipv6_mask() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_fdir_masks>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).ipv6_mask) as usize - ptr as usize
+            },
+            16usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_fdir_masks),
+                "::",
+                stringify!(ipv6_mask)
+            )
+        );
+    }
+    test_field_ipv6_mask();
+    fn test_field_src_port_mask() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_fdir_masks>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).src_port_mask) as usize -
+                    ptr as usize
+            },
+            52usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_fdir_masks),
+                "::",
+                stringify!(src_port_mask)
+            )
+        );
+    }
+    test_field_src_port_mask();
+    fn test_field_dst_port_mask() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_fdir_masks>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).dst_port_mask) as usize -
+                    ptr as usize
+            },
+            54usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_fdir_masks),
+                "::",
+                stringify!(dst_port_mask)
+            )
+        );
+    }
+    test_field_dst_port_mask();
+    fn test_field_mac_addr_byte_mask() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_fdir_masks>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mac_addr_byte_mask) as usize -
+                    ptr as usize
+            },
+            56usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_fdir_masks),
+                "::",
+                stringify!(mac_addr_byte_mask)
+            )
+        );
+    }
+    test_field_mac_addr_byte_mask();
+    fn test_field_tunnel_id_mask() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_fdir_masks>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).tunnel_id_mask) as usize -
+                    ptr as usize
+            },
+            60usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_fdir_masks),
+                "::",
+                stringify!(tunnel_id_mask)
+            )
+        );
+    }
+    test_field_tunnel_id_mask();
+    fn test_field_tunnel_type_mask() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_fdir_masks>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).tunnel_type_mask) as usize -
+                    ptr as usize
+            },
+            64usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_fdir_masks),
+                "::",
+                stringify!(tunnel_type_mask)
+            )
+        );
+    }
+    test_field_tunnel_type_mask();
 }
 impl Clone for rte_eth_fdir_masks {
     fn clone(&self) -> Self {
@@ -1720,32 +1996,44 @@
         4usize,
         concat!("Alignment of ", stringify!(rte_eth_flex_payload_cfg))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_flex_payload_cfg>())).type_
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_flex_payload_cfg),
-            "::",
-            stringify!(type_)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_flex_payload_cfg>())).src_offset
-                as *const _ as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_flex_payload_cfg),
-            "::",
-            stringify!(src_offset)
-        )
-    );
+    fn test_field_type() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_flex_payload_cfg>::uninit(
+                    );
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).type_) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_flex_payload_cfg),
+                "::",
+                stringify!(type_)
+            )
+        );
+    }
+    test_field_type();
+    fn test_field_src_offset() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_flex_payload_cfg>::uninit(
+                    );
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).src_offset) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_flex_payload_cfg),
+                "::",
+                stringify!(src_offset)
+            )
+        );
+    }
+    test_field_src_offset();
 }
 impl Clone for rte_eth_flex_payload_cfg {
     fn clone(&self) -> Self {
@@ -1781,32 +2069,42 @@
         2usize,
         concat!("Alignment of ", stringify!(rte_eth_fdir_flex_mask))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_fdir_flex_mask>())).flow_type
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_fdir_flex_mask),
-            "::",
-            stringify!(flow_type)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_fdir_flex_mask>())).mask as *const _
-                as usize
-        },
-        2usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_fdir_flex_mask),
-            "::",
-            stringify!(mask)
-        )
-    );
+    fn test_field_flow_type() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_fdir_flex_mask>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).flow_type) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_fdir_flex_mask),
+                "::",
+                stringify!(flow_type)
+            )
+        );
+    }
+    test_field_flow_type();
+    fn test_field_mask() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_fdir_flex_mask>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mask) as usize - ptr as usize
+            },
+            2usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_fdir_flex_mask),
+                "::",
+                stringify!(mask)
+            )
+        );
+    }
+    test_field_mask();
 }
 impl Clone for rte_eth_fdir_flex_mask {
     fn clone(&self) -> Self {
@@ -1837,58 +2135,79 @@
         4usize,
         concat!("Alignment of ", stringify!(rte_eth_fdir_flex_conf))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_fdir_flex_conf>())).nb_payloads
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_fdir_flex_conf),
-            "::",
-            stringify!(nb_payloads)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_fdir_flex_conf>())).nb_flexmasks
-                as *const _ as usize
-        },
-        2usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_fdir_flex_conf),
-            "::",
-            stringify!(nb_flexmasks)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_fdir_flex_conf>())).flex_set
-                as *const _ as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_fdir_flex_conf),
-            "::",
-            stringify!(flex_set)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_fdir_flex_conf>())).flex_mask
-                as *const _ as usize
-        },
-        292usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_fdir_flex_conf),
-            "::",
-            stringify!(flex_mask)
-        )
-    );
+    fn test_field_nb_payloads() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_fdir_flex_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).nb_payloads) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_fdir_flex_conf),
+                "::",
+                stringify!(nb_payloads)
+            )
+        );
+    }
+    test_field_nb_payloads();
+    fn test_field_nb_flexmasks() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_fdir_flex_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).nb_flexmasks) as usize -
+                    ptr as usize
+            },
+            2usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_fdir_flex_conf),
+                "::",
+                stringify!(nb_flexmasks)
+            )
+        );
+    }
+    test_field_nb_flexmasks();
+    fn test_field_flex_set() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_fdir_flex_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).flex_set) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_fdir_flex_conf),
+                "::",
+                stringify!(flex_set)
+            )
+        );
+    }
+    test_field_flex_set();
+    fn test_field_flex_mask() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_eth_fdir_flex_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).flex_mask) as usize - ptr as usize
+            },
+            292usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_fdir_flex_conf),
+                "::",
+                stringify!(flex_mask)
+            )
+        );
+    }
+    test_field_flex_mask();
 }
 impl Clone for rte_eth_fdir_flex_conf {
     fn clone(&self) -> Self {
@@ -1934,82 +2253,108 @@
         4usize,
         concat!("Alignment of ", stringify!(rte_fdir_conf))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_fdir_conf>())).mode as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_fdir_conf),
-            "::",
-            stringify!(mode)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_fdir_conf>())).pballoc as *const _
-                as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_fdir_conf),
-            "::",
-            stringify!(pballoc)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_fdir_conf>())).status as *const _
-                as usize
-        },
-        8usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_fdir_conf),
-            "::",
-            stringify!(status)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_fdir_conf>())).drop_queue as *const _
-                as usize
-        },
-        12usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_fdir_conf),
-            "::",
-            stringify!(drop_queue)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_fdir_conf>())).mask as *const _ as usize
-        },
-        16usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_fdir_conf),
-            "::",
-            stringify!(mask)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_fdir_conf>())).flex_conf as *const _
-                as usize
-        },
-        84usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_fdir_conf),
-            "::",
-            stringify!(flex_conf)
-        )
-    );
+    fn test_field_mode() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_fdir_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mode) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_fdir_conf),
+                "::",
+                stringify!(mode)
+            )
+        );
+    }
+    test_field_mode();
+    fn test_field_pballoc() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_fdir_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).pballoc) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_fdir_conf),
+                "::",
+                stringify!(pballoc)
+            )
+        );
+    }
+    test_field_pballoc();
+    fn test_field_status() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_fdir_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).status) as usize - ptr as usize
+            },
+            8usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_fdir_conf),
+                "::",
+                stringify!(status)
+            )
+        );
+    }
+    test_field_status();
+    fn test_field_drop_queue() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_fdir_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).drop_queue) as usize - ptr as usize
+            },
+            12usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_fdir_conf),
+                "::",
+                stringify!(drop_queue)
+            )
+        );
+    }
+    test_field_drop_queue();
+    fn test_field_mask() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_fdir_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mask) as usize - ptr as usize
+            },
+            16usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_fdir_conf),
+                "::",
+                stringify!(mask)
+            )
+        );
+    }
+    test_field_mask();
+    fn test_field_flex_conf() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_fdir_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).flex_conf) as usize - ptr as usize
+            },
+            84usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_fdir_conf),
+                "::",
+                stringify!(flex_conf)
+            )
+        );
+    }
+    test_field_flex_conf();
 }
 impl Clone for rte_fdir_conf {
     fn clone(&self) -> Self {
@@ -2046,30 +2391,40 @@
         2usize,
         concat!("Alignment of ", stringify!(rte_intr_conf))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_intr_conf>())).lsc as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_intr_conf),
-            "::",
-            stringify!(lsc)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_intr_conf>())).rxq as *const _ as usize
-        },
-        2usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_intr_conf),
-            "::",
-            stringify!(rxq)
-        )
-    );
+    fn test_field_lsc() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_intr_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).lsc) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_intr_conf),
+                "::",
+                stringify!(lsc)
+            )
+        );
+    }
+    test_field_lsc();
+    fn test_field_rxq() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_intr_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).rxq) as usize - ptr as usize
+            },
+            2usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_intr_conf),
+                "::",
+                stringify!(rxq)
+            )
+        );
+    }
+    test_field_rxq();
 }
 impl Clone for rte_intr_conf {
     fn clone(&self) -> Self {
@@ -2133,58 +2488,84 @@
         8usize,
         concat!("Alignment of ", stringify!(rte_eth_conf__bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_conf__bindgen_ty_1>())).rss_conf
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_conf__bindgen_ty_1),
-            "::",
-            stringify!(rss_conf)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_conf__bindgen_ty_1>())).vmdq_dcb_conf
-                as *const _ as usize
-        },
-        24usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_conf__bindgen_ty_1),
-            "::",
-            stringify!(vmdq_dcb_conf)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_conf__bindgen_ty_1>())).dcb_rx_conf
-                as *const _ as usize
-        },
-        1064usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_conf__bindgen_ty_1),
-            "::",
-            stringify!(dcb_rx_conf)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_conf__bindgen_ty_1>())).vmdq_rx_conf
-                as *const _ as usize
-        },
-        1080usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_conf__bindgen_ty_1),
-            "::",
-            stringify!(vmdq_rx_conf)
-        )
-    );
+    fn test_field_rss_conf() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    rte_eth_conf__bindgen_ty_1,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).rss_conf) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_conf__bindgen_ty_1),
+                "::",
+                stringify!(rss_conf)
+            )
+        );
+    }
+    test_field_rss_conf();
+    fn test_field_vmdq_dcb_conf() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    rte_eth_conf__bindgen_ty_1,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).vmdq_dcb_conf) as usize -
+                    ptr as usize
+            },
+            24usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_conf__bindgen_ty_1),
+                "::",
+                stringify!(vmdq_dcb_conf)
+            )
+        );
+    }
+    test_field_vmdq_dcb_conf();
+    fn test_field_dcb_rx_conf() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    rte_eth_conf__bindgen_ty_1,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).dcb_rx_conf) as usize - ptr as usize
+            },
+            1064usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_conf__bindgen_ty_1),
+                "::",
+                stringify!(dcb_rx_conf)
+            )
+        );
+    }
+    test_field_dcb_rx_conf();
+    fn test_field_vmdq_rx_conf() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    rte_eth_conf__bindgen_ty_1,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).vmdq_rx_conf) as usize -
+                    ptr as usize
+            },
+            1080usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_conf__bindgen_ty_1),
+                "::",
+                stringify!(vmdq_rx_conf)
+            )
+        );
+    }
+    test_field_vmdq_rx_conf();
 }
 impl Clone for rte_eth_conf__bindgen_ty_1 {
     fn clone(&self) -> Self {
@@ -2220,45 +2601,65 @@
         4usize,
         concat!("Alignment of ", stringify!(rte_eth_conf__bindgen_ty_2))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_conf__bindgen_ty_2>()))
-                .vmdq_dcb_tx_conf as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_conf__bindgen_ty_2),
-            "::",
-            stringify!(vmdq_dcb_tx_conf)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_conf__bindgen_ty_2>())).dcb_tx_conf
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_conf__bindgen_ty_2),
-            "::",
-            stringify!(dcb_tx_conf)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_conf__bindgen_ty_2>())).vmdq_tx_conf
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_conf__bindgen_ty_2),
-            "::",
-            stringify!(vmdq_tx_conf)
-        )
-    );
+    fn test_field_vmdq_dcb_tx_conf() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    rte_eth_conf__bindgen_ty_2,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).vmdq_dcb_tx_conf) as usize -
+                    ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_conf__bindgen_ty_2),
+                "::",
+                stringify!(vmdq_dcb_tx_conf)
+            )
+        );
+    }
+    test_field_vmdq_dcb_tx_conf();
+    fn test_field_dcb_tx_conf() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    rte_eth_conf__bindgen_ty_2,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).dcb_tx_conf) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_conf__bindgen_ty_2),
+                "::",
+                stringify!(dcb_tx_conf)
+            )
+        );
+    }
+    test_field_dcb_tx_conf();
+    fn test_field_vmdq_tx_conf() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    rte_eth_conf__bindgen_ty_2,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).vmdq_tx_conf) as usize -
+                    ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_conf__bindgen_ty_2),
+                "::",
+                stringify!(vmdq_tx_conf)
+            )
+        );
+    }
+    test_field_vmdq_tx_conf();
 }
 impl Clone for rte_eth_conf__bindgen_ty_2 {
     fn clone(&self) -> Self {
@@ -2277,121 +2678,160 @@
         8usize,
         concat!("Alignment of ", stringify!(rte_eth_conf))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_conf>())).link_speeds as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_conf),
-            "::",
-            stringify!(link_speeds)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_conf>())).rxmode as *const _ as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_conf),
-            "::",
-            stringify!(rxmode)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_conf>())).txmode as *const _ as usize
-        },
-        16usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_conf),
-            "::",
-            stringify!(txmode)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_conf>())).lpbk_mode as *const _
-                as usize
-        },
-        24usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_conf),
-            "::",
-            stringify!(lpbk_mode)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_conf>())).rx_adv_conf as *const _
-                as usize
-        },
-        32usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_conf),
-            "::",
-            stringify!(rx_adv_conf)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_conf>())).tx_adv_conf as *const _
-                as usize
-        },
-        2152usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_conf),
-            "::",
-            stringify!(tx_adv_conf)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_conf>())).dcb_capability_en
-                as *const _ as usize
-        },
-        2164usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_conf),
-            "::",
-            stringify!(dcb_capability_en)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_conf>())).fdir_conf as *const _
-                as usize
-        },
-        2168usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_conf),
-            "::",
-            stringify!(fdir_conf)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_conf>())).intr_conf as *const _
-                as usize
-        },
-        2940usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_conf),
-            "::",
-            stringify!(intr_conf)
-        )
-    );
+    fn test_field_link_speeds() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_eth_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).link_speeds) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_conf),
+                "::",
+                stringify!(link_speeds)
+            )
+        );
+    }
+    test_field_link_speeds();
+    fn test_field_rxmode() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_eth_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).rxmode) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_conf),
+                "::",
+                stringify!(rxmode)
+            )
+        );
+    }
+    test_field_rxmode();
+    fn test_field_txmode() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_eth_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).txmode) as usize - ptr as usize
+            },
+            16usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_conf),
+                "::",
+                stringify!(txmode)
+            )
+        );
+    }
+    test_field_txmode();
+    fn test_field_lpbk_mode() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_eth_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).lpbk_mode) as usize - ptr as usize
+            },
+            24usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_conf),
+                "::",
+                stringify!(lpbk_mode)
+            )
+        );
+    }
+    test_field_lpbk_mode();
+    fn test_field_rx_adv_conf() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_eth_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).rx_adv_conf) as usize - ptr as usize
+            },
+            32usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_conf),
+                "::",
+                stringify!(rx_adv_conf)
+            )
+        );
+    }
+    test_field_rx_adv_conf();
+    fn test_field_tx_adv_conf() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_eth_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).tx_adv_conf) as usize - ptr as usize
+            },
+            2152usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_conf),
+                "::",
+                stringify!(tx_adv_conf)
+            )
+        );
+    }
+    test_field_tx_adv_conf();
+    fn test_field_dcb_capability_en() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_eth_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).dcb_capability_en) as usize -
+                    ptr as usize
+            },
+            2164usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_conf),
+                "::",
+                stringify!(dcb_capability_en)
+            )
+        );
+    }
+    test_field_dcb_capability_en();
+    fn test_field_fdir_conf() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_eth_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).fdir_conf) as usize - ptr as usize
+            },
+            2168usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_conf),
+                "::",
+                stringify!(fdir_conf)
+            )
+        );
+    }
+    test_field_fdir_conf();
+    fn test_field_intr_conf() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_eth_conf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).intr_conf) as usize - ptr as usize
+            },
+            2940usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_conf),
+                "::",
+                stringify!(intr_conf)
+            )
+        );
+    }
+    test_field_intr_conf();
 }
 impl Clone for rte_eth_conf {
     fn clone(&self) -> Self {
diff --git a/tests/expectations/tests/layout_kni_mbuf.rs b/tests/expectations/tests/layout_kni_mbuf.rs
index e73344c..4eaa707 100644
--- a/tests/expectations/tests/layout_kni_mbuf.rs
+++ b/tests/expectations/tests/layout_kni_mbuf.rs
@@ -44,181 +44,245 @@
         64usize,
         concat!("Alignment of ", stringify!(rte_kni_mbuf))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_kni_mbuf>())).buf_addr as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_kni_mbuf),
-            "::",
-            stringify!(buf_addr)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_kni_mbuf>())).buf_physaddr as *const _
-                as usize
-        },
-        8usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_kni_mbuf),
-            "::",
-            stringify!(buf_physaddr)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_kni_mbuf>())).pad0 as *const _ as usize
-        },
-        16usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_kni_mbuf),
-            "::",
-            stringify!(pad0)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_kni_mbuf>())).data_off as *const _
-                as usize
-        },
-        18usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_kni_mbuf),
-            "::",
-            stringify!(data_off)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_kni_mbuf>())).pad1 as *const _ as usize
-        },
-        20usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_kni_mbuf),
-            "::",
-            stringify!(pad1)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_kni_mbuf>())).nb_segs as *const _
-                as usize
-        },
-        22usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_kni_mbuf),
-            "::",
-            stringify!(nb_segs)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_kni_mbuf>())).pad4 as *const _ as usize
-        },
-        23usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_kni_mbuf),
-            "::",
-            stringify!(pad4)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_kni_mbuf>())).ol_flags as *const _
-                as usize
-        },
-        24usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_kni_mbuf),
-            "::",
-            stringify!(ol_flags)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_kni_mbuf>())).pad2 as *const _ as usize
-        },
-        32usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_kni_mbuf),
-            "::",
-            stringify!(pad2)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_kni_mbuf>())).pkt_len as *const _
-                as usize
-        },
-        36usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_kni_mbuf),
-            "::",
-            stringify!(pkt_len)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_kni_mbuf>())).data_len as *const _
-                as usize
-        },
-        40usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_kni_mbuf),
-            "::",
-            stringify!(data_len)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_kni_mbuf>())).pad3 as *const _ as usize
-        },
-        64usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_kni_mbuf),
-            "::",
-            stringify!(pad3)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_kni_mbuf>())).pool as *const _ as usize
-        },
-        72usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_kni_mbuf),
-            "::",
-            stringify!(pool)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_kni_mbuf>())).next as *const _ as usize
-        },
-        80usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_kni_mbuf),
-            "::",
-            stringify!(next)
-        )
-    );
+    fn test_field_buf_addr() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_kni_mbuf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).buf_addr) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_kni_mbuf),
+                "::",
+                stringify!(buf_addr)
+            )
+        );
+    }
+    test_field_buf_addr();
+    fn test_field_buf_physaddr() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_kni_mbuf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).buf_physaddr) as usize -
+                    ptr as usize
+            },
+            8usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_kni_mbuf),
+                "::",
+                stringify!(buf_physaddr)
+            )
+        );
+    }
+    test_field_buf_physaddr();
+    fn test_field_pad0() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_kni_mbuf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).pad0) as usize - ptr as usize
+            },
+            16usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_kni_mbuf),
+                "::",
+                stringify!(pad0)
+            )
+        );
+    }
+    test_field_pad0();
+    fn test_field_data_off() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_kni_mbuf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).data_off) as usize - ptr as usize
+            },
+            18usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_kni_mbuf),
+                "::",
+                stringify!(data_off)
+            )
+        );
+    }
+    test_field_data_off();
+    fn test_field_pad1() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_kni_mbuf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).pad1) as usize - ptr as usize
+            },
+            20usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_kni_mbuf),
+                "::",
+                stringify!(pad1)
+            )
+        );
+    }
+    test_field_pad1();
+    fn test_field_nb_segs() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_kni_mbuf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).nb_segs) as usize - ptr as usize
+            },
+            22usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_kni_mbuf),
+                "::",
+                stringify!(nb_segs)
+            )
+        );
+    }
+    test_field_nb_segs();
+    fn test_field_pad4() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_kni_mbuf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).pad4) as usize - ptr as usize
+            },
+            23usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_kni_mbuf),
+                "::",
+                stringify!(pad4)
+            )
+        );
+    }
+    test_field_pad4();
+    fn test_field_ol_flags() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_kni_mbuf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).ol_flags) as usize - ptr as usize
+            },
+            24usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_kni_mbuf),
+                "::",
+                stringify!(ol_flags)
+            )
+        );
+    }
+    test_field_ol_flags();
+    fn test_field_pad2() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_kni_mbuf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).pad2) as usize - ptr as usize
+            },
+            32usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_kni_mbuf),
+                "::",
+                stringify!(pad2)
+            )
+        );
+    }
+    test_field_pad2();
+    fn test_field_pkt_len() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_kni_mbuf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).pkt_len) as usize - ptr as usize
+            },
+            36usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_kni_mbuf),
+                "::",
+                stringify!(pkt_len)
+            )
+        );
+    }
+    test_field_pkt_len();
+    fn test_field_data_len() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_kni_mbuf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).data_len) as usize - ptr as usize
+            },
+            40usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_kni_mbuf),
+                "::",
+                stringify!(data_len)
+            )
+        );
+    }
+    test_field_data_len();
+    fn test_field_pad3() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_kni_mbuf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).pad3) as usize - ptr as usize
+            },
+            64usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_kni_mbuf),
+                "::",
+                stringify!(pad3)
+            )
+        );
+    }
+    test_field_pad3();
+    fn test_field_pool() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_kni_mbuf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).pool) as usize - ptr as usize
+            },
+            72usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_kni_mbuf),
+                "::",
+                stringify!(pool)
+            )
+        );
+    }
+    test_field_pool();
+    fn test_field_next() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_kni_mbuf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).next) as usize - ptr as usize
+            },
+            80usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_kni_mbuf),
+                "::",
+                stringify!(next)
+            )
+        );
+    }
+    test_field_next();
 }
 impl Default for rte_kni_mbuf {
     fn default() -> Self {
diff --git a/tests/expectations/tests/layout_large_align_field.rs b/tests/expectations/tests/layout_large_align_field.rs
index 4208e72..daf3d56 100644
--- a/tests/expectations/tests/layout_large_align_field.rs
+++ b/tests/expectations/tests/layout_large_align_field.rs
@@ -75,36 +75,57 @@
         8usize,
         concat!("Alignment of ", stringify!(ip_frag))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<ip_frag>())).ofs as *const _ as usize },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(ip_frag),
-            "::",
-            stringify!(ofs)
-        )
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<ip_frag>())).len as *const _ as usize },
-        2usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(ip_frag),
-            "::",
-            stringify!(len)
-        )
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<ip_frag>())).mb as *const _ as usize },
-        8usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(ip_frag),
-            "::",
-            stringify!(mb)
-        )
-    );
+    fn test_field_ofs() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<ip_frag>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).ofs) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(ip_frag),
+                "::",
+                stringify!(ofs)
+            )
+        );
+    }
+    test_field_ofs();
+    fn test_field_len() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<ip_frag>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).len) as usize - ptr as usize
+            },
+            2usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(ip_frag),
+                "::",
+                stringify!(len)
+            )
+        );
+    }
+    test_field_len();
+    fn test_field_mb() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<ip_frag>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mb) as usize - ptr as usize
+            },
+            8usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(ip_frag),
+                "::",
+                stringify!(mb)
+            )
+        );
+    }
+    test_field_mb();
 }
 impl Default for ip_frag {
     fn default() -> Self {
@@ -138,42 +159,57 @@
         8usize,
         concat!("Alignment of ", stringify!(ip_frag_key))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ip_frag_key>())).src_dst as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(ip_frag_key),
-            "::",
-            stringify!(src_dst)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ip_frag_key>())).id as *const _ as usize
-        },
-        32usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(ip_frag_key),
-            "::",
-            stringify!(id)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ip_frag_key>())).key_len as *const _ as usize
-        },
-        36usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(ip_frag_key),
-            "::",
-            stringify!(key_len)
-        )
-    );
+    fn test_field_src_dst() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<ip_frag_key>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).src_dst) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(ip_frag_key),
+                "::",
+                stringify!(src_dst)
+            )
+        );
+    }
+    test_field_src_dst();
+    fn test_field_id() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<ip_frag_key>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).id) as usize - ptr as usize
+            },
+            32usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(ip_frag_key),
+                "::",
+                stringify!(id)
+            )
+        );
+    }
+    test_field_id();
+    fn test_field_key_len() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<ip_frag_key>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).key_len) as usize - ptr as usize
+            },
+            36usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(ip_frag_key),
+                "::",
+                stringify!(key_len)
+            )
+        );
+    }
+    test_field_key_len();
 }
 /// @internal Fragmented packet to reassemble.
 /// First two entries in the frags[] array are for the last and first fragments.
@@ -214,32 +250,40 @@
         8usize,
         concat!("Alignment of ", stringify!(ip_frag_pkt__bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ip_frag_pkt__bindgen_ty_1>())).tqe_next
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(ip_frag_pkt__bindgen_ty_1),
-            "::",
-            stringify!(tqe_next)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ip_frag_pkt__bindgen_ty_1>())).tqe_prev
-                as *const _ as usize
-        },
-        8usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(ip_frag_pkt__bindgen_ty_1),
-            "::",
-            stringify!(tqe_prev)
-        )
-    );
+    fn test_field_tqe_next() {
+        assert_eq!(
+            unsafe {
+                let uninit = :: std :: mem :: MaybeUninit :: < ip_frag_pkt__bindgen_ty_1 > :: uninit () ;
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).tqe_next) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(ip_frag_pkt__bindgen_ty_1),
+                "::",
+                stringify!(tqe_next)
+            )
+        );
+    }
+    test_field_tqe_next();
+    fn test_field_tqe_prev() {
+        assert_eq!(
+            unsafe {
+                let uninit = :: std :: mem :: MaybeUninit :: < ip_frag_pkt__bindgen_ty_1 > :: uninit () ;
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).tqe_prev) as usize - ptr as usize
+            },
+            8usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(ip_frag_pkt__bindgen_ty_1),
+                "::",
+                stringify!(tqe_prev)
+            )
+        );
+    }
+    test_field_tqe_prev();
 }
 impl Default for ip_frag_pkt__bindgen_ty_1 {
     fn default() -> Self {
@@ -262,93 +306,125 @@
         64usize,
         concat!("Alignment of ", stringify!(ip_frag_pkt))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ip_frag_pkt>())).lru as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(ip_frag_pkt),
-            "::",
-            stringify!(lru)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ip_frag_pkt>())).key as *const _ as usize
-        },
-        16usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(ip_frag_pkt),
-            "::",
-            stringify!(key)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ip_frag_pkt>())).start as *const _ as usize
-        },
-        56usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(ip_frag_pkt),
-            "::",
-            stringify!(start)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ip_frag_pkt>())).total_size as *const _
-                as usize
-        },
-        64usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(ip_frag_pkt),
-            "::",
-            stringify!(total_size)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ip_frag_pkt>())).frag_size as *const _
-                as usize
-        },
-        68usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(ip_frag_pkt),
-            "::",
-            stringify!(frag_size)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ip_frag_pkt>())).last_idx as *const _
-                as usize
-        },
-        72usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(ip_frag_pkt),
-            "::",
-            stringify!(last_idx)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ip_frag_pkt>())).frags as *const _ as usize
-        },
-        80usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(ip_frag_pkt),
-            "::",
-            stringify!(frags)
-        )
-    );
+    fn test_field_lru() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<ip_frag_pkt>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).lru) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(ip_frag_pkt),
+                "::",
+                stringify!(lru)
+            )
+        );
+    }
+    test_field_lru();
+    fn test_field_key() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<ip_frag_pkt>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).key) as usize - ptr as usize
+            },
+            16usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(ip_frag_pkt),
+                "::",
+                stringify!(key)
+            )
+        );
+    }
+    test_field_key();
+    fn test_field_start() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<ip_frag_pkt>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).start) as usize - ptr as usize
+            },
+            56usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(ip_frag_pkt),
+                "::",
+                stringify!(start)
+            )
+        );
+    }
+    test_field_start();
+    fn test_field_total_size() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<ip_frag_pkt>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).total_size) as usize - ptr as usize
+            },
+            64usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(ip_frag_pkt),
+                "::",
+                stringify!(total_size)
+            )
+        );
+    }
+    test_field_total_size();
+    fn test_field_frag_size() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<ip_frag_pkt>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).frag_size) as usize - ptr as usize
+            },
+            68usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(ip_frag_pkt),
+                "::",
+                stringify!(frag_size)
+            )
+        );
+    }
+    test_field_frag_size();
+    fn test_field_last_idx() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<ip_frag_pkt>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).last_idx) as usize - ptr as usize
+            },
+            72usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(ip_frag_pkt),
+                "::",
+                stringify!(last_idx)
+            )
+        );
+    }
+    test_field_last_idx();
+    fn test_field_frags() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<ip_frag_pkt>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).frags) as usize - ptr as usize
+            },
+            80usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(ip_frag_pkt),
+                "::",
+                stringify!(frags)
+            )
+        );
+    }
+    test_field_frags();
 }
 impl Default for ip_frag_pkt {
     fn default() -> Self {
@@ -377,32 +453,40 @@
         8usize,
         concat!("Alignment of ", stringify!(ip_pkt_list))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ip_pkt_list>())).tqh_first as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(ip_pkt_list),
-            "::",
-            stringify!(tqh_first)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ip_pkt_list>())).tqh_last as *const _
-                as usize
-        },
-        8usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(ip_pkt_list),
-            "::",
-            stringify!(tqh_last)
-        )
-    );
+    fn test_field_tqh_first() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<ip_pkt_list>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).tqh_first) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(ip_pkt_list),
+                "::",
+                stringify!(tqh_first)
+            )
+        );
+    }
+    test_field_tqh_first();
+    fn test_field_tqh_last() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<ip_pkt_list>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).tqh_last) as usize - ptr as usize
+            },
+            8usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(ip_pkt_list),
+                "::",
+                stringify!(tqh_last)
+            )
+        );
+    }
+    test_field_tqh_last();
 }
 impl Default for ip_pkt_list {
     fn default() -> Self {
@@ -443,84 +527,115 @@
         64usize,
         concat!("Alignment of ", stringify!(ip_frag_tbl_stat))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ip_frag_tbl_stat>())).find_num as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(ip_frag_tbl_stat),
-            "::",
-            stringify!(find_num)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ip_frag_tbl_stat>())).add_num as *const _
-                as usize
-        },
-        8usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(ip_frag_tbl_stat),
-            "::",
-            stringify!(add_num)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ip_frag_tbl_stat>())).del_num as *const _
-                as usize
-        },
-        16usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(ip_frag_tbl_stat),
-            "::",
-            stringify!(del_num)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ip_frag_tbl_stat>())).reuse_num as *const _
-                as usize
-        },
-        24usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(ip_frag_tbl_stat),
-            "::",
-            stringify!(reuse_num)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ip_frag_tbl_stat>())).fail_total as *const _
-                as usize
-        },
-        32usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(ip_frag_tbl_stat),
-            "::",
-            stringify!(fail_total)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ip_frag_tbl_stat>())).fail_nospace
-                as *const _ as usize
-        },
-        40usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(ip_frag_tbl_stat),
-            "::",
-            stringify!(fail_nospace)
-        )
-    );
+    fn test_field_find_num() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<ip_frag_tbl_stat>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).find_num) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(ip_frag_tbl_stat),
+                "::",
+                stringify!(find_num)
+            )
+        );
+    }
+    test_field_find_num();
+    fn test_field_add_num() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<ip_frag_tbl_stat>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).add_num) as usize - ptr as usize
+            },
+            8usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(ip_frag_tbl_stat),
+                "::",
+                stringify!(add_num)
+            )
+        );
+    }
+    test_field_add_num();
+    fn test_field_del_num() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<ip_frag_tbl_stat>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).del_num) as usize - ptr as usize
+            },
+            16usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(ip_frag_tbl_stat),
+                "::",
+                stringify!(del_num)
+            )
+        );
+    }
+    test_field_del_num();
+    fn test_field_reuse_num() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<ip_frag_tbl_stat>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).reuse_num) as usize - ptr as usize
+            },
+            24usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(ip_frag_tbl_stat),
+                "::",
+                stringify!(reuse_num)
+            )
+        );
+    }
+    test_field_reuse_num();
+    fn test_field_fail_total() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<ip_frag_tbl_stat>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).fail_total) as usize - ptr as usize
+            },
+            32usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(ip_frag_tbl_stat),
+                "::",
+                stringify!(fail_total)
+            )
+        );
+    }
+    test_field_fail_total();
+    fn test_field_fail_nospace() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<ip_frag_tbl_stat>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).fail_nospace) as usize -
+                    ptr as usize
+            },
+            40usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(ip_frag_tbl_stat),
+                "::",
+                stringify!(fail_nospace)
+            )
+        );
+    }
+    test_field_fail_nospace();
 }
 impl Default for ip_frag_tbl_stat {
     fn default() -> Self {
@@ -571,147 +686,205 @@
         64usize,
         concat!("Alignment of ", stringify!(rte_ip_frag_tbl))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_ip_frag_tbl>())).max_cycles as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_ip_frag_tbl),
-            "::",
-            stringify!(max_cycles)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_ip_frag_tbl>())).entry_mask as *const _
-                as usize
-        },
-        8usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_ip_frag_tbl),
-            "::",
-            stringify!(entry_mask)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_ip_frag_tbl>())).max_entries as *const _
-                as usize
-        },
-        12usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_ip_frag_tbl),
-            "::",
-            stringify!(max_entries)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_ip_frag_tbl>())).use_entries as *const _
-                as usize
-        },
-        16usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_ip_frag_tbl),
-            "::",
-            stringify!(use_entries)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_ip_frag_tbl>())).bucket_entries
-                as *const _ as usize
-        },
-        20usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_ip_frag_tbl),
-            "::",
-            stringify!(bucket_entries)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_ip_frag_tbl>())).nb_entries as *const _
-                as usize
-        },
-        24usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_ip_frag_tbl),
-            "::",
-            stringify!(nb_entries)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_ip_frag_tbl>())).nb_buckets as *const _
-                as usize
-        },
-        28usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_ip_frag_tbl),
-            "::",
-            stringify!(nb_buckets)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_ip_frag_tbl>())).last as *const _
-                as usize
-        },
-        32usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_ip_frag_tbl),
-            "::",
-            stringify!(last)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_ip_frag_tbl>())).lru as *const _ as usize
-        },
-        40usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_ip_frag_tbl),
-            "::",
-            stringify!(lru)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_ip_frag_tbl>())).stat as *const _
-                as usize
-        },
-        64usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_ip_frag_tbl),
-            "::",
-            stringify!(stat)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_ip_frag_tbl>())).pkt as *const _ as usize
-        },
-        128usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_ip_frag_tbl),
-            "::",
-            stringify!(pkt)
-        )
-    );
+    fn test_field_max_cycles() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_ip_frag_tbl>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).max_cycles) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_ip_frag_tbl),
+                "::",
+                stringify!(max_cycles)
+            )
+        );
+    }
+    test_field_max_cycles();
+    fn test_field_entry_mask() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_ip_frag_tbl>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).entry_mask) as usize - ptr as usize
+            },
+            8usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_ip_frag_tbl),
+                "::",
+                stringify!(entry_mask)
+            )
+        );
+    }
+    test_field_entry_mask();
+    fn test_field_max_entries() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_ip_frag_tbl>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).max_entries) as usize - ptr as usize
+            },
+            12usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_ip_frag_tbl),
+                "::",
+                stringify!(max_entries)
+            )
+        );
+    }
+    test_field_max_entries();
+    fn test_field_use_entries() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_ip_frag_tbl>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).use_entries) as usize - ptr as usize
+            },
+            16usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_ip_frag_tbl),
+                "::",
+                stringify!(use_entries)
+            )
+        );
+    }
+    test_field_use_entries();
+    fn test_field_bucket_entries() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_ip_frag_tbl>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).bucket_entries) as usize -
+                    ptr as usize
+            },
+            20usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_ip_frag_tbl),
+                "::",
+                stringify!(bucket_entries)
+            )
+        );
+    }
+    test_field_bucket_entries();
+    fn test_field_nb_entries() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_ip_frag_tbl>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).nb_entries) as usize - ptr as usize
+            },
+            24usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_ip_frag_tbl),
+                "::",
+                stringify!(nb_entries)
+            )
+        );
+    }
+    test_field_nb_entries();
+    fn test_field_nb_buckets() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_ip_frag_tbl>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).nb_buckets) as usize - ptr as usize
+            },
+            28usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_ip_frag_tbl),
+                "::",
+                stringify!(nb_buckets)
+            )
+        );
+    }
+    test_field_nb_buckets();
+    fn test_field_last() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_ip_frag_tbl>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).last) as usize - ptr as usize
+            },
+            32usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_ip_frag_tbl),
+                "::",
+                stringify!(last)
+            )
+        );
+    }
+    test_field_last();
+    fn test_field_lru() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_ip_frag_tbl>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).lru) as usize - ptr as usize
+            },
+            40usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_ip_frag_tbl),
+                "::",
+                stringify!(lru)
+            )
+        );
+    }
+    test_field_lru();
+    fn test_field_stat() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_ip_frag_tbl>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).stat) as usize - ptr as usize
+            },
+            64usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_ip_frag_tbl),
+                "::",
+                stringify!(stat)
+            )
+        );
+    }
+    test_field_stat();
+    fn test_field_pkt() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_ip_frag_tbl>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).pkt) as usize - ptr as usize
+            },
+            128usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_ip_frag_tbl),
+                "::",
+                stringify!(pkt)
+            )
+        );
+    }
+    test_field_pkt();
 }
 impl Default for rte_ip_frag_tbl {
     fn default() -> Self {
diff --git a/tests/expectations/tests/layout_mbuf.rs b/tests/expectations/tests/layout_mbuf.rs
index aefce3d..549c529 100644
--- a/tests/expectations/tests/layout_mbuf.rs
+++ b/tests/expectations/tests/layout_mbuf.rs
@@ -116,18 +116,24 @@
         2usize,
         concat!("Alignment of ", stringify!(rte_atomic16_t))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_atomic16_t>())).cnt as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_atomic16_t),
-            "::",
-            stringify!(cnt)
-        )
-    );
+    fn test_field_cnt() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_atomic16_t>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).cnt) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_atomic16_t),
+                "::",
+                stringify!(cnt)
+            )
+        );
+    }
+    test_field_cnt();
 }
 /// The generic rte_mbuf, containing a packet mbuf.
 #[repr(C)]
@@ -202,32 +208,43 @@
         2usize,
         concat!("Alignment of ", stringify!(rte_mbuf__bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf__bindgen_ty_1>())).refcnt_atomic
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf__bindgen_ty_1),
-            "::",
-            stringify!(refcnt_atomic)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf__bindgen_ty_1>())).refcnt
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf__bindgen_ty_1),
-            "::",
-            stringify!(refcnt)
-        )
-    );
+    fn test_field_refcnt_atomic() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_mbuf__bindgen_ty_1>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).refcnt_atomic) as usize -
+                    ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_mbuf__bindgen_ty_1),
+                "::",
+                stringify!(refcnt_atomic)
+            )
+        );
+    }
+    test_field_refcnt_atomic();
+    fn test_field_refcnt() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_mbuf__bindgen_ty_1>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).refcnt) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_mbuf__bindgen_ty_1),
+                "::",
+                stringify!(refcnt)
+            )
+        );
+    }
+    test_field_refcnt();
 }
 impl Default for rte_mbuf__bindgen_ty_1 {
     fn default() -> Self {
@@ -421,19 +438,24 @@
         4usize,
         concat!("Alignment of ", stringify!(rte_mbuf__bindgen_ty_2))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf__bindgen_ty_2>())).packet_type
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf__bindgen_ty_2),
-            "::",
-            stringify!(packet_type)
-        )
-    );
+    fn test_field_packet_type() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_mbuf__bindgen_ty_2>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).packet_type) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_mbuf__bindgen_ty_2),
+                "::",
+                stringify!(packet_type)
+            )
+        );
+    }
+    test_field_packet_type();
 }
 impl Default for rte_mbuf__bindgen_ty_2 {
     fn default() -> Self {
@@ -480,8 +502,14 @@
 ) {
     assert_eq ! (:: std :: mem :: size_of :: < rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1 > () , 4usize , concat ! ("Size of: " , stringify ! (rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1)));
     assert_eq ! (:: std :: mem :: align_of :: < rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1 > () , 2usize , concat ! ("Alignment of " , stringify ! (rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1)));
-    assert_eq ! (unsafe { & (* (:: std :: ptr :: null :: < rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1 > ())) . hash as * const _ as usize } , 0usize , concat ! ("Offset of field: " , stringify ! (rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1) , "::" , stringify ! (hash)));
-    assert_eq ! (unsafe { & (* (:: std :: ptr :: null :: < rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1 > ())) . id as * const _ as usize } , 2usize , concat ! ("Offset of field: " , stringify ! (rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1) , "::" , stringify ! (id)));
+    fn test_field_hash() {
+        assert_eq ! (unsafe { let uninit = :: std :: mem :: MaybeUninit :: < rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1 > :: uninit () ; let ptr = uninit . as_ptr () ; :: std :: ptr :: addr_of ! ((* ptr) . hash) as usize - ptr as usize } , 0usize , concat ! ("Offset of field: " , stringify ! (rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1) , "::" , stringify ! (hash)));
+    }
+    test_field_hash();
+    fn test_field_id() {
+        assert_eq ! (unsafe { let uninit = :: std :: mem :: MaybeUninit :: < rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1 > :: uninit () ; let ptr = uninit . as_ptr () ; :: std :: ptr :: addr_of ! ((* ptr) . id) as usize - ptr as usize } , 2usize , concat ! ("Offset of field: " , stringify ! (rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1) , "::" , stringify ! (id)));
+    }
+    test_field_id();
 }
 #[test]
 fn bindgen_test_layout_rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1() {
@@ -504,21 +532,25 @@
             stringify!(rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1)
         )
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<
-                rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1,
-            >()))
-            .lo as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1),
-            "::",
-            stringify!(lo)
-        )
-    );
+    fn test_field_lo() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).lo) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1),
+                "::",
+                stringify!(lo)
+            )
+        );
+    }
+    test_field_lo();
 }
 impl Default for rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1 {
     fn default() -> Self {
@@ -547,19 +579,25 @@
             stringify!(rte_mbuf__bindgen_ty_3__bindgen_ty_1)
         )
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf__bindgen_ty_3__bindgen_ty_1>())).hi
-                as *const _ as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf__bindgen_ty_3__bindgen_ty_1),
-            "::",
-            stringify!(hi)
-        )
-    );
+    fn test_field_hi() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    rte_mbuf__bindgen_ty_3__bindgen_ty_1,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).hi) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_mbuf__bindgen_ty_3__bindgen_ty_1),
+                "::",
+                stringify!(hi)
+            )
+        );
+    }
+    test_field_hi();
 }
 impl Default for rte_mbuf__bindgen_ty_3__bindgen_ty_1 {
     fn default() -> Self {
@@ -594,32 +632,44 @@
             stringify!(rte_mbuf__bindgen_ty_3__bindgen_ty_2)
         )
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf__bindgen_ty_3__bindgen_ty_2>())).lo
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf__bindgen_ty_3__bindgen_ty_2),
-            "::",
-            stringify!(lo)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf__bindgen_ty_3__bindgen_ty_2>())).hi
-                as *const _ as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf__bindgen_ty_3__bindgen_ty_2),
-            "::",
-            stringify!(hi)
-        )
-    );
+    fn test_field_lo() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    rte_mbuf__bindgen_ty_3__bindgen_ty_2,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).lo) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_mbuf__bindgen_ty_3__bindgen_ty_2),
+                "::",
+                stringify!(lo)
+            )
+        );
+    }
+    test_field_lo();
+    fn test_field_hi() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    rte_mbuf__bindgen_ty_3__bindgen_ty_2,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).hi) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_mbuf__bindgen_ty_3__bindgen_ty_2),
+                "::",
+                stringify!(hi)
+            )
+        );
+    }
+    test_field_hi();
 }
 #[test]
 fn bindgen_test_layout_rte_mbuf__bindgen_ty_3() {
@@ -633,58 +683,78 @@
         4usize,
         concat!("Alignment of ", stringify!(rte_mbuf__bindgen_ty_3))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf__bindgen_ty_3>())).rss as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf__bindgen_ty_3),
-            "::",
-            stringify!(rss)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf__bindgen_ty_3>())).fdir as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf__bindgen_ty_3),
-            "::",
-            stringify!(fdir)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf__bindgen_ty_3>())).sched as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf__bindgen_ty_3),
-            "::",
-            stringify!(sched)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf__bindgen_ty_3>())).usr as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf__bindgen_ty_3),
-            "::",
-            stringify!(usr)
-        )
-    );
+    fn test_field_rss() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_mbuf__bindgen_ty_3>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).rss) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_mbuf__bindgen_ty_3),
+                "::",
+                stringify!(rss)
+            )
+        );
+    }
+    test_field_rss();
+    fn test_field_fdir() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_mbuf__bindgen_ty_3>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).fdir) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_mbuf__bindgen_ty_3),
+                "::",
+                stringify!(fdir)
+            )
+        );
+    }
+    test_field_fdir();
+    fn test_field_sched() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_mbuf__bindgen_ty_3>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).sched) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_mbuf__bindgen_ty_3),
+                "::",
+                stringify!(sched)
+            )
+        );
+    }
+    test_field_sched();
+    fn test_field_usr() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_mbuf__bindgen_ty_3>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).usr) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_mbuf__bindgen_ty_3),
+                "::",
+                stringify!(usr)
+            )
+        );
+    }
+    test_field_usr();
 }
 impl Default for rte_mbuf__bindgen_ty_3 {
     fn default() -> Self {
@@ -715,32 +785,42 @@
         8usize,
         concat!("Alignment of ", stringify!(rte_mbuf__bindgen_ty_4))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf__bindgen_ty_4>())).userdata
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf__bindgen_ty_4),
-            "::",
-            stringify!(userdata)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf__bindgen_ty_4>())).udata64
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf__bindgen_ty_4),
-            "::",
-            stringify!(udata64)
-        )
-    );
+    fn test_field_userdata() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_mbuf__bindgen_ty_4>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).userdata) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_mbuf__bindgen_ty_4),
+                "::",
+                stringify!(userdata)
+            )
+        );
+    }
+    test_field_userdata();
+    fn test_field_udata64() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_mbuf__bindgen_ty_4>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).udata64) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_mbuf__bindgen_ty_4),
+                "::",
+                stringify!(udata64)
+            )
+        );
+    }
+    test_field_udata64();
 }
 impl Default for rte_mbuf__bindgen_ty_4 {
     fn default() -> Self {
@@ -915,19 +995,24 @@
         8usize,
         concat!("Alignment of ", stringify!(rte_mbuf__bindgen_ty_5))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf__bindgen_ty_5>())).tx_offload
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf__bindgen_ty_5),
-            "::",
-            stringify!(tx_offload)
-        )
-    );
+    fn test_field_tx_offload() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_mbuf__bindgen_ty_5>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).tx_offload) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_mbuf__bindgen_ty_5),
+                "::",
+                stringify!(tx_offload)
+            )
+        );
+    }
+    test_field_tx_offload();
 }
 impl Default for rte_mbuf__bindgen_ty_5 {
     fn default() -> Self {
@@ -950,261 +1035,366 @@
         64usize,
         concat!("Alignment of ", stringify!(rte_mbuf))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).cacheline0 as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf),
-            "::",
-            stringify!(cacheline0)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).buf_addr as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf),
-            "::",
-            stringify!(buf_addr)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).buf_physaddr as *const _
-                as usize
-        },
-        8usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf),
-            "::",
-            stringify!(buf_physaddr)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).buf_len as *const _ as usize
-        },
-        16usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf),
-            "::",
-            stringify!(buf_len)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).rearm_data as *const _ as usize
-        },
-        18usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf),
-            "::",
-            stringify!(rearm_data)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).data_off as *const _ as usize
-        },
-        18usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf),
-            "::",
-            stringify!(data_off)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).nb_segs as *const _ as usize
-        },
-        22usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf),
-            "::",
-            stringify!(nb_segs)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).port as *const _ as usize
-        },
-        23usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf),
-            "::",
-            stringify!(port)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).ol_flags as *const _ as usize
-        },
-        24usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf),
-            "::",
-            stringify!(ol_flags)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).rx_descriptor_fields1
-                as *const _ as usize
-        },
-        32usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf),
-            "::",
-            stringify!(rx_descriptor_fields1)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).pkt_len as *const _ as usize
-        },
-        36usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf),
-            "::",
-            stringify!(pkt_len)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).data_len as *const _ as usize
-        },
-        40usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf),
-            "::",
-            stringify!(data_len)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).vlan_tci as *const _ as usize
-        },
-        42usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf),
-            "::",
-            stringify!(vlan_tci)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).hash as *const _ as usize
-        },
-        44usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf),
-            "::",
-            stringify!(hash)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).seqn as *const _ as usize
-        },
-        52usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf),
-            "::",
-            stringify!(seqn)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).vlan_tci_outer as *const _
-                as usize
-        },
-        56usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf),
-            "::",
-            stringify!(vlan_tci_outer)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).cacheline1 as *const _ as usize
-        },
-        64usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf),
-            "::",
-            stringify!(cacheline1)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).pool as *const _ as usize
-        },
-        72usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf),
-            "::",
-            stringify!(pool)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).next as *const _ as usize
-        },
-        80usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf),
-            "::",
-            stringify!(next)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).priv_size as *const _ as usize
-        },
-        96usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf),
-            "::",
-            stringify!(priv_size)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).timesync as *const _ as usize
-        },
-        98usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf),
-            "::",
-            stringify!(timesync)
-        )
-    );
+    fn test_field_cacheline0() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_mbuf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).cacheline0) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_mbuf),
+                "::",
+                stringify!(cacheline0)
+            )
+        );
+    }
+    test_field_cacheline0();
+    fn test_field_buf_addr() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_mbuf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).buf_addr) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_mbuf),
+                "::",
+                stringify!(buf_addr)
+            )
+        );
+    }
+    test_field_buf_addr();
+    fn test_field_buf_physaddr() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_mbuf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).buf_physaddr) as usize -
+                    ptr as usize
+            },
+            8usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_mbuf),
+                "::",
+                stringify!(buf_physaddr)
+            )
+        );
+    }
+    test_field_buf_physaddr();
+    fn test_field_buf_len() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_mbuf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).buf_len) as usize - ptr as usize
+            },
+            16usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_mbuf),
+                "::",
+                stringify!(buf_len)
+            )
+        );
+    }
+    test_field_buf_len();
+    fn test_field_rearm_data() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_mbuf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).rearm_data) as usize - ptr as usize
+            },
+            18usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_mbuf),
+                "::",
+                stringify!(rearm_data)
+            )
+        );
+    }
+    test_field_rearm_data();
+    fn test_field_data_off() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_mbuf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).data_off) as usize - ptr as usize
+            },
+            18usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_mbuf),
+                "::",
+                stringify!(data_off)
+            )
+        );
+    }
+    test_field_data_off();
+    fn test_field_nb_segs() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_mbuf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).nb_segs) as usize - ptr as usize
+            },
+            22usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_mbuf),
+                "::",
+                stringify!(nb_segs)
+            )
+        );
+    }
+    test_field_nb_segs();
+    fn test_field_port() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_mbuf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).port) as usize - ptr as usize
+            },
+            23usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_mbuf),
+                "::",
+                stringify!(port)
+            )
+        );
+    }
+    test_field_port();
+    fn test_field_ol_flags() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_mbuf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).ol_flags) as usize - ptr as usize
+            },
+            24usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_mbuf),
+                "::",
+                stringify!(ol_flags)
+            )
+        );
+    }
+    test_field_ol_flags();
+    fn test_field_rx_descriptor_fields1() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_mbuf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).rx_descriptor_fields1) as usize -
+                    ptr as usize
+            },
+            32usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_mbuf),
+                "::",
+                stringify!(rx_descriptor_fields1)
+            )
+        );
+    }
+    test_field_rx_descriptor_fields1();
+    fn test_field_pkt_len() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_mbuf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).pkt_len) as usize - ptr as usize
+            },
+            36usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_mbuf),
+                "::",
+                stringify!(pkt_len)
+            )
+        );
+    }
+    test_field_pkt_len();
+    fn test_field_data_len() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_mbuf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).data_len) as usize - ptr as usize
+            },
+            40usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_mbuf),
+                "::",
+                stringify!(data_len)
+            )
+        );
+    }
+    test_field_data_len();
+    fn test_field_vlan_tci() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_mbuf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).vlan_tci) as usize - ptr as usize
+            },
+            42usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_mbuf),
+                "::",
+                stringify!(vlan_tci)
+            )
+        );
+    }
+    test_field_vlan_tci();
+    fn test_field_hash() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_mbuf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).hash) as usize - ptr as usize
+            },
+            44usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_mbuf),
+                "::",
+                stringify!(hash)
+            )
+        );
+    }
+    test_field_hash();
+    fn test_field_seqn() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_mbuf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).seqn) as usize - ptr as usize
+            },
+            52usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_mbuf),
+                "::",
+                stringify!(seqn)
+            )
+        );
+    }
+    test_field_seqn();
+    fn test_field_vlan_tci_outer() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_mbuf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).vlan_tci_outer) as usize -
+                    ptr as usize
+            },
+            56usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_mbuf),
+                "::",
+                stringify!(vlan_tci_outer)
+            )
+        );
+    }
+    test_field_vlan_tci_outer();
+    fn test_field_cacheline1() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_mbuf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).cacheline1) as usize - ptr as usize
+            },
+            64usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_mbuf),
+                "::",
+                stringify!(cacheline1)
+            )
+        );
+    }
+    test_field_cacheline1();
+    fn test_field_pool() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_mbuf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).pool) as usize - ptr as usize
+            },
+            72usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_mbuf),
+                "::",
+                stringify!(pool)
+            )
+        );
+    }
+    test_field_pool();
+    fn test_field_next() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_mbuf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).next) as usize - ptr as usize
+            },
+            80usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_mbuf),
+                "::",
+                stringify!(next)
+            )
+        );
+    }
+    test_field_next();
+    fn test_field_priv_size() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_mbuf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).priv_size) as usize - ptr as usize
+            },
+            96usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_mbuf),
+                "::",
+                stringify!(priv_size)
+            )
+        );
+    }
+    test_field_priv_size();
+    fn test_field_timesync() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_mbuf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).timesync) as usize - ptr as usize
+            },
+            98usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_mbuf),
+                "::",
+                stringify!(timesync)
+            )
+        );
+    }
+    test_field_timesync();
 }
 impl Default for rte_mbuf {
     fn default() -> Self {
diff --git a/tests/expectations/tests/layout_mbuf_1_0.rs b/tests/expectations/tests/layout_mbuf_1_0.rs
index ce4c66c..b9fddeb 100644
--- a/tests/expectations/tests/layout_mbuf_1_0.rs
+++ b/tests/expectations/tests/layout_mbuf_1_0.rs
@@ -159,18 +159,24 @@
         2usize,
         concat!("Alignment of ", stringify!(rte_atomic16_t))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_atomic16_t>())).cnt as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_atomic16_t),
-            "::",
-            stringify!(cnt)
-        )
-    );
+    fn test_field_cnt() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_atomic16_t>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).cnt) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_atomic16_t),
+                "::",
+                stringify!(cnt)
+            )
+        );
+    }
+    test_field_cnt();
 }
 impl Clone for rte_atomic16_t {
     fn clone(&self) -> Self {
@@ -251,32 +257,43 @@
         2usize,
         concat!("Alignment of ", stringify!(rte_mbuf__bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf__bindgen_ty_1>())).refcnt_atomic
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf__bindgen_ty_1),
-            "::",
-            stringify!(refcnt_atomic)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf__bindgen_ty_1>())).refcnt
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf__bindgen_ty_1),
-            "::",
-            stringify!(refcnt)
-        )
-    );
+    fn test_field_refcnt_atomic() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_mbuf__bindgen_ty_1>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).refcnt_atomic) as usize -
+                    ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_mbuf__bindgen_ty_1),
+                "::",
+                stringify!(refcnt_atomic)
+            )
+        );
+    }
+    test_field_refcnt_atomic();
+    fn test_field_refcnt() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_mbuf__bindgen_ty_1>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).refcnt) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_mbuf__bindgen_ty_1),
+                "::",
+                stringify!(refcnt)
+            )
+        );
+    }
+    test_field_refcnt();
 }
 impl Clone for rte_mbuf__bindgen_ty_1 {
     fn clone(&self) -> Self {
@@ -473,19 +490,24 @@
         4usize,
         concat!("Alignment of ", stringify!(rte_mbuf__bindgen_ty_2))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf__bindgen_ty_2>())).packet_type
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf__bindgen_ty_2),
-            "::",
-            stringify!(packet_type)
-        )
-    );
+    fn test_field_packet_type() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_mbuf__bindgen_ty_2>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).packet_type) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_mbuf__bindgen_ty_2),
+                "::",
+                stringify!(packet_type)
+            )
+        );
+    }
+    test_field_packet_type();
 }
 impl Clone for rte_mbuf__bindgen_ty_2 {
     fn clone(&self) -> Self {
@@ -531,8 +553,14 @@
 ) {
     assert_eq ! (:: std :: mem :: size_of :: < rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1 > () , 4usize , concat ! ("Size of: " , stringify ! (rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1)));
     assert_eq ! (:: std :: mem :: align_of :: < rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1 > () , 2usize , concat ! ("Alignment of " , stringify ! (rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1)));
-    assert_eq ! (unsafe { & (* (:: std :: ptr :: null :: < rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1 > ())) . hash as * const _ as usize } , 0usize , concat ! ("Offset of field: " , stringify ! (rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1) , "::" , stringify ! (hash)));
-    assert_eq ! (unsafe { & (* (:: std :: ptr :: null :: < rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1 > ())) . id as * const _ as usize } , 2usize , concat ! ("Offset of field: " , stringify ! (rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1) , "::" , stringify ! (id)));
+    fn test_field_hash() {
+        assert_eq ! (unsafe { let uninit = :: std :: mem :: MaybeUninit :: < rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1 > :: uninit () ; let ptr = uninit . as_ptr () ; :: std :: ptr :: addr_of ! ((* ptr) . hash) as usize - ptr as usize } , 0usize , concat ! ("Offset of field: " , stringify ! (rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1) , "::" , stringify ! (hash)));
+    }
+    test_field_hash();
+    fn test_field_id() {
+        assert_eq ! (unsafe { let uninit = :: std :: mem :: MaybeUninit :: < rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1 > :: uninit () ; let ptr = uninit . as_ptr () ; :: std :: ptr :: addr_of ! ((* ptr) . id) as usize - ptr as usize } , 2usize , concat ! ("Offset of field: " , stringify ! (rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1) , "::" , stringify ! (id)));
+    }
+    test_field_id();
 }
 impl Clone
     for rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1
@@ -562,21 +590,25 @@
             stringify!(rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1)
         )
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<
-                rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1,
-            >()))
-            .lo as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1),
-            "::",
-            stringify!(lo)
-        )
-    );
+    fn test_field_lo() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).lo) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1),
+                "::",
+                stringify!(lo)
+            )
+        );
+    }
+    test_field_lo();
 }
 impl Clone for rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1 {
     fn clone(&self) -> Self {
@@ -601,19 +633,25 @@
             stringify!(rte_mbuf__bindgen_ty_3__bindgen_ty_1)
         )
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf__bindgen_ty_3__bindgen_ty_1>())).hi
-                as *const _ as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf__bindgen_ty_3__bindgen_ty_1),
-            "::",
-            stringify!(hi)
-        )
-    );
+    fn test_field_hi() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    rte_mbuf__bindgen_ty_3__bindgen_ty_1,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).hi) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_mbuf__bindgen_ty_3__bindgen_ty_1),
+                "::",
+                stringify!(hi)
+            )
+        );
+    }
+    test_field_hi();
 }
 impl Clone for rte_mbuf__bindgen_ty_3__bindgen_ty_1 {
     fn clone(&self) -> Self {
@@ -644,32 +682,44 @@
             stringify!(rte_mbuf__bindgen_ty_3__bindgen_ty_2)
         )
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf__bindgen_ty_3__bindgen_ty_2>())).lo
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf__bindgen_ty_3__bindgen_ty_2),
-            "::",
-            stringify!(lo)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf__bindgen_ty_3__bindgen_ty_2>())).hi
-                as *const _ as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf__bindgen_ty_3__bindgen_ty_2),
-            "::",
-            stringify!(hi)
-        )
-    );
+    fn test_field_lo() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    rte_mbuf__bindgen_ty_3__bindgen_ty_2,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).lo) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_mbuf__bindgen_ty_3__bindgen_ty_2),
+                "::",
+                stringify!(lo)
+            )
+        );
+    }
+    test_field_lo();
+    fn test_field_hi() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    rte_mbuf__bindgen_ty_3__bindgen_ty_2,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).hi) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_mbuf__bindgen_ty_3__bindgen_ty_2),
+                "::",
+                stringify!(hi)
+            )
+        );
+    }
+    test_field_hi();
 }
 impl Clone for rte_mbuf__bindgen_ty_3__bindgen_ty_2 {
     fn clone(&self) -> Self {
@@ -688,58 +738,78 @@
         4usize,
         concat!("Alignment of ", stringify!(rte_mbuf__bindgen_ty_3))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf__bindgen_ty_3>())).rss as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf__bindgen_ty_3),
-            "::",
-            stringify!(rss)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf__bindgen_ty_3>())).fdir as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf__bindgen_ty_3),
-            "::",
-            stringify!(fdir)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf__bindgen_ty_3>())).sched as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf__bindgen_ty_3),
-            "::",
-            stringify!(sched)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf__bindgen_ty_3>())).usr as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf__bindgen_ty_3),
-            "::",
-            stringify!(usr)
-        )
-    );
+    fn test_field_rss() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_mbuf__bindgen_ty_3>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).rss) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_mbuf__bindgen_ty_3),
+                "::",
+                stringify!(rss)
+            )
+        );
+    }
+    test_field_rss();
+    fn test_field_fdir() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_mbuf__bindgen_ty_3>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).fdir) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_mbuf__bindgen_ty_3),
+                "::",
+                stringify!(fdir)
+            )
+        );
+    }
+    test_field_fdir();
+    fn test_field_sched() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_mbuf__bindgen_ty_3>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).sched) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_mbuf__bindgen_ty_3),
+                "::",
+                stringify!(sched)
+            )
+        );
+    }
+    test_field_sched();
+    fn test_field_usr() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_mbuf__bindgen_ty_3>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).usr) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_mbuf__bindgen_ty_3),
+                "::",
+                stringify!(usr)
+            )
+        );
+    }
+    test_field_usr();
 }
 impl Clone for rte_mbuf__bindgen_ty_3 {
     fn clone(&self) -> Self {
@@ -767,32 +837,42 @@
         8usize,
         concat!("Alignment of ", stringify!(rte_mbuf__bindgen_ty_4))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf__bindgen_ty_4>())).userdata
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf__bindgen_ty_4),
-            "::",
-            stringify!(userdata)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf__bindgen_ty_4>())).udata64
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf__bindgen_ty_4),
-            "::",
-            stringify!(udata64)
-        )
-    );
+    fn test_field_userdata() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_mbuf__bindgen_ty_4>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).userdata) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_mbuf__bindgen_ty_4),
+                "::",
+                stringify!(userdata)
+            )
+        );
+    }
+    test_field_userdata();
+    fn test_field_udata64() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_mbuf__bindgen_ty_4>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).udata64) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_mbuf__bindgen_ty_4),
+                "::",
+                stringify!(udata64)
+            )
+        );
+    }
+    test_field_udata64();
 }
 impl Clone for rte_mbuf__bindgen_ty_4 {
     fn clone(&self) -> Self {
@@ -970,19 +1050,24 @@
         8usize,
         concat!("Alignment of ", stringify!(rte_mbuf__bindgen_ty_5))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf__bindgen_ty_5>())).tx_offload
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf__bindgen_ty_5),
-            "::",
-            stringify!(tx_offload)
-        )
-    );
+    fn test_field_tx_offload() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<rte_mbuf__bindgen_ty_5>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).tx_offload) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_mbuf__bindgen_ty_5),
+                "::",
+                stringify!(tx_offload)
+            )
+        );
+    }
+    test_field_tx_offload();
 }
 impl Clone for rte_mbuf__bindgen_ty_5 {
     fn clone(&self) -> Self {
@@ -996,261 +1081,366 @@
         128usize,
         concat!("Size of: ", stringify!(rte_mbuf))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).cacheline0 as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf),
-            "::",
-            stringify!(cacheline0)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).buf_addr as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf),
-            "::",
-            stringify!(buf_addr)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).buf_physaddr as *const _
-                as usize
-        },
-        8usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf),
-            "::",
-            stringify!(buf_physaddr)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).buf_len as *const _ as usize
-        },
-        16usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf),
-            "::",
-            stringify!(buf_len)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).rearm_data as *const _ as usize
-        },
-        18usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf),
-            "::",
-            stringify!(rearm_data)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).data_off as *const _ as usize
-        },
-        18usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf),
-            "::",
-            stringify!(data_off)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).nb_segs as *const _ as usize
-        },
-        22usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf),
-            "::",
-            stringify!(nb_segs)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).port as *const _ as usize
-        },
-        23usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf),
-            "::",
-            stringify!(port)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).ol_flags as *const _ as usize
-        },
-        24usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf),
-            "::",
-            stringify!(ol_flags)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).rx_descriptor_fields1
-                as *const _ as usize
-        },
-        32usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf),
-            "::",
-            stringify!(rx_descriptor_fields1)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).pkt_len as *const _ as usize
-        },
-        36usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf),
-            "::",
-            stringify!(pkt_len)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).data_len as *const _ as usize
-        },
-        40usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf),
-            "::",
-            stringify!(data_len)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).vlan_tci as *const _ as usize
-        },
-        42usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf),
-            "::",
-            stringify!(vlan_tci)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).hash as *const _ as usize
-        },
-        44usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf),
-            "::",
-            stringify!(hash)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).seqn as *const _ as usize
-        },
-        52usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf),
-            "::",
-            stringify!(seqn)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).vlan_tci_outer as *const _
-                as usize
-        },
-        56usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf),
-            "::",
-            stringify!(vlan_tci_outer)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).cacheline1 as *const _ as usize
-        },
-        64usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf),
-            "::",
-            stringify!(cacheline1)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).pool as *const _ as usize
-        },
-        72usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf),
-            "::",
-            stringify!(pool)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).next as *const _ as usize
-        },
-        80usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf),
-            "::",
-            stringify!(next)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).priv_size as *const _ as usize
-        },
-        96usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf),
-            "::",
-            stringify!(priv_size)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).timesync as *const _ as usize
-        },
-        98usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf),
-            "::",
-            stringify!(timesync)
-        )
-    );
+    fn test_field_cacheline0() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_mbuf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).cacheline0) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_mbuf),
+                "::",
+                stringify!(cacheline0)
+            )
+        );
+    }
+    test_field_cacheline0();
+    fn test_field_buf_addr() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_mbuf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).buf_addr) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_mbuf),
+                "::",
+                stringify!(buf_addr)
+            )
+        );
+    }
+    test_field_buf_addr();
+    fn test_field_buf_physaddr() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_mbuf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).buf_physaddr) as usize -
+                    ptr as usize
+            },
+            8usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_mbuf),
+                "::",
+                stringify!(buf_physaddr)
+            )
+        );
+    }
+    test_field_buf_physaddr();
+    fn test_field_buf_len() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_mbuf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).buf_len) as usize - ptr as usize
+            },
+            16usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_mbuf),
+                "::",
+                stringify!(buf_len)
+            )
+        );
+    }
+    test_field_buf_len();
+    fn test_field_rearm_data() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_mbuf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).rearm_data) as usize - ptr as usize
+            },
+            18usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_mbuf),
+                "::",
+                stringify!(rearm_data)
+            )
+        );
+    }
+    test_field_rearm_data();
+    fn test_field_data_off() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_mbuf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).data_off) as usize - ptr as usize
+            },
+            18usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_mbuf),
+                "::",
+                stringify!(data_off)
+            )
+        );
+    }
+    test_field_data_off();
+    fn test_field_nb_segs() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_mbuf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).nb_segs) as usize - ptr as usize
+            },
+            22usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_mbuf),
+                "::",
+                stringify!(nb_segs)
+            )
+        );
+    }
+    test_field_nb_segs();
+    fn test_field_port() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_mbuf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).port) as usize - ptr as usize
+            },
+            23usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_mbuf),
+                "::",
+                stringify!(port)
+            )
+        );
+    }
+    test_field_port();
+    fn test_field_ol_flags() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_mbuf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).ol_flags) as usize - ptr as usize
+            },
+            24usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_mbuf),
+                "::",
+                stringify!(ol_flags)
+            )
+        );
+    }
+    test_field_ol_flags();
+    fn test_field_rx_descriptor_fields1() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_mbuf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).rx_descriptor_fields1) as usize -
+                    ptr as usize
+            },
+            32usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_mbuf),
+                "::",
+                stringify!(rx_descriptor_fields1)
+            )
+        );
+    }
+    test_field_rx_descriptor_fields1();
+    fn test_field_pkt_len() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_mbuf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).pkt_len) as usize - ptr as usize
+            },
+            36usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_mbuf),
+                "::",
+                stringify!(pkt_len)
+            )
+        );
+    }
+    test_field_pkt_len();
+    fn test_field_data_len() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_mbuf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).data_len) as usize - ptr as usize
+            },
+            40usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_mbuf),
+                "::",
+                stringify!(data_len)
+            )
+        );
+    }
+    test_field_data_len();
+    fn test_field_vlan_tci() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_mbuf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).vlan_tci) as usize - ptr as usize
+            },
+            42usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_mbuf),
+                "::",
+                stringify!(vlan_tci)
+            )
+        );
+    }
+    test_field_vlan_tci();
+    fn test_field_hash() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_mbuf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).hash) as usize - ptr as usize
+            },
+            44usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_mbuf),
+                "::",
+                stringify!(hash)
+            )
+        );
+    }
+    test_field_hash();
+    fn test_field_seqn() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_mbuf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).seqn) as usize - ptr as usize
+            },
+            52usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_mbuf),
+                "::",
+                stringify!(seqn)
+            )
+        );
+    }
+    test_field_seqn();
+    fn test_field_vlan_tci_outer() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_mbuf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).vlan_tci_outer) as usize -
+                    ptr as usize
+            },
+            56usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_mbuf),
+                "::",
+                stringify!(vlan_tci_outer)
+            )
+        );
+    }
+    test_field_vlan_tci_outer();
+    fn test_field_cacheline1() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_mbuf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).cacheline1) as usize - ptr as usize
+            },
+            64usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_mbuf),
+                "::",
+                stringify!(cacheline1)
+            )
+        );
+    }
+    test_field_cacheline1();
+    fn test_field_pool() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_mbuf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).pool) as usize - ptr as usize
+            },
+            72usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_mbuf),
+                "::",
+                stringify!(pool)
+            )
+        );
+    }
+    test_field_pool();
+    fn test_field_next() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_mbuf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).next) as usize - ptr as usize
+            },
+            80usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_mbuf),
+                "::",
+                stringify!(next)
+            )
+        );
+    }
+    test_field_next();
+    fn test_field_priv_size() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_mbuf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).priv_size) as usize - ptr as usize
+            },
+            96usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_mbuf),
+                "::",
+                stringify!(priv_size)
+            )
+        );
+    }
+    test_field_priv_size();
+    fn test_field_timesync() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_mbuf>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).timesync) as usize - ptr as usize
+            },
+            98usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_mbuf),
+                "::",
+                stringify!(timesync)
+            )
+        );
+    }
+    test_field_timesync();
 }
 impl Default for rte_mbuf {
     fn default() -> Self {
diff --git a/tests/expectations/tests/libclang-3.9/abi_variadic_function.rs b/tests/expectations/tests/libclang-3.9/abi_variadic_function.rs
deleted file mode 100644
index 6aeb16f..0000000
--- a/tests/expectations/tests/libclang-3.9/abi_variadic_function.rs
+++ /dev/null
@@ -1,11 +0,0 @@
-#![allow(
-    dead_code,
-    non_snake_case,
-    non_camel_case_types,
-    non_upper_case_globals
-)]
-
-extern "C" {
-    #[link_name = "\u{1}_Z1bcz"]
-    pub fn b(arg1: ::std::os::raw::c_char, ...) -> ::std::os::raw::c_char;
-}
diff --git a/tests/expectations/tests/libclang-3.9/auto.rs b/tests/expectations/tests/libclang-3.9/auto.rs
deleted file mode 100644
index 0b20b39..0000000
--- a/tests/expectations/tests/libclang-3.9/auto.rs
+++ /dev/null
@@ -1,35 +0,0 @@
-#![allow(
-    dead_code,
-    non_snake_case,
-    non_camel_case_types,
-    non_upper_case_globals
-)]
-
-#[repr(C)]
-#[derive(Debug, Default, Copy, Clone)]
-pub struct Foo {
-    pub _address: u8,
-}
-pub const Foo_kFoo: bool = true;
-#[test]
-fn bindgen_test_layout_Foo() {
-    assert_eq!(
-        ::std::mem::size_of::<Foo>(),
-        1usize,
-        concat!("Size of: ", stringify!(Foo))
-    );
-    assert_eq!(
-        ::std::mem::align_of::<Foo>(),
-        1usize,
-        concat!("Alignment of ", stringify!(Foo))
-    );
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy, Clone)]
-pub struct Bar {
-    pub _address: u8,
-}
-extern "C" {
-    #[link_name = "\u{1}_Z5Test2v"]
-    pub fn Test2() -> ::std::os::raw::c_uint;
-}
diff --git a/tests/expectations/tests/libclang-3.9/call-conv-field.rs b/tests/expectations/tests/libclang-3.9/call-conv-field.rs
deleted file mode 100644
index f134bd8..0000000
--- a/tests/expectations/tests/libclang-3.9/call-conv-field.rs
+++ /dev/null
@@ -1,60 +0,0 @@
-#![allow(
-    dead_code,
-    non_snake_case,
-    non_camel_case_types,
-    non_upper_case_globals
-)]
-#![cfg(not(test))]
-
-#[repr(C)]
-#[derive(Default, Copy, Clone)]
-pub struct JNINativeInterface_ {
-    pub GetVersion: ::std::option::Option<
-        unsafe extern "stdcall" fn(
-            env: *mut ::std::os::raw::c_void,
-        ) -> ::std::os::raw::c_int,
-    >,
-    pub __hack: ::std::os::raw::c_ulonglong,
-}
-#[test]
-fn bindgen_test_layout_JNINativeInterface_() {
-    assert_eq!(
-        ::std::mem::size_of::<JNINativeInterface_>(),
-        16usize,
-        concat!("Size of: ", stringify!(JNINativeInterface_))
-    );
-    assert_eq!(
-        ::std::mem::align_of::<JNINativeInterface_>(),
-        8usize,
-        concat!("Alignment of ", stringify!(JNINativeInterface_))
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<JNINativeInterface_>())).GetVersion
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(JNINativeInterface_),
-            "::",
-            stringify!(GetVersion)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<JNINativeInterface_>())).__hack as *const _
-                as usize
-        },
-        8usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(JNINativeInterface_),
-            "::",
-            stringify!(__hack)
-        )
-    );
-}
-extern "stdcall" {
-    pub fn bar();
-}
diff --git a/tests/expectations/tests/libclang-3.9/const_bool.rs b/tests/expectations/tests/libclang-3.9/const_bool.rs
deleted file mode 100644
index 97e1d8d..0000000
--- a/tests/expectations/tests/libclang-3.9/const_bool.rs
+++ /dev/null
@@ -1,29 +0,0 @@
-#![allow(
-    dead_code,
-    non_snake_case,
-    non_camel_case_types,
-    non_upper_case_globals
-)]
-
-pub const k: bool = true;
-#[repr(C)]
-#[derive(Debug, Default, Copy, Clone)]
-pub struct A {
-    pub _address: u8,
-}
-pub const A_k: bool = false;
-#[test]
-fn bindgen_test_layout_A() {
-    assert_eq!(
-        ::std::mem::size_of::<A>(),
-        1usize,
-        concat!("Size of: ", stringify!(A))
-    );
-    assert_eq!(
-        ::std::mem::align_of::<A>(),
-        1usize,
-        concat!("Alignment of ", stringify!(A))
-    );
-}
-pub type foo = bool;
-pub const k2: foo = true;
diff --git a/tests/expectations/tests/libclang-3.9/constant-evaluate.rs b/tests/expectations/tests/libclang-3.9/constant-evaluate.rs
deleted file mode 100644
index 77e2812..0000000
--- a/tests/expectations/tests/libclang-3.9/constant-evaluate.rs
+++ /dev/null
@@ -1,27 +0,0 @@
-#![allow(
-    dead_code,
-    non_snake_case,
-    non_camel_case_types,
-    non_upper_case_globals
-)]
-
-pub const foo: _bindgen_ty_1 = _bindgen_ty_1::foo;
-pub const bar: _bindgen_ty_1 = _bindgen_ty_1::bar;
-#[repr(u32)]
-#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
-pub enum _bindgen_ty_1 {
-    foo = 4,
-    bar = 8,
-}
-pub type EasyToOverflow = ::std::os::raw::c_ulonglong;
-pub const k: EasyToOverflow = 2147483648;
-pub const k_expr: EasyToOverflow = 0;
-extern "C" {
-    pub static wow: EasyToOverflow;
-}
-pub const BAZ: ::std::os::raw::c_longlong = 24;
-pub const fuzz: f64 = 51.0;
-pub const BAZZ: ::std::os::raw::c_char = 53;
-pub const WAT: ::std::os::raw::c_char = 0;
-pub const bytestring: &'static [u8; 4usize] = b"Foo\0";
-pub const NOT_UTF8: [u8; 5usize] = [240u8, 40u8, 140u8, 40u8, 0u8];
diff --git a/tests/expectations/tests/libclang-3.9/error-E0600-cannot-apply-unary-negation-to-u32.rs b/tests/expectations/tests/libclang-3.9/error-E0600-cannot-apply-unary-negation-to-u32.rs
deleted file mode 100644
index 3fa853e..0000000
--- a/tests/expectations/tests/libclang-3.9/error-E0600-cannot-apply-unary-negation-to-u32.rs
+++ /dev/null
@@ -1,9 +0,0 @@
-#![allow(
-    dead_code,
-    non_snake_case,
-    non_camel_case_types,
-    non_upper_case_globals
-)]
-#![allow(overflowing_literals)]
-
-pub const a: u32 = 18446744073709551611;
diff --git a/tests/expectations/tests/libclang-3.9/issue-769-bad-instantiation-test.rs b/tests/expectations/tests/libclang-3.9/issue-769-bad-instantiation-test.rs
deleted file mode 100644
index 47e166c..0000000
--- a/tests/expectations/tests/libclang-3.9/issue-769-bad-instantiation-test.rs
+++ /dev/null
@@ -1,65 +0,0 @@
-#![allow(
-    dead_code,
-    non_snake_case,
-    non_camel_case_types,
-    non_upper_case_globals
-)]
-
-#[allow(non_snake_case, non_camel_case_types, non_upper_case_globals)]
-pub mod root {
-    #[allow(unused_imports)]
-    use self::super::root;
-    #[repr(C)]
-    #[derive(Debug, Copy, Clone)]
-    pub struct Rooted<T> {
-        pub member: T,
-        pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
-    }
-    impl<T> Default for Rooted<T> {
-        fn default() -> Self {
-            let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
-            unsafe {
-                ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
-                s.assume_init()
-            }
-        }
-    }
-    #[test]
-    fn __bindgen_test_layout_Rooted_open0_int_close0_instantiation() {
-        assert_eq!(
-            ::std::mem::size_of::<root::Rooted<::std::os::raw::c_int>>(),
-            4usize,
-            concat!(
-                "Size of template specialization: ",
-                stringify!(root::Rooted<::std::os::raw::c_int>)
-            )
-        );
-        assert_eq!(
-            ::std::mem::align_of::<root::Rooted<::std::os::raw::c_int>>(),
-            4usize,
-            concat!(
-                "Alignment of template specialization: ",
-                stringify!(root::Rooted<::std::os::raw::c_int>)
-            )
-        );
-    }
-    #[test]
-    fn __bindgen_test_layout_Rooted_open0_int_close0_instantiation_1() {
-        assert_eq!(
-            ::std::mem::size_of::<root::Rooted<::std::os::raw::c_int>>(),
-            4usize,
-            concat!(
-                "Size of template specialization: ",
-                stringify!(root::Rooted<::std::os::raw::c_int>)
-            )
-        );
-        assert_eq!(
-            ::std::mem::align_of::<root::Rooted<::std::os::raw::c_int>>(),
-            4usize,
-            concat!(
-                "Alignment of template specialization: ",
-                stringify!(root::Rooted<::std::os::raw::c_int>)
-            )
-        );
-    }
-}
diff --git a/tests/expectations/tests/libclang-3.9/mangling-win32.rs b/tests/expectations/tests/libclang-3.9/mangling-win32.rs
deleted file mode 100644
index 0aee327..0000000
--- a/tests/expectations/tests/libclang-3.9/mangling-win32.rs
+++ /dev/null
@@ -1,52 +0,0 @@
-#![allow(
-    dead_code,
-    non_snake_case,
-    non_camel_case_types,
-    non_upper_case_globals
-)]
-
-extern "C" {
-    pub fn foo();
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy, Clone)]
-pub struct Foo {
-    pub _address: u8,
-}
-extern "C" {
-    #[link_name = "\u{1}?sBar@Foo@@2_NA"]
-    pub static mut Foo_sBar: bool;
-}
-#[test]
-fn bindgen_test_layout_Foo() {
-    assert_eq!(
-        ::std::mem::size_of::<Foo>(),
-        1usize,
-        concat!("Size of: ", stringify!(Foo))
-    );
-    assert_eq!(
-        ::std::mem::align_of::<Foo>(),
-        1usize,
-        concat!("Alignment of ", stringify!(Foo))
-    );
-}
-extern "fastcall" {
-    pub fn fast_call_func_no_args() -> ::std::os::raw::c_int;
-}
-extern "fastcall" {
-    pub fn fast_call_func_many_args(
-        arg1: ::std::os::raw::c_int,
-        arg2: ::std::os::raw::c_int,
-        arg3: ::std::os::raw::c_int,
-    ) -> ::std::os::raw::c_int;
-}
-extern "stdcall" {
-    pub fn std_call_func_no_args() -> ::std::os::raw::c_int;
-}
-extern "stdcall" {
-    pub fn std_call_func_many_args(
-        arg1: ::std::os::raw::c_int,
-        arg2: ::std::os::raw::c_int,
-        arg3: ::std::os::raw::c_int,
-    ) -> ::std::os::raw::c_int;
-}
diff --git a/tests/expectations/tests/libclang-3.9/objc_inheritance.rs b/tests/expectations/tests/libclang-3.9/objc_inheritance.rs
deleted file mode 100644
index 5f07dba..0000000
--- a/tests/expectations/tests/libclang-3.9/objc_inheritance.rs
+++ /dev/null
@@ -1,117 +0,0 @@
-#![allow(
-    dead_code,
-    non_snake_case,
-    non_camel_case_types,
-    non_upper_case_globals
-)]
-#![cfg(target_os = "macos")]
-
-#[macro_use]
-extern crate objc;
-#[allow(non_camel_case_types)]
-pub type id = *mut objc::runtime::Object;
-#[repr(transparent)]
-#[derive(Clone)]
-pub struct Foo(pub id);
-impl std::ops::Deref for Foo {
-    type Target = objc::runtime::Object;
-    fn deref(&self) -> &Self::Target {
-        unsafe { &*self.0 }
-    }
-}
-unsafe impl objc::Message for Foo {}
-impl Foo {
-    pub fn alloc() -> Self {
-        Self(unsafe { msg_send!(objc::class!(Foo), alloc) })
-    }
-}
-impl IFoo for Foo {}
-pub trait IFoo: Sized + std::ops::Deref {}
-#[repr(transparent)]
-#[derive(Clone)]
-pub struct Bar(pub id);
-impl std::ops::Deref for Bar {
-    type Target = objc::runtime::Object;
-    fn deref(&self) -> &Self::Target {
-        unsafe { &*self.0 }
-    }
-}
-unsafe impl objc::Message for Bar {}
-impl Bar {
-    pub fn alloc() -> Self {
-        Self(unsafe { msg_send!(objc::class!(Bar), alloc) })
-    }
-}
-impl IFoo for Bar {}
-impl From<Bar> for Foo {
-    fn from(child: Bar) -> Foo {
-        Foo(child.0)
-    }
-}
-impl std::convert::TryFrom<Foo> for Bar {
-    type Error = &'static str;
-    fn try_from(parent: Foo) -> Result<Bar, Self::Error> {
-        let is_kind_of: bool =
-            unsafe { msg_send!(parent, isKindOfClass: class!(Bar)) };
-        if is_kind_of {
-            Ok(Bar(parent.0))
-        } else {
-            Err("This Foo cannot be downcasted to Bar")
-        }
-    }
-}
-impl IBar for Bar {}
-pub trait IBar: Sized + std::ops::Deref {}
-#[repr(transparent)]
-#[derive(Clone)]
-pub struct Baz(pub id);
-impl std::ops::Deref for Baz {
-    type Target = objc::runtime::Object;
-    fn deref(&self) -> &Self::Target {
-        unsafe { &*self.0 }
-    }
-}
-unsafe impl objc::Message for Baz {}
-impl Baz {
-    pub fn alloc() -> Self {
-        Self(unsafe { msg_send!(objc::class!(Baz), alloc) })
-    }
-}
-impl IBar for Baz {}
-impl From<Baz> for Bar {
-    fn from(child: Baz) -> Bar {
-        Bar(child.0)
-    }
-}
-impl std::convert::TryFrom<Bar> for Baz {
-    type Error = &'static str;
-    fn try_from(parent: Bar) -> Result<Baz, Self::Error> {
-        let is_kind_of: bool =
-            unsafe { msg_send!(parent, isKindOfClass: class!(Baz)) };
-        if is_kind_of {
-            Ok(Baz(parent.0))
-        } else {
-            Err("This Bar cannot be downcasted to Baz")
-        }
-    }
-}
-impl IFoo for Baz {}
-impl From<Baz> for Foo {
-    fn from(child: Baz) -> Foo {
-        Foo(child.0)
-    }
-}
-impl std::convert::TryFrom<Foo> for Baz {
-    type Error = &'static str;
-    fn try_from(parent: Foo) -> Result<Baz, Self::Error> {
-        let is_kind_of: bool =
-            unsafe { msg_send!(parent, isKindOfClass: class!(Baz)) };
-        if is_kind_of {
-            Ok(Baz(parent.0))
-        } else {
-            Err("This Foo cannot be downcasted to Baz")
-        }
-    }
-}
-impl IBaz for Baz {}
-pub trait IBaz: Sized + std::ops::Deref {}
diff --git a/tests/expectations/tests/libclang-3.9/objc_template.rs b/tests/expectations/tests/libclang-3.9/objc_template.rs
deleted file mode 100644
index 4ccf72b..0000000
--- a/tests/expectations/tests/libclang-3.9/objc_template.rs
+++ /dev/null
@@ -1,65 +0,0 @@
-#![allow(
-    dead_code,
-    non_snake_case,
-    non_camel_case_types,
-    non_upper_case_globals
-)]
-#![cfg(target_os = "macos")]
-
-#[macro_use]
-extern crate objc;
-#[allow(non_camel_case_types)]
-pub type id = *mut objc::runtime::Object;
-#[repr(transparent)]
-#[derive(Clone)]
-pub struct Foo(pub id);
-impl std::ops::Deref for Foo {
-    type Target = objc::runtime::Object;
-    fn deref(&self) -> &Self::Target {
-        unsafe { &*self.0 }
-    }
-}
-unsafe impl objc::Message for Foo {}
-impl Foo {
-    pub fn alloc() -> Self {
-        Self(unsafe { msg_send!(objc::class!(Foo), alloc) })
-    }
-}
-impl<ObjectType: 'static> IFoo<ObjectType> for Foo {}
-pub trait IFoo<ObjectType>: Sized + std::ops::Deref {
-    unsafe fn get(&self) -> id
-    where
-        <Self as std::ops::Deref>::Target: objc::Message + Sized,
-    {
-        msg_send!(*self, get)
-    }
-}
-#[repr(transparent)]
-#[derive(Clone)]
-pub struct FooMultiGeneric(pub id);
-impl std::ops::Deref for FooMultiGeneric {
-    type Target = objc::runtime::Object;
-    fn deref(&self) -> &Self::Target {
-        unsafe { &*self.0 }
-    }
-}
-unsafe impl objc::Message for FooMultiGeneric {}
-impl FooMultiGeneric {
-    pub fn alloc() -> Self {
-        Self(unsafe { msg_send!(objc::class!(FooMultiGeneric), alloc) })
-    }
-}
-impl<KeyType: 'static, ObjectType: 'static>
-    IFooMultiGeneric<KeyType, ObjectType> for FooMultiGeneric
-{
-}
-pub trait IFooMultiGeneric<KeyType, ObjectType>:
-    Sized + std::ops::Deref
-{
-    unsafe fn objectForKey_(&self, key: id) -> id
-    where
-        <Self as std::ops::Deref>::Target: objc::Message + Sized,
-    {
-        msg_send!(*self, objectForKey: key)
-    }
-}
diff --git a/tests/expectations/tests/libclang-3.9/partial-specialization-and-inheritance.rs b/tests/expectations/tests/libclang-3.9/partial-specialization-and-inheritance.rs
deleted file mode 100644
index e62ea68..0000000
--- a/tests/expectations/tests/libclang-3.9/partial-specialization-and-inheritance.rs
+++ /dev/null
@@ -1,39 +0,0 @@
-#![allow(
-    dead_code,
-    non_snake_case,
-    non_camel_case_types,
-    non_upper_case_globals
-)]
-
-#[repr(C)]
-#[derive(Debug, Default, Copy, Clone)]
-pub struct Base {
-    pub _address: u8,
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy, Clone)]
-pub struct Derived {
-    pub b: bool,
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy, Clone)]
-pub struct Usage {
-    pub _address: u8,
-}
-extern "C" {
-    #[link_name = "\u{1}_ZN5Usage13static_memberE"]
-    pub static mut Usage_static_member: [u32; 2usize];
-}
-#[test]
-fn bindgen_test_layout_Usage() {
-    assert_eq!(
-        ::std::mem::size_of::<Usage>(),
-        1usize,
-        concat!("Size of: ", stringify!(Usage))
-    );
-    assert_eq!(
-        ::std::mem::align_of::<Usage>(),
-        1usize,
-        concat!("Alignment of ", stringify!(Usage))
-    );
-}
diff --git a/tests/expectations/tests/libclang-3.9/template_instantiation_with_fn_local_type.rs b/tests/expectations/tests/libclang-3.9/template_instantiation_with_fn_local_type.rs
deleted file mode 100644
index ba0c6e7..0000000
--- a/tests/expectations/tests/libclang-3.9/template_instantiation_with_fn_local_type.rs
+++ /dev/null
@@ -1,60 +0,0 @@
-#![allow(
-    dead_code,
-    non_snake_case,
-    non_camel_case_types,
-    non_upper_case_globals
-)]
-
-#[repr(C)]
-#[derive(Debug, Default, Copy, Clone)]
-pub struct Foo {
-    pub _address: u8,
-}
-extern "C" {
-    #[link_name = "\u{1}_Z1fv"]
-    pub fn f();
-}
-#[test]
-fn __bindgen_test_layout_Foo_open0__bindgen_ty_id_20_close0_instantiation() {
-    assert_eq!(
-        ::std::mem::size_of::<Foo>(),
-        1usize,
-        concat!("Size of template specialization: ", stringify!(Foo))
-    );
-    assert_eq!(
-        ::std::mem::align_of::<Foo>(),
-        1usize,
-        concat!("Alignment of template specialization: ", stringify!(Foo))
-    );
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy, Clone)]
-pub struct Baz {
-    pub _address: u8,
-}
-#[test]
-fn bindgen_test_layout_Baz() {
-    assert_eq!(
-        ::std::mem::size_of::<Baz>(),
-        1usize,
-        concat!("Size of: ", stringify!(Baz))
-    );
-    assert_eq!(
-        ::std::mem::align_of::<Baz>(),
-        1usize,
-        concat!("Alignment of ", stringify!(Baz))
-    );
-}
- #[test]
-fn __bindgen_test_layout_Foo_open0__bindgen_ty_id_21_close0_instantiation() {
-    assert_eq!(
-        ::std::mem::size_of::<Foo>(),
-        1usize,
-        concat!("Size of template specialization: ", stringify!(Foo))
-    );
-    assert_eq!(
-        ::std::mem::align_of::<Foo>(),
-        1usize,
-        concat!("Alignment of template specialization: ", stringify!(Foo))
-    );
-}
diff --git a/tests/expectations/tests/libclang-3.9/type_alias_template_specialized.rs b/tests/expectations/tests/libclang-3.9/type_alias_template_specialized.rs
deleted file mode 100644
index 67e1c5a..0000000
--- a/tests/expectations/tests/libclang-3.9/type_alias_template_specialized.rs
+++ /dev/null
@@ -1,37 +0,0 @@
-#![allow(
-    dead_code,
-    non_snake_case,
-    non_camel_case_types,
-    non_upper_case_globals
-)]
-
-#[repr(C)]
-#[derive(Debug, Default, Copy, Clone)]
-pub struct Rooted {
-    pub ptr: ::std::os::raw::c_int,
-}
-#[test]
-fn bindgen_test_layout_Rooted() {
-    assert_eq!(
-        ::std::mem::size_of::<Rooted>(),
-        4usize,
-        concat!("Size of: ", stringify!(Rooted))
-    );
-    assert_eq!(
-        ::std::mem::align_of::<Rooted>(),
-        4usize,
-        concat!("Alignment of ", stringify!(Rooted))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Rooted>())).ptr as *const _ as usize },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(Rooted),
-            "::",
-            stringify!(ptr)
-        )
-    );
-}
-/// <div rustbindgen replaces="MaybeWrapped"></div>
-pub type MaybeWrapped<a> = a;
diff --git a/tests/expectations/tests/libclang-3.9/wasm-constructor-returns.rs b/tests/expectations/tests/libclang-3.9/wasm-constructor-returns.rs
deleted file mode 100644
index f207d0d..0000000
--- a/tests/expectations/tests/libclang-3.9/wasm-constructor-returns.rs
+++ /dev/null
@@ -1,37 +0,0 @@
-#![allow(
-    dead_code,
-    non_snake_case,
-    non_camel_case_types,
-    non_upper_case_globals
-)]
-
-#[repr(C)]
-#[derive(Debug, Default, Copy, Clone)]
-pub struct Foo {
-    pub _address: u8,
-}
-#[test]
-fn bindgen_test_layout_Foo() {
-    assert_eq!(
-        ::std::mem::size_of::<Foo>(),
-        1usize,
-        concat!("Size of: ", stringify!(Foo))
-    );
-    assert_eq!(
-        ::std::mem::align_of::<Foo>(),
-        1usize,
-        concat!("Alignment of ", stringify!(Foo))
-    );
-}
-extern "C" {
-    #[link_name = "\u{1}_ZN3FooC1Ei"]
-    pub fn Foo_Foo(this: *mut Foo, var: ::std::os::raw::c_int);
-}
-impl Foo {
-    #[inline]
-    pub unsafe fn new(var: ::std::os::raw::c_int) -> Self {
-        let mut __bindgen_tmp = ::std::mem::MaybeUninit::uninit();
-        Foo_Foo(__bindgen_tmp.as_mut_ptr(), var);
-        __bindgen_tmp.assume_init()
-    }
-}
diff --git a/tests/expectations/tests/libclang-4/abi_variadic_function.rs b/tests/expectations/tests/libclang-4/abi_variadic_function.rs
deleted file mode 100644
index 6aeb16f..0000000
--- a/tests/expectations/tests/libclang-4/abi_variadic_function.rs
+++ /dev/null
@@ -1,11 +0,0 @@
-#![allow(
-    dead_code,
-    non_snake_case,
-    non_camel_case_types,
-    non_upper_case_globals
-)]
-
-extern "C" {
-    #[link_name = "\u{1}_Z1bcz"]
-    pub fn b(arg1: ::std::os::raw::c_char, ...) -> ::std::os::raw::c_char;
-}
diff --git a/tests/expectations/tests/libclang-4/auto.rs b/tests/expectations/tests/libclang-4/auto.rs
deleted file mode 100644
index 0b20b39..0000000
--- a/tests/expectations/tests/libclang-4/auto.rs
+++ /dev/null
@@ -1,35 +0,0 @@
-#![allow(
-    dead_code,
-    non_snake_case,
-    non_camel_case_types,
-    non_upper_case_globals
-)]
-
-#[repr(C)]
-#[derive(Debug, Default, Copy, Clone)]
-pub struct Foo {
-    pub _address: u8,
-}
-pub const Foo_kFoo: bool = true;
-#[test]
-fn bindgen_test_layout_Foo() {
-    assert_eq!(
-        ::std::mem::size_of::<Foo>(),
-        1usize,
-        concat!("Size of: ", stringify!(Foo))
-    );
-    assert_eq!(
-        ::std::mem::align_of::<Foo>(),
-        1usize,
-        concat!("Alignment of ", stringify!(Foo))
-    );
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy, Clone)]
-pub struct Bar {
-    pub _address: u8,
-}
-extern "C" {
-    #[link_name = "\u{1}_Z5Test2v"]
-    pub fn Test2() -> ::std::os::raw::c_uint;
-}
diff --git a/tests/expectations/tests/libclang-4/call-conv-field.rs b/tests/expectations/tests/libclang-4/call-conv-field.rs
deleted file mode 100644
index f134bd8..0000000
--- a/tests/expectations/tests/libclang-4/call-conv-field.rs
+++ /dev/null
@@ -1,60 +0,0 @@
-#![allow(
-    dead_code,
-    non_snake_case,
-    non_camel_case_types,
-    non_upper_case_globals
-)]
-#![cfg(not(test))]
-
-#[repr(C)]
-#[derive(Default, Copy, Clone)]
-pub struct JNINativeInterface_ {
-    pub GetVersion: ::std::option::Option<
-        unsafe extern "stdcall" fn(
-            env: *mut ::std::os::raw::c_void,
-        ) -> ::std::os::raw::c_int,
-    >,
-    pub __hack: ::std::os::raw::c_ulonglong,
-}
-#[test]
-fn bindgen_test_layout_JNINativeInterface_() {
-    assert_eq!(
-        ::std::mem::size_of::<JNINativeInterface_>(),
-        16usize,
-        concat!("Size of: ", stringify!(JNINativeInterface_))
-    );
-    assert_eq!(
-        ::std::mem::align_of::<JNINativeInterface_>(),
-        8usize,
-        concat!("Alignment of ", stringify!(JNINativeInterface_))
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<JNINativeInterface_>())).GetVersion
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(JNINativeInterface_),
-            "::",
-            stringify!(GetVersion)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<JNINativeInterface_>())).__hack as *const _
-                as usize
-        },
-        8usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(JNINativeInterface_),
-            "::",
-            stringify!(__hack)
-        )
-    );
-}
-extern "stdcall" {
-    pub fn bar();
-}
diff --git a/tests/expectations/tests/libclang-4/const_bool.rs b/tests/expectations/tests/libclang-4/const_bool.rs
deleted file mode 100644
index 97e1d8d..0000000
--- a/tests/expectations/tests/libclang-4/const_bool.rs
+++ /dev/null
@@ -1,29 +0,0 @@
-#![allow(
-    dead_code,
-    non_snake_case,
-    non_camel_case_types,
-    non_upper_case_globals
-)]
-
-pub const k: bool = true;
-#[repr(C)]
-#[derive(Debug, Default, Copy, Clone)]
-pub struct A {
-    pub _address: u8,
-}
-pub const A_k: bool = false;
-#[test]
-fn bindgen_test_layout_A() {
-    assert_eq!(
-        ::std::mem::size_of::<A>(),
-        1usize,
-        concat!("Size of: ", stringify!(A))
-    );
-    assert_eq!(
-        ::std::mem::align_of::<A>(),
-        1usize,
-        concat!("Alignment of ", stringify!(A))
-    );
-}
-pub type foo = bool;
-pub const k2: foo = true;
diff --git a/tests/expectations/tests/libclang-4/constant-evaluate.rs b/tests/expectations/tests/libclang-4/constant-evaluate.rs
deleted file mode 100644
index df2638f..0000000
--- a/tests/expectations/tests/libclang-4/constant-evaluate.rs
+++ /dev/null
@@ -1,25 +0,0 @@
-#![allow(
-    dead_code,
-    non_snake_case,
-    non_camel_case_types,
-    non_upper_case_globals
-)]
-
-pub const foo: _bindgen_ty_1 = _bindgen_ty_1::foo;
-pub const bar: _bindgen_ty_1 = _bindgen_ty_1::bar;
-#[repr(u32)]
-#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
-pub enum _bindgen_ty_1 {
-    foo = 4,
-    bar = 8,
-}
-pub type EasyToOverflow = ::std::os::raw::c_ulonglong;
-pub const k: EasyToOverflow = 2147483648;
-pub const k_expr: EasyToOverflow = 1152921504606846976;
-pub const wow: EasyToOverflow = 2147483648;
-pub const BAZ: ::std::os::raw::c_longlong = 24;
-pub const fuzz: f64 = 51.0;
-pub const BAZZ: ::std::os::raw::c_char = 53;
-pub const WAT: ::std::os::raw::c_char = 0;
-pub const bytestring: &'static [u8; 4usize] = b"Foo\0";
-pub const NOT_UTF8: [u8; 5usize] = [240u8, 40u8, 140u8, 40u8, 0u8];
diff --git a/tests/expectations/tests/libclang-4/issue-769-bad-instantiation-test.rs b/tests/expectations/tests/libclang-4/issue-769-bad-instantiation-test.rs
deleted file mode 100644
index 6085796..0000000
--- a/tests/expectations/tests/libclang-4/issue-769-bad-instantiation-test.rs
+++ /dev/null
@@ -1,67 +0,0 @@
-#![allow(
-    dead_code,
-    non_snake_case,
-    non_camel_case_types,
-    non_upper_case_globals
-)]
-
-#[allow(non_snake_case, non_camel_case_types, non_upper_case_globals)]
-pub mod root {
-    #[allow(unused_imports)]
-    use self::super::root;
-    #[repr(C)]
-    #[derive(Debug, Copy, Clone)]
-    pub struct Rooted<T> {
-        pub member: T,
-        pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
-    }
-    impl<T> Default for Rooted<T> {
-        fn default() -> Self {
-            let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
-            unsafe {
-                ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
-                s.assume_init()
-            }
-        }
-    }
-    pub type AutoValueVector_Alias = ::std::os::raw::c_int;
-    #[test]
-    fn __bindgen_test_layout_Rooted_open0_int_close0_instantiation() {
-        assert_eq!(
-            ::std::mem::size_of::<root::Rooted<::std::os::raw::c_int>>(),
-            4usize,
-            concat!(
-                "Size of template specialization: ",
-                stringify!(root::Rooted<::std::os::raw::c_int>)
-            )
-        );
-        assert_eq!(
-            ::std::mem::align_of::<root::Rooted<::std::os::raw::c_int>>(),
-            4usize,
-            concat!(
-                "Alignment of template specialization: ",
-                stringify!(root::Rooted<::std::os::raw::c_int>)
-            )
-        );
-    }
-    #[test]
-    fn __bindgen_test_layout_Rooted_open0_AutoValueVector_Alias_close0_instantiation(
-    ) {
-        assert_eq!(
-            ::std::mem::size_of::<root::Rooted<root::AutoValueVector_Alias>>(),
-            4usize,
-            concat!(
-                "Size of template specialization: ",
-                stringify!(root::Rooted<root::AutoValueVector_Alias>)
-            )
-        );
-        assert_eq!(
-            ::std::mem::align_of::<root::Rooted<root::AutoValueVector_Alias>>(),
-            4usize,
-            concat!(
-                "Alignment of template specialization: ",
-                stringify!(root::Rooted<root::AutoValueVector_Alias>)
-            )
-        );
-    }
-}
diff --git a/tests/expectations/tests/libclang-4/mangling-win32.rs b/tests/expectations/tests/libclang-4/mangling-win32.rs
deleted file mode 100644
index 0aee327..0000000
--- a/tests/expectations/tests/libclang-4/mangling-win32.rs
+++ /dev/null
@@ -1,52 +0,0 @@
-#![allow(
-    dead_code,
-    non_snake_case,
-    non_camel_case_types,
-    non_upper_case_globals
-)]
-
-extern "C" {
-    pub fn foo();
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy, Clone)]
-pub struct Foo {
-    pub _address: u8,
-}
-extern "C" {
-    #[link_name = "\u{1}?sBar@Foo@@2_NA"]
-    pub static mut Foo_sBar: bool;
-}
-#[test]
-fn bindgen_test_layout_Foo() {
-    assert_eq!(
-        ::std::mem::size_of::<Foo>(),
-        1usize,
-        concat!("Size of: ", stringify!(Foo))
-    );
-    assert_eq!(
-        ::std::mem::align_of::<Foo>(),
-        1usize,
-        concat!("Alignment of ", stringify!(Foo))
-    );
-}
-extern "fastcall" {
-    pub fn fast_call_func_no_args() -> ::std::os::raw::c_int;
-}
-extern "fastcall" {
-    pub fn fast_call_func_many_args(
-        arg1: ::std::os::raw::c_int,
-        arg2: ::std::os::raw::c_int,
-        arg3: ::std::os::raw::c_int,
-    ) -> ::std::os::raw::c_int;
-}
-extern "stdcall" {
-    pub fn std_call_func_no_args() -> ::std::os::raw::c_int;
-}
-extern "stdcall" {
-    pub fn std_call_func_many_args(
-        arg1: ::std::os::raw::c_int,
-        arg2: ::std::os::raw::c_int,
-        arg3: ::std::os::raw::c_int,
-    ) -> ::std::os::raw::c_int;
-}
diff --git a/tests/expectations/tests/libclang-4/objc_inheritance.rs b/tests/expectations/tests/libclang-4/objc_inheritance.rs
deleted file mode 100644
index 5f07dba..0000000
--- a/tests/expectations/tests/libclang-4/objc_inheritance.rs
+++ /dev/null
@@ -1,117 +0,0 @@
-#![allow(
-    dead_code,
-    non_snake_case,
-    non_camel_case_types,
-    non_upper_case_globals
-)]
-#![cfg(target_os = "macos")]
-
-#[macro_use]
-extern crate objc;
-#[allow(non_camel_case_types)]
-pub type id = *mut objc::runtime::Object;
-#[repr(transparent)]
-#[derive(Clone)]
-pub struct Foo(pub id);
-impl std::ops::Deref for Foo {
-    type Target = objc::runtime::Object;
-    fn deref(&self) -> &Self::Target {
-        unsafe { &*self.0 }
-    }
-}
-unsafe impl objc::Message for Foo {}
-impl Foo {
-    pub fn alloc() -> Self {
-        Self(unsafe { msg_send!(objc::class!(Foo), alloc) })
-    }
-}
-impl IFoo for Foo {}
-pub trait IFoo: Sized + std::ops::Deref {}
-#[repr(transparent)]
-#[derive(Clone)]
-pub struct Bar(pub id);
-impl std::ops::Deref for Bar {
-    type Target = objc::runtime::Object;
-    fn deref(&self) -> &Self::Target {
-        unsafe { &*self.0 }
-    }
-}
-unsafe impl objc::Message for Bar {}
-impl Bar {
-    pub fn alloc() -> Self {
-        Self(unsafe { msg_send!(objc::class!(Bar), alloc) })
-    }
-}
-impl IFoo for Bar {}
-impl From<Bar> for Foo {
-    fn from(child: Bar) -> Foo {
-        Foo(child.0)
-    }
-}
-impl std::convert::TryFrom<Foo> for Bar {
-    type Error = &'static str;
-    fn try_from(parent: Foo) -> Result<Bar, Self::Error> {
-        let is_kind_of: bool =
-            unsafe { msg_send!(parent, isKindOfClass: class!(Bar)) };
-        if is_kind_of {
-            Ok(Bar(parent.0))
-        } else {
-            Err("This Foo cannot be downcasted to Bar")
-        }
-    }
-}
-impl IBar for Bar {}
-pub trait IBar: Sized + std::ops::Deref {}
-#[repr(transparent)]
-#[derive(Clone)]
-pub struct Baz(pub id);
-impl std::ops::Deref for Baz {
-    type Target = objc::runtime::Object;
-    fn deref(&self) -> &Self::Target {
-        unsafe { &*self.0 }
-    }
-}
-unsafe impl objc::Message for Baz {}
-impl Baz {
-    pub fn alloc() -> Self {
-        Self(unsafe { msg_send!(objc::class!(Baz), alloc) })
-    }
-}
-impl IBar for Baz {}
-impl From<Baz> for Bar {
-    fn from(child: Baz) -> Bar {
-        Bar(child.0)
-    }
-}
-impl std::convert::TryFrom<Bar> for Baz {
-    type Error = &'static str;
-    fn try_from(parent: Bar) -> Result<Baz, Self::Error> {
-        let is_kind_of: bool =
-            unsafe { msg_send!(parent, isKindOfClass: class!(Baz)) };
-        if is_kind_of {
-            Ok(Baz(parent.0))
-        } else {
-            Err("This Bar cannot be downcasted to Baz")
-        }
-    }
-}
-impl IFoo for Baz {}
-impl From<Baz> for Foo {
-    fn from(child: Baz) -> Foo {
-        Foo(child.0)
-    }
-}
-impl std::convert::TryFrom<Foo> for Baz {
-    type Error = &'static str;
-    fn try_from(parent: Foo) -> Result<Baz, Self::Error> {
-        let is_kind_of: bool =
-            unsafe { msg_send!(parent, isKindOfClass: class!(Baz)) };
-        if is_kind_of {
-            Ok(Baz(parent.0))
-        } else {
-            Err("This Foo cannot be downcasted to Baz")
-        }
-    }
-}
-impl IBaz for Baz {}
-pub trait IBaz: Sized + std::ops::Deref {}
diff --git a/tests/expectations/tests/libclang-4/objc_template.rs b/tests/expectations/tests/libclang-4/objc_template.rs
deleted file mode 100644
index 36b7d22..0000000
--- a/tests/expectations/tests/libclang-4/objc_template.rs
+++ /dev/null
@@ -1,65 +0,0 @@
-#![allow(
-    dead_code,
-    non_snake_case,
-    non_camel_case_types,
-    non_upper_case_globals
-)]
-#![cfg(target_os = "macos")]
-
-#[macro_use]
-extern crate objc;
-#[allow(non_camel_case_types)]
-pub type id = *mut objc::runtime::Object;
-#[repr(transparent)]
-#[derive(Clone)]
-pub struct Foo(pub id);
-impl std::ops::Deref for Foo {
-    type Target = objc::runtime::Object;
-    fn deref(&self) -> &Self::Target {
-        unsafe { &*self.0 }
-    }
-}
-unsafe impl objc::Message for Foo {}
-impl Foo {
-    pub fn alloc() -> Self {
-        Self(unsafe { msg_send!(objc::class!(Foo), alloc) })
-    }
-}
-impl<ObjectType: 'static> IFoo<ObjectType> for Foo {}
-pub trait IFoo<ObjectType>: Sized + std::ops::Deref {
-    unsafe fn get(&self) -> *mut ObjectType
-    where
-        <Self as std::ops::Deref>::Target: objc::Message + Sized,
-    {
-        msg_send!(*self, get)
-    }
-}
-#[repr(transparent)]
-#[derive(Clone)]
-pub struct FooMultiGeneric(pub id);
-impl std::ops::Deref for FooMultiGeneric {
-    type Target = objc::runtime::Object;
-    fn deref(&self) -> &Self::Target {
-        unsafe { &*self.0 }
-    }
-}
-unsafe impl objc::Message for FooMultiGeneric {}
-impl FooMultiGeneric {
-    pub fn alloc() -> Self {
-        Self(unsafe { msg_send!(objc::class!(FooMultiGeneric), alloc) })
-    }
-}
-impl<KeyType: 'static, ObjectType: 'static>
-    IFooMultiGeneric<KeyType, ObjectType> for FooMultiGeneric
-{
-}
-pub trait IFooMultiGeneric<KeyType, ObjectType>:
-    Sized + std::ops::Deref
-{
-    unsafe fn objectForKey_(&self, key: *mut KeyType) -> *mut ObjectType
-    where
-        <Self as std::ops::Deref>::Target: objc::Message + Sized,
-    {
-        msg_send!(*self, objectForKey: key)
-    }
-}
diff --git a/tests/expectations/tests/libclang-4/partial-specialization-and-inheritance.rs b/tests/expectations/tests/libclang-4/partial-specialization-and-inheritance.rs
deleted file mode 100644
index e62ea68..0000000
--- a/tests/expectations/tests/libclang-4/partial-specialization-and-inheritance.rs
+++ /dev/null
@@ -1,39 +0,0 @@
-#![allow(
-    dead_code,
-    non_snake_case,
-    non_camel_case_types,
-    non_upper_case_globals
-)]
-
-#[repr(C)]
-#[derive(Debug, Default, Copy, Clone)]
-pub struct Base {
-    pub _address: u8,
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy, Clone)]
-pub struct Derived {
-    pub b: bool,
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy, Clone)]
-pub struct Usage {
-    pub _address: u8,
-}
-extern "C" {
-    #[link_name = "\u{1}_ZN5Usage13static_memberE"]
-    pub static mut Usage_static_member: [u32; 2usize];
-}
-#[test]
-fn bindgen_test_layout_Usage() {
-    assert_eq!(
-        ::std::mem::size_of::<Usage>(),
-        1usize,
-        concat!("Size of: ", stringify!(Usage))
-    );
-    assert_eq!(
-        ::std::mem::align_of::<Usage>(),
-        1usize,
-        concat!("Alignment of ", stringify!(Usage))
-    );
-}
diff --git a/tests/expectations/tests/libclang-4/type_alias_template_specialized.rs b/tests/expectations/tests/libclang-4/type_alias_template_specialized.rs
deleted file mode 100644
index f874e9d..0000000
--- a/tests/expectations/tests/libclang-4/type_alias_template_specialized.rs
+++ /dev/null
@@ -1,65 +0,0 @@
-#![allow(
-    dead_code,
-    non_snake_case,
-    non_camel_case_types,
-    non_upper_case_globals
-)]
-
-#[repr(C)]
-#[derive(Debug, Copy, Clone)]
-pub struct Rooted {
-    pub ptr: MaybeWrapped<::std::os::raw::c_int>,
-}
-#[test]
-fn bindgen_test_layout_Rooted() {
-    assert_eq!(
-        ::std::mem::size_of::<Rooted>(),
-        4usize,
-        concat!("Size of: ", stringify!(Rooted))
-    );
-    assert_eq!(
-        ::std::mem::align_of::<Rooted>(),
-        4usize,
-        concat!("Alignment of ", stringify!(Rooted))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Rooted>())).ptr as *const _ as usize },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(Rooted),
-            "::",
-            stringify!(ptr)
-        )
-    );
-}
-impl Default for Rooted {
-    fn default() -> Self {
-        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
-        unsafe {
-            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
-            s.assume_init()
-        }
-    }
-}
-/// <div rustbindgen replaces="MaybeWrapped"></div>
-pub type MaybeWrapped<a> = a;
-#[test]
-fn __bindgen_test_layout_MaybeWrapped_open0_int_close0_instantiation() {
-    assert_eq!(
-        ::std::mem::size_of::<MaybeWrapped<::std::os::raw::c_int>>(),
-        4usize,
-        concat!(
-            "Size of template specialization: ",
-            stringify!(MaybeWrapped<::std::os::raw::c_int>)
-        )
-    );
-    assert_eq!(
-        ::std::mem::align_of::<MaybeWrapped<::std::os::raw::c_int>>(),
-        4usize,
-        concat!(
-            "Alignment of template specialization: ",
-            stringify!(MaybeWrapped<::std::os::raw::c_int>)
-        )
-    );
-}
diff --git a/tests/expectations/tests/libclang-4/wasm-constructor-returns.rs b/tests/expectations/tests/libclang-4/wasm-constructor-returns.rs
deleted file mode 100644
index f207d0d..0000000
--- a/tests/expectations/tests/libclang-4/wasm-constructor-returns.rs
+++ /dev/null
@@ -1,37 +0,0 @@
-#![allow(
-    dead_code,
-    non_snake_case,
-    non_camel_case_types,
-    non_upper_case_globals
-)]
-
-#[repr(C)]
-#[derive(Debug, Default, Copy, Clone)]
-pub struct Foo {
-    pub _address: u8,
-}
-#[test]
-fn bindgen_test_layout_Foo() {
-    assert_eq!(
-        ::std::mem::size_of::<Foo>(),
-        1usize,
-        concat!("Size of: ", stringify!(Foo))
-    );
-    assert_eq!(
-        ::std::mem::align_of::<Foo>(),
-        1usize,
-        concat!("Alignment of ", stringify!(Foo))
-    );
-}
-extern "C" {
-    #[link_name = "\u{1}_ZN3FooC1Ei"]
-    pub fn Foo_Foo(this: *mut Foo, var: ::std::os::raw::c_int);
-}
-impl Foo {
-    #[inline]
-    pub unsafe fn new(var: ::std::os::raw::c_int) -> Self {
-        let mut __bindgen_tmp = ::std::mem::MaybeUninit::uninit();
-        Foo_Foo(__bindgen_tmp.as_mut_ptr(), var);
-        __bindgen_tmp.assume_init()
-    }
-}
diff --git a/tests/expectations/tests/libclang-5/call-conv-field.rs b/tests/expectations/tests/libclang-5/call-conv-field.rs
index f134bd8..f83181e 100644
--- a/tests/expectations/tests/libclang-5/call-conv-field.rs
+++ b/tests/expectations/tests/libclang-5/call-conv-field.rs
@@ -28,32 +28,42 @@
         8usize,
         concat!("Alignment of ", stringify!(JNINativeInterface_))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<JNINativeInterface_>())).GetVersion
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(JNINativeInterface_),
-            "::",
-            stringify!(GetVersion)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<JNINativeInterface_>())).__hack as *const _
-                as usize
-        },
-        8usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(JNINativeInterface_),
-            "::",
-            stringify!(__hack)
-        )
-    );
+    fn test_field_GetVersion() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<JNINativeInterface_>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).GetVersion) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(JNINativeInterface_),
+                "::",
+                stringify!(GetVersion)
+            )
+        );
+    }
+    test_field_GetVersion();
+    fn test_field___hack() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<JNINativeInterface_>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).__hack) as usize - ptr as usize
+            },
+            8usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(JNINativeInterface_),
+                "::",
+                stringify!(__hack)
+            )
+        );
+    }
+    test_field___hack();
 }
 extern "stdcall" {
     pub fn bar();
diff --git a/tests/expectations/tests/libclang-5/constant-evaluate.rs b/tests/expectations/tests/libclang-5/constant-evaluate.rs
index df2638f..9debe39 100644
--- a/tests/expectations/tests/libclang-5/constant-evaluate.rs
+++ b/tests/expectations/tests/libclang-5/constant-evaluate.rs
@@ -21,5 +21,5 @@
 pub const fuzz: f64 = 51.0;
 pub const BAZZ: ::std::os::raw::c_char = 53;
 pub const WAT: ::std::os::raw::c_char = 0;
-pub const bytestring: &'static [u8; 4usize] = b"Foo\0";
+pub const bytestring: &[u8; 4usize] = b"Foo\0";
 pub const NOT_UTF8: [u8; 5usize] = [240u8, 40u8, 140u8, 40u8, 0u8];
diff --git a/tests/expectations/tests/libclang-5/objc_inheritance.rs b/tests/expectations/tests/libclang-5/objc_inheritance.rs
index 5f07dba..f1c2a88 100644
--- a/tests/expectations/tests/libclang-5/objc_inheritance.rs
+++ b/tests/expectations/tests/libclang-5/objc_inheritance.rs
@@ -6,12 +6,11 @@
 )]
 #![cfg(target_os = "macos")]
 
-#[macro_use]
-extern crate objc;
+use objc::{self, class, msg_send, sel, sel_impl};
 #[allow(non_camel_case_types)]
 pub type id = *mut objc::runtime::Object;
 #[repr(transparent)]
-#[derive(Clone)]
+#[derive(Debug, Copy, Clone)]
 pub struct Foo(pub id);
 impl std::ops::Deref for Foo {
     type Target = objc::runtime::Object;
@@ -22,13 +21,13 @@
 unsafe impl objc::Message for Foo {}
 impl Foo {
     pub fn alloc() -> Self {
-        Self(unsafe { msg_send!(objc::class!(Foo), alloc) })
+        Self(unsafe { msg_send!(class!(Foo), alloc) })
     }
 }
 impl IFoo for Foo {}
 pub trait IFoo: Sized + std::ops::Deref {}
 #[repr(transparent)]
-#[derive(Clone)]
+#[derive(Debug, Copy, Clone)]
 pub struct Bar(pub id);
 impl std::ops::Deref for Bar {
     type Target = objc::runtime::Object;
@@ -39,7 +38,7 @@
 unsafe impl objc::Message for Bar {}
 impl Bar {
     pub fn alloc() -> Self {
-        Self(unsafe { msg_send!(objc::class!(Bar), alloc) })
+        Self(unsafe { msg_send!(class!(Bar), alloc) })
     }
 }
 impl IFoo for Bar {}
@@ -63,7 +62,7 @@
 impl IBar for Bar {}
 pub trait IBar: Sized + std::ops::Deref {}
 #[repr(transparent)]
-#[derive(Clone)]
+#[derive(Debug, Copy, Clone)]
 pub struct Baz(pub id);
 impl std::ops::Deref for Baz {
     type Target = objc::runtime::Object;
@@ -74,7 +73,7 @@
 unsafe impl objc::Message for Baz {}
 impl Baz {
     pub fn alloc() -> Self {
-        Self(unsafe { msg_send!(objc::class!(Baz), alloc) })
+        Self(unsafe { msg_send!(class!(Baz), alloc) })
     }
 }
 impl IBar for Baz {}
diff --git a/tests/expectations/tests/libclang-5/objc_template.rs b/tests/expectations/tests/libclang-5/objc_template.rs
index 36b7d22..53caa66 100644
--- a/tests/expectations/tests/libclang-5/objc_template.rs
+++ b/tests/expectations/tests/libclang-5/objc_template.rs
@@ -6,12 +6,11 @@
 )]
 #![cfg(target_os = "macos")]
 
-#[macro_use]
-extern crate objc;
+use objc::{self, class, msg_send, sel, sel_impl};
 #[allow(non_camel_case_types)]
 pub type id = *mut objc::runtime::Object;
 #[repr(transparent)]
-#[derive(Clone)]
+#[derive(Debug, Copy, Clone)]
 pub struct Foo(pub id);
 impl std::ops::Deref for Foo {
     type Target = objc::runtime::Object;
@@ -22,11 +21,11 @@
 unsafe impl objc::Message for Foo {}
 impl Foo {
     pub fn alloc() -> Self {
-        Self(unsafe { msg_send!(objc::class!(Foo), alloc) })
+        Self(unsafe { msg_send!(class!(Foo), alloc) })
     }
 }
 impl<ObjectType: 'static> IFoo<ObjectType> for Foo {}
-pub trait IFoo<ObjectType>: Sized + std::ops::Deref {
+pub trait IFoo<ObjectType: 'static>: Sized + std::ops::Deref {
     unsafe fn get(&self) -> *mut ObjectType
     where
         <Self as std::ops::Deref>::Target: objc::Message + Sized,
@@ -35,7 +34,7 @@
     }
 }
 #[repr(transparent)]
-#[derive(Clone)]
+#[derive(Debug, Copy, Clone)]
 pub struct FooMultiGeneric(pub id);
 impl std::ops::Deref for FooMultiGeneric {
     type Target = objc::runtime::Object;
@@ -46,14 +45,14 @@
 unsafe impl objc::Message for FooMultiGeneric {}
 impl FooMultiGeneric {
     pub fn alloc() -> Self {
-        Self(unsafe { msg_send!(objc::class!(FooMultiGeneric), alloc) })
+        Self(unsafe { msg_send!(class!(FooMultiGeneric), alloc) })
     }
 }
 impl<KeyType: 'static, ObjectType: 'static>
     IFooMultiGeneric<KeyType, ObjectType> for FooMultiGeneric
 {
 }
-pub trait IFooMultiGeneric<KeyType, ObjectType>:
+pub trait IFooMultiGeneric<KeyType: 'static, ObjectType: 'static>:
     Sized + std::ops::Deref
 {
     unsafe fn objectForKey_(&self, key: *mut KeyType) -> *mut ObjectType
diff --git a/tests/expectations/tests/libclang-5/type_alias_template_specialized.rs b/tests/expectations/tests/libclang-5/type_alias_template_specialized.rs
index f874e9d..213d4cd 100644
--- a/tests/expectations/tests/libclang-5/type_alias_template_specialized.rs
+++ b/tests/expectations/tests/libclang-5/type_alias_template_specialized.rs
@@ -22,16 +22,23 @@
         4usize,
         concat!("Alignment of ", stringify!(Rooted))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Rooted>())).ptr as *const _ as usize },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(Rooted),
-            "::",
-            stringify!(ptr)
-        )
-    );
+    fn test_field_ptr() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Rooted>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).ptr) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Rooted),
+                "::",
+                stringify!(ptr)
+            )
+        );
+    }
+    test_field_ptr();
 }
 impl Default for Rooted {
     fn default() -> Self {
diff --git a/tests/expectations/tests/libclang-9/call-conv-field.rs b/tests/expectations/tests/libclang-9/call-conv-field.rs
index f134bd8..f83181e 100644
--- a/tests/expectations/tests/libclang-9/call-conv-field.rs
+++ b/tests/expectations/tests/libclang-9/call-conv-field.rs
@@ -28,32 +28,42 @@
         8usize,
         concat!("Alignment of ", stringify!(JNINativeInterface_))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<JNINativeInterface_>())).GetVersion
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(JNINativeInterface_),
-            "::",
-            stringify!(GetVersion)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<JNINativeInterface_>())).__hack as *const _
-                as usize
-        },
-        8usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(JNINativeInterface_),
-            "::",
-            stringify!(__hack)
-        )
-    );
+    fn test_field_GetVersion() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<JNINativeInterface_>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).GetVersion) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(JNINativeInterface_),
+                "::",
+                stringify!(GetVersion)
+            )
+        );
+    }
+    test_field_GetVersion();
+    fn test_field___hack() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<JNINativeInterface_>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).__hack) as usize - ptr as usize
+            },
+            8usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(JNINativeInterface_),
+                "::",
+                stringify!(__hack)
+            )
+        );
+    }
+    test_field___hack();
 }
 extern "stdcall" {
     pub fn bar();
diff --git a/tests/expectations/tests/libclang-9/class.rs b/tests/expectations/tests/libclang-9/class.rs
index e4527de..82ab680 100644
--- a/tests/expectations/tests/libclang-9/class.rs
+++ b/tests/expectations/tests/libclang-9/class.rs
@@ -53,21 +53,35 @@
         4usize,
         concat!("Alignment of ", stringify!(C))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<C>())).a as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(C), "::", stringify!(a))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<C>())).big_array as *const _ as usize },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C),
-            "::",
-            stringify!(big_array)
-        )
-    );
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<C>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            0usize,
+            concat!("Offset of field: ", stringify!(C), "::", stringify!(a))
+        );
+    }
+    test_field_a();
+    fn test_field_big_array() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<C>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).big_array) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C),
+                "::",
+                stringify!(big_array)
+            )
+        );
+    }
+    test_field_big_array();
 }
 impl Default for C {
     fn default() -> Self {
@@ -96,45 +110,64 @@
         4usize,
         concat!("Alignment of ", stringify!(C_with_zero_length_array))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C_with_zero_length_array>())).a as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C_with_zero_length_array),
-            "::",
-            stringify!(a)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C_with_zero_length_array>())).big_array
-                as *const _ as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C_with_zero_length_array),
-            "::",
-            stringify!(big_array)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C_with_zero_length_array>()))
-                .zero_length_array as *const _ as usize
-        },
-        37usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C_with_zero_length_array),
-            "::",
-            stringify!(zero_length_array)
-        )
-    );
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<C_with_zero_length_array>::uninit(
+                    );
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C_with_zero_length_array),
+                "::",
+                stringify!(a)
+            )
+        );
+    }
+    test_field_a();
+    fn test_field_big_array() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<C_with_zero_length_array>::uninit(
+                    );
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).big_array) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C_with_zero_length_array),
+                "::",
+                stringify!(big_array)
+            )
+        );
+    }
+    test_field_big_array();
+    fn test_field_zero_length_array() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<C_with_zero_length_array>::uninit(
+                    );
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).zero_length_array) as usize -
+                    ptr as usize
+            },
+            37usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C_with_zero_length_array),
+                "::",
+                stringify!(zero_length_array)
+            )
+        );
+    }
+    test_field_zero_length_array();
 }
 impl Default for C_with_zero_length_array {
     fn default() -> Self {
@@ -163,32 +196,45 @@
         4usize,
         concat!("Alignment of ", stringify!(C_with_zero_length_array_2))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C_with_zero_length_array_2>())).a as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C_with_zero_length_array_2),
-            "::",
-            stringify!(a)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C_with_zero_length_array_2>()))
-                .zero_length_array as *const _ as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C_with_zero_length_array_2),
-            "::",
-            stringify!(zero_length_array)
-        )
-    );
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    C_with_zero_length_array_2,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C_with_zero_length_array_2),
+                "::",
+                stringify!(a)
+            )
+        );
+    }
+    test_field_a();
+    fn test_field_zero_length_array() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    C_with_zero_length_array_2,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).zero_length_array) as usize -
+                    ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C_with_zero_length_array_2),
+                "::",
+                stringify!(zero_length_array)
+            )
+        );
+    }
+    test_field_zero_length_array();
 }
 #[repr(C)]
 pub struct C_with_incomplete_array {
@@ -208,45 +254,64 @@
         4usize,
         concat!("Alignment of ", stringify!(C_with_incomplete_array))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C_with_incomplete_array>())).a as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C_with_incomplete_array),
-            "::",
-            stringify!(a)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C_with_incomplete_array>())).big_array
-                as *const _ as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C_with_incomplete_array),
-            "::",
-            stringify!(big_array)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C_with_incomplete_array>())).incomplete_array
-                as *const _ as usize
-        },
-        37usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C_with_incomplete_array),
-            "::",
-            stringify!(incomplete_array)
-        )
-    );
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<C_with_incomplete_array>::uninit(
+                    );
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C_with_incomplete_array),
+                "::",
+                stringify!(a)
+            )
+        );
+    }
+    test_field_a();
+    fn test_field_big_array() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<C_with_incomplete_array>::uninit(
+                    );
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).big_array) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C_with_incomplete_array),
+                "::",
+                stringify!(big_array)
+            )
+        );
+    }
+    test_field_big_array();
+    fn test_field_incomplete_array() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<C_with_incomplete_array>::uninit(
+                    );
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).incomplete_array) as usize -
+                    ptr as usize
+            },
+            37usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C_with_incomplete_array),
+                "::",
+                stringify!(incomplete_array)
+            )
+        );
+    }
+    test_field_incomplete_array();
 }
 impl Default for C_with_incomplete_array {
     fn default() -> Self {
@@ -275,32 +340,41 @@
         4usize,
         concat!("Alignment of ", stringify!(C_with_incomplete_array_2))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C_with_incomplete_array_2>())).a as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C_with_incomplete_array_2),
-            "::",
-            stringify!(a)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C_with_incomplete_array_2>()))
-                .incomplete_array as *const _ as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C_with_incomplete_array_2),
-            "::",
-            stringify!(incomplete_array)
-        )
-    );
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit = :: std :: mem :: MaybeUninit :: < C_with_incomplete_array_2 > :: uninit () ;
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C_with_incomplete_array_2),
+                "::",
+                stringify!(a)
+            )
+        );
+    }
+    test_field_a();
+    fn test_field_incomplete_array() {
+        assert_eq!(
+            unsafe {
+                let uninit = :: std :: mem :: MaybeUninit :: < C_with_incomplete_array_2 > :: uninit () ;
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).incomplete_array) as usize -
+                    ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C_with_incomplete_array_2),
+                "::",
+                stringify!(incomplete_array)
+            )
+        );
+    }
+    test_field_incomplete_array();
 }
 #[repr(C)]
 pub struct C_with_zero_length_array_and_incomplete_array {
@@ -327,66 +401,84 @@
             stringify!(C_with_zero_length_array_and_incomplete_array)
         )
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<
-                C_with_zero_length_array_and_incomplete_array,
-            >()))
-            .a as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C_with_zero_length_array_and_incomplete_array),
-            "::",
-            stringify!(a)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<
-                C_with_zero_length_array_and_incomplete_array,
-            >()))
-            .big_array as *const _ as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C_with_zero_length_array_and_incomplete_array),
-            "::",
-            stringify!(big_array)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<
-                C_with_zero_length_array_and_incomplete_array,
-            >()))
-            .zero_length_array as *const _ as usize
-        },
-        37usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C_with_zero_length_array_and_incomplete_array),
-            "::",
-            stringify!(zero_length_array)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<
-                C_with_zero_length_array_and_incomplete_array,
-            >()))
-            .incomplete_array as *const _ as usize
-        },
-        37usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C_with_zero_length_array_and_incomplete_array),
-            "::",
-            stringify!(incomplete_array)
-        )
-    );
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    C_with_zero_length_array_and_incomplete_array,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C_with_zero_length_array_and_incomplete_array),
+                "::",
+                stringify!(a)
+            )
+        );
+    }
+    test_field_a();
+    fn test_field_big_array() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    C_with_zero_length_array_and_incomplete_array,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).big_array) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C_with_zero_length_array_and_incomplete_array),
+                "::",
+                stringify!(big_array)
+            )
+        );
+    }
+    test_field_big_array();
+    fn test_field_zero_length_array() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    C_with_zero_length_array_and_incomplete_array,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).zero_length_array) as usize -
+                    ptr as usize
+            },
+            37usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C_with_zero_length_array_and_incomplete_array),
+                "::",
+                stringify!(zero_length_array)
+            )
+        );
+    }
+    test_field_zero_length_array();
+    fn test_field_incomplete_array() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    C_with_zero_length_array_and_incomplete_array,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).incomplete_array) as usize -
+                    ptr as usize
+            },
+            37usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C_with_zero_length_array_and_incomplete_array),
+                "::",
+                stringify!(incomplete_array)
+            )
+        );
+    }
+    test_field_incomplete_array();
 }
 impl Default for C_with_zero_length_array_and_incomplete_array {
     fn default() -> Self {
@@ -424,51 +516,65 @@
             stringify!(C_with_zero_length_array_and_incomplete_array_2)
         )
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<
-                C_with_zero_length_array_and_incomplete_array_2,
-            >()))
-            .a as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C_with_zero_length_array_and_incomplete_array_2),
-            "::",
-            stringify!(a)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<
-                C_with_zero_length_array_and_incomplete_array_2,
-            >()))
-            .zero_length_array as *const _ as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C_with_zero_length_array_and_incomplete_array_2),
-            "::",
-            stringify!(zero_length_array)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<
-                C_with_zero_length_array_and_incomplete_array_2,
-            >()))
-            .incomplete_array as *const _ as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C_with_zero_length_array_and_incomplete_array_2),
-            "::",
-            stringify!(incomplete_array)
-        )
-    );
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    C_with_zero_length_array_and_incomplete_array_2,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C_with_zero_length_array_and_incomplete_array_2),
+                "::",
+                stringify!(a)
+            )
+        );
+    }
+    test_field_a();
+    fn test_field_zero_length_array() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    C_with_zero_length_array_and_incomplete_array_2,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).zero_length_array) as usize -
+                    ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C_with_zero_length_array_and_incomplete_array_2),
+                "::",
+                stringify!(zero_length_array)
+            )
+        );
+    }
+    test_field_zero_length_array();
+    fn test_field_incomplete_array() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    C_with_zero_length_array_and_incomplete_array_2,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).incomplete_array) as usize -
+                    ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C_with_zero_length_array_and_incomplete_array_2),
+                "::",
+                stringify!(incomplete_array)
+            )
+        );
+    }
+    test_field_incomplete_array();
 }
 #[repr(C)]
 #[derive(Debug, Default, Hash, PartialOrd, Ord, PartialEq, Eq)]
@@ -487,16 +593,23 @@
         4usize,
         concat!("Alignment of ", stringify!(WithDtor))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<WithDtor>())).b as *const _ as usize },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(WithDtor),
-            "::",
-            stringify!(b)
-        )
-    );
+    fn test_field_b() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<WithDtor>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(WithDtor),
+                "::",
+                stringify!(b)
+            )
+        );
+    }
+    test_field_b();
 }
 #[repr(C)]
 pub struct IncompleteArrayNonCopiable {
@@ -515,32 +628,45 @@
         8usize,
         concat!("Alignment of ", stringify!(IncompleteArrayNonCopiable))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<IncompleteArrayNonCopiable>())).whatever
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(IncompleteArrayNonCopiable),
-            "::",
-            stringify!(whatever)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<IncompleteArrayNonCopiable>()))
-                .incomplete_array as *const _ as usize
-        },
-        8usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(IncompleteArrayNonCopiable),
-            "::",
-            stringify!(incomplete_array)
-        )
-    );
+    fn test_field_whatever() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    IncompleteArrayNonCopiable,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).whatever) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(IncompleteArrayNonCopiable),
+                "::",
+                stringify!(whatever)
+            )
+        );
+    }
+    test_field_whatever();
+    fn test_field_incomplete_array() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    IncompleteArrayNonCopiable,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).incomplete_array) as usize -
+                    ptr as usize
+            },
+            8usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(IncompleteArrayNonCopiable),
+                "::",
+                stringify!(incomplete_array)
+            )
+        );
+    }
+    test_field_incomplete_array();
 }
 impl Default for IncompleteArrayNonCopiable {
     fn default() -> Self {
@@ -569,16 +695,40 @@
         4usize,
         concat!("Alignment of ", stringify!(Union))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Union>())).d as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(Union), "::", stringify!(d))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Union>())).i as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(Union), "::", stringify!(i))
-    );
+    fn test_field_d() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Union>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).d) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Union),
+                "::",
+                stringify!(d)
+            )
+        );
+    }
+    test_field_d();
+    fn test_field_i() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Union>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).i) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Union),
+                "::",
+                stringify!(i)
+            )
+        );
+    }
+    test_field_i();
 }
 impl Default for Union {
     fn default() -> Self {
@@ -606,18 +756,23 @@
         4usize,
         concat!("Alignment of ", stringify!(WithUnion))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<WithUnion>())).data as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(WithUnion),
-            "::",
-            stringify!(data)
-        )
-    );
+    fn test_field_data() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<WithUnion>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).data) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(WithUnion),
+                "::",
+                stringify!(data)
+            )
+        );
+    }
+    test_field_data();
 }
 impl Default for WithUnion {
     fn default() -> Self {
diff --git a/tests/expectations/tests/libclang-9/class_1_0.rs b/tests/expectations/tests/libclang-9/class_1_0.rs
index 4263bd1..604dde7 100644
--- a/tests/expectations/tests/libclang-9/class_1_0.rs
+++ b/tests/expectations/tests/libclang-9/class_1_0.rs
@@ -96,21 +96,35 @@
         4usize,
         concat!("Alignment of ", stringify!(C))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<C>())).a as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(C), "::", stringify!(a))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<C>())).big_array as *const _ as usize },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C),
-            "::",
-            stringify!(big_array)
-        )
-    );
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<C>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            0usize,
+            concat!("Offset of field: ", stringify!(C), "::", stringify!(a))
+        );
+    }
+    test_field_a();
+    fn test_field_big_array() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<C>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).big_array) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C),
+                "::",
+                stringify!(big_array)
+            )
+        );
+    }
+    test_field_big_array();
 }
 impl Clone for C {
     fn clone(&self) -> Self {
@@ -149,45 +163,64 @@
         4usize,
         concat!("Alignment of ", stringify!(C_with_zero_length_array))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C_with_zero_length_array>())).a as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C_with_zero_length_array),
-            "::",
-            stringify!(a)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C_with_zero_length_array>())).big_array
-                as *const _ as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C_with_zero_length_array),
-            "::",
-            stringify!(big_array)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C_with_zero_length_array>()))
-                .zero_length_array as *const _ as usize
-        },
-        37usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C_with_zero_length_array),
-            "::",
-            stringify!(zero_length_array)
-        )
-    );
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<C_with_zero_length_array>::uninit(
+                    );
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C_with_zero_length_array),
+                "::",
+                stringify!(a)
+            )
+        );
+    }
+    test_field_a();
+    fn test_field_big_array() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<C_with_zero_length_array>::uninit(
+                    );
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).big_array) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C_with_zero_length_array),
+                "::",
+                stringify!(big_array)
+            )
+        );
+    }
+    test_field_big_array();
+    fn test_field_zero_length_array() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<C_with_zero_length_array>::uninit(
+                    );
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).zero_length_array) as usize -
+                    ptr as usize
+            },
+            37usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C_with_zero_length_array),
+                "::",
+                stringify!(zero_length_array)
+            )
+        );
+    }
+    test_field_zero_length_array();
 }
 impl Default for C_with_zero_length_array {
     fn default() -> Self {
@@ -216,32 +249,45 @@
         4usize,
         concat!("Alignment of ", stringify!(C_with_zero_length_array_2))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C_with_zero_length_array_2>())).a as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C_with_zero_length_array_2),
-            "::",
-            stringify!(a)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C_with_zero_length_array_2>()))
-                .zero_length_array as *const _ as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C_with_zero_length_array_2),
-            "::",
-            stringify!(zero_length_array)
-        )
-    );
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    C_with_zero_length_array_2,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C_with_zero_length_array_2),
+                "::",
+                stringify!(a)
+            )
+        );
+    }
+    test_field_a();
+    fn test_field_zero_length_array() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    C_with_zero_length_array_2,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).zero_length_array) as usize -
+                    ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C_with_zero_length_array_2),
+                "::",
+                stringify!(zero_length_array)
+            )
+        );
+    }
+    test_field_zero_length_array();
 }
 #[repr(C)]
 pub struct C_with_incomplete_array {
@@ -261,45 +307,64 @@
         4usize,
         concat!("Alignment of ", stringify!(C_with_incomplete_array))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C_with_incomplete_array>())).a as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C_with_incomplete_array),
-            "::",
-            stringify!(a)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C_with_incomplete_array>())).big_array
-                as *const _ as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C_with_incomplete_array),
-            "::",
-            stringify!(big_array)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C_with_incomplete_array>())).incomplete_array
-                as *const _ as usize
-        },
-        37usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C_with_incomplete_array),
-            "::",
-            stringify!(incomplete_array)
-        )
-    );
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<C_with_incomplete_array>::uninit(
+                    );
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C_with_incomplete_array),
+                "::",
+                stringify!(a)
+            )
+        );
+    }
+    test_field_a();
+    fn test_field_big_array() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<C_with_incomplete_array>::uninit(
+                    );
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).big_array) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C_with_incomplete_array),
+                "::",
+                stringify!(big_array)
+            )
+        );
+    }
+    test_field_big_array();
+    fn test_field_incomplete_array() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<C_with_incomplete_array>::uninit(
+                    );
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).incomplete_array) as usize -
+                    ptr as usize
+            },
+            37usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C_with_incomplete_array),
+                "::",
+                stringify!(incomplete_array)
+            )
+        );
+    }
+    test_field_incomplete_array();
 }
 impl Default for C_with_incomplete_array {
     fn default() -> Self {
@@ -328,32 +393,41 @@
         4usize,
         concat!("Alignment of ", stringify!(C_with_incomplete_array_2))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C_with_incomplete_array_2>())).a as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C_with_incomplete_array_2),
-            "::",
-            stringify!(a)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C_with_incomplete_array_2>()))
-                .incomplete_array as *const _ as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C_with_incomplete_array_2),
-            "::",
-            stringify!(incomplete_array)
-        )
-    );
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit = :: std :: mem :: MaybeUninit :: < C_with_incomplete_array_2 > :: uninit () ;
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C_with_incomplete_array_2),
+                "::",
+                stringify!(a)
+            )
+        );
+    }
+    test_field_a();
+    fn test_field_incomplete_array() {
+        assert_eq!(
+            unsafe {
+                let uninit = :: std :: mem :: MaybeUninit :: < C_with_incomplete_array_2 > :: uninit () ;
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).incomplete_array) as usize -
+                    ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C_with_incomplete_array_2),
+                "::",
+                stringify!(incomplete_array)
+            )
+        );
+    }
+    test_field_incomplete_array();
 }
 #[repr(C)]
 pub struct C_with_zero_length_array_and_incomplete_array {
@@ -380,66 +454,84 @@
             stringify!(C_with_zero_length_array_and_incomplete_array)
         )
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<
-                C_with_zero_length_array_and_incomplete_array,
-            >()))
-            .a as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C_with_zero_length_array_and_incomplete_array),
-            "::",
-            stringify!(a)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<
-                C_with_zero_length_array_and_incomplete_array,
-            >()))
-            .big_array as *const _ as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C_with_zero_length_array_and_incomplete_array),
-            "::",
-            stringify!(big_array)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<
-                C_with_zero_length_array_and_incomplete_array,
-            >()))
-            .zero_length_array as *const _ as usize
-        },
-        37usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C_with_zero_length_array_and_incomplete_array),
-            "::",
-            stringify!(zero_length_array)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<
-                C_with_zero_length_array_and_incomplete_array,
-            >()))
-            .incomplete_array as *const _ as usize
-        },
-        37usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C_with_zero_length_array_and_incomplete_array),
-            "::",
-            stringify!(incomplete_array)
-        )
-    );
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    C_with_zero_length_array_and_incomplete_array,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C_with_zero_length_array_and_incomplete_array),
+                "::",
+                stringify!(a)
+            )
+        );
+    }
+    test_field_a();
+    fn test_field_big_array() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    C_with_zero_length_array_and_incomplete_array,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).big_array) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C_with_zero_length_array_and_incomplete_array),
+                "::",
+                stringify!(big_array)
+            )
+        );
+    }
+    test_field_big_array();
+    fn test_field_zero_length_array() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    C_with_zero_length_array_and_incomplete_array,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).zero_length_array) as usize -
+                    ptr as usize
+            },
+            37usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C_with_zero_length_array_and_incomplete_array),
+                "::",
+                stringify!(zero_length_array)
+            )
+        );
+    }
+    test_field_zero_length_array();
+    fn test_field_incomplete_array() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    C_with_zero_length_array_and_incomplete_array,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).incomplete_array) as usize -
+                    ptr as usize
+            },
+            37usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C_with_zero_length_array_and_incomplete_array),
+                "::",
+                stringify!(incomplete_array)
+            )
+        );
+    }
+    test_field_incomplete_array();
 }
 impl Default for C_with_zero_length_array_and_incomplete_array {
     fn default() -> Self {
@@ -477,51 +569,65 @@
             stringify!(C_with_zero_length_array_and_incomplete_array_2)
         )
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<
-                C_with_zero_length_array_and_incomplete_array_2,
-            >()))
-            .a as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C_with_zero_length_array_and_incomplete_array_2),
-            "::",
-            stringify!(a)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<
-                C_with_zero_length_array_and_incomplete_array_2,
-            >()))
-            .zero_length_array as *const _ as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C_with_zero_length_array_and_incomplete_array_2),
-            "::",
-            stringify!(zero_length_array)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<
-                C_with_zero_length_array_and_incomplete_array_2,
-            >()))
-            .incomplete_array as *const _ as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C_with_zero_length_array_and_incomplete_array_2),
-            "::",
-            stringify!(incomplete_array)
-        )
-    );
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    C_with_zero_length_array_and_incomplete_array_2,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C_with_zero_length_array_and_incomplete_array_2),
+                "::",
+                stringify!(a)
+            )
+        );
+    }
+    test_field_a();
+    fn test_field_zero_length_array() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    C_with_zero_length_array_and_incomplete_array_2,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).zero_length_array) as usize -
+                    ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C_with_zero_length_array_and_incomplete_array_2),
+                "::",
+                stringify!(zero_length_array)
+            )
+        );
+    }
+    test_field_zero_length_array();
+    fn test_field_incomplete_array() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    C_with_zero_length_array_and_incomplete_array_2,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).incomplete_array) as usize -
+                    ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C_with_zero_length_array_and_incomplete_array_2),
+                "::",
+                stringify!(incomplete_array)
+            )
+        );
+    }
+    test_field_incomplete_array();
 }
 #[repr(C)]
 #[derive(Debug, Default, Hash, PartialEq, Eq)]
@@ -540,16 +646,23 @@
         4usize,
         concat!("Alignment of ", stringify!(WithDtor))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<WithDtor>())).b as *const _ as usize },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(WithDtor),
-            "::",
-            stringify!(b)
-        )
-    );
+    fn test_field_b() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<WithDtor>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(WithDtor),
+                "::",
+                stringify!(b)
+            )
+        );
+    }
+    test_field_b();
 }
 #[repr(C)]
 pub struct IncompleteArrayNonCopiable {
@@ -568,32 +681,45 @@
         8usize,
         concat!("Alignment of ", stringify!(IncompleteArrayNonCopiable))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<IncompleteArrayNonCopiable>())).whatever
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(IncompleteArrayNonCopiable),
-            "::",
-            stringify!(whatever)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<IncompleteArrayNonCopiable>()))
-                .incomplete_array as *const _ as usize
-        },
-        8usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(IncompleteArrayNonCopiable),
-            "::",
-            stringify!(incomplete_array)
-        )
-    );
+    fn test_field_whatever() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    IncompleteArrayNonCopiable,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).whatever) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(IncompleteArrayNonCopiable),
+                "::",
+                stringify!(whatever)
+            )
+        );
+    }
+    test_field_whatever();
+    fn test_field_incomplete_array() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    IncompleteArrayNonCopiable,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).incomplete_array) as usize -
+                    ptr as usize
+            },
+            8usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(IncompleteArrayNonCopiable),
+                "::",
+                stringify!(incomplete_array)
+            )
+        );
+    }
+    test_field_incomplete_array();
 }
 impl Default for IncompleteArrayNonCopiable {
     fn default() -> Self {
@@ -623,16 +749,40 @@
         4usize,
         concat!("Alignment of ", stringify!(Union))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Union>())).d as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(Union), "::", stringify!(d))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Union>())).i as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(Union), "::", stringify!(i))
-    );
+    fn test_field_d() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Union>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).d) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Union),
+                "::",
+                stringify!(d)
+            )
+        );
+    }
+    test_field_d();
+    fn test_field_i() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Union>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).i) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Union),
+                "::",
+                stringify!(i)
+            )
+        );
+    }
+    test_field_i();
 }
 impl Clone for Union {
     fn clone(&self) -> Self {
@@ -656,18 +806,23 @@
         4usize,
         concat!("Alignment of ", stringify!(WithUnion))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<WithUnion>())).data as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(WithUnion),
-            "::",
-            stringify!(data)
-        )
-    );
+    fn test_field_data() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<WithUnion>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).data) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(WithUnion),
+                "::",
+                stringify!(data)
+            )
+        );
+    }
+    test_field_data();
 }
 impl Clone for WithUnion {
     fn clone(&self) -> Self {
diff --git a/tests/expectations/tests/libclang-9/constant-evaluate.rs b/tests/expectations/tests/libclang-9/constant-evaluate.rs
index df2638f..9debe39 100644
--- a/tests/expectations/tests/libclang-9/constant-evaluate.rs
+++ b/tests/expectations/tests/libclang-9/constant-evaluate.rs
@@ -21,5 +21,5 @@
 pub const fuzz: f64 = 51.0;
 pub const BAZZ: ::std::os::raw::c_char = 53;
 pub const WAT: ::std::os::raw::c_char = 0;
-pub const bytestring: &'static [u8; 4usize] = b"Foo\0";
+pub const bytestring: &[u8; 4usize] = b"Foo\0";
 pub const NOT_UTF8: [u8; 5usize] = [240u8, 40u8, 140u8, 40u8, 0u8];
diff --git a/tests/expectations/tests/libclang-9/derive-hash-struct-with-incomplete-array.rs b/tests/expectations/tests/libclang-9/derive-hash-struct-with-incomplete-array.rs
index 32607b3..2365d9a 100644
--- a/tests/expectations/tests/libclang-9/derive-hash-struct-with-incomplete-array.rs
+++ b/tests/expectations/tests/libclang-9/derive-hash-struct-with-incomplete-array.rs
@@ -53,24 +53,36 @@
         4usize,
         concat!("Alignment of ", stringify!(test))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<test>())).a as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(test), "::", stringify!(a))
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<test>())).zero_length_array as *const _
-                as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(test),
-            "::",
-            stringify!(zero_length_array)
-        )
-    );
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<test>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            0usize,
+            concat!("Offset of field: ", stringify!(test), "::", stringify!(a))
+        );
+    }
+    test_field_a();
+    fn test_field_zero_length_array() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<test>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).zero_length_array) as usize -
+                    ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(test),
+                "::",
+                stringify!(zero_length_array)
+            )
+        );
+    }
+    test_field_zero_length_array();
 }
 #[repr(C)]
 #[derive(Debug, Default)]
@@ -90,24 +102,41 @@
         4usize,
         concat!("Alignment of ", stringify!(test2))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<test2>())).a as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(test2), "::", stringify!(a))
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<test2>())).incomplete_array as *const _
-                as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(test2),
-            "::",
-            stringify!(incomplete_array)
-        )
-    );
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<test2>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(test2),
+                "::",
+                stringify!(a)
+            )
+        );
+    }
+    test_field_a();
+    fn test_field_incomplete_array() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<test2>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).incomplete_array) as usize -
+                    ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(test2),
+                "::",
+                stringify!(incomplete_array)
+            )
+        );
+    }
+    test_field_incomplete_array();
 }
 #[repr(C)]
 #[derive(Debug, Default)]
@@ -128,35 +157,57 @@
         4usize,
         concat!("Alignment of ", stringify!(test3))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<test3>())).a as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(test3), "::", stringify!(a))
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<test3>())).zero_length_array as *const _
-                as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(test3),
-            "::",
-            stringify!(zero_length_array)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<test3>())).incomplete_array as *const _
-                as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(test3),
-            "::",
-            stringify!(incomplete_array)
-        )
-    );
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<test3>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(test3),
+                "::",
+                stringify!(a)
+            )
+        );
+    }
+    test_field_a();
+    fn test_field_zero_length_array() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<test3>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).zero_length_array) as usize -
+                    ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(test3),
+                "::",
+                stringify!(zero_length_array)
+            )
+        );
+    }
+    test_field_zero_length_array();
+    fn test_field_incomplete_array() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<test3>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).incomplete_array) as usize -
+                    ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(test3),
+                "::",
+                stringify!(incomplete_array)
+            )
+        );
+    }
+    test_field_incomplete_array();
 }
diff --git a/tests/expectations/tests/libclang-9/incomplete-array-padding.rs b/tests/expectations/tests/libclang-9/incomplete-array-padding.rs
index 382195d..d796cc6 100644
--- a/tests/expectations/tests/libclang-9/incomplete-array-padding.rs
+++ b/tests/expectations/tests/libclang-9/incomplete-array-padding.rs
@@ -140,11 +140,18 @@
         8usize,
         concat!("Alignment of ", stringify!(foo))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<foo>())).b as *const _ as usize },
-        8usize,
-        concat!("Offset of field: ", stringify!(foo), "::", stringify!(b))
-    );
+    fn test_field_b() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<foo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize
+            },
+            8usize,
+            concat!("Offset of field: ", stringify!(foo), "::", stringify!(b))
+        );
+    }
+    test_field_b();
 }
 impl Default for foo {
     fn default() -> Self {
diff --git a/tests/expectations/tests/libclang-9/issue-643-inner-struct.rs b/tests/expectations/tests/libclang-9/issue-643-inner-struct.rs
index 49664cd..53f1254 100644
--- a/tests/expectations/tests/libclang-9/issue-643-inner-struct.rs
+++ b/tests/expectations/tests/libclang-9/issue-643-inner-struct.rs
@@ -60,19 +60,23 @@
         4usize,
         concat!("Alignment of ", stringify!(rte_ring_prod))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_ring_prod>())).watermark as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_ring_prod),
-            "::",
-            stringify!(watermark)
-        )
-    );
+    fn test_field_watermark() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_ring_prod>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).watermark) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_ring_prod),
+                "::",
+                stringify!(watermark)
+            )
+        );
+    }
+    test_field_watermark();
 }
 #[repr(C)]
 #[derive(Debug, Default, Copy, Clone)]
@@ -91,19 +95,23 @@
         4usize,
         concat!("Alignment of ", stringify!(rte_ring_cons))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_ring_cons>())).sc_dequeue as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_ring_cons),
-            "::",
-            stringify!(sc_dequeue)
-        )
-    );
+    fn test_field_sc_dequeue() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_ring_cons>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).sc_dequeue) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_ring_cons),
+                "::",
+                stringify!(sc_dequeue)
+            )
+        );
+    }
+    test_field_sc_dequeue();
 }
 #[test]
 fn bindgen_test_layout_rte_ring() {
@@ -117,54 +125,74 @@
         8usize,
         concat!("Alignment of ", stringify!(rte_ring))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_ring>())).memzone as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_ring),
-            "::",
-            stringify!(memzone)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_ring>())).prod as *const _ as usize
-        },
-        8usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_ring),
-            "::",
-            stringify!(prod)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_ring>())).cons as *const _ as usize
-        },
-        12usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_ring),
-            "::",
-            stringify!(cons)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_ring>())).ring as *const _ as usize
-        },
-        16usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_ring),
-            "::",
-            stringify!(ring)
-        )
-    );
+    fn test_field_memzone() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_ring>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).memzone) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_ring),
+                "::",
+                stringify!(memzone)
+            )
+        );
+    }
+    test_field_memzone();
+    fn test_field_prod() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_ring>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).prod) as usize - ptr as usize
+            },
+            8usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_ring),
+                "::",
+                stringify!(prod)
+            )
+        );
+    }
+    test_field_prod();
+    fn test_field_cons() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_ring>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).cons) as usize - ptr as usize
+            },
+            12usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_ring),
+                "::",
+                stringify!(cons)
+            )
+        );
+    }
+    test_field_cons();
+    fn test_field_ring() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_ring>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).ring) as usize - ptr as usize
+            },
+            16usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_ring),
+                "::",
+                stringify!(ring)
+            )
+        );
+    }
+    test_field_ring();
 }
 impl Default for rte_ring {
     fn default() -> Self {
diff --git a/tests/expectations/tests/libclang-9/layout_align.rs b/tests/expectations/tests/libclang-9/layout_align.rs
index 4ad5417..2ecbb6f 100644
--- a/tests/expectations/tests/libclang-9/layout_align.rs
+++ b/tests/expectations/tests/libclang-9/layout_align.rs
@@ -147,67 +147,91 @@
         8usize,
         concat!("Alignment of ", stringify!(rte_kni_fifo))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_kni_fifo>())).write as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_kni_fifo),
-            "::",
-            stringify!(write)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_kni_fifo>())).read as *const _ as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_kni_fifo),
-            "::",
-            stringify!(read)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_kni_fifo>())).len as *const _ as usize
-        },
-        8usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_kni_fifo),
-            "::",
-            stringify!(len)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_kni_fifo>())).elem_size as *const _
-                as usize
-        },
-        12usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_kni_fifo),
-            "::",
-            stringify!(elem_size)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_kni_fifo>())).buffer as *const _ as usize
-        },
-        16usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_kni_fifo),
-            "::",
-            stringify!(buffer)
-        )
-    );
+    fn test_field_write() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_kni_fifo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).write) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_kni_fifo),
+                "::",
+                stringify!(write)
+            )
+        );
+    }
+    test_field_write();
+    fn test_field_read() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_kni_fifo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).read) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_kni_fifo),
+                "::",
+                stringify!(read)
+            )
+        );
+    }
+    test_field_read();
+    fn test_field_len() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_kni_fifo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).len) as usize - ptr as usize
+            },
+            8usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_kni_fifo),
+                "::",
+                stringify!(len)
+            )
+        );
+    }
+    test_field_len();
+    fn test_field_elem_size() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_kni_fifo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).elem_size) as usize - ptr as usize
+            },
+            12usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_kni_fifo),
+                "::",
+                stringify!(elem_size)
+            )
+        );
+    }
+    test_field_elem_size();
+    fn test_field_buffer() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_kni_fifo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).buffer) as usize - ptr as usize
+            },
+            16usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_kni_fifo),
+                "::",
+                stringify!(buffer)
+            )
+        );
+    }
+    test_field_buffer();
 }
 impl Default for rte_kni_fifo {
     fn default() -> Self {
@@ -240,19 +264,23 @@
         8usize,
         concat!("Alignment of ", stringify!(rte_eth_link))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_link>())).link_speed as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_link),
-            "::",
-            stringify!(link_speed)
-        )
-    );
+    fn test_field_link_speed() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<rte_eth_link>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).link_speed) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(rte_eth_link),
+                "::",
+                stringify!(link_speed)
+            )
+        );
+    }
+    test_field_link_speed();
 }
 impl rte_eth_link {
     #[inline]
diff --git a/tests/expectations/tests/libclang-9/objc_inheritance.rs b/tests/expectations/tests/libclang-9/objc_inheritance.rs
index 5f07dba..f1c2a88 100644
--- a/tests/expectations/tests/libclang-9/objc_inheritance.rs
+++ b/tests/expectations/tests/libclang-9/objc_inheritance.rs
@@ -6,12 +6,11 @@
 )]
 #![cfg(target_os = "macos")]
 
-#[macro_use]
-extern crate objc;
+use objc::{self, class, msg_send, sel, sel_impl};
 #[allow(non_camel_case_types)]
 pub type id = *mut objc::runtime::Object;
 #[repr(transparent)]
-#[derive(Clone)]
+#[derive(Debug, Copy, Clone)]
 pub struct Foo(pub id);
 impl std::ops::Deref for Foo {
     type Target = objc::runtime::Object;
@@ -22,13 +21,13 @@
 unsafe impl objc::Message for Foo {}
 impl Foo {
     pub fn alloc() -> Self {
-        Self(unsafe { msg_send!(objc::class!(Foo), alloc) })
+        Self(unsafe { msg_send!(class!(Foo), alloc) })
     }
 }
 impl IFoo for Foo {}
 pub trait IFoo: Sized + std::ops::Deref {}
 #[repr(transparent)]
-#[derive(Clone)]
+#[derive(Debug, Copy, Clone)]
 pub struct Bar(pub id);
 impl std::ops::Deref for Bar {
     type Target = objc::runtime::Object;
@@ -39,7 +38,7 @@
 unsafe impl objc::Message for Bar {}
 impl Bar {
     pub fn alloc() -> Self {
-        Self(unsafe { msg_send!(objc::class!(Bar), alloc) })
+        Self(unsafe { msg_send!(class!(Bar), alloc) })
     }
 }
 impl IFoo for Bar {}
@@ -63,7 +62,7 @@
 impl IBar for Bar {}
 pub trait IBar: Sized + std::ops::Deref {}
 #[repr(transparent)]
-#[derive(Clone)]
+#[derive(Debug, Copy, Clone)]
 pub struct Baz(pub id);
 impl std::ops::Deref for Baz {
     type Target = objc::runtime::Object;
@@ -74,7 +73,7 @@
 unsafe impl objc::Message for Baz {}
 impl Baz {
     pub fn alloc() -> Self {
-        Self(unsafe { msg_send!(objc::class!(Baz), alloc) })
+        Self(unsafe { msg_send!(class!(Baz), alloc) })
     }
 }
 impl IBar for Baz {}
diff --git a/tests/expectations/tests/libclang-9/objc_template.rs b/tests/expectations/tests/libclang-9/objc_template.rs
index 88cf209..3c61503 100644
--- a/tests/expectations/tests/libclang-9/objc_template.rs
+++ b/tests/expectations/tests/libclang-9/objc_template.rs
@@ -6,12 +6,11 @@
 )]
 #![cfg(target_os = "macos")]
 
-#[macro_use]
-extern crate objc;
+use objc::{self, class, msg_send, sel, sel_impl};
 #[allow(non_camel_case_types)]
 pub type id = *mut objc::runtime::Object;
 #[repr(transparent)]
-#[derive(Clone)]
+#[derive(Debug, Copy, Clone)]
 pub struct Foo(pub id);
 impl std::ops::Deref for Foo {
     type Target = objc::runtime::Object;
@@ -22,11 +21,11 @@
 unsafe impl objc::Message for Foo {}
 impl Foo {
     pub fn alloc() -> Self {
-        Self(unsafe { msg_send!(objc::class!(Foo), alloc) })
+        Self(unsafe { msg_send!(class!(Foo), alloc) })
     }
 }
 impl<ObjectType: 'static> IFoo<ObjectType> for Foo {}
-pub trait IFoo<ObjectType>: Sized + std::ops::Deref {
+pub trait IFoo<ObjectType: 'static>: Sized + std::ops::Deref {
     unsafe fn get(&self) -> u64
     where
         <Self as std::ops::Deref>::Target: objc::Message + Sized,
@@ -35,7 +34,7 @@
     }
 }
 #[repr(transparent)]
-#[derive(Clone)]
+#[derive(Debug, Copy, Clone)]
 pub struct FooMultiGeneric(pub id);
 impl std::ops::Deref for FooMultiGeneric {
     type Target = objc::runtime::Object;
@@ -46,14 +45,14 @@
 unsafe impl objc::Message for FooMultiGeneric {}
 impl FooMultiGeneric {
     pub fn alloc() -> Self {
-        Self(unsafe { msg_send!(objc::class!(FooMultiGeneric), alloc) })
+        Self(unsafe { msg_send!(class!(FooMultiGeneric), alloc) })
     }
 }
 impl<KeyType: 'static, ObjectType: 'static>
     IFooMultiGeneric<KeyType, ObjectType> for FooMultiGeneric
 {
 }
-pub trait IFooMultiGeneric<KeyType, ObjectType>:
+pub trait IFooMultiGeneric<KeyType: 'static, ObjectType: 'static>:
     Sized + std::ops::Deref
 {
     unsafe fn objectForKey_(&self, key: u64) -> u64
diff --git a/tests/expectations/tests/libclang-9/type_alias_template_specialized.rs b/tests/expectations/tests/libclang-9/type_alias_template_specialized.rs
index f874e9d..213d4cd 100644
--- a/tests/expectations/tests/libclang-9/type_alias_template_specialized.rs
+++ b/tests/expectations/tests/libclang-9/type_alias_template_specialized.rs
@@ -22,16 +22,23 @@
         4usize,
         concat!("Alignment of ", stringify!(Rooted))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Rooted>())).ptr as *const _ as usize },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(Rooted),
-            "::",
-            stringify!(ptr)
-        )
-    );
+    fn test_field_ptr() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Rooted>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).ptr) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Rooted),
+                "::",
+                stringify!(ptr)
+            )
+        );
+    }
+    test_field_ptr();
 }
 impl Default for Rooted {
     fn default() -> Self {
diff --git a/tests/expectations/tests/libclang-9/zero-sized-array.rs b/tests/expectations/tests/libclang-9/zero-sized-array.rs
index 6514b93..185b8e2 100644
--- a/tests/expectations/tests/libclang-9/zero-sized-array.rs
+++ b/tests/expectations/tests/libclang-9/zero-sized-array.rs
@@ -53,18 +53,24 @@
         1usize,
         concat!("Alignment of ", stringify!(ZeroSizedArray))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ZeroSizedArray>())).arr as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(ZeroSizedArray),
-            "::",
-            stringify!(arr)
-        )
-    );
+    fn test_field_arr() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<ZeroSizedArray>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).arr) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(ZeroSizedArray),
+                "::",
+                stringify!(arr)
+            )
+        );
+    }
+    test_field_arr();
 }
 /// And nor should this get an `_address` field.
 #[repr(C)]
@@ -84,19 +90,24 @@
         1usize,
         concat!("Alignment of ", stringify!(ContainsZeroSizedArray))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ContainsZeroSizedArray>())).zsa as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(ContainsZeroSizedArray),
-            "::",
-            stringify!(zsa)
-        )
-    );
+    fn test_field_zsa() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<ContainsZeroSizedArray>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).zsa) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(ContainsZeroSizedArray),
+                "::",
+                stringify!(zsa)
+            )
+        );
+    }
+    test_field_zsa();
 }
 /// Inheriting from ZeroSizedArray shouldn't cause an `_address` to be inserted
 /// either.
@@ -136,19 +147,24 @@
         1usize,
         concat!("Alignment of ", stringify!(DynamicallySizedArray))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<DynamicallySizedArray>())).arr as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(DynamicallySizedArray),
-            "::",
-            stringify!(arr)
-        )
-    );
+    fn test_field_arr() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<DynamicallySizedArray>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).arr) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(DynamicallySizedArray),
+                "::",
+                stringify!(arr)
+            )
+        );
+    }
+    test_field_arr();
 }
 /// No `_address` field here either.
 #[repr(C)]
@@ -168,17 +184,23 @@
         1usize,
         concat!("Alignment of ", stringify!(ContainsDynamicallySizedArray))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ContainsDynamicallySizedArray>())).dsa
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(ContainsDynamicallySizedArray),
-            "::",
-            stringify!(dsa)
-        )
-    );
+    fn test_field_dsa() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    ContainsDynamicallySizedArray,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).dsa) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(ContainsDynamicallySizedArray),
+                "::",
+                stringify!(dsa)
+            )
+        );
+    }
+    test_field_dsa();
 }
diff --git a/tests/expectations/tests/long_double.rs b/tests/expectations/tests/long_double.rs
index dbd4248..7e2dfd2 100644
--- a/tests/expectations/tests/long_double.rs
+++ b/tests/expectations/tests/long_double.rs
@@ -23,9 +23,21 @@
         16usize,
         concat!("Alignment of ", stringify!(foo))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<foo>())).bar as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(foo), "::", stringify!(bar))
-    );
+    fn test_field_bar() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<foo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo),
+                "::",
+                stringify!(bar)
+            )
+        );
+    }
+    test_field_bar();
 }
diff --git a/tests/expectations/tests/macro_const.rs b/tests/expectations/tests/macro_const.rs
index e135661..de423a2 100644
--- a/tests/expectations/tests/macro_const.rs
+++ b/tests/expectations/tests/macro_const.rs
@@ -5,7 +5,7 @@
     non_upper_case_globals
 )]
 
-pub const foo: &'static [u8; 4usize] = b"bar\0";
+pub const foo: &[u8; 4usize] = b"bar\0";
 pub const CHAR: u8 = 98u8;
 pub const CHARR: u8 = 0u8;
 pub const FLOAT: f64 = 5.09;
diff --git a/tests/expectations/tests/macro_const_1_0.rs b/tests/expectations/tests/macro_const_1_0.rs
new file mode 100644
index 0000000..e135661
--- /dev/null
+++ b/tests/expectations/tests/macro_const_1_0.rs
@@ -0,0 +1,14 @@
+#![allow(
+    dead_code,
+    non_snake_case,
+    non_camel_case_types,
+    non_upper_case_globals
+)]
+
+pub const foo: &'static [u8; 4usize] = b"bar\0";
+pub const CHAR: u8 = 98u8;
+pub const CHARR: u8 = 0u8;
+pub const FLOAT: f64 = 5.09;
+pub const FLOAT_EXPR: f64 = 0.005;
+pub const LONG: u32 = 3;
+pub const INVALID_UTF8: [u8; 5usize] = [240u8, 40u8, 140u8, 40u8, 0u8];
diff --git a/tests/expectations/tests/msvc-no-usr.rs b/tests/expectations/tests/msvc-no-usr.rs
index ea5a90b..6e8a98c 100644
--- a/tests/expectations/tests/msvc-no-usr.rs
+++ b/tests/expectations/tests/msvc-no-usr.rs
@@ -23,9 +23,16 @@
         8usize,
         concat!("Alignment of ", stringify!(A))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<A>())).foo as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(A), "::", stringify!(foo))
-    );
+    fn test_field_foo() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<A>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).foo) as usize - ptr as usize
+            },
+            0usize,
+            concat!("Offset of field: ", stringify!(A), "::", stringify!(foo))
+        );
+    }
+    test_field_foo();
 }
diff --git a/tests/expectations/tests/mutable.rs b/tests/expectations/tests/mutable.rs
index 9f5865f..feae060 100644
--- a/tests/expectations/tests/mutable.rs
+++ b/tests/expectations/tests/mutable.rs
@@ -23,26 +23,40 @@
         4usize,
         concat!("Alignment of ", stringify!(C))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<C>())).m_member as *const _ as usize },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C),
-            "::",
-            stringify!(m_member)
-        )
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<C>())).m_other as *const _ as usize },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C),
-            "::",
-            stringify!(m_other)
-        )
-    );
+    fn test_field_m_member() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<C>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).m_member) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C),
+                "::",
+                stringify!(m_member)
+            )
+        );
+    }
+    test_field_m_member();
+    fn test_field_m_other() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<C>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).m_other) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C),
+                "::",
+                stringify!(m_other)
+            )
+        );
+    }
+    test_field_m_other();
 }
 #[repr(C)]
 #[derive(Debug, Default)]
@@ -61,19 +75,23 @@
         4usize,
         concat!("Alignment of ", stringify!(NonCopiable))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<NonCopiable>())).m_member as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(NonCopiable),
-            "::",
-            stringify!(m_member)
-        )
-    );
+    fn test_field_m_member() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<NonCopiable>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).m_member) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(NonCopiable),
+                "::",
+                stringify!(m_member)
+            )
+        );
+    }
+    test_field_m_member();
 }
 #[repr(C)]
 #[derive(Debug, Default)]
@@ -98,17 +116,23 @@
             stringify!(NonCopiableWithNonCopiableMutableMember)
         )
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<NonCopiableWithNonCopiableMutableMember>()))
-                .m_member as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(NonCopiableWithNonCopiableMutableMember),
-            "::",
-            stringify!(m_member)
-        )
-    );
+    fn test_field_m_member() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    NonCopiableWithNonCopiableMutableMember,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).m_member) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(NonCopiableWithNonCopiableMutableMember),
+                "::",
+                stringify!(m_member)
+            )
+        );
+    }
+    test_field_m_member();
 }
diff --git a/tests/expectations/tests/namespace.rs b/tests/expectations/tests/namespace.rs
index 576fc93..72c17ee 100644
--- a/tests/expectations/tests/namespace.rs
+++ b/tests/expectations/tests/namespace.rs
@@ -43,16 +43,23 @@
                 4usize,
                 concat!("Alignment of ", stringify!(A))
             );
-            assert_eq!(
-                unsafe { &(*(::std::ptr::null::<A>())).b as *const _ as usize },
-                0usize,
-                concat!(
-                    "Offset of field: ",
-                    stringify!(A),
-                    "::",
-                    stringify!(b)
-                )
-            );
+            fn test_field_b() {
+                assert_eq!(
+                    unsafe {
+                        let uninit = ::std::mem::MaybeUninit::<A>::uninit();
+                        let ptr = uninit.as_ptr();
+                        ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize
+                    },
+                    0usize,
+                    concat!(
+                        "Offset of field: ",
+                        stringify!(A),
+                        "::",
+                        stringify!(b)
+                    )
+                );
+            }
+            test_field_b();
         }
     }
     #[repr(C)]
diff --git a/tests/expectations/tests/nested.rs b/tests/expectations/tests/nested.rs
index 92cd660..48061e9 100644
--- a/tests/expectations/tests/nested.rs
+++ b/tests/expectations/tests/nested.rs
@@ -22,11 +22,18 @@
         4usize,
         concat!("Alignment of ", stringify!(Calc))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Calc>())).w as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(Calc), "::", stringify!(w))
-    );
+    fn test_field_w() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Calc>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).w) as usize - ptr as usize
+            },
+            0usize,
+            concat!("Offset of field: ", stringify!(Calc), "::", stringify!(w))
+        );
+    }
+    test_field_w();
 }
 #[repr(C)]
 #[derive(Debug, Default, Copy, Clone)]
@@ -69,30 +76,40 @@
         4usize,
         concat!("Alignment of ", stringify!(Test_Size))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<Test_Size>())).mWidth as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(Test_Size),
-            "::",
-            stringify!(mWidth)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<Test_Size>())).mHeight as *const _ as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(Test_Size),
-            "::",
-            stringify!(mHeight)
-        )
-    );
+    fn test_field_mWidth() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Test_Size>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mWidth) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Test_Size),
+                "::",
+                stringify!(mWidth)
+            )
+        );
+    }
+    test_field_mWidth();
+    fn test_field_mHeight() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Test_Size>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mHeight) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Test_Size),
+                "::",
+                stringify!(mHeight)
+            )
+        );
+    }
+    test_field_mHeight();
 }
 #[test]
 fn bindgen_test_layout_Test() {
diff --git a/tests/expectations/tests/nested_vtable.rs b/tests/expectations/tests/nested_vtable.rs
index 0218777..7ee4830 100644
--- a/tests/expectations/tests/nested_vtable.rs
+++ b/tests/expectations/tests/nested_vtable.rs
@@ -6,7 +6,10 @@
 )]
 
 #[repr(C)]
-pub struct nsISupports__bindgen_vtable(::std::os::raw::c_void);
+pub struct nsISupports__bindgen_vtable {
+    pub nsISupports_QueryInterface:
+        unsafe extern "C" fn(this: *mut nsISupports) -> *mut nsISupports,
+}
 #[repr(C)]
 #[derive(Debug, Copy, Clone)]
 pub struct nsISupports {
diff --git a/tests/expectations/tests/nested_within_namespace.rs b/tests/expectations/tests/nested_within_namespace.rs
index 86b9b8c..3e6e046 100644
--- a/tests/expectations/tests/nested_within_namespace.rs
+++ b/tests/expectations/tests/nested_within_namespace.rs
@@ -34,18 +34,24 @@
                 4usize,
                 concat!("Alignment of ", stringify!(Bar_Baz))
             );
-            assert_eq!(
-                unsafe {
-                    &(*(::std::ptr::null::<Bar_Baz>())).foo as *const _ as usize
-                },
-                0usize,
-                concat!(
-                    "Offset of field: ",
-                    stringify!(Bar_Baz),
-                    "::",
-                    stringify!(foo)
-                )
-            );
+            fn test_field_foo() {
+                assert_eq!(
+                    unsafe {
+                        let uninit =
+                            ::std::mem::MaybeUninit::<Bar_Baz>::uninit();
+                        let ptr = uninit.as_ptr();
+                        ::std::ptr::addr_of!((*ptr).foo) as usize - ptr as usize
+                    },
+                    0usize,
+                    concat!(
+                        "Offset of field: ",
+                        stringify!(Bar_Baz),
+                        "::",
+                        stringify!(foo)
+                    )
+                );
+            }
+            test_field_foo();
         }
         #[test]
         fn bindgen_test_layout_Bar() {
@@ -59,18 +65,23 @@
                 4usize,
                 concat!("Alignment of ", stringify!(Bar))
             );
-            assert_eq!(
-                unsafe {
-                    &(*(::std::ptr::null::<Bar>())).foo as *const _ as usize
-                },
-                0usize,
-                concat!(
-                    "Offset of field: ",
-                    stringify!(Bar),
-                    "::",
-                    stringify!(foo)
-                )
-            );
+            fn test_field_foo() {
+                assert_eq!(
+                    unsafe {
+                        let uninit = ::std::mem::MaybeUninit::<Bar>::uninit();
+                        let ptr = uninit.as_ptr();
+                        ::std::ptr::addr_of!((*ptr).foo) as usize - ptr as usize
+                    },
+                    0usize,
+                    concat!(
+                        "Offset of field: ",
+                        stringify!(Bar),
+                        "::",
+                        stringify!(foo)
+                    )
+                );
+            }
+            test_field_foo();
         }
         #[repr(C)]
         #[derive(Debug, Default, Copy, Clone)]
@@ -89,18 +100,23 @@
                 4usize,
                 concat!("Alignment of ", stringify!(Baz))
             );
-            assert_eq!(
-                unsafe {
-                    &(*(::std::ptr::null::<Baz>())).baz as *const _ as usize
-                },
-                0usize,
-                concat!(
-                    "Offset of field: ",
-                    stringify!(Baz),
-                    "::",
-                    stringify!(baz)
-                )
-            );
+            fn test_field_baz() {
+                assert_eq!(
+                    unsafe {
+                        let uninit = ::std::mem::MaybeUninit::<Baz>::uninit();
+                        let ptr = uninit.as_ptr();
+                        ::std::ptr::addr_of!((*ptr).baz) as usize - ptr as usize
+                    },
+                    0usize,
+                    concat!(
+                        "Offset of field: ",
+                        stringify!(Baz),
+                        "::",
+                        stringify!(baz)
+                    )
+                );
+            }
+            test_field_baz();
         }
     }
 }
diff --git a/tests/expectations/tests/no-comments.rs b/tests/expectations/tests/no-comments.rs
index 7a9d0d8..f13b4f8 100644
--- a/tests/expectations/tests/no-comments.rs
+++ b/tests/expectations/tests/no-comments.rs
@@ -22,9 +22,16 @@
         4usize,
         concat!("Alignment of ", stringify!(Foo))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Foo>())).s as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(Foo), "::", stringify!(s))
-    );
+    fn test_field_s() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Foo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).s) as usize - ptr as usize
+            },
+            0usize,
+            concat!("Offset of field: ", stringify!(Foo), "::", stringify!(s))
+        );
+    }
+    test_field_s();
 }
diff --git a/tests/expectations/tests/no-derive-debug.rs b/tests/expectations/tests/no-derive-debug.rs
index a62eaa5..2aa1c10 100644
--- a/tests/expectations/tests/no-derive-debug.rs
+++ b/tests/expectations/tests/no-derive-debug.rs
@@ -31,16 +31,40 @@
         4usize,
         concat!("Alignment of ", stringify!(bar))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<bar>())).foo as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(bar), "::", stringify!(foo))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<bar>())).baz as *const _ as usize },
-        4usize,
-        concat!("Offset of field: ", stringify!(bar), "::", stringify!(baz))
-    );
+    fn test_field_foo() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<bar>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).foo) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(bar),
+                "::",
+                stringify!(foo)
+            )
+        );
+    }
+    test_field_foo();
+    fn test_field_baz() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<bar>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).baz) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(bar),
+                "::",
+                stringify!(baz)
+            )
+        );
+    }
+    test_field_baz();
 }
 impl Default for bar {
     fn default() -> Self {
diff --git a/tests/expectations/tests/no-derive-default.rs b/tests/expectations/tests/no-derive-default.rs
index eda13aa..6e5efbe 100644
--- a/tests/expectations/tests/no-derive-default.rs
+++ b/tests/expectations/tests/no-derive-default.rs
@@ -31,14 +31,38 @@
         4usize,
         concat!("Alignment of ", stringify!(bar))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<bar>())).foo as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(bar), "::", stringify!(foo))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<bar>())).baz as *const _ as usize },
-        4usize,
-        concat!("Offset of field: ", stringify!(bar), "::", stringify!(baz))
-    );
+    fn test_field_foo() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<bar>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).foo) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(bar),
+                "::",
+                stringify!(foo)
+            )
+        );
+    }
+    test_field_foo();
+    fn test_field_baz() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<bar>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).baz) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(bar),
+                "::",
+                stringify!(baz)
+            )
+        );
+    }
+    test_field_baz();
 }
diff --git a/tests/expectations/tests/no-hash-allowlisted.rs b/tests/expectations/tests/no-hash-allowlisted.rs
index 1cd7f67..43132cb 100644
--- a/tests/expectations/tests/no-hash-allowlisted.rs
+++ b/tests/expectations/tests/no-hash-allowlisted.rs
@@ -22,9 +22,21 @@
         4usize,
         concat!("Alignment of ", stringify!(NoHash))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<NoHash>())).i as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(NoHash), "::", stringify!(i))
-    );
+    fn test_field_i() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<NoHash>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).i) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(NoHash),
+                "::",
+                stringify!(i)
+            )
+        );
+    }
+    test_field_i();
 }
diff --git a/tests/expectations/tests/no-partialeq-allowlisted.rs b/tests/expectations/tests/no-partialeq-allowlisted.rs
index cd3ed3b..e43e855 100644
--- a/tests/expectations/tests/no-partialeq-allowlisted.rs
+++ b/tests/expectations/tests/no-partialeq-allowlisted.rs
@@ -22,16 +22,21 @@
         4usize,
         concat!("Alignment of ", stringify!(NoPartialEq))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<NoPartialEq>())).i as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(NoPartialEq),
-            "::",
-            stringify!(i)
-        )
-    );
+    fn test_field_i() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<NoPartialEq>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).i) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(NoPartialEq),
+                "::",
+                stringify!(i)
+            )
+        );
+    }
+    test_field_i();
 }
diff --git a/tests/expectations/tests/no-recursive-allowlisting.rs b/tests/expectations/tests/no-recursive-allowlisting.rs
index 0aa0b5e..197b099 100644
--- a/tests/expectations/tests/no-recursive-allowlisting.rs
+++ b/tests/expectations/tests/no-recursive-allowlisting.rs
@@ -24,11 +24,23 @@
         8usize,
         concat!("Alignment of ", stringify!(Foo))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Foo>())).baz as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(Foo), "::", stringify!(baz))
-    );
+    fn test_field_baz() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Foo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).baz) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Foo),
+                "::",
+                stringify!(baz)
+            )
+        );
+    }
+    test_field_baz();
 }
 impl Default for Foo {
     fn default() -> Self {
diff --git a/tests/expectations/tests/no-std.rs b/tests/expectations/tests/no-std.rs
index f63ac45..f3157bb 100644
--- a/tests/expectations/tests/no-std.rs
+++ b/tests/expectations/tests/no-std.rs
@@ -29,21 +29,47 @@
         8usize,
         concat!("Alignment of ", stringify!(foo))
     );
-    assert_eq!(
-        unsafe { &(*(::core::ptr::null::<foo>())).a as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(foo), "::", stringify!(a))
-    );
-    assert_eq!(
-        unsafe { &(*(::core::ptr::null::<foo>())).b as *const _ as usize },
-        4usize,
-        concat!("Offset of field: ", stringify!(foo), "::", stringify!(b))
-    );
-    assert_eq!(
-        unsafe { &(*(::core::ptr::null::<foo>())).bar as *const _ as usize },
-        8usize,
-        concat!("Offset of field: ", stringify!(foo), "::", stringify!(bar))
-    );
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::core::mem::MaybeUninit::<foo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::core::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            0usize,
+            concat!("Offset of field: ", stringify!(foo), "::", stringify!(a))
+        );
+    }
+    test_field_a();
+    fn test_field_b() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::core::mem::MaybeUninit::<foo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::core::ptr::addr_of!((*ptr).b) as usize - ptr as usize
+            },
+            4usize,
+            concat!("Offset of field: ", stringify!(foo), "::", stringify!(b))
+        );
+    }
+    test_field_b();
+    fn test_field_bar() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::core::mem::MaybeUninit::<foo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::core::ptr::addr_of!((*ptr).bar) as usize - ptr as usize
+            },
+            8usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo),
+                "::",
+                stringify!(bar)
+            )
+        );
+    }
+    test_field_bar();
 }
 impl Default for foo {
     fn default() -> Self {
diff --git a/tests/expectations/tests/no_copy_allowlisted.rs b/tests/expectations/tests/no_copy_allowlisted.rs
index fa53bb6..ae086d2 100644
--- a/tests/expectations/tests/no_copy_allowlisted.rs
+++ b/tests/expectations/tests/no_copy_allowlisted.rs
@@ -22,9 +22,21 @@
         4usize,
         concat!("Alignment of ", stringify!(NoCopy))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<NoCopy>())).i as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(NoCopy), "::", stringify!(i))
-    );
+    fn test_field_i() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<NoCopy>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).i) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(NoCopy),
+                "::",
+                stringify!(i)
+            )
+        );
+    }
+    test_field_i();
 }
diff --git a/tests/expectations/tests/no_debug_allowlisted.rs b/tests/expectations/tests/no_debug_allowlisted.rs
index e240d64..9f070d2 100644
--- a/tests/expectations/tests/no_debug_allowlisted.rs
+++ b/tests/expectations/tests/no_debug_allowlisted.rs
@@ -22,14 +22,21 @@
         4usize,
         concat!("Alignment of ", stringify!(NoDebug))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<NoDebug>())).i as *const _ as usize },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(NoDebug),
-            "::",
-            stringify!(i)
-        )
-    );
+    fn test_field_i() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<NoDebug>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).i) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(NoDebug),
+                "::",
+                stringify!(i)
+            )
+        );
+    }
+    test_field_i();
 }
diff --git a/tests/expectations/tests/no_default_allowlisted.rs b/tests/expectations/tests/no_default_allowlisted.rs
index 980f157..07e01b7 100644
--- a/tests/expectations/tests/no_default_allowlisted.rs
+++ b/tests/expectations/tests/no_default_allowlisted.rs
@@ -22,14 +22,21 @@
         4usize,
         concat!("Alignment of ", stringify!(NoDefault))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<NoDefault>())).i as *const _ as usize },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(NoDefault),
-            "::",
-            stringify!(i)
-        )
-    );
+    fn test_field_i() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<NoDefault>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).i) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(NoDefault),
+                "::",
+                stringify!(i)
+            )
+        );
+    }
+    test_field_i();
 }
diff --git a/tests/expectations/tests/non-type-params.rs b/tests/expectations/tests/non-type-params.rs
index acd7a09..f647852 100644
--- a/tests/expectations/tests/non-type-params.rs
+++ b/tests/expectations/tests/non-type-params.rs
@@ -26,43 +26,57 @@
         4usize,
         concat!("Alignment of ", stringify!(UsesArray))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<UsesArray>())).array_char_16 as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(UsesArray),
-            "::",
-            stringify!(array_char_16)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<UsesArray>())).array_bool_8 as *const _
-                as usize
-        },
-        16usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(UsesArray),
-            "::",
-            stringify!(array_bool_8)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<UsesArray>())).array_int_4 as *const _
-                as usize
-        },
-        24usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(UsesArray),
-            "::",
-            stringify!(array_int_4)
-        )
-    );
+    fn test_field_array_char_16() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<UsesArray>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).array_char_16) as usize -
+                    ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(UsesArray),
+                "::",
+                stringify!(array_char_16)
+            )
+        );
+    }
+    test_field_array_char_16();
+    fn test_field_array_bool_8() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<UsesArray>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).array_bool_8) as usize -
+                    ptr as usize
+            },
+            16usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(UsesArray),
+                "::",
+                stringify!(array_bool_8)
+            )
+        );
+    }
+    test_field_array_bool_8();
+    fn test_field_array_int_4() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<UsesArray>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).array_int_4) as usize - ptr as usize
+            },
+            24usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(UsesArray),
+                "::",
+                stringify!(array_int_4)
+            )
+        );
+    }
+    test_field_array_int_4();
 }
diff --git a/tests/expectations/tests/objc_allowlist.rs b/tests/expectations/tests/objc_allowlist.rs
index dcec0fd..370cab9 100644
--- a/tests/expectations/tests/objc_allowlist.rs
+++ b/tests/expectations/tests/objc_allowlist.rs
@@ -6,9 +6,53 @@
 )]
 #![cfg(target_os = "macos")]
 
-#[macro_use]
-extern crate objc;
+use objc::{self, class, msg_send, sel, sel_impl};
 #[allow(non_camel_case_types)]
 pub type id = *mut objc::runtime::Object;
+pub trait PSomeProtocol: Sized + std::ops::Deref {
+    unsafe fn protocolMethod(&self)
+    where
+        <Self as std::ops::Deref>::Target: objc::Message + Sized,
+    {
+        msg_send!(*self, protocolMethod)
+    }
+    unsafe fn protocolClassMethod()
+    where
+        <Self as std::ops::Deref>::Target: objc::Message + Sized,
+    {
+        msg_send!(class!(SomeProtocol), protocolClassMethod)
+    }
+}
+#[repr(transparent)]
+#[derive(Debug, Copy, Clone)]
+pub struct AllowlistMe(pub id);
+impl std::ops::Deref for AllowlistMe {
+    type Target = objc::runtime::Object;
+    fn deref(&self) -> &Self::Target {
+        unsafe { &*self.0 }
+    }
+}
+unsafe impl objc::Message for AllowlistMe {}
+impl AllowlistMe {
+    pub fn alloc() -> Self {
+        Self(unsafe { msg_send!(class!(AllowlistMe), alloc) })
+    }
+}
+impl PSomeProtocol for AllowlistMe {}
+impl IAllowlistMe for AllowlistMe {}
+pub trait IAllowlistMe: Sized + std::ops::Deref {
+    unsafe fn method(&self)
+    where
+        <Self as std::ops::Deref>::Target: objc::Message + Sized,
+    {
+        msg_send!(*self, method)
+    }
+    unsafe fn classMethod()
+    where
+        <Self as std::ops::Deref>::Target: objc::Message + Sized,
+    {
+        msg_send!(class!(AllowlistMe), classMethod)
+    }
+}
 impl AllowlistMe_InterestingCategory for AllowlistMe {}
 pub trait AllowlistMe_InterestingCategory: Sized + std::ops::Deref {}
diff --git a/tests/expectations/tests/objc_category.rs b/tests/expectations/tests/objc_category.rs
index e0328c7..9d60233 100644
--- a/tests/expectations/tests/objc_category.rs
+++ b/tests/expectations/tests/objc_category.rs
@@ -6,12 +6,11 @@
 )]
 #![cfg(target_os = "macos")]
 
-#[macro_use]
-extern crate objc;
+use objc::{self, class, msg_send, sel, sel_impl};
 #[allow(non_camel_case_types)]
 pub type id = *mut objc::runtime::Object;
 #[repr(transparent)]
-#[derive(Clone)]
+#[derive(Debug, Copy, Clone)]
 pub struct Foo(pub id);
 impl std::ops::Deref for Foo {
     type Target = objc::runtime::Object;
@@ -22,7 +21,7 @@
 unsafe impl objc::Message for Foo {}
 impl Foo {
     pub fn alloc() -> Self {
-        Self(unsafe { msg_send!(objc::class!(Foo), alloc) })
+        Self(unsafe { msg_send!(class!(Foo), alloc) })
     }
 }
 impl IFoo for Foo {}
diff --git a/tests/expectations/tests/objc_class.rs b/tests/expectations/tests/objc_class.rs
index 5a8a71d..b322bdd 100644
--- a/tests/expectations/tests/objc_class.rs
+++ b/tests/expectations/tests/objc_class.rs
@@ -6,15 +6,14 @@
 )]
 #![cfg(target_os = "macos")]
 
-#[macro_use]
-extern crate objc;
+use objc::{self, class, msg_send, sel, sel_impl};
 #[allow(non_camel_case_types)]
 pub type id = *mut objc::runtime::Object;
 extern "C" {
     pub static mut fooVar: Foo;
 }
 #[repr(transparent)]
-#[derive(Clone)]
+#[derive(Debug, Copy, Clone)]
 pub struct Foo(pub id);
 impl std::ops::Deref for Foo {
     type Target = objc::runtime::Object;
@@ -25,7 +24,7 @@
 unsafe impl objc::Message for Foo {}
 impl Foo {
     pub fn alloc() -> Self {
-        Self(unsafe { msg_send!(objc::class!(Foo), alloc) })
+        Self(unsafe { msg_send!(class!(Foo), alloc) })
     }
 }
 impl IFoo for Foo {}
diff --git a/tests/expectations/tests/objc_class_method.rs b/tests/expectations/tests/objc_class_method.rs
index 26f2110..29e7025 100644
--- a/tests/expectations/tests/objc_class_method.rs
+++ b/tests/expectations/tests/objc_class_method.rs
@@ -6,12 +6,11 @@
 )]
 #![cfg(target_os = "macos")]
 
-#[macro_use]
-extern crate objc;
+use objc::{self, class, msg_send, sel, sel_impl};
 #[allow(non_camel_case_types)]
 pub type id = *mut objc::runtime::Object;
 #[repr(transparent)]
-#[derive(Clone)]
+#[derive(Debug, Copy, Clone)]
 pub struct Foo(pub id);
 impl std::ops::Deref for Foo {
     type Target = objc::runtime::Object;
@@ -22,7 +21,7 @@
 unsafe impl objc::Message for Foo {}
 impl Foo {
     pub fn alloc() -> Self {
-        Self(unsafe { msg_send!(objc::class!(Foo), alloc) })
+        Self(unsafe { msg_send!(class!(Foo), alloc) })
     }
 }
 impl IFoo for Foo {}
diff --git a/tests/expectations/tests/objc_interface.rs b/tests/expectations/tests/objc_interface.rs
index c5ba275..89e64d8 100644
--- a/tests/expectations/tests/objc_interface.rs
+++ b/tests/expectations/tests/objc_interface.rs
@@ -6,12 +6,11 @@
 )]
 #![cfg(target_os = "macos")]
 
-#[macro_use]
-extern crate objc;
+use objc::{self, class, msg_send, sel, sel_impl};
 #[allow(non_camel_case_types)]
 pub type id = *mut objc::runtime::Object;
 #[repr(transparent)]
-#[derive(Clone)]
+#[derive(Debug, Copy, Clone)]
 pub struct Foo(pub id);
 impl std::ops::Deref for Foo {
     type Target = objc::runtime::Object;
@@ -22,7 +21,7 @@
 unsafe impl objc::Message for Foo {}
 impl Foo {
     pub fn alloc() -> Self {
-        Self(unsafe { msg_send!(objc::class!(Foo), alloc) })
+        Self(unsafe { msg_send!(class!(Foo), alloc) })
     }
 }
 impl IFoo for Foo {}
diff --git a/tests/expectations/tests/objc_interface_type.rs b/tests/expectations/tests/objc_interface_type.rs
index cef29c8..5cafeed 100644
--- a/tests/expectations/tests/objc_interface_type.rs
+++ b/tests/expectations/tests/objc_interface_type.rs
@@ -6,12 +6,11 @@
 )]
 #![cfg(target_os = "macos")]
 
-#[macro_use]
-extern crate objc;
+use objc::{self, class, msg_send, sel, sel_impl};
 #[allow(non_camel_case_types)]
 pub type id = *mut objc::runtime::Object;
 #[repr(transparent)]
-#[derive(Clone)]
+#[derive(Debug, Copy, Clone)]
 pub struct Foo(pub id);
 impl std::ops::Deref for Foo {
     type Target = objc::runtime::Object;
@@ -22,7 +21,7 @@
 unsafe impl objc::Message for Foo {}
 impl Foo {
     pub fn alloc() -> Self {
-        Self(unsafe { msg_send!(objc::class!(Foo), alloc) })
+        Self(unsafe { msg_send!(class!(Foo), alloc) })
     }
 }
 impl IFoo for Foo {}
@@ -44,18 +43,23 @@
         8usize,
         concat!("Alignment of ", stringify!(FooStruct))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<FooStruct>())).foo as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(FooStruct),
-            "::",
-            stringify!(foo)
-        )
-    );
+    fn test_field_foo() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<FooStruct>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).foo) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(FooStruct),
+                "::",
+                stringify!(foo)
+            )
+        );
+    }
+    test_field_foo();
 }
 impl Default for FooStruct {
     fn default() -> Self {
diff --git a/tests/expectations/tests/objc_method.rs b/tests/expectations/tests/objc_method.rs
index af5c609..593fd27 100644
--- a/tests/expectations/tests/objc_method.rs
+++ b/tests/expectations/tests/objc_method.rs
@@ -6,12 +6,11 @@
 )]
 #![cfg(target_os = "macos")]
 
-#[macro_use]
-extern crate objc;
+use objc::{self, class, msg_send, sel, sel_impl};
 #[allow(non_camel_case_types)]
 pub type id = *mut objc::runtime::Object;
 #[repr(transparent)]
-#[derive(Clone)]
+#[derive(Debug, Copy, Clone)]
 pub struct Foo(pub id);
 impl std::ops::Deref for Foo {
     type Target = objc::runtime::Object;
@@ -22,7 +21,7 @@
 unsafe impl objc::Message for Foo {}
 impl Foo {
     pub fn alloc() -> Self {
-        Self(unsafe { msg_send!(objc::class!(Foo), alloc) })
+        Self(unsafe { msg_send!(class!(Foo), alloc) })
     }
 }
 impl IFoo for Foo {}
diff --git a/tests/expectations/tests/objc_method_clash.rs b/tests/expectations/tests/objc_method_clash.rs
index 8370f33..ac77cc1 100644
--- a/tests/expectations/tests/objc_method_clash.rs
+++ b/tests/expectations/tests/objc_method_clash.rs
@@ -6,12 +6,11 @@
 )]
 #![cfg(target_os = "macos")]
 
-#[macro_use]
-extern crate objc;
+use objc::{self, class, msg_send, sel, sel_impl};
 #[allow(non_camel_case_types)]
 pub type id = *mut objc::runtime::Object;
 #[repr(transparent)]
-#[derive(Clone)]
+#[derive(Debug, Copy, Clone)]
 pub struct Foo(pub id);
 impl std::ops::Deref for Foo {
     type Target = objc::runtime::Object;
@@ -22,7 +21,7 @@
 unsafe impl objc::Message for Foo {}
 impl Foo {
     pub fn alloc() -> Self {
-        Self(unsafe { msg_send!(objc::class!(Foo), alloc) })
+        Self(unsafe { msg_send!(class!(Foo), alloc) })
     }
 }
 impl IFoo for Foo {}
diff --git a/tests/expectations/tests/objc_pointer_return_types.rs b/tests/expectations/tests/objc_pointer_return_types.rs
index c9b6b52..1ec8494 100644
--- a/tests/expectations/tests/objc_pointer_return_types.rs
+++ b/tests/expectations/tests/objc_pointer_return_types.rs
@@ -6,12 +6,11 @@
 )]
 #![cfg(target_os = "macos")]
 
-#[macro_use]
-extern crate objc;
+use objc::{self, class, msg_send, sel, sel_impl};
 #[allow(non_camel_case_types)]
 pub type id = *mut objc::runtime::Object;
 #[repr(transparent)]
-#[derive(Clone)]
+#[derive(Debug, Copy, Clone)]
 pub struct Bar(pub id);
 impl std::ops::Deref for Bar {
     type Target = objc::runtime::Object;
@@ -22,13 +21,13 @@
 unsafe impl objc::Message for Bar {}
 impl Bar {
     pub fn alloc() -> Self {
-        Self(unsafe { msg_send!(objc::class!(Bar), alloc) })
+        Self(unsafe { msg_send!(class!(Bar), alloc) })
     }
 }
 impl IBar for Bar {}
 pub trait IBar: Sized + std::ops::Deref {}
 #[repr(transparent)]
-#[derive(Clone)]
+#[derive(Debug, Copy, Clone)]
 pub struct Foo(pub id);
 impl std::ops::Deref for Foo {
     type Target = objc::runtime::Object;
@@ -39,7 +38,7 @@
 unsafe impl objc::Message for Foo {}
 impl Foo {
     pub fn alloc() -> Self {
-        Self(unsafe { msg_send!(objc::class!(Foo), alloc) })
+        Self(unsafe { msg_send!(class!(Foo), alloc) })
     }
 }
 impl IFoo for Foo {}
diff --git a/tests/expectations/tests/objc_property_fnptr.rs b/tests/expectations/tests/objc_property_fnptr.rs
index 85f18e9..9f3fabd 100644
--- a/tests/expectations/tests/objc_property_fnptr.rs
+++ b/tests/expectations/tests/objc_property_fnptr.rs
@@ -6,12 +6,11 @@
 )]
 #![cfg(target_os = "macos")]
 
-#[macro_use]
-extern crate objc;
+use objc::{self, class, msg_send, sel, sel_impl};
 #[allow(non_camel_case_types)]
 pub type id = *mut objc::runtime::Object;
 #[repr(transparent)]
-#[derive(Clone)]
+#[derive(Debug, Copy, Clone)]
 pub struct Foo(pub id);
 impl std::ops::Deref for Foo {
     type Target = objc::runtime::Object;
@@ -22,7 +21,7 @@
 unsafe impl objc::Message for Foo {}
 impl Foo {
     pub fn alloc() -> Self {
-        Self(unsafe { msg_send!(objc::class!(Foo), alloc) })
+        Self(unsafe { msg_send!(class!(Foo), alloc) })
     }
 }
 impl IFoo for Foo {}
diff --git a/tests/expectations/tests/objc_protocol.rs b/tests/expectations/tests/objc_protocol.rs
index e68ddcc..5bd7d43 100644
--- a/tests/expectations/tests/objc_protocol.rs
+++ b/tests/expectations/tests/objc_protocol.rs
@@ -6,13 +6,12 @@
 )]
 #![cfg(target_os = "macos")]
 
-#[macro_use]
-extern crate objc;
+use objc::{self, class, msg_send, sel, sel_impl};
 #[allow(non_camel_case_types)]
 pub type id = *mut objc::runtime::Object;
 pub trait PFoo: Sized + std::ops::Deref {}
 #[repr(transparent)]
-#[derive(Clone)]
+#[derive(Debug, Copy, Clone)]
 pub struct Foo(pub id);
 impl std::ops::Deref for Foo {
     type Target = objc::runtime::Object;
@@ -23,7 +22,7 @@
 unsafe impl objc::Message for Foo {}
 impl Foo {
     pub fn alloc() -> Self {
-        Self(unsafe { msg_send!(objc::class!(Foo), alloc) })
+        Self(unsafe { msg_send!(class!(Foo), alloc) })
     }
 }
 impl PFoo for Foo {}
diff --git a/tests/expectations/tests/objc_protocol_inheritance.rs b/tests/expectations/tests/objc_protocol_inheritance.rs
index 598273b..f5f80e2 100644
--- a/tests/expectations/tests/objc_protocol_inheritance.rs
+++ b/tests/expectations/tests/objc_protocol_inheritance.rs
@@ -6,13 +6,12 @@
 )]
 #![cfg(target_os = "macos")]
 
-#[macro_use]
-extern crate objc;
+use objc::{self, class, msg_send, sel, sel_impl};
 #[allow(non_camel_case_types)]
 pub type id = *mut objc::runtime::Object;
 pub trait PFoo: Sized + std::ops::Deref {}
 #[repr(transparent)]
-#[derive(Clone)]
+#[derive(Debug, Copy, Clone)]
 pub struct Foo(pub id);
 impl std::ops::Deref for Foo {
     type Target = objc::runtime::Object;
@@ -23,14 +22,14 @@
 unsafe impl objc::Message for Foo {}
 impl Foo {
     pub fn alloc() -> Self {
-        Self(unsafe { msg_send!(objc::class!(Foo), alloc) })
+        Self(unsafe { msg_send!(class!(Foo), alloc) })
     }
 }
 impl PFoo for Foo {}
 impl IFoo for Foo {}
 pub trait IFoo: Sized + std::ops::Deref {}
 #[repr(transparent)]
-#[derive(Clone)]
+#[derive(Debug, Copy, Clone)]
 pub struct Bar(pub id);
 impl std::ops::Deref for Bar {
     type Target = objc::runtime::Object;
@@ -41,7 +40,7 @@
 unsafe impl objc::Message for Bar {}
 impl Bar {
     pub fn alloc() -> Self {
-        Self(unsafe { msg_send!(objc::class!(Bar), alloc) })
+        Self(unsafe { msg_send!(class!(Bar), alloc) })
     }
 }
 impl IFoo for Bar {}
diff --git a/tests/expectations/tests/objc_sel_and_id.rs b/tests/expectations/tests/objc_sel_and_id.rs
index 2a38909..0017eab 100644
--- a/tests/expectations/tests/objc_sel_and_id.rs
+++ b/tests/expectations/tests/objc_sel_and_id.rs
@@ -6,8 +6,7 @@
 )]
 #![cfg(target_os = "macos")]
 
-#[macro_use]
-extern crate objc;
+use objc::{self, class, msg_send, sel, sel_impl};
 #[allow(non_camel_case_types)]
 pub type id = *mut objc::runtime::Object;
 extern "C" {
diff --git a/tests/expectations/tests/opaque-template-inst-member-2.rs b/tests/expectations/tests/opaque-template-inst-member-2.rs
index f47aff0..391c46d 100644
--- a/tests/expectations/tests/opaque-template-inst-member-2.rs
+++ b/tests/expectations/tests/opaque-template-inst-member-2.rs
@@ -31,32 +31,42 @@
         4usize,
         concat!("Alignment of ", stringify!(ContainsOpaqueTemplate))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ContainsOpaqueTemplate>())).mBlah as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(ContainsOpaqueTemplate),
-            "::",
-            stringify!(mBlah)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ContainsOpaqueTemplate>())).mBaz as *const _
-                as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(ContainsOpaqueTemplate),
-            "::",
-            stringify!(mBaz)
-        )
-    );
+    fn test_field_mBlah() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<ContainsOpaqueTemplate>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mBlah) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(ContainsOpaqueTemplate),
+                "::",
+                stringify!(mBlah)
+            )
+        );
+    }
+    test_field_mBlah();
+    fn test_field_mBaz() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<ContainsOpaqueTemplate>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mBaz) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(ContainsOpaqueTemplate),
+                "::",
+                stringify!(mBaz)
+            )
+        );
+    }
+    test_field_mBaz();
 }
 /// Should also derive Debug/Hash/PartialEq.
 #[repr(C)]
@@ -77,19 +87,24 @@
         8usize,
         concat!("Alignment of ", stringify!(InheritsOpaqueTemplate))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<InheritsOpaqueTemplate>())).wow as *const _
-                as usize
-        },
-        8usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(InheritsOpaqueTemplate),
-            "::",
-            stringify!(wow)
-        )
-    );
+    fn test_field_wow() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<InheritsOpaqueTemplate>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).wow) as usize - ptr as usize
+            },
+            8usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(InheritsOpaqueTemplate),
+                "::",
+                stringify!(wow)
+            )
+        );
+    }
+    test_field_wow();
 }
 impl Default for InheritsOpaqueTemplate {
     fn default() -> Self {
diff --git a/tests/expectations/tests/opaque-template-inst-member.rs b/tests/expectations/tests/opaque-template-inst-member.rs
index a3c6778..0942976 100644
--- a/tests/expectations/tests/opaque-template-inst-member.rs
+++ b/tests/expectations/tests/opaque-template-inst-member.rs
@@ -29,32 +29,42 @@
         4usize,
         concat!("Alignment of ", stringify!(ContainsOpaqueTemplate))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ContainsOpaqueTemplate>())).mBlah as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(ContainsOpaqueTemplate),
-            "::",
-            stringify!(mBlah)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ContainsOpaqueTemplate>())).mBaz as *const _
-                as usize
-        },
-        404usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(ContainsOpaqueTemplate),
-            "::",
-            stringify!(mBaz)
-        )
-    );
+    fn test_field_mBlah() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<ContainsOpaqueTemplate>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mBlah) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(ContainsOpaqueTemplate),
+                "::",
+                stringify!(mBlah)
+            )
+        );
+    }
+    test_field_mBlah();
+    fn test_field_mBaz() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<ContainsOpaqueTemplate>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mBaz) as usize - ptr as usize
+            },
+            404usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(ContainsOpaqueTemplate),
+                "::",
+                stringify!(mBaz)
+            )
+        );
+    }
+    test_field_mBaz();
 }
 impl Default for ContainsOpaqueTemplate {
     fn default() -> Self {
@@ -89,19 +99,24 @@
         8usize,
         concat!("Alignment of ", stringify!(InheritsOpaqueTemplate))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<InheritsOpaqueTemplate>())).wow as *const _
-                as usize
-        },
-        408usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(InheritsOpaqueTemplate),
-            "::",
-            stringify!(wow)
-        )
-    );
+    fn test_field_wow() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<InheritsOpaqueTemplate>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).wow) as usize - ptr as usize
+            },
+            408usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(InheritsOpaqueTemplate),
+                "::",
+                stringify!(wow)
+            )
+        );
+    }
+    test_field_wow();
 }
 impl Default for InheritsOpaqueTemplate {
     fn default() -> Self {
diff --git a/tests/expectations/tests/opaque-template-instantiation-namespaced.rs b/tests/expectations/tests/opaque-template-instantiation-namespaced.rs
index e972443..293f2a1 100644
--- a/tests/expectations/tests/opaque-template-instantiation-namespaced.rs
+++ b/tests/expectations/tests/opaque-template-instantiation-namespaced.rs
@@ -45,18 +45,23 @@
                 1usize,
                 concat!("Alignment of ", stringify!(Foo))
             );
-            assert_eq!(
-                unsafe {
-                    &(*(::std::ptr::null::<Foo>())).c as *const _ as usize
-                },
-                0usize,
-                concat!(
-                    "Offset of field: ",
-                    stringify!(Foo),
-                    "::",
-                    stringify!(c)
-                )
-            );
+            fn test_field_c() {
+                assert_eq!(
+                    unsafe {
+                        let uninit = ::std::mem::MaybeUninit::<Foo>::uninit();
+                        let ptr = uninit.as_ptr();
+                        ::std::ptr::addr_of!((*ptr).c) as usize - ptr as usize
+                    },
+                    0usize,
+                    concat!(
+                        "Offset of field: ",
+                        stringify!(Foo),
+                        "::",
+                        stringify!(c)
+                    )
+                );
+            }
+            test_field_c();
         }
         #[repr(C)]
         #[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
@@ -75,18 +80,23 @@
                 4usize,
                 concat!("Alignment of ", stringify!(Bar))
             );
-            assert_eq!(
-                unsafe {
-                    &(*(::std::ptr::null::<Bar>())).i as *const _ as usize
-                },
-                0usize,
-                concat!(
-                    "Offset of field: ",
-                    stringify!(Bar),
-                    "::",
-                    stringify!(i)
-                )
-            );
+            fn test_field_i() {
+                assert_eq!(
+                    unsafe {
+                        let uninit = ::std::mem::MaybeUninit::<Bar>::uninit();
+                        let ptr = uninit.as_ptr();
+                        ::std::ptr::addr_of!((*ptr).i) as usize - ptr as usize
+                    },
+                    0usize,
+                    concat!(
+                        "Offset of field: ",
+                        stringify!(Bar),
+                        "::",
+                        stringify!(i)
+                    )
+                );
+            }
+            test_field_i();
         }
         #[repr(C)]
         #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
@@ -105,19 +115,26 @@
                 1usize,
                 concat!("Alignment of ", stringify!(ContainsInstantiation))
             );
-            assert_eq!(
-                unsafe {
-                    &(*(::std::ptr::null::<ContainsInstantiation>())).not_opaque
-                        as *const _ as usize
-                },
-                0usize,
-                concat!(
-                    "Offset of field: ",
-                    stringify!(ContainsInstantiation),
-                    "::",
-                    stringify!(not_opaque)
-                )
-            );
+            fn test_field_not_opaque() {
+                assert_eq!(
+                    unsafe {
+                        let uninit = ::std::mem::MaybeUninit::<
+                            ContainsInstantiation,
+                        >::uninit();
+                        let ptr = uninit.as_ptr();
+                        ::std::ptr::addr_of!((*ptr).not_opaque) as usize -
+                            ptr as usize
+                    },
+                    0usize,
+                    concat!(
+                        "Offset of field: ",
+                        stringify!(ContainsInstantiation),
+                        "::",
+                        stringify!(not_opaque)
+                    )
+                );
+            }
+            test_field_not_opaque();
         }
         impl Default for ContainsInstantiation {
             fn default() -> Self {
@@ -148,19 +165,26 @@
                     stringify!(ContainsOpaqueInstantiation)
                 )
             );
-            assert_eq!(
-                unsafe {
-                    &(*(::std::ptr::null::<ContainsOpaqueInstantiation>()))
-                        .opaque as *const _ as usize
-                },
-                0usize,
-                concat!(
-                    "Offset of field: ",
-                    stringify!(ContainsOpaqueInstantiation),
-                    "::",
-                    stringify!(opaque)
-                )
-            );
+            fn test_field_opaque() {
+                assert_eq!(
+                    unsafe {
+                        let uninit = ::std::mem::MaybeUninit::<
+                            ContainsOpaqueInstantiation,
+                        >::uninit();
+                        let ptr = uninit.as_ptr();
+                        ::std::ptr::addr_of!((*ptr).opaque) as usize -
+                            ptr as usize
+                    },
+                    0usize,
+                    concat!(
+                        "Offset of field: ",
+                        stringify!(ContainsOpaqueInstantiation),
+                        "::",
+                        stringify!(opaque)
+                    )
+                );
+            }
+            test_field_opaque();
         }
     }
     #[test]
diff --git a/tests/expectations/tests/opaque-template-instantiation.rs b/tests/expectations/tests/opaque-template-instantiation.rs
index 6f0f31b..9f02920 100644
--- a/tests/expectations/tests/opaque-template-instantiation.rs
+++ b/tests/expectations/tests/opaque-template-instantiation.rs
@@ -37,19 +37,24 @@
         1usize,
         concat!("Alignment of ", stringify!(ContainsInstantiation))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ContainsInstantiation>())).not_opaque
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(ContainsInstantiation),
-            "::",
-            stringify!(not_opaque)
-        )
-    );
+    fn test_field_not_opaque() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<ContainsInstantiation>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).not_opaque) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(ContainsInstantiation),
+                "::",
+                stringify!(not_opaque)
+            )
+        );
+    }
+    test_field_not_opaque();
 }
 impl Default for ContainsInstantiation {
     fn default() -> Self {
@@ -77,19 +82,25 @@
         4usize,
         concat!("Alignment of ", stringify!(ContainsOpaqueInstantiation))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ContainsOpaqueInstantiation>())).opaque
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(ContainsOpaqueInstantiation),
-            "::",
-            stringify!(opaque)
-        )
-    );
+    fn test_field_opaque() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    ContainsOpaqueInstantiation,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).opaque) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(ContainsOpaqueInstantiation),
+                "::",
+                stringify!(opaque)
+            )
+        );
+    }
+    test_field_opaque();
 }
 #[test]
 fn __bindgen_test_layout_Template_open0_char_close0_instantiation() {
diff --git a/tests/expectations/tests/opaque_in_struct.rs b/tests/expectations/tests/opaque_in_struct.rs
index 980df3d..4af91c4 100644
--- a/tests/expectations/tests/opaque_in_struct.rs
+++ b/tests/expectations/tests/opaque_in_struct.rs
@@ -42,16 +42,21 @@
         4usize,
         concat!("Alignment of ", stringify!(container))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<container>())).contained as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(container),
-            "::",
-            stringify!(contained)
-        )
-    );
+    fn test_field_contained() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<container>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).contained) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(container),
+                "::",
+                stringify!(contained)
+            )
+        );
+    }
+    test_field_contained();
 }
diff --git a/tests/expectations/tests/opaque_pointer.rs b/tests/expectations/tests/opaque_pointer.rs
index 90b019b..7230c3c 100644
--- a/tests/expectations/tests/opaque_pointer.rs
+++ b/tests/expectations/tests/opaque_pointer.rs
@@ -50,43 +50,57 @@
         8usize,
         concat!("Alignment of ", stringify!(WithOpaquePtr))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<WithOpaquePtr>())).whatever as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(WithOpaquePtr),
-            "::",
-            stringify!(whatever)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<WithOpaquePtr>())).other as *const _ as usize
-        },
-        8usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(WithOpaquePtr),
-            "::",
-            stringify!(other)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<WithOpaquePtr>())).t as *const _ as usize
-        },
-        12usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(WithOpaquePtr),
-            "::",
-            stringify!(t)
-        )
-    );
+    fn test_field_whatever() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<WithOpaquePtr>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).whatever) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(WithOpaquePtr),
+                "::",
+                stringify!(whatever)
+            )
+        );
+    }
+    test_field_whatever();
+    fn test_field_other() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<WithOpaquePtr>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).other) as usize - ptr as usize
+            },
+            8usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(WithOpaquePtr),
+                "::",
+                stringify!(other)
+            )
+        );
+    }
+    test_field_other();
+    fn test_field_t() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<WithOpaquePtr>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).t) as usize - ptr as usize
+            },
+            12usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(WithOpaquePtr),
+                "::",
+                stringify!(t)
+            )
+        );
+    }
+    test_field_t();
 }
 impl Default for WithOpaquePtr {
     fn default() -> Self {
diff --git a/tests/expectations/tests/packed-n-with-padding.rs b/tests/expectations/tests/packed-n-with-padding.rs
index 13cb030..6e749b1 100644
--- a/tests/expectations/tests/packed-n-with-padding.rs
+++ b/tests/expectations/tests/packed-n-with-padding.rs
@@ -25,24 +25,72 @@
         2usize,
         concat!("Alignment of ", stringify!(Packed))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Packed>())).a as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(Packed), "::", stringify!(a))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Packed>())).b as *const _ as usize },
-        2usize,
-        concat!("Offset of field: ", stringify!(Packed), "::", stringify!(b))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Packed>())).c as *const _ as usize },
-        4usize,
-        concat!("Offset of field: ", stringify!(Packed), "::", stringify!(c))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Packed>())).d as *const _ as usize },
-        6usize,
-        concat!("Offset of field: ", stringify!(Packed), "::", stringify!(d))
-    );
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Packed>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Packed),
+                "::",
+                stringify!(a)
+            )
+        );
+    }
+    test_field_a();
+    fn test_field_b() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Packed>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize
+            },
+            2usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Packed),
+                "::",
+                stringify!(b)
+            )
+        );
+    }
+    test_field_b();
+    fn test_field_c() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Packed>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).c) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Packed),
+                "::",
+                stringify!(c)
+            )
+        );
+    }
+    test_field_c();
+    fn test_field_d() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Packed>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).d) as usize - ptr as usize
+            },
+            6usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Packed),
+                "::",
+                stringify!(d)
+            )
+        );
+    }
+    test_field_d();
 }
diff --git a/tests/expectations/tests/packed-vtable.rs b/tests/expectations/tests/packed-vtable.rs
index 0069ead..7168815 100644
--- a/tests/expectations/tests/packed-vtable.rs
+++ b/tests/expectations/tests/packed-vtable.rs
@@ -9,7 +9,6 @@
 #[repr(C)]
 pub struct PackedVtable__bindgen_vtable(::std::os::raw::c_void);
 #[repr(C, packed)]
-#[derive(Debug)]
 pub struct PackedVtable {
     pub vtable_: *const PackedVtable__bindgen_vtable,
 }
diff --git a/tests/expectations/tests/parsecb-anonymous-enum-variant-rename.rs b/tests/expectations/tests/parsecb-anonymous-enum-variant-rename.rs
index e615486..8ead5b8 100644
--- a/tests/expectations/tests/parsecb-anonymous-enum-variant-rename.rs
+++ b/tests/expectations/tests/parsecb-anonymous-enum-variant-rename.rs
@@ -5,5 +5,5 @@
     non_upper_case_globals
 )]
 
-pub const RENAMED_MyVal: ::std::os::raw::c_uint = 0;
+pub const RENAMED_MyVal: _bindgen_ty_1 = 0;
 pub type _bindgen_ty_1 = ::std::os::raw::c_uint;
diff --git a/tests/expectations/tests/private.rs b/tests/expectations/tests/private.rs
index 328f97f..63b5676 100644
--- a/tests/expectations/tests/private.rs
+++ b/tests/expectations/tests/private.rs
@@ -24,32 +24,40 @@
         4usize,
         concat!("Alignment of ", stringify!(HasPrivate))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<HasPrivate>())).mNotPrivate as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(HasPrivate),
-            "::",
-            stringify!(mNotPrivate)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<HasPrivate>())).mIsPrivate as *const _
-                as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(HasPrivate),
-            "::",
-            stringify!(mIsPrivate)
-        )
-    );
+    fn test_field_mNotPrivate() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<HasPrivate>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mNotPrivate) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(HasPrivate),
+                "::",
+                stringify!(mNotPrivate)
+            )
+        );
+    }
+    test_field_mNotPrivate();
+    fn test_field_mIsPrivate() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<HasPrivate>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mIsPrivate) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(HasPrivate),
+                "::",
+                stringify!(mIsPrivate)
+            )
+        );
+    }
+    test_field_mIsPrivate();
 }
 /// <div rustbindgen private></div>
 #[repr(C)]
@@ -70,32 +78,41 @@
         4usize,
         concat!("Alignment of ", stringify!(VeryPrivate))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<VeryPrivate>())).mIsPrivate as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(VeryPrivate),
-            "::",
-            stringify!(mIsPrivate)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<VeryPrivate>())).mIsAlsoPrivate as *const _
-                as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(VeryPrivate),
-            "::",
-            stringify!(mIsAlsoPrivate)
-        )
-    );
+    fn test_field_mIsPrivate() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<VeryPrivate>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mIsPrivate) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(VeryPrivate),
+                "::",
+                stringify!(mIsPrivate)
+            )
+        );
+    }
+    test_field_mIsPrivate();
+    fn test_field_mIsAlsoPrivate() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<VeryPrivate>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mIsAlsoPrivate) as usize -
+                    ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(VeryPrivate),
+                "::",
+                stringify!(mIsAlsoPrivate)
+            )
+        );
+    }
+    test_field_mIsAlsoPrivate();
 }
 /// <div rustbindgen private></div>
 #[repr(C)]
@@ -117,30 +134,40 @@
         4usize,
         concat!("Alignment of ", stringify!(ContradictPrivate))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ContradictPrivate>())).mNotPrivate
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(ContradictPrivate),
-            "::",
-            stringify!(mNotPrivate)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ContradictPrivate>())).mIsPrivate as *const _
-                as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(ContradictPrivate),
-            "::",
-            stringify!(mIsPrivate)
-        )
-    );
+    fn test_field_mNotPrivate() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<ContradictPrivate>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mNotPrivate) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(ContradictPrivate),
+                "::",
+                stringify!(mNotPrivate)
+            )
+        );
+    }
+    test_field_mNotPrivate();
+    fn test_field_mIsPrivate() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<ContradictPrivate>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mIsPrivate) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(ContradictPrivate),
+                "::",
+                stringify!(mIsPrivate)
+            )
+        );
+    }
+    test_field_mIsPrivate();
 }
diff --git a/tests/expectations/tests/private_fields.rs b/tests/expectations/tests/private_fields.rs
index 92a4bf6..bea0fa4 100644
--- a/tests/expectations/tests/private_fields.rs
+++ b/tests/expectations/tests/private_fields.rs
@@ -109,26 +109,40 @@
         4usize,
         concat!("Alignment of ", stringify!(PubPriv))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<PubPriv>())).x as *const _ as usize },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(PubPriv),
-            "::",
-            stringify!(x)
-        )
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<PubPriv>())).y as *const _ as usize },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(PubPriv),
-            "::",
-            stringify!(y)
-        )
-    );
+    fn test_field_x() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<PubPriv>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).x) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(PubPriv),
+                "::",
+                stringify!(x)
+            )
+        );
+    }
+    test_field_x();
+    fn test_field_y() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<PubPriv>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).y) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(PubPriv),
+                "::",
+                stringify!(y)
+            )
+        );
+    }
+    test_field_y();
 }
 #[repr(C)]
 #[repr(align(4))]
@@ -345,16 +359,23 @@
         4usize,
         concat!("Alignment of ", stringify!(Base))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Base>())).member as *const _ as usize },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(Base),
-            "::",
-            stringify!(member)
-        )
-    );
+    fn test_field_member() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Base>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).member) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Base),
+                "::",
+                stringify!(member)
+            )
+        );
+    }
+    test_field_member();
 }
 #[repr(C)]
 #[derive(Debug, Default, Copy, Clone)]
@@ -415,19 +436,25 @@
         4usize,
         concat!("Alignment of ", stringify!(WithAnonStruct__bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<WithAnonStruct__bindgen_ty_1>())).a
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(WithAnonStruct__bindgen_ty_1),
-            "::",
-            stringify!(a)
-        )
-    );
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    WithAnonStruct__bindgen_ty_1,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(WithAnonStruct__bindgen_ty_1),
+                "::",
+                stringify!(a)
+            )
+        );
+    }
+    test_field_a();
 }
 #[repr(C)]
 #[derive(Debug, Default, Copy, Clone)]
@@ -446,19 +473,25 @@
         4usize,
         concat!("Alignment of ", stringify!(WithAnonStruct__bindgen_ty_2))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<WithAnonStruct__bindgen_ty_2>())).b
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(WithAnonStruct__bindgen_ty_2),
-            "::",
-            stringify!(b)
-        )
-    );
+    fn test_field_b() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    WithAnonStruct__bindgen_ty_2,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(WithAnonStruct__bindgen_ty_2),
+                "::",
+                stringify!(b)
+            )
+        );
+    }
+    test_field_b();
 }
 #[test]
 fn bindgen_test_layout_WithAnonStruct() {
diff --git a/tests/expectations/tests/ref_argument_array.rs b/tests/expectations/tests/ref_argument_array.rs
index 799dd81..00a8e0e 100644
--- a/tests/expectations/tests/ref_argument_array.rs
+++ b/tests/expectations/tests/ref_argument_array.rs
@@ -7,7 +7,12 @@
 
 pub const NSID_LENGTH: u32 = 10;
 #[repr(C)]
-pub struct nsID__bindgen_vtable(::std::os::raw::c_void);
+pub struct nsID__bindgen_vtable {
+    pub nsID_ToProvidedString: unsafe extern "C" fn(
+        this: *mut nsID,
+        aDest: *mut [::std::os::raw::c_char; 10usize],
+    ),
+}
 #[repr(C)]
 #[derive(Debug, Copy, Clone)]
 pub struct nsID {
diff --git a/tests/expectations/tests/reparented_replacement.rs b/tests/expectations/tests/reparented_replacement.rs
index 1f4fa6e..f8426c2 100644
--- a/tests/expectations/tests/reparented_replacement.rs
+++ b/tests/expectations/tests/reparented_replacement.rs
@@ -30,18 +30,24 @@
                 4usize,
                 concat!("Alignment of ", stringify!(Bar))
             );
-            assert_eq!(
-                unsafe {
-                    &(*(::std::ptr::null::<Bar>())).bazz as *const _ as usize
-                },
-                0usize,
-                concat!(
-                    "Offset of field: ",
-                    stringify!(Bar),
-                    "::",
-                    stringify!(bazz)
-                )
-            );
+            fn test_field_bazz() {
+                assert_eq!(
+                    unsafe {
+                        let uninit = ::std::mem::MaybeUninit::<Bar>::uninit();
+                        let ptr = uninit.as_ptr();
+                        ::std::ptr::addr_of!((*ptr).bazz) as usize -
+                            ptr as usize
+                    },
+                    0usize,
+                    concat!(
+                        "Offset of field: ",
+                        stringify!(Bar),
+                        "::",
+                        stringify!(bazz)
+                    )
+                );
+            }
+            test_field_bazz();
         }
     }
     pub type ReferencesBar = root::foo::Bar;
diff --git a/tests/expectations/tests/replace_use.rs b/tests/expectations/tests/replace_use.rs
index 7bec94b..9478801 100644
--- a/tests/expectations/tests/replace_use.rs
+++ b/tests/expectations/tests/replace_use.rs
@@ -28,11 +28,18 @@
         4usize,
         concat!("Alignment of ", stringify!(Test))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Test>())).a as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(Test), "::", stringify!(a))
-    );
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Test>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            0usize,
+            concat!("Offset of field: ", stringify!(Test), "::", stringify!(a))
+        );
+    }
+    test_field_a();
 }
 #[test]
 fn __bindgen_test_layout_nsTArray_open0_long_close0_instantiation() {
diff --git a/tests/expectations/tests/repr-align.rs b/tests/expectations/tests/repr-align.rs
index df23536..3f00fce 100644
--- a/tests/expectations/tests/repr-align.rs
+++ b/tests/expectations/tests/repr-align.rs
@@ -25,16 +25,30 @@
         8usize,
         concat!("Alignment of ", stringify!(a))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<a>())).b as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(a), "::", stringify!(b))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<a>())).c as *const _ as usize },
-        4usize,
-        concat!("Offset of field: ", stringify!(a), "::", stringify!(c))
-    );
+    fn test_field_b() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<a>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize
+            },
+            0usize,
+            concat!("Offset of field: ", stringify!(a), "::", stringify!(b))
+        );
+    }
+    test_field_b();
+    fn test_field_c() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<a>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).c) as usize - ptr as usize
+            },
+            4usize,
+            concat!("Offset of field: ", stringify!(a), "::", stringify!(c))
+        );
+    }
+    test_field_c();
 }
 #[repr(C)]
 #[repr(align(8))]
@@ -55,14 +69,28 @@
         8usize,
         concat!("Alignment of ", stringify!(b))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<b>())).b as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(b), "::", stringify!(b))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<b>())).c as *const _ as usize },
-        4usize,
-        concat!("Offset of field: ", stringify!(b), "::", stringify!(c))
-    );
+    fn test_field_b() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<b>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize
+            },
+            0usize,
+            concat!("Offset of field: ", stringify!(b), "::", stringify!(b))
+        );
+    }
+    test_field_b();
+    fn test_field_c() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<b>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).c) as usize - ptr as usize
+            },
+            4usize,
+            concat!("Offset of field: ", stringify!(b), "::", stringify!(c))
+        );
+    }
+    test_field_c();
 }
diff --git a/tests/expectations/tests/same_struct_name_in_different_namespaces.rs b/tests/expectations/tests/same_struct_name_in_different_namespaces.rs
index 056b671..294861d 100644
--- a/tests/expectations/tests/same_struct_name_in_different_namespaces.rs
+++ b/tests/expectations/tests/same_struct_name_in_different_namespaces.rs
@@ -28,28 +28,40 @@
         4usize,
         concat!("Alignment of ", stringify!(JS_shadow_Zone))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<JS_shadow_Zone>())).x as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(JS_shadow_Zone),
-            "::",
-            stringify!(x)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<JS_shadow_Zone>())).y as *const _ as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(JS_shadow_Zone),
-            "::",
-            stringify!(y)
-        )
-    );
+    fn test_field_x() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<JS_shadow_Zone>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).x) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(JS_shadow_Zone),
+                "::",
+                stringify!(x)
+            )
+        );
+    }
+    test_field_x();
+    fn test_field_y() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<JS_shadow_Zone>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).y) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(JS_shadow_Zone),
+                "::",
+                stringify!(y)
+            )
+        );
+    }
+    test_field_y();
 }
diff --git a/tests/expectations/tests/sentry-defined-multiple-times.rs b/tests/expectations/tests/sentry-defined-multiple-times.rs
index 5f2ec54..bf76d0e 100644
--- a/tests/expectations/tests/sentry-defined-multiple-times.rs
+++ b/tests/expectations/tests/sentry-defined-multiple-times.rs
@@ -39,19 +39,25 @@
                 1usize,
                 concat!("Alignment of ", stringify!(sentry))
             );
-            assert_eq!(
-                unsafe {
-                    &(*(::std::ptr::null::<sentry>())).i_am_plain_sentry
-                        as *const _ as usize
-                },
-                0usize,
-                concat!(
-                    "Offset of field: ",
-                    stringify!(sentry),
-                    "::",
-                    stringify!(i_am_plain_sentry)
-                )
-            );
+            fn test_field_i_am_plain_sentry() {
+                assert_eq!(
+                    unsafe {
+                        let uninit =
+                            ::std::mem::MaybeUninit::<sentry>::uninit();
+                        let ptr = uninit.as_ptr();
+                        ::std::ptr::addr_of!((*ptr).i_am_plain_sentry) as usize -
+                            ptr as usize
+                    },
+                    0usize,
+                    concat!(
+                        "Offset of field: ",
+                        stringify!(sentry),
+                        "::",
+                        stringify!(i_am_plain_sentry)
+                    )
+                );
+            }
+            test_field_i_am_plain_sentry();
         }
         #[repr(C)]
         #[derive(Debug, Default, Copy, Clone)]
@@ -88,20 +94,28 @@
                 1usize,
                 concat!("Alignment of ", stringify!(NotTemplateWrapper_sentry))
             );
-            assert_eq!(
-                unsafe {
-                    &(*(::std::ptr::null::<NotTemplateWrapper_sentry>()))
-                        .i_am_not_template_wrapper_sentry
-                        as *const _ as usize
-                },
-                0usize,
-                concat!(
-                    "Offset of field: ",
-                    stringify!(NotTemplateWrapper_sentry),
-                    "::",
-                    stringify!(i_am_not_template_wrapper_sentry)
-                )
-            );
+            fn test_field_i_am_not_template_wrapper_sentry() {
+                assert_eq!(
+                    unsafe {
+                        let uninit = ::std::mem::MaybeUninit::<
+                            NotTemplateWrapper_sentry,
+                        >::uninit();
+                        let ptr = uninit.as_ptr();
+                        ::std::ptr::addr_of!(
+                            (*ptr).i_am_not_template_wrapper_sentry
+                        ) as usize -
+                            ptr as usize
+                    },
+                    0usize,
+                    concat!(
+                        "Offset of field: ",
+                        stringify!(NotTemplateWrapper_sentry),
+                        "::",
+                        stringify!(i_am_not_template_wrapper_sentry)
+                    )
+                );
+            }
+            test_field_i_am_not_template_wrapper_sentry();
         }
         #[repr(C)]
         #[derive(Debug, Default, Copy, Clone)]
@@ -131,20 +145,28 @@
                     stringify!(InlineNotTemplateWrapper_sentry)
                 )
             );
-            assert_eq!(
-                unsafe {
-                    &(*(::std::ptr::null::<InlineNotTemplateWrapper_sentry>()))
-                        .i_am_inline_not_template_wrapper_sentry
-                        as *const _ as usize
-                },
-                0usize,
-                concat!(
-                    "Offset of field: ",
-                    stringify!(InlineNotTemplateWrapper_sentry),
-                    "::",
-                    stringify!(i_am_inline_not_template_wrapper_sentry)
-                )
-            );
+            fn test_field_i_am_inline_not_template_wrapper_sentry() {
+                assert_eq!(
+                    unsafe {
+                        let uninit = ::std::mem::MaybeUninit::<
+                            InlineNotTemplateWrapper_sentry,
+                        >::uninit();
+                        let ptr = uninit.as_ptr();
+                        ::std::ptr::addr_of!(
+                            (*ptr).i_am_inline_not_template_wrapper_sentry
+                        ) as usize -
+                            ptr as usize
+                    },
+                    0usize,
+                    concat!(
+                        "Offset of field: ",
+                        stringify!(InlineNotTemplateWrapper_sentry),
+                        "::",
+                        stringify!(i_am_inline_not_template_wrapper_sentry)
+                    )
+                );
+            }
+            test_field_i_am_inline_not_template_wrapper_sentry();
         }
         #[test]
         fn bindgen_test_layout_InlineNotTemplateWrapper() {
@@ -238,22 +260,29 @@
                     stringify!(OuterDoubleWrapper_InnerDoubleWrapper_sentry)
                 )
             );
-            assert_eq!(
-                unsafe {
-                    &(*(::std::ptr::null::<
-                        OuterDoubleWrapper_InnerDoubleWrapper_sentry,
-                    >()))
-                    .i_am_double_wrapper_sentry as *const _
-                        as usize
-                },
-                0usize,
-                concat!(
-                    "Offset of field: ",
-                    stringify!(OuterDoubleWrapper_InnerDoubleWrapper_sentry),
-                    "::",
-                    stringify!(i_am_double_wrapper_sentry)
-                )
-            );
+            fn test_field_i_am_double_wrapper_sentry() {
+                assert_eq!(
+                    unsafe {
+                        let uninit = ::std::mem::MaybeUninit::<
+                            OuterDoubleWrapper_InnerDoubleWrapper_sentry,
+                        >::uninit();
+                        let ptr = uninit.as_ptr();
+                        ::std::ptr::addr_of!((*ptr).i_am_double_wrapper_sentry)
+                            as usize -
+                            ptr as usize
+                    },
+                    0usize,
+                    concat!(
+                        "Offset of field: ",
+                        stringify!(
+                            OuterDoubleWrapper_InnerDoubleWrapper_sentry
+                        ),
+                        "::",
+                        stringify!(i_am_double_wrapper_sentry)
+                    )
+                );
+            }
+            test_field_i_am_double_wrapper_sentry();
         }
         #[repr(C)]
         #[derive(Debug, Default, Copy, Clone)]
@@ -275,7 +304,10 @@
         ) {
             assert_eq ! (:: std :: mem :: size_of :: < OuterDoubleInlineWrapper_InnerDoubleInlineWrapper_sentry > () , 4usize , concat ! ("Size of: " , stringify ! (OuterDoubleInlineWrapper_InnerDoubleInlineWrapper_sentry)));
             assert_eq ! (:: std :: mem :: align_of :: < OuterDoubleInlineWrapper_InnerDoubleInlineWrapper_sentry > () , 4usize , concat ! ("Alignment of " , stringify ! (OuterDoubleInlineWrapper_InnerDoubleInlineWrapper_sentry)));
-            assert_eq ! (unsafe { & (* (:: std :: ptr :: null :: < OuterDoubleInlineWrapper_InnerDoubleInlineWrapper_sentry > ())) . i_am_double_wrapper_inline_sentry as * const _ as usize } , 0usize , concat ! ("Offset of field: " , stringify ! (OuterDoubleInlineWrapper_InnerDoubleInlineWrapper_sentry) , "::" , stringify ! (i_am_double_wrapper_inline_sentry)));
+            fn test_field_i_am_double_wrapper_inline_sentry() {
+                assert_eq ! (unsafe { let uninit = :: std :: mem :: MaybeUninit :: < OuterDoubleInlineWrapper_InnerDoubleInlineWrapper_sentry > :: uninit () ; let ptr = uninit . as_ptr () ; :: std :: ptr :: addr_of ! ((* ptr) . i_am_double_wrapper_inline_sentry) as usize - ptr as usize } , 0usize , concat ! ("Offset of field: " , stringify ! (OuterDoubleInlineWrapper_InnerDoubleInlineWrapper_sentry) , "::" , stringify ! (i_am_double_wrapper_inline_sentry)));
+            }
+            test_field_i_am_double_wrapper_inline_sentry();
         }
         #[test]
         fn bindgen_test_layout_OuterDoubleInlineWrapper_InnerDoubleInlineWrapper(
@@ -346,18 +378,24 @@
             4usize,
             concat!("Alignment of ", stringify!(sentry))
         );
-        assert_eq!(
-            unsafe {
-                &(*(::std::ptr::null::<sentry>())).i_am_outside_namespace_sentry
-                    as *const _ as usize
-            },
-            0usize,
-            concat!(
-                "Offset of field: ",
-                stringify!(sentry),
-                "::",
-                stringify!(i_am_outside_namespace_sentry)
-            )
-        );
+        fn test_field_i_am_outside_namespace_sentry() {
+            assert_eq!(
+                unsafe {
+                    let uninit = ::std::mem::MaybeUninit::<sentry>::uninit();
+                    let ptr = uninit.as_ptr();
+                    ::std::ptr::addr_of!((*ptr).i_am_outside_namespace_sentry)
+                        as usize -
+                        ptr as usize
+                },
+                0usize,
+                concat!(
+                    "Offset of field: ",
+                    stringify!(sentry),
+                    "::",
+                    stringify!(i_am_outside_namespace_sentry)
+                )
+            );
+        }
+        test_field_i_am_outside_namespace_sentry();
     }
 }
diff --git a/tests/expectations/tests/size_t_is_usize.rs b/tests/expectations/tests/size_t_is_usize.rs
index 0d9ab2c..f4e4b79 100644
--- a/tests/expectations/tests/size_t_is_usize.rs
+++ b/tests/expectations/tests/size_t_is_usize.rs
@@ -24,21 +24,47 @@
         8usize,
         concat!("Alignment of ", stringify!(A))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<A>())).len as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(A), "::", stringify!(len))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<A>())).offset as *const _ as usize },
-        8usize,
-        concat!("Offset of field: ", stringify!(A), "::", stringify!(offset))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<A>())).next as *const _ as usize },
-        16usize,
-        concat!("Offset of field: ", stringify!(A), "::", stringify!(next))
-    );
+    fn test_field_len() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<A>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).len) as usize - ptr as usize
+            },
+            0usize,
+            concat!("Offset of field: ", stringify!(A), "::", stringify!(len))
+        );
+    }
+    test_field_len();
+    fn test_field_offset() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<A>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).offset) as usize - ptr as usize
+            },
+            8usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(A),
+                "::",
+                stringify!(offset)
+            )
+        );
+    }
+    test_field_offset();
+    fn test_field_next() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<A>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).next) as usize - ptr as usize
+            },
+            16usize,
+            concat!("Offset of field: ", stringify!(A), "::", stringify!(next))
+        );
+    }
+    test_field_next();
 }
 impl Default for A {
     fn default() -> Self {
diff --git a/tests/expectations/tests/size_t_template.rs b/tests/expectations/tests/size_t_template.rs
index 6796bc9..3c14d85 100644
--- a/tests/expectations/tests/size_t_template.rs
+++ b/tests/expectations/tests/size_t_template.rs
@@ -22,9 +22,16 @@
         4usize,
         concat!("Alignment of ", stringify!(C))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<C>())).arr as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(C), "::", stringify!(arr))
-    );
+    fn test_field_arr() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<C>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).arr) as usize - ptr as usize
+            },
+            0usize,
+            concat!("Offset of field: ", stringify!(C), "::", stringify!(arr))
+        );
+    }
+    test_field_arr();
 }
diff --git a/tests/expectations/tests/struct_containing_forward_declared_struct.rs b/tests/expectations/tests/struct_containing_forward_declared_struct.rs
index 7298095..bd1419c 100644
--- a/tests/expectations/tests/struct_containing_forward_declared_struct.rs
+++ b/tests/expectations/tests/struct_containing_forward_declared_struct.rs
@@ -22,11 +22,23 @@
         8usize,
         concat!("Alignment of ", stringify!(a))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<a>())).val_a as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(a), "::", stringify!(val_a))
-    );
+    fn test_field_val_a() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<a>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).val_a) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(a),
+                "::",
+                stringify!(val_a)
+            )
+        );
+    }
+    test_field_val_a();
 }
 impl Default for a {
     fn default() -> Self {
@@ -54,9 +66,21 @@
         4usize,
         concat!("Alignment of ", stringify!(b))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<b>())).val_b as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(b), "::", stringify!(val_b))
-    );
+    fn test_field_val_b() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<b>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).val_b) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(b),
+                "::",
+                stringify!(val_b)
+            )
+        );
+    }
+    test_field_val_b();
 }
diff --git a/tests/expectations/tests/struct_typedef.rs b/tests/expectations/tests/struct_typedef.rs
index 34c9dbd..1eab593 100644
--- a/tests/expectations/tests/struct_typedef.rs
+++ b/tests/expectations/tests/struct_typedef.rs
@@ -22,19 +22,24 @@
         1usize,
         concat!("Alignment of ", stringify!(typedef_named_struct))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<typedef_named_struct>())).has_name
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(typedef_named_struct),
-            "::",
-            stringify!(has_name)
-        )
-    );
+    fn test_field_has_name() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<typedef_named_struct>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).has_name) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(typedef_named_struct),
+                "::",
+                stringify!(has_name)
+            )
+        );
+    }
+    test_field_has_name();
 }
 #[repr(C)]
 #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
@@ -53,19 +58,23 @@
         8usize,
         concat!("Alignment of ", stringify!(_bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<_bindgen_ty_1>())).no_name as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(_bindgen_ty_1),
-            "::",
-            stringify!(no_name)
-        )
-    );
+    fn test_field_no_name() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<_bindgen_ty_1>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).no_name) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(_bindgen_ty_1),
+                "::",
+                stringify!(no_name)
+            )
+        );
+    }
+    test_field_no_name();
 }
 impl Default for _bindgen_ty_1 {
     fn default() -> Self {
diff --git a/tests/expectations/tests/struct_typedef_ns.rs b/tests/expectations/tests/struct_typedef_ns.rs
index ef91fe4..8b11356 100644
--- a/tests/expectations/tests/struct_typedef_ns.rs
+++ b/tests/expectations/tests/struct_typedef_ns.rs
@@ -29,19 +29,24 @@
                 4usize,
                 concat!("Alignment of ", stringify!(typedef_struct))
             );
-            assert_eq!(
-                unsafe {
-                    &(*(::std::ptr::null::<typedef_struct>())).foo as *const _
-                        as usize
-                },
-                0usize,
-                concat!(
-                    "Offset of field: ",
-                    stringify!(typedef_struct),
-                    "::",
-                    stringify!(foo)
-                )
-            );
+            fn test_field_foo() {
+                assert_eq!(
+                    unsafe {
+                        let uninit =
+                            ::std::mem::MaybeUninit::<typedef_struct>::uninit();
+                        let ptr = uninit.as_ptr();
+                        ::std::ptr::addr_of!((*ptr).foo) as usize - ptr as usize
+                    },
+                    0usize,
+                    concat!(
+                        "Offset of field: ",
+                        stringify!(typedef_struct),
+                        "::",
+                        stringify!(foo)
+                    )
+                );
+            }
+            test_field_foo();
         }
         #[repr(u32)]
         #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
@@ -69,19 +74,24 @@
                 4usize,
                 concat!("Alignment of ", stringify!(_bindgen_ty_1))
             );
-            assert_eq!(
-                unsafe {
-                    &(*(::std::ptr::null::<_bindgen_ty_1>())).foo as *const _
-                        as usize
-                },
-                0usize,
-                concat!(
-                    "Offset of field: ",
-                    stringify!(_bindgen_ty_1),
-                    "::",
-                    stringify!(foo)
-                )
-            );
+            fn test_field_foo() {
+                assert_eq!(
+                    unsafe {
+                        let uninit =
+                            ::std::mem::MaybeUninit::<_bindgen_ty_1>::uninit();
+                        let ptr = uninit.as_ptr();
+                        ::std::ptr::addr_of!((*ptr).foo) as usize - ptr as usize
+                    },
+                    0usize,
+                    concat!(
+                        "Offset of field: ",
+                        stringify!(_bindgen_ty_1),
+                        "::",
+                        stringify!(foo)
+                    )
+                );
+            }
+            test_field_foo();
         }
         pub type typedef_struct = root::_bindgen_mod_id_12::_bindgen_ty_1;
         pub const _bindgen_mod_id_12_BAR:
diff --git a/tests/expectations/tests/struct_with_anon_struct.rs b/tests/expectations/tests/struct_with_anon_struct.rs
index 0f5d3da..88e1d7b 100644
--- a/tests/expectations/tests/struct_with_anon_struct.rs
+++ b/tests/expectations/tests/struct_with_anon_struct.rs
@@ -28,30 +28,42 @@
         4usize,
         concat!("Alignment of ", stringify!(foo__bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1>())).a as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1),
-            "::",
-            stringify!(a)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1>())).b as *const _ as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1),
-            "::",
-            stringify!(b)
-        )
-    );
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<foo__bindgen_ty_1>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo__bindgen_ty_1),
+                "::",
+                stringify!(a)
+            )
+        );
+    }
+    test_field_a();
+    fn test_field_b() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<foo__bindgen_ty_1>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo__bindgen_ty_1),
+                "::",
+                stringify!(b)
+            )
+        );
+    }
+    test_field_b();
 }
 #[test]
 fn bindgen_test_layout_foo() {
@@ -65,9 +77,21 @@
         4usize,
         concat!("Alignment of ", stringify!(foo))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<foo>())).bar as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(foo), "::", stringify!(bar))
-    );
+    fn test_field_bar() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<foo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo),
+                "::",
+                stringify!(bar)
+            )
+        );
+    }
+    test_field_bar();
 }
diff --git a/tests/expectations/tests/struct_with_anon_struct_array.rs b/tests/expectations/tests/struct_with_anon_struct_array.rs
index d5a5044..b556699 100644
--- a/tests/expectations/tests/struct_with_anon_struct_array.rs
+++ b/tests/expectations/tests/struct_with_anon_struct_array.rs
@@ -29,30 +29,42 @@
         4usize,
         concat!("Alignment of ", stringify!(foo__bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1>())).a as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1),
-            "::",
-            stringify!(a)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1>())).b as *const _ as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1),
-            "::",
-            stringify!(b)
-        )
-    );
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<foo__bindgen_ty_1>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo__bindgen_ty_1),
+                "::",
+                stringify!(a)
+            )
+        );
+    }
+    test_field_a();
+    fn test_field_b() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<foo__bindgen_ty_1>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo__bindgen_ty_1),
+                "::",
+                stringify!(b)
+            )
+        );
+    }
+    test_field_b();
 }
 #[repr(C)]
 #[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
@@ -72,30 +84,42 @@
         4usize,
         concat!("Alignment of ", stringify!(foo__bindgen_ty_2))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_2>())).a as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_2),
-            "::",
-            stringify!(a)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_2>())).b as *const _ as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_2),
-            "::",
-            stringify!(b)
-        )
-    );
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<foo__bindgen_ty_2>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo__bindgen_ty_2),
+                "::",
+                stringify!(a)
+            )
+        );
+    }
+    test_field_a();
+    fn test_field_b() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<foo__bindgen_ty_2>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo__bindgen_ty_2),
+                "::",
+                stringify!(b)
+            )
+        );
+    }
+    test_field_b();
 }
 #[test]
 fn bindgen_test_layout_foo() {
@@ -109,14 +133,38 @@
         4usize,
         concat!("Alignment of ", stringify!(foo))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<foo>())).bar as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(foo), "::", stringify!(bar))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<foo>())).baz as *const _ as usize },
-        16usize,
-        concat!("Offset of field: ", stringify!(foo), "::", stringify!(baz))
-    );
+    fn test_field_bar() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<foo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo),
+                "::",
+                stringify!(bar)
+            )
+        );
+    }
+    test_field_bar();
+    fn test_field_baz() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<foo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).baz) as usize - ptr as usize
+            },
+            16usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo),
+                "::",
+                stringify!(baz)
+            )
+        );
+    }
+    test_field_baz();
 }
diff --git a/tests/expectations/tests/struct_with_anon_struct_pointer.rs b/tests/expectations/tests/struct_with_anon_struct_pointer.rs
index 0ed19f7..5050ef4 100644
--- a/tests/expectations/tests/struct_with_anon_struct_pointer.rs
+++ b/tests/expectations/tests/struct_with_anon_struct_pointer.rs
@@ -28,30 +28,42 @@
         4usize,
         concat!("Alignment of ", stringify!(foo__bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1>())).a as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1),
-            "::",
-            stringify!(a)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1>())).b as *const _ as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1),
-            "::",
-            stringify!(b)
-        )
-    );
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<foo__bindgen_ty_1>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo__bindgen_ty_1),
+                "::",
+                stringify!(a)
+            )
+        );
+    }
+    test_field_a();
+    fn test_field_b() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<foo__bindgen_ty_1>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo__bindgen_ty_1),
+                "::",
+                stringify!(b)
+            )
+        );
+    }
+    test_field_b();
 }
 #[test]
 fn bindgen_test_layout_foo() {
@@ -65,11 +77,23 @@
         8usize,
         concat!("Alignment of ", stringify!(foo))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<foo>())).bar as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(foo), "::", stringify!(bar))
-    );
+    fn test_field_bar() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<foo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo),
+                "::",
+                stringify!(bar)
+            )
+        );
+    }
+    test_field_bar();
 }
 impl Default for foo {
     fn default() -> Self {
diff --git a/tests/expectations/tests/struct_with_anon_union.rs b/tests/expectations/tests/struct_with_anon_union.rs
index 15b8c9e..37f0747 100644
--- a/tests/expectations/tests/struct_with_anon_union.rs
+++ b/tests/expectations/tests/struct_with_anon_union.rs
@@ -28,30 +28,42 @@
         4usize,
         concat!("Alignment of ", stringify!(foo__bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1>())).a as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1),
-            "::",
-            stringify!(a)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1>())).b as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1),
-            "::",
-            stringify!(b)
-        )
-    );
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<foo__bindgen_ty_1>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo__bindgen_ty_1),
+                "::",
+                stringify!(a)
+            )
+        );
+    }
+    test_field_a();
+    fn test_field_b() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<foo__bindgen_ty_1>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo__bindgen_ty_1),
+                "::",
+                stringify!(b)
+            )
+        );
+    }
+    test_field_b();
 }
 impl Default for foo__bindgen_ty_1 {
     fn default() -> Self {
@@ -74,11 +86,23 @@
         4usize,
         concat!("Alignment of ", stringify!(foo))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<foo>())).bar as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(foo), "::", stringify!(bar))
-    );
+    fn test_field_bar() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<foo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo),
+                "::",
+                stringify!(bar)
+            )
+        );
+    }
+    test_field_bar();
 }
 impl Default for foo {
     fn default() -> Self {
diff --git a/tests/expectations/tests/struct_with_anon_union_1_0.rs b/tests/expectations/tests/struct_with_anon_union_1_0.rs
index b02c444..03e0efc 100644
--- a/tests/expectations/tests/struct_with_anon_union_1_0.rs
+++ b/tests/expectations/tests/struct_with_anon_union_1_0.rs
@@ -72,30 +72,42 @@
         4usize,
         concat!("Alignment of ", stringify!(foo__bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1>())).a as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1),
-            "::",
-            stringify!(a)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1>())).b as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1),
-            "::",
-            stringify!(b)
-        )
-    );
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<foo__bindgen_ty_1>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo__bindgen_ty_1),
+                "::",
+                stringify!(a)
+            )
+        );
+    }
+    test_field_a();
+    fn test_field_b() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<foo__bindgen_ty_1>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo__bindgen_ty_1),
+                "::",
+                stringify!(b)
+            )
+        );
+    }
+    test_field_b();
 }
 impl Clone for foo__bindgen_ty_1 {
     fn clone(&self) -> Self {
@@ -114,11 +126,23 @@
         4usize,
         concat!("Alignment of ", stringify!(foo))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<foo>())).bar as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(foo), "::", stringify!(bar))
-    );
+    fn test_field_bar() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<foo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo),
+                "::",
+                stringify!(bar)
+            )
+        );
+    }
+    test_field_bar();
 }
 impl Clone for foo {
     fn clone(&self) -> Self {
diff --git a/tests/expectations/tests/struct_with_anon_unnamed_struct.rs b/tests/expectations/tests/struct_with_anon_unnamed_struct.rs
index 30751e7..8916bcd 100644
--- a/tests/expectations/tests/struct_with_anon_unnamed_struct.rs
+++ b/tests/expectations/tests/struct_with_anon_unnamed_struct.rs
@@ -28,30 +28,42 @@
         4usize,
         concat!("Alignment of ", stringify!(foo__bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1>())).a as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1),
-            "::",
-            stringify!(a)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1>())).b as *const _ as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1),
-            "::",
-            stringify!(b)
-        )
-    );
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<foo__bindgen_ty_1>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo__bindgen_ty_1),
+                "::",
+                stringify!(a)
+            )
+        );
+    }
+    test_field_a();
+    fn test_field_b() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<foo__bindgen_ty_1>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo__bindgen_ty_1),
+                "::",
+                stringify!(b)
+            )
+        );
+    }
+    test_field_b();
 }
 #[test]
 fn bindgen_test_layout_foo() {
diff --git a/tests/expectations/tests/struct_with_anon_unnamed_union.rs b/tests/expectations/tests/struct_with_anon_unnamed_union.rs
index 17a8357..eb177c9 100644
--- a/tests/expectations/tests/struct_with_anon_unnamed_union.rs
+++ b/tests/expectations/tests/struct_with_anon_unnamed_union.rs
@@ -28,30 +28,42 @@
         4usize,
         concat!("Alignment of ", stringify!(foo__bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1>())).a as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1),
-            "::",
-            stringify!(a)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1>())).b as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1),
-            "::",
-            stringify!(b)
-        )
-    );
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<foo__bindgen_ty_1>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo__bindgen_ty_1),
+                "::",
+                stringify!(a)
+            )
+        );
+    }
+    test_field_a();
+    fn test_field_b() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<foo__bindgen_ty_1>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo__bindgen_ty_1),
+                "::",
+                stringify!(b)
+            )
+        );
+    }
+    test_field_b();
 }
 impl Default for foo__bindgen_ty_1 {
     fn default() -> Self {
diff --git a/tests/expectations/tests/struct_with_anon_unnamed_union_1_0.rs b/tests/expectations/tests/struct_with_anon_unnamed_union_1_0.rs
index f72abd2..0098a40 100644
--- a/tests/expectations/tests/struct_with_anon_unnamed_union_1_0.rs
+++ b/tests/expectations/tests/struct_with_anon_unnamed_union_1_0.rs
@@ -72,30 +72,42 @@
         4usize,
         concat!("Alignment of ", stringify!(foo__bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1>())).a as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1),
-            "::",
-            stringify!(a)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1>())).b as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1),
-            "::",
-            stringify!(b)
-        )
-    );
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<foo__bindgen_ty_1>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo__bindgen_ty_1),
+                "::",
+                stringify!(a)
+            )
+        );
+    }
+    test_field_a();
+    fn test_field_b() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<foo__bindgen_ty_1>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo__bindgen_ty_1),
+                "::",
+                stringify!(b)
+            )
+        );
+    }
+    test_field_b();
 }
 impl Clone for foo__bindgen_ty_1 {
     fn clone(&self) -> Self {
diff --git a/tests/expectations/tests/struct_with_bitfields.rs b/tests/expectations/tests/struct_with_bitfields.rs
index 2e95726..0012395 100644
--- a/tests/expectations/tests/struct_with_bitfields.rs
+++ b/tests/expectations/tests/struct_with_bitfields.rs
@@ -112,16 +112,23 @@
         4usize,
         concat!("Alignment of ", stringify!(bitfield))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<bitfield>())).e as *const _ as usize },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(bitfield),
-            "::",
-            stringify!(e)
-        )
-    );
+    fn test_field_e() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<bitfield>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).e) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(bitfield),
+                "::",
+                stringify!(e)
+            )
+        );
+    }
+    test_field_e();
 }
 impl bitfield {
     #[inline]
diff --git a/tests/expectations/tests/struct_with_derive_debug.rs b/tests/expectations/tests/struct_with_derive_debug.rs
index 721ba96..a2729bb 100644
--- a/tests/expectations/tests/struct_with_derive_debug.rs
+++ b/tests/expectations/tests/struct_with_derive_debug.rs
@@ -22,18 +22,23 @@
         4usize,
         concat!("Alignment of ", stringify!(LittleArray))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<LittleArray>())).a as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(LittleArray),
-            "::",
-            stringify!(a)
-        )
-    );
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<LittleArray>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(LittleArray),
+                "::",
+                stringify!(a)
+            )
+        );
+    }
+    test_field_a();
 }
 #[repr(C)]
 #[derive(Copy, Clone)]
@@ -52,16 +57,23 @@
         4usize,
         concat!("Alignment of ", stringify!(BigArray))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<BigArray>())).a as *const _ as usize },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(BigArray),
-            "::",
-            stringify!(a)
-        )
-    );
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<BigArray>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(BigArray),
+                "::",
+                stringify!(a)
+            )
+        );
+    }
+    test_field_a();
 }
 impl Default for BigArray {
     fn default() -> Self {
@@ -89,18 +101,24 @@
         4usize,
         concat!("Alignment of ", stringify!(WithLittleArray))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<WithLittleArray>())).a as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(WithLittleArray),
-            "::",
-            stringify!(a)
-        )
-    );
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<WithLittleArray>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(WithLittleArray),
+                "::",
+                stringify!(a)
+            )
+        );
+    }
+    test_field_a();
 }
 #[repr(C)]
 #[derive(Copy, Clone)]
@@ -119,18 +137,23 @@
         4usize,
         concat!("Alignment of ", stringify!(WithBigArray))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<WithBigArray>())).a as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(WithBigArray),
-            "::",
-            stringify!(a)
-        )
-    );
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<WithBigArray>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(WithBigArray),
+                "::",
+                stringify!(a)
+            )
+        );
+    }
+    test_field_a();
 }
 impl Default for WithBigArray {
     fn default() -> Self {
diff --git a/tests/expectations/tests/struct_with_large_array.rs b/tests/expectations/tests/struct_with_large_array.rs
index 56179c2..e792f71 100644
--- a/tests/expectations/tests/struct_with_large_array.rs
+++ b/tests/expectations/tests/struct_with_large_array.rs
@@ -22,18 +22,23 @@
         1usize,
         concat!("Alignment of ", stringify!(S))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<S>())).large_array as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(S),
-            "::",
-            stringify!(large_array)
-        )
-    );
+    fn test_field_large_array() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<S>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).large_array) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(S),
+                "::",
+                stringify!(large_array)
+            )
+        );
+    }
+    test_field_large_array();
 }
 impl Default for S {
     fn default() -> Self {
diff --git a/tests/expectations/tests/struct_with_nesting.rs b/tests/expectations/tests/struct_with_nesting.rs
index 7ced63e..5b98fc4 100644
--- a/tests/expectations/tests/struct_with_nesting.rs
+++ b/tests/expectations/tests/struct_with_nesting.rs
@@ -36,32 +36,44 @@
         2usize,
         concat!("Alignment of ", stringify!(foo__bindgen_ty_1__bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1__bindgen_ty_1>())).c1
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1__bindgen_ty_1),
-            "::",
-            stringify!(c1)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1__bindgen_ty_1>())).c2
-                as *const _ as usize
-        },
-        2usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1__bindgen_ty_1),
-            "::",
-            stringify!(c2)
-        )
-    );
+    fn test_field_c1() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    foo__bindgen_ty_1__bindgen_ty_1,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).c1) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo__bindgen_ty_1__bindgen_ty_1),
+                "::",
+                stringify!(c1)
+            )
+        );
+    }
+    test_field_c1();
+    fn test_field_c2() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    foo__bindgen_ty_1__bindgen_ty_1,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).c2) as usize - ptr as usize
+            },
+            2usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo__bindgen_ty_1__bindgen_ty_1),
+                "::",
+                stringify!(c2)
+            )
+        );
+    }
+    test_field_c2();
 }
 #[repr(C)]
 #[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
@@ -83,58 +95,82 @@
         1usize,
         concat!("Alignment of ", stringify!(foo__bindgen_ty_1__bindgen_ty_2))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1__bindgen_ty_2>())).d1
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1__bindgen_ty_2),
-            "::",
-            stringify!(d1)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1__bindgen_ty_2>())).d2
-                as *const _ as usize
-        },
-        1usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1__bindgen_ty_2),
-            "::",
-            stringify!(d2)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1__bindgen_ty_2>())).d3
-                as *const _ as usize
-        },
-        2usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1__bindgen_ty_2),
-            "::",
-            stringify!(d3)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1__bindgen_ty_2>())).d4
-                as *const _ as usize
-        },
-        3usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1__bindgen_ty_2),
-            "::",
-            stringify!(d4)
-        )
-    );
+    fn test_field_d1() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    foo__bindgen_ty_1__bindgen_ty_2,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).d1) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo__bindgen_ty_1__bindgen_ty_2),
+                "::",
+                stringify!(d1)
+            )
+        );
+    }
+    test_field_d1();
+    fn test_field_d2() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    foo__bindgen_ty_1__bindgen_ty_2,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).d2) as usize - ptr as usize
+            },
+            1usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo__bindgen_ty_1__bindgen_ty_2),
+                "::",
+                stringify!(d2)
+            )
+        );
+    }
+    test_field_d2();
+    fn test_field_d3() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    foo__bindgen_ty_1__bindgen_ty_2,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).d3) as usize - ptr as usize
+            },
+            2usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo__bindgen_ty_1__bindgen_ty_2),
+                "::",
+                stringify!(d3)
+            )
+        );
+    }
+    test_field_d3();
+    fn test_field_d4() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    foo__bindgen_ty_1__bindgen_ty_2,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).d4) as usize - ptr as usize
+            },
+            3usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo__bindgen_ty_1__bindgen_ty_2),
+                "::",
+                stringify!(d4)
+            )
+        );
+    }
+    test_field_d4();
 }
 #[test]
 fn bindgen_test_layout_foo__bindgen_ty_1() {
@@ -148,18 +184,24 @@
         4usize,
         concat!("Alignment of ", stringify!(foo__bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1>())).b as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1),
-            "::",
-            stringify!(b)
-        )
-    );
+    fn test_field_b() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<foo__bindgen_ty_1>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo__bindgen_ty_1),
+                "::",
+                stringify!(b)
+            )
+        );
+    }
+    test_field_b();
 }
 impl Default for foo__bindgen_ty_1 {
     fn default() -> Self {
@@ -182,11 +224,18 @@
         4usize,
         concat!("Alignment of ", stringify!(foo))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<foo>())).a as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(foo), "::", stringify!(a))
-    );
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<foo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            0usize,
+            concat!("Offset of field: ", stringify!(foo), "::", stringify!(a))
+        );
+    }
+    test_field_a();
 }
 impl Default for foo {
     fn default() -> Self {
diff --git a/tests/expectations/tests/struct_with_nesting_1_0.rs b/tests/expectations/tests/struct_with_nesting_1_0.rs
index 9f27161..0a7e1ec 100644
--- a/tests/expectations/tests/struct_with_nesting_1_0.rs
+++ b/tests/expectations/tests/struct_with_nesting_1_0.rs
@@ -80,32 +80,44 @@
         2usize,
         concat!("Alignment of ", stringify!(foo__bindgen_ty_1__bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1__bindgen_ty_1>())).c1
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1__bindgen_ty_1),
-            "::",
-            stringify!(c1)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1__bindgen_ty_1>())).c2
-                as *const _ as usize
-        },
-        2usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1__bindgen_ty_1),
-            "::",
-            stringify!(c2)
-        )
-    );
+    fn test_field_c1() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    foo__bindgen_ty_1__bindgen_ty_1,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).c1) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo__bindgen_ty_1__bindgen_ty_1),
+                "::",
+                stringify!(c1)
+            )
+        );
+    }
+    test_field_c1();
+    fn test_field_c2() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    foo__bindgen_ty_1__bindgen_ty_1,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).c2) as usize - ptr as usize
+            },
+            2usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo__bindgen_ty_1__bindgen_ty_1),
+                "::",
+                stringify!(c2)
+            )
+        );
+    }
+    test_field_c2();
 }
 impl Clone for foo__bindgen_ty_1__bindgen_ty_1 {
     fn clone(&self) -> Self {
@@ -132,58 +144,82 @@
         1usize,
         concat!("Alignment of ", stringify!(foo__bindgen_ty_1__bindgen_ty_2))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1__bindgen_ty_2>())).d1
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1__bindgen_ty_2),
-            "::",
-            stringify!(d1)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1__bindgen_ty_2>())).d2
-                as *const _ as usize
-        },
-        1usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1__bindgen_ty_2),
-            "::",
-            stringify!(d2)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1__bindgen_ty_2>())).d3
-                as *const _ as usize
-        },
-        2usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1__bindgen_ty_2),
-            "::",
-            stringify!(d3)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1__bindgen_ty_2>())).d4
-                as *const _ as usize
-        },
-        3usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1__bindgen_ty_2),
-            "::",
-            stringify!(d4)
-        )
-    );
+    fn test_field_d1() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    foo__bindgen_ty_1__bindgen_ty_2,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).d1) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo__bindgen_ty_1__bindgen_ty_2),
+                "::",
+                stringify!(d1)
+            )
+        );
+    }
+    test_field_d1();
+    fn test_field_d2() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    foo__bindgen_ty_1__bindgen_ty_2,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).d2) as usize - ptr as usize
+            },
+            1usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo__bindgen_ty_1__bindgen_ty_2),
+                "::",
+                stringify!(d2)
+            )
+        );
+    }
+    test_field_d2();
+    fn test_field_d3() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    foo__bindgen_ty_1__bindgen_ty_2,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).d3) as usize - ptr as usize
+            },
+            2usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo__bindgen_ty_1__bindgen_ty_2),
+                "::",
+                stringify!(d3)
+            )
+        );
+    }
+    test_field_d3();
+    fn test_field_d4() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    foo__bindgen_ty_1__bindgen_ty_2,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).d4) as usize - ptr as usize
+            },
+            3usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo__bindgen_ty_1__bindgen_ty_2),
+                "::",
+                stringify!(d4)
+            )
+        );
+    }
+    test_field_d4();
 }
 impl Clone for foo__bindgen_ty_1__bindgen_ty_2 {
     fn clone(&self) -> Self {
@@ -202,18 +238,24 @@
         4usize,
         concat!("Alignment of ", stringify!(foo__bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1>())).b as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1),
-            "::",
-            stringify!(b)
-        )
-    );
+    fn test_field_b() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<foo__bindgen_ty_1>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo__bindgen_ty_1),
+                "::",
+                stringify!(b)
+            )
+        );
+    }
+    test_field_b();
 }
 impl Clone for foo__bindgen_ty_1 {
     fn clone(&self) -> Self {
@@ -232,11 +274,18 @@
         4usize,
         concat!("Alignment of ", stringify!(foo))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<foo>())).a as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(foo), "::", stringify!(a))
-    );
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<foo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            0usize,
+            concat!("Offset of field: ", stringify!(foo), "::", stringify!(a))
+        );
+    }
+    test_field_a();
 }
 impl Clone for foo {
     fn clone(&self) -> Self {
diff --git a/tests/expectations/tests/struct_with_packing.rs b/tests/expectations/tests/struct_with_packing.rs
index 14ee36f..c82edf2 100644
--- a/tests/expectations/tests/struct_with_packing.rs
+++ b/tests/expectations/tests/struct_with_packing.rs
@@ -23,14 +23,28 @@
         1usize,
         concat!("Alignment of ", stringify!(a))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<a>())).b as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(a), "::", stringify!(b))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<a>())).c as *const _ as usize },
-        1usize,
-        concat!("Offset of field: ", stringify!(a), "::", stringify!(c))
-    );
+    fn test_field_b() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<a>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize
+            },
+            0usize,
+            concat!("Offset of field: ", stringify!(a), "::", stringify!(b))
+        );
+    }
+    test_field_b();
+    fn test_field_c() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<a>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).c) as usize - ptr as usize
+            },
+            1usize,
+            concat!("Offset of field: ", stringify!(a), "::", stringify!(c))
+        );
+    }
+    test_field_c();
 }
diff --git a/tests/expectations/tests/struct_with_struct.rs b/tests/expectations/tests/struct_with_struct.rs
index c605c6e..a8d0693 100644
--- a/tests/expectations/tests/struct_with_struct.rs
+++ b/tests/expectations/tests/struct_with_struct.rs
@@ -28,30 +28,42 @@
         4usize,
         concat!("Alignment of ", stringify!(foo__bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1>())).x as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1),
-            "::",
-            stringify!(x)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1>())).y as *const _ as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1),
-            "::",
-            stringify!(y)
-        )
-    );
+    fn test_field_x() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<foo__bindgen_ty_1>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).x) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo__bindgen_ty_1),
+                "::",
+                stringify!(x)
+            )
+        );
+    }
+    test_field_x();
+    fn test_field_y() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<foo__bindgen_ty_1>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).y) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo__bindgen_ty_1),
+                "::",
+                stringify!(y)
+            )
+        );
+    }
+    test_field_y();
 }
 #[test]
 fn bindgen_test_layout_foo() {
@@ -65,9 +77,21 @@
         4usize,
         concat!("Alignment of ", stringify!(foo))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<foo>())).bar as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(foo), "::", stringify!(bar))
-    );
+    fn test_field_bar() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<foo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo),
+                "::",
+                stringify!(bar)
+            )
+        );
+    }
+    test_field_bar();
 }
diff --git a/tests/expectations/tests/template.rs b/tests/expectations/tests/template.rs
index 9c48488..4de7b7a 100644
--- a/tests/expectations/tests/template.rs
+++ b/tests/expectations/tests/template.rs
@@ -64,12 +64,13 @@
     pub mBConstRef: B<*const ::std::os::raw::c_int>,
     pub mPtrRef: B<*mut *mut ::std::os::raw::c_int>,
     pub mArrayRef: B<*mut [::std::os::raw::c_int; 1usize]>,
+    pub mBConstArray: B<[::std::os::raw::c_int; 1usize]>,
 }
 #[test]
 fn bindgen_test_layout_C() {
     assert_eq!(
         ::std::mem::size_of::<C>(),
-        96usize,
+        104usize,
         concat!("Size of: ", stringify!(C))
     );
     assert_eq!(
@@ -77,165 +78,276 @@
         8usize,
         concat!("Alignment of ", stringify!(C))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<C>())).mB as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(C), "::", stringify!(mB))
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C>())).mBConstPtr as *const _ as usize
-        },
-        8usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C),
-            "::",
-            stringify!(mBConstPtr)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C>())).mBConstStructPtr as *const _ as usize
-        },
-        16usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C),
-            "::",
-            stringify!(mBConstStructPtr)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C>())).mBConstStructPtrArray as *const _
-                as usize
-        },
-        24usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C),
-            "::",
-            stringify!(mBConstStructPtrArray)
-        )
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<C>())).mBConst as *const _ as usize },
-        32usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C),
-            "::",
-            stringify!(mBConst)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C>())).mBVolatile as *const _ as usize
-        },
-        36usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C),
-            "::",
-            stringify!(mBVolatile)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C>())).mBConstBool as *const _ as usize
-        },
-        40usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C),
-            "::",
-            stringify!(mBConstBool)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C>())).mBConstChar as *const _ as usize
-        },
-        42usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C),
-            "::",
-            stringify!(mBConstChar)
-        )
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<C>())).mBArray as *const _ as usize },
-        44usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C),
-            "::",
-            stringify!(mBArray)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C>())).mBPtrArray as *const _ as usize
-        },
-        48usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C),
-            "::",
-            stringify!(mBPtrArray)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C>())).mBArrayPtr as *const _ as usize
-        },
-        56usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C),
-            "::",
-            stringify!(mBArrayPtr)
-        )
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<C>())).mBRef as *const _ as usize },
-        64usize,
-        concat!("Offset of field: ", stringify!(C), "::", stringify!(mBRef))
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C>())).mBConstRef as *const _ as usize
-        },
-        72usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C),
-            "::",
-            stringify!(mBConstRef)
-        )
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<C>())).mPtrRef as *const _ as usize },
-        80usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C),
-            "::",
-            stringify!(mPtrRef)
-        )
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<C>())).mArrayRef as *const _ as usize },
-        88usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C),
-            "::",
-            stringify!(mArrayRef)
-        )
-    );
+    fn test_field_mB() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<C>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mB) as usize - ptr as usize
+            },
+            0usize,
+            concat!("Offset of field: ", stringify!(C), "::", stringify!(mB))
+        );
+    }
+    test_field_mB();
+    fn test_field_mBConstPtr() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<C>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mBConstPtr) as usize - ptr as usize
+            },
+            8usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C),
+                "::",
+                stringify!(mBConstPtr)
+            )
+        );
+    }
+    test_field_mBConstPtr();
+    fn test_field_mBConstStructPtr() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<C>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mBConstStructPtr) as usize -
+                    ptr as usize
+            },
+            16usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C),
+                "::",
+                stringify!(mBConstStructPtr)
+            )
+        );
+    }
+    test_field_mBConstStructPtr();
+    fn test_field_mBConstStructPtrArray() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<C>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mBConstStructPtrArray) as usize -
+                    ptr as usize
+            },
+            24usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C),
+                "::",
+                stringify!(mBConstStructPtrArray)
+            )
+        );
+    }
+    test_field_mBConstStructPtrArray();
+    fn test_field_mBConst() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<C>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mBConst) as usize - ptr as usize
+            },
+            32usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C),
+                "::",
+                stringify!(mBConst)
+            )
+        );
+    }
+    test_field_mBConst();
+    fn test_field_mBVolatile() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<C>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mBVolatile) as usize - ptr as usize
+            },
+            36usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C),
+                "::",
+                stringify!(mBVolatile)
+            )
+        );
+    }
+    test_field_mBVolatile();
+    fn test_field_mBConstBool() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<C>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mBConstBool) as usize - ptr as usize
+            },
+            40usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C),
+                "::",
+                stringify!(mBConstBool)
+            )
+        );
+    }
+    test_field_mBConstBool();
+    fn test_field_mBConstChar() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<C>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mBConstChar) as usize - ptr as usize
+            },
+            42usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C),
+                "::",
+                stringify!(mBConstChar)
+            )
+        );
+    }
+    test_field_mBConstChar();
+    fn test_field_mBArray() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<C>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mBArray) as usize - ptr as usize
+            },
+            44usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C),
+                "::",
+                stringify!(mBArray)
+            )
+        );
+    }
+    test_field_mBArray();
+    fn test_field_mBPtrArray() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<C>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mBPtrArray) as usize - ptr as usize
+            },
+            48usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C),
+                "::",
+                stringify!(mBPtrArray)
+            )
+        );
+    }
+    test_field_mBPtrArray();
+    fn test_field_mBArrayPtr() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<C>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mBArrayPtr) as usize - ptr as usize
+            },
+            56usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C),
+                "::",
+                stringify!(mBArrayPtr)
+            )
+        );
+    }
+    test_field_mBArrayPtr();
+    fn test_field_mBRef() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<C>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mBRef) as usize - ptr as usize
+            },
+            64usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C),
+                "::",
+                stringify!(mBRef)
+            )
+        );
+    }
+    test_field_mBRef();
+    fn test_field_mBConstRef() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<C>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mBConstRef) as usize - ptr as usize
+            },
+            72usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C),
+                "::",
+                stringify!(mBConstRef)
+            )
+        );
+    }
+    test_field_mBConstRef();
+    fn test_field_mPtrRef() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<C>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mPtrRef) as usize - ptr as usize
+            },
+            80usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C),
+                "::",
+                stringify!(mPtrRef)
+            )
+        );
+    }
+    test_field_mPtrRef();
+    fn test_field_mArrayRef() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<C>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mArrayRef) as usize - ptr as usize
+            },
+            88usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C),
+                "::",
+                stringify!(mArrayRef)
+            )
+        );
+    }
+    test_field_mArrayRef();
+    fn test_field_mBConstArray() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<C>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mBConstArray) as usize -
+                    ptr as usize
+            },
+            96usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(C),
+                "::",
+                stringify!(mBConstArray)
+            )
+        );
+    }
+    test_field_mBConstArray();
 }
 impl Default for C {
     fn default() -> Self {
@@ -311,19 +423,24 @@
         8usize,
         concat!("Alignment of ", stringify!(RootedContainer))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<RootedContainer>())).root as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(RootedContainer),
-            "::",
-            stringify!(root)
-        )
-    );
+    fn test_field_root() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<RootedContainer>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).root) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(RootedContainer),
+                "::",
+                stringify!(root)
+            )
+        );
+    }
+    test_field_root();
 }
 impl Default for RootedContainer {
     fn default() -> Self {
@@ -367,19 +484,24 @@
         4usize,
         concat!("Alignment of ", stringify!(PODButContainsDtor))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<PODButContainsDtor>())).member as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(PODButContainsDtor),
-            "::",
-            stringify!(member)
-        )
-    );
+    fn test_field_member() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<PODButContainsDtor>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).member) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(PODButContainsDtor),
+                "::",
+                stringify!(member)
+            )
+        );
+    }
+    test_field_member();
 }
 impl Default for PODButContainsDtor {
     fn default() -> Self {
@@ -413,18 +535,24 @@
         4usize,
         concat!("Alignment of ", stringify!(POD))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<POD>())).opaque_member as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(POD),
-            "::",
-            stringify!(opaque_member)
-        )
-    );
+    fn test_field_opaque_member() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<POD>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).opaque_member) as usize -
+                    ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(POD),
+                "::",
+                stringify!(opaque_member)
+            )
+        );
+    }
+    test_field_opaque_member();
 }
 /// <div rustbindgen replaces="NestedReplaced"></div>
 #[repr(C)]
@@ -877,6 +1005,25 @@
     );
 }
 #[test]
+fn __bindgen_test_layout_B_open0_array1_const_int_close0_instantiation() {
+    assert_eq!(
+        ::std::mem::size_of::<B<[::std::os::raw::c_int; 1usize]>>(),
+        4usize,
+        concat!(
+            "Size of template specialization: ",
+            stringify!(B<[::std::os::raw::c_int; 1usize]>)
+        )
+    );
+    assert_eq!(
+        ::std::mem::align_of::<B<[::std::os::raw::c_int; 1usize]>>(),
+        4usize,
+        concat!(
+            "Alignment of template specialization: ",
+            stringify!(B<[::std::os::raw::c_int; 1usize]>)
+        )
+    );
+}
+#[test]
 fn __bindgen_test_layout_Foo_open0_int_int_close0_instantiation_1() {
     assert_eq!(
         ::std::mem::size_of::<Foo<::std::os::raw::c_int>>(),
diff --git a/tests/expectations/tests/test_mixed_header_and_header_contents.rs b/tests/expectations/tests/test_mixed_header_and_header_contents.rs
index c97be9b..369d10d 100644
--- a/tests/expectations/tests/test_mixed_header_and_header_contents.rs
+++ b/tests/expectations/tests/test_mixed_header_and_header_contents.rs
@@ -43,69 +43,198 @@
         1usize,
         concat!("Alignment of ", stringify!(Test))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Test>())).ch as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(Test), "::", stringify!(ch))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Test>())).u as *const _ as usize },
-        1usize,
-        concat!("Offset of field: ", stringify!(Test), "::", stringify!(u))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Test>())).d as *const _ as usize },
-        2usize,
-        concat!("Offset of field: ", stringify!(Test), "::", stringify!(d))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Test>())).cch as *const _ as usize },
-        3usize,
-        concat!("Offset of field: ", stringify!(Test), "::", stringify!(cch))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Test>())).cu as *const _ as usize },
-        4usize,
-        concat!("Offset of field: ", stringify!(Test), "::", stringify!(cu))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Test>())).cd as *const _ as usize },
-        5usize,
-        concat!("Offset of field: ", stringify!(Test), "::", stringify!(cd))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Test>())).Cch as *const _ as usize },
-        6usize,
-        concat!("Offset of field: ", stringify!(Test), "::", stringify!(Cch))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Test>())).Cu as *const _ as usize },
-        7usize,
-        concat!("Offset of field: ", stringify!(Test), "::", stringify!(Cu))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Test>())).Cd as *const _ as usize },
-        8usize,
-        concat!("Offset of field: ", stringify!(Test), "::", stringify!(Cd))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Test>())).Ccch as *const _ as usize },
-        9usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(Test),
-            "::",
-            stringify!(Ccch)
-        )
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Test>())).Ccu as *const _ as usize },
-        10usize,
-        concat!("Offset of field: ", stringify!(Test), "::", stringify!(Ccu))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Test>())).Ccd as *const _ as usize },
-        11usize,
-        concat!("Offset of field: ", stringify!(Test), "::", stringify!(Ccd))
-    );
+    fn test_field_ch() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Test>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).ch) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Test),
+                "::",
+                stringify!(ch)
+            )
+        );
+    }
+    test_field_ch();
+    fn test_field_u() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Test>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).u) as usize - ptr as usize
+            },
+            1usize,
+            concat!("Offset of field: ", stringify!(Test), "::", stringify!(u))
+        );
+    }
+    test_field_u();
+    fn test_field_d() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Test>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).d) as usize - ptr as usize
+            },
+            2usize,
+            concat!("Offset of field: ", stringify!(Test), "::", stringify!(d))
+        );
+    }
+    test_field_d();
+    fn test_field_cch() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Test>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).cch) as usize - ptr as usize
+            },
+            3usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Test),
+                "::",
+                stringify!(cch)
+            )
+        );
+    }
+    test_field_cch();
+    fn test_field_cu() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Test>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).cu) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Test),
+                "::",
+                stringify!(cu)
+            )
+        );
+    }
+    test_field_cu();
+    fn test_field_cd() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Test>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).cd) as usize - ptr as usize
+            },
+            5usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Test),
+                "::",
+                stringify!(cd)
+            )
+        );
+    }
+    test_field_cd();
+    fn test_field_Cch() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Test>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).Cch) as usize - ptr as usize
+            },
+            6usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Test),
+                "::",
+                stringify!(Cch)
+            )
+        );
+    }
+    test_field_Cch();
+    fn test_field_Cu() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Test>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).Cu) as usize - ptr as usize
+            },
+            7usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Test),
+                "::",
+                stringify!(Cu)
+            )
+        );
+    }
+    test_field_Cu();
+    fn test_field_Cd() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Test>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).Cd) as usize - ptr as usize
+            },
+            8usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Test),
+                "::",
+                stringify!(Cd)
+            )
+        );
+    }
+    test_field_Cd();
+    fn test_field_Ccch() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Test>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).Ccch) as usize - ptr as usize
+            },
+            9usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Test),
+                "::",
+                stringify!(Ccch)
+            )
+        );
+    }
+    test_field_Ccch();
+    fn test_field_Ccu() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Test>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).Ccu) as usize - ptr as usize
+            },
+            10usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Test),
+                "::",
+                stringify!(Ccu)
+            )
+        );
+    }
+    test_field_Ccu();
+    fn test_field_Ccd() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Test>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).Ccd) as usize - ptr as usize
+            },
+            11usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Test),
+                "::",
+                stringify!(Ccd)
+            )
+        );
+    }
+    test_field_Ccd();
 }
diff --git a/tests/expectations/tests/test_multiple_header_calls_in_builder.rs b/tests/expectations/tests/test_multiple_header_calls_in_builder.rs
index c77c183..b05dd97 100644
--- a/tests/expectations/tests/test_multiple_header_calls_in_builder.rs
+++ b/tests/expectations/tests/test_multiple_header_calls_in_builder.rs
@@ -37,69 +37,198 @@
         1usize,
         concat!("Alignment of ", stringify!(Test))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Test>())).ch as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(Test), "::", stringify!(ch))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Test>())).u as *const _ as usize },
-        1usize,
-        concat!("Offset of field: ", stringify!(Test), "::", stringify!(u))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Test>())).d as *const _ as usize },
-        2usize,
-        concat!("Offset of field: ", stringify!(Test), "::", stringify!(d))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Test>())).cch as *const _ as usize },
-        3usize,
-        concat!("Offset of field: ", stringify!(Test), "::", stringify!(cch))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Test>())).cu as *const _ as usize },
-        4usize,
-        concat!("Offset of field: ", stringify!(Test), "::", stringify!(cu))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Test>())).cd as *const _ as usize },
-        5usize,
-        concat!("Offset of field: ", stringify!(Test), "::", stringify!(cd))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Test>())).Cch as *const _ as usize },
-        6usize,
-        concat!("Offset of field: ", stringify!(Test), "::", stringify!(Cch))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Test>())).Cu as *const _ as usize },
-        7usize,
-        concat!("Offset of field: ", stringify!(Test), "::", stringify!(Cu))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Test>())).Cd as *const _ as usize },
-        8usize,
-        concat!("Offset of field: ", stringify!(Test), "::", stringify!(Cd))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Test>())).Ccch as *const _ as usize },
-        9usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(Test),
-            "::",
-            stringify!(Ccch)
-        )
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Test>())).Ccu as *const _ as usize },
-        10usize,
-        concat!("Offset of field: ", stringify!(Test), "::", stringify!(Ccu))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Test>())).Ccd as *const _ as usize },
-        11usize,
-        concat!("Offset of field: ", stringify!(Test), "::", stringify!(Ccd))
-    );
+    fn test_field_ch() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Test>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).ch) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Test),
+                "::",
+                stringify!(ch)
+            )
+        );
+    }
+    test_field_ch();
+    fn test_field_u() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Test>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).u) as usize - ptr as usize
+            },
+            1usize,
+            concat!("Offset of field: ", stringify!(Test), "::", stringify!(u))
+        );
+    }
+    test_field_u();
+    fn test_field_d() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Test>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).d) as usize - ptr as usize
+            },
+            2usize,
+            concat!("Offset of field: ", stringify!(Test), "::", stringify!(d))
+        );
+    }
+    test_field_d();
+    fn test_field_cch() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Test>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).cch) as usize - ptr as usize
+            },
+            3usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Test),
+                "::",
+                stringify!(cch)
+            )
+        );
+    }
+    test_field_cch();
+    fn test_field_cu() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Test>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).cu) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Test),
+                "::",
+                stringify!(cu)
+            )
+        );
+    }
+    test_field_cu();
+    fn test_field_cd() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Test>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).cd) as usize - ptr as usize
+            },
+            5usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Test),
+                "::",
+                stringify!(cd)
+            )
+        );
+    }
+    test_field_cd();
+    fn test_field_Cch() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Test>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).Cch) as usize - ptr as usize
+            },
+            6usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Test),
+                "::",
+                stringify!(Cch)
+            )
+        );
+    }
+    test_field_Cch();
+    fn test_field_Cu() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Test>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).Cu) as usize - ptr as usize
+            },
+            7usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Test),
+                "::",
+                stringify!(Cu)
+            )
+        );
+    }
+    test_field_Cu();
+    fn test_field_Cd() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Test>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).Cd) as usize - ptr as usize
+            },
+            8usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Test),
+                "::",
+                stringify!(Cd)
+            )
+        );
+    }
+    test_field_Cd();
+    fn test_field_Ccch() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Test>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).Ccch) as usize - ptr as usize
+            },
+            9usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Test),
+                "::",
+                stringify!(Ccch)
+            )
+        );
+    }
+    test_field_Ccch();
+    fn test_field_Ccu() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Test>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).Ccu) as usize - ptr as usize
+            },
+            10usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Test),
+                "::",
+                stringify!(Ccu)
+            )
+        );
+    }
+    test_field_Ccu();
+    fn test_field_Ccd() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Test>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).Ccd) as usize - ptr as usize
+            },
+            11usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Test),
+                "::",
+                stringify!(Ccd)
+            )
+        );
+    }
+    test_field_Ccd();
 }
diff --git a/tests/expectations/tests/timex.rs b/tests/expectations/tests/timex.rs
index b2a84d8..8f0677b 100644
--- a/tests/expectations/tests/timex.rs
+++ b/tests/expectations/tests/timex.rs
@@ -110,16 +110,23 @@
         4usize,
         concat!("Alignment of ", stringify!(timex))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<timex>())).tai as *const _ as usize },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(timex),
-            "::",
-            stringify!(tai)
-        )
-    );
+    fn test_field_tai() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<timex>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).tai) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(timex),
+                "::",
+                stringify!(tai)
+            )
+        );
+    }
+    test_field_tai();
 }
 impl Default for timex {
     fn default() -> Self {
@@ -149,18 +156,23 @@
         4usize,
         concat!("Alignment of ", stringify!(timex_named))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<timex_named>())).tai as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(timex_named),
-            "::",
-            stringify!(tai)
-        )
-    );
+    fn test_field_tai() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<timex_named>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).tai) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(timex_named),
+                "::",
+                stringify!(tai)
+            )
+        );
+    }
+    test_field_tai();
 }
 impl Default for timex_named {
     fn default() -> Self {
diff --git a/tests/expectations/tests/type-referenced-by-allowlisted-function.rs b/tests/expectations/tests/type-referenced-by-allowlisted-function.rs
index 568f943..421abdc 100644
--- a/tests/expectations/tests/type-referenced-by-allowlisted-function.rs
+++ b/tests/expectations/tests/type-referenced-by-allowlisted-function.rs
@@ -22,18 +22,23 @@
         4usize,
         concat!("Alignment of ", stringify!(dl_phdr_info))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<dl_phdr_info>())).x as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(dl_phdr_info),
-            "::",
-            stringify!(x)
-        )
-    );
+    fn test_field_x() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<dl_phdr_info>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).x) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(dl_phdr_info),
+                "::",
+                stringify!(x)
+            )
+        );
+    }
+    test_field_x();
 }
 extern "C" {
     pub fn dl_iterate_phdr(arg1: *mut dl_phdr_info) -> ::std::os::raw::c_int;
diff --git a/tests/expectations/tests/typeref.rs b/tests/expectations/tests/typeref.rs
index 1c34be7..f4b048c 100644
--- a/tests/expectations/tests/typeref.rs
+++ b/tests/expectations/tests/typeref.rs
@@ -22,19 +22,24 @@
         1usize,
         concat!("Alignment of ", stringify!(mozilla_FragmentOrURL))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<mozilla_FragmentOrURL>())).mIsLocalRef
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(mozilla_FragmentOrURL),
-            "::",
-            stringify!(mIsLocalRef)
-        )
-    );
+    fn test_field_mIsLocalRef() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<mozilla_FragmentOrURL>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mIsLocalRef) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(mozilla_FragmentOrURL),
+                "::",
+                stringify!(mIsLocalRef)
+            )
+        );
+    }
+    test_field_mIsLocalRef();
 }
 #[repr(C)]
 #[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
@@ -98,11 +103,23 @@
         8usize,
         concat!("Alignment of ", stringify!(Bar))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Bar>())).mFoo as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(Bar), "::", stringify!(mFoo))
-    );
+    fn test_field_mFoo() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Bar>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mFoo) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Bar),
+                "::",
+                stringify!(mFoo)
+            )
+        );
+    }
+    test_field_mFoo();
 }
 impl Default for Bar {
     fn default() -> Self {
@@ -129,16 +146,23 @@
         8usize,
         concat!("Alignment of ", stringify!(nsFoo))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<nsFoo>())).mBar as *const _ as usize },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(nsFoo),
-            "::",
-            stringify!(mBar)
-        )
-    );
+    fn test_field_mBar() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<nsFoo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mBar) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(nsFoo),
+                "::",
+                stringify!(mBar)
+            )
+        );
+    }
+    test_field_mBar();
 }
 impl Default for nsFoo {
     fn default() -> Self {
diff --git a/tests/expectations/tests/typeref_1_0.rs b/tests/expectations/tests/typeref_1_0.rs
index 2820d9f..273a774 100644
--- a/tests/expectations/tests/typeref_1_0.rs
+++ b/tests/expectations/tests/typeref_1_0.rs
@@ -65,19 +65,24 @@
         1usize,
         concat!("Alignment of ", stringify!(mozilla_FragmentOrURL))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<mozilla_FragmentOrURL>())).mIsLocalRef
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(mozilla_FragmentOrURL),
-            "::",
-            stringify!(mIsLocalRef)
-        )
-    );
+    fn test_field_mIsLocalRef() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<mozilla_FragmentOrURL>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mIsLocalRef) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(mozilla_FragmentOrURL),
+                "::",
+                stringify!(mIsLocalRef)
+            )
+        );
+    }
+    test_field_mIsLocalRef();
 }
 impl Clone for mozilla_FragmentOrURL {
     fn clone(&self) -> Self {
@@ -136,11 +141,23 @@
         8usize,
         concat!("Alignment of ", stringify!(Bar))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Bar>())).mFoo as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(Bar), "::", stringify!(mFoo))
-    );
+    fn test_field_mFoo() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Bar>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mFoo) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Bar),
+                "::",
+                stringify!(mFoo)
+            )
+        );
+    }
+    test_field_mFoo();
 }
 impl Clone for Bar {
     fn clone(&self) -> Self {
@@ -173,16 +190,23 @@
         8usize,
         concat!("Alignment of ", stringify!(nsFoo))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<nsFoo>())).mBar as *const _ as usize },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(nsFoo),
-            "::",
-            stringify!(mBar)
-        )
-    );
+    fn test_field_mBar() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<nsFoo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mBar) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(nsFoo),
+                "::",
+                stringify!(mBar)
+            )
+        );
+    }
+    test_field_mBar();
 }
 impl Clone for nsFoo {
     fn clone(&self) -> Self {
diff --git a/tests/expectations/tests/underscore.rs b/tests/expectations/tests/underscore.rs
index 6ef2d8a..a9c20d0 100644
--- a/tests/expectations/tests/underscore.rs
+++ b/tests/expectations/tests/underscore.rs
@@ -23,9 +23,21 @@
         1usize,
         concat!("Alignment of ", stringify!(ptr_t))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<ptr_t>())).__ as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(ptr_t), "::", stringify!(__))
-    );
+    fn test_field__() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<ptr_t>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).__) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(ptr_t),
+                "::",
+                stringify!(__)
+            )
+        );
+    }
+    test_field__();
 }
diff --git a/tests/expectations/tests/union-align.rs b/tests/expectations/tests/union-align.rs
index 8612764..5370169 100644
--- a/tests/expectations/tests/union-align.rs
+++ b/tests/expectations/tests/union-align.rs
@@ -23,11 +23,23 @@
         16usize,
         concat!("Alignment of ", stringify!(Bar))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Bar>())).foo as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(Bar), "::", stringify!(foo))
-    );
+    fn test_field_foo() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Bar>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).foo) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Bar),
+                "::",
+                stringify!(foo)
+            )
+        );
+    }
+    test_field_foo();
 }
 impl Default for Bar {
     fn default() -> Self {
@@ -56,11 +68,23 @@
         16usize,
         concat!("Alignment of ", stringify!(Baz))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Baz>())).bar as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(Baz), "::", stringify!(bar))
-    );
+    fn test_field_bar() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Baz>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Baz),
+                "::",
+                stringify!(bar)
+            )
+        );
+    }
+    test_field_bar();
 }
 impl Default for Baz {
     fn default() -> Self {
diff --git a/tests/expectations/tests/union-in-ns.rs b/tests/expectations/tests/union-in-ns.rs
index b52c6c3..28e7fa2 100644
--- a/tests/expectations/tests/union-in-ns.rs
+++ b/tests/expectations/tests/union-in-ns.rs
@@ -26,16 +26,23 @@
             4usize,
             concat!("Alignment of ", stringify!(bar))
         );
-        assert_eq!(
-            unsafe { &(*(::std::ptr::null::<bar>())).baz as *const _ as usize },
-            0usize,
-            concat!(
-                "Offset of field: ",
-                stringify!(bar),
-                "::",
-                stringify!(baz)
-            )
-        );
+        fn test_field_baz() {
+            assert_eq!(
+                unsafe {
+                    let uninit = ::std::mem::MaybeUninit::<bar>::uninit();
+                    let ptr = uninit.as_ptr();
+                    ::std::ptr::addr_of!((*ptr).baz) as usize - ptr as usize
+                },
+                0usize,
+                concat!(
+                    "Offset of field: ",
+                    stringify!(bar),
+                    "::",
+                    stringify!(baz)
+                )
+            );
+        }
+        test_field_baz();
     }
     impl Default for bar {
         fn default() -> Self {
diff --git a/tests/expectations/tests/union-in-ns_1_0.rs b/tests/expectations/tests/union-in-ns_1_0.rs
index c210c38..2d0584a 100644
--- a/tests/expectations/tests/union-in-ns_1_0.rs
+++ b/tests/expectations/tests/union-in-ns_1_0.rs
@@ -73,16 +73,23 @@
             4usize,
             concat!("Alignment of ", stringify!(bar))
         );
-        assert_eq!(
-            unsafe { &(*(::std::ptr::null::<bar>())).baz as *const _ as usize },
-            0usize,
-            concat!(
-                "Offset of field: ",
-                stringify!(bar),
-                "::",
-                stringify!(baz)
-            )
-        );
+        fn test_field_baz() {
+            assert_eq!(
+                unsafe {
+                    let uninit = ::std::mem::MaybeUninit::<bar>::uninit();
+                    let ptr = uninit.as_ptr();
+                    ::std::ptr::addr_of!((*ptr).baz) as usize - ptr as usize
+                },
+                0usize,
+                concat!(
+                    "Offset of field: ",
+                    stringify!(bar),
+                    "::",
+                    stringify!(baz)
+                )
+            );
+        }
+        test_field_baz();
     }
     impl Clone for bar {
         fn clone(&self) -> Self {
diff --git a/tests/expectations/tests/union_dtor.rs b/tests/expectations/tests/union_dtor.rs
index 94ad3fd..359005c 100644
--- a/tests/expectations/tests/union_dtor.rs
+++ b/tests/expectations/tests/union_dtor.rs
@@ -22,30 +22,40 @@
         8usize,
         concat!("Alignment of ", stringify!(UnionWithDtor))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<UnionWithDtor>())).mFoo as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(UnionWithDtor),
-            "::",
-            stringify!(mFoo)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<UnionWithDtor>())).mBar as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(UnionWithDtor),
-            "::",
-            stringify!(mBar)
-        )
-    );
+    fn test_field_mFoo() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<UnionWithDtor>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mFoo) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(UnionWithDtor),
+                "::",
+                stringify!(mFoo)
+            )
+        );
+    }
+    test_field_mFoo();
+    fn test_field_mBar() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<UnionWithDtor>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mBar) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(UnionWithDtor),
+                "::",
+                stringify!(mBar)
+            )
+        );
+    }
+    test_field_mBar();
 }
 extern "C" {
     #[link_name = "\u{1}_ZN13UnionWithDtorD1Ev"]
diff --git a/tests/expectations/tests/union_dtor_1_0.rs b/tests/expectations/tests/union_dtor_1_0.rs
index a59f99f..68ebced 100644
--- a/tests/expectations/tests/union_dtor_1_0.rs
+++ b/tests/expectations/tests/union_dtor_1_0.rs
@@ -67,30 +67,40 @@
         8usize,
         concat!("Alignment of ", stringify!(UnionWithDtor))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<UnionWithDtor>())).mFoo as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(UnionWithDtor),
-            "::",
-            stringify!(mFoo)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<UnionWithDtor>())).mBar as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(UnionWithDtor),
-            "::",
-            stringify!(mBar)
-        )
-    );
+    fn test_field_mFoo() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<UnionWithDtor>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mFoo) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(UnionWithDtor),
+                "::",
+                stringify!(mFoo)
+            )
+        );
+    }
+    test_field_mFoo();
+    fn test_field_mBar() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<UnionWithDtor>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mBar) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(UnionWithDtor),
+                "::",
+                stringify!(mBar)
+            )
+        );
+    }
+    test_field_mBar();
 }
 extern "C" {
     #[link_name = "\u{1}_ZN13UnionWithDtorD1Ev"]
diff --git a/tests/expectations/tests/union_fields.rs b/tests/expectations/tests/union_fields.rs
index 6cd0d56..7864ac1 100644
--- a/tests/expectations/tests/union_fields.rs
+++ b/tests/expectations/tests/union_fields.rs
@@ -24,43 +24,57 @@
         8usize,
         concat!("Alignment of ", stringify!(nsStyleUnion))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<nsStyleUnion>())).mInt as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(nsStyleUnion),
-            "::",
-            stringify!(mInt)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<nsStyleUnion>())).mFloat as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(nsStyleUnion),
-            "::",
-            stringify!(mFloat)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<nsStyleUnion>())).mPointer as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(nsStyleUnion),
-            "::",
-            stringify!(mPointer)
-        )
-    );
+    fn test_field_mInt() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<nsStyleUnion>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mInt) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(nsStyleUnion),
+                "::",
+                stringify!(mInt)
+            )
+        );
+    }
+    test_field_mInt();
+    fn test_field_mFloat() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<nsStyleUnion>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mFloat) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(nsStyleUnion),
+                "::",
+                stringify!(mFloat)
+            )
+        );
+    }
+    test_field_mFloat();
+    fn test_field_mPointer() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<nsStyleUnion>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mPointer) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(nsStyleUnion),
+                "::",
+                stringify!(mPointer)
+            )
+        );
+    }
+    test_field_mPointer();
 }
 impl Default for nsStyleUnion {
     fn default() -> Self {
diff --git a/tests/expectations/tests/union_fields_1_0.rs b/tests/expectations/tests/union_fields_1_0.rs
index 36972b6..5fccd4e 100644
--- a/tests/expectations/tests/union_fields_1_0.rs
+++ b/tests/expectations/tests/union_fields_1_0.rs
@@ -68,43 +68,57 @@
         8usize,
         concat!("Alignment of ", stringify!(nsStyleUnion))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<nsStyleUnion>())).mInt as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(nsStyleUnion),
-            "::",
-            stringify!(mInt)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<nsStyleUnion>())).mFloat as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(nsStyleUnion),
-            "::",
-            stringify!(mFloat)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<nsStyleUnion>())).mPointer as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(nsStyleUnion),
-            "::",
-            stringify!(mPointer)
-        )
-    );
+    fn test_field_mInt() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<nsStyleUnion>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mInt) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(nsStyleUnion),
+                "::",
+                stringify!(mInt)
+            )
+        );
+    }
+    test_field_mInt();
+    fn test_field_mFloat() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<nsStyleUnion>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mFloat) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(nsStyleUnion),
+                "::",
+                stringify!(mFloat)
+            )
+        );
+    }
+    test_field_mFloat();
+    fn test_field_mPointer() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<nsStyleUnion>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mPointer) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(nsStyleUnion),
+                "::",
+                stringify!(mPointer)
+            )
+        );
+    }
+    test_field_mPointer();
 }
 impl Clone for nsStyleUnion {
     fn clone(&self) -> Self {
diff --git a/tests/expectations/tests/union_with_anon_struct.rs b/tests/expectations/tests/union_with_anon_struct.rs
index afb7350..7a67b2d 100644
--- a/tests/expectations/tests/union_with_anon_struct.rs
+++ b/tests/expectations/tests/union_with_anon_struct.rs
@@ -28,30 +28,42 @@
         4usize,
         concat!("Alignment of ", stringify!(foo__bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1>())).a as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1),
-            "::",
-            stringify!(a)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1>())).b as *const _ as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1),
-            "::",
-            stringify!(b)
-        )
-    );
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<foo__bindgen_ty_1>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo__bindgen_ty_1),
+                "::",
+                stringify!(a)
+            )
+        );
+    }
+    test_field_a();
+    fn test_field_b() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<foo__bindgen_ty_1>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo__bindgen_ty_1),
+                "::",
+                stringify!(b)
+            )
+        );
+    }
+    test_field_b();
 }
 #[test]
 fn bindgen_test_layout_foo() {
@@ -65,11 +77,23 @@
         4usize,
         concat!("Alignment of ", stringify!(foo))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<foo>())).bar as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(foo), "::", stringify!(bar))
-    );
+    fn test_field_bar() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<foo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo),
+                "::",
+                stringify!(bar)
+            )
+        );
+    }
+    test_field_bar();
 }
 impl Default for foo {
     fn default() -> Self {
diff --git a/tests/expectations/tests/union_with_anon_struct_1_0.rs b/tests/expectations/tests/union_with_anon_struct_1_0.rs
index 09dcfa1..aed67ec 100644
--- a/tests/expectations/tests/union_with_anon_struct_1_0.rs
+++ b/tests/expectations/tests/union_with_anon_struct_1_0.rs
@@ -72,30 +72,42 @@
         4usize,
         concat!("Alignment of ", stringify!(foo__bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1>())).a as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1),
-            "::",
-            stringify!(a)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1>())).b as *const _ as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1),
-            "::",
-            stringify!(b)
-        )
-    );
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<foo__bindgen_ty_1>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo__bindgen_ty_1),
+                "::",
+                stringify!(a)
+            )
+        );
+    }
+    test_field_a();
+    fn test_field_b() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<foo__bindgen_ty_1>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo__bindgen_ty_1),
+                "::",
+                stringify!(b)
+            )
+        );
+    }
+    test_field_b();
 }
 impl Clone for foo__bindgen_ty_1 {
     fn clone(&self) -> Self {
@@ -114,11 +126,23 @@
         4usize,
         concat!("Alignment of ", stringify!(foo))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<foo>())).bar as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(foo), "::", stringify!(bar))
-    );
+    fn test_field_bar() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<foo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo),
+                "::",
+                stringify!(bar)
+            )
+        );
+    }
+    test_field_bar();
 }
 impl Clone for foo {
     fn clone(&self) -> Self {
diff --git a/tests/expectations/tests/union_with_anon_struct_bitfield.rs b/tests/expectations/tests/union_with_anon_struct_bitfield.rs
index 09ed515..87186fe 100644
--- a/tests/expectations/tests/union_with_anon_struct_bitfield.rs
+++ b/tests/expectations/tests/union_with_anon_struct_bitfield.rs
@@ -174,11 +174,18 @@
         4usize,
         concat!("Alignment of ", stringify!(foo))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<foo>())).a as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(foo), "::", stringify!(a))
-    );
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<foo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            0usize,
+            concat!("Offset of field: ", stringify!(foo), "::", stringify!(a))
+        );
+    }
+    test_field_a();
 }
 impl Default for foo {
     fn default() -> Self {
diff --git a/tests/expectations/tests/union_with_anon_struct_bitfield_1_0.rs b/tests/expectations/tests/union_with_anon_struct_bitfield_1_0.rs
index 43736b0..66f3367 100644
--- a/tests/expectations/tests/union_with_anon_struct_bitfield_1_0.rs
+++ b/tests/expectations/tests/union_with_anon_struct_bitfield_1_0.rs
@@ -223,11 +223,18 @@
         4usize,
         concat!("Alignment of ", stringify!(foo))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<foo>())).a as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(foo), "::", stringify!(a))
-    );
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<foo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            0usize,
+            concat!("Offset of field: ", stringify!(foo), "::", stringify!(a))
+        );
+    }
+    test_field_a();
 }
 impl Clone for foo {
     fn clone(&self) -> Self {
diff --git a/tests/expectations/tests/union_with_anon_union.rs b/tests/expectations/tests/union_with_anon_union.rs
index a24962c..789fb49 100644
--- a/tests/expectations/tests/union_with_anon_union.rs
+++ b/tests/expectations/tests/union_with_anon_union.rs
@@ -28,30 +28,42 @@
         4usize,
         concat!("Alignment of ", stringify!(foo__bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1>())).a as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1),
-            "::",
-            stringify!(a)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1>())).b as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1),
-            "::",
-            stringify!(b)
-        )
-    );
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<foo__bindgen_ty_1>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo__bindgen_ty_1),
+                "::",
+                stringify!(a)
+            )
+        );
+    }
+    test_field_a();
+    fn test_field_b() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<foo__bindgen_ty_1>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo__bindgen_ty_1),
+                "::",
+                stringify!(b)
+            )
+        );
+    }
+    test_field_b();
 }
 impl Default for foo__bindgen_ty_1 {
     fn default() -> Self {
@@ -74,11 +86,23 @@
         4usize,
         concat!("Alignment of ", stringify!(foo))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<foo>())).bar as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(foo), "::", stringify!(bar))
-    );
+    fn test_field_bar() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<foo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo),
+                "::",
+                stringify!(bar)
+            )
+        );
+    }
+    test_field_bar();
 }
 impl Default for foo {
     fn default() -> Self {
diff --git a/tests/expectations/tests/union_with_anon_union_1_0.rs b/tests/expectations/tests/union_with_anon_union_1_0.rs
index f892c45..4bb91cf 100644
--- a/tests/expectations/tests/union_with_anon_union_1_0.rs
+++ b/tests/expectations/tests/union_with_anon_union_1_0.rs
@@ -73,30 +73,42 @@
         4usize,
         concat!("Alignment of ", stringify!(foo__bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1>())).a as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1),
-            "::",
-            stringify!(a)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1>())).b as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1),
-            "::",
-            stringify!(b)
-        )
-    );
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<foo__bindgen_ty_1>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo__bindgen_ty_1),
+                "::",
+                stringify!(a)
+            )
+        );
+    }
+    test_field_a();
+    fn test_field_b() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<foo__bindgen_ty_1>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo__bindgen_ty_1),
+                "::",
+                stringify!(b)
+            )
+        );
+    }
+    test_field_b();
 }
 impl Clone for foo__bindgen_ty_1 {
     fn clone(&self) -> Self {
@@ -115,11 +127,23 @@
         4usize,
         concat!("Alignment of ", stringify!(foo))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<foo>())).bar as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(foo), "::", stringify!(bar))
-    );
+    fn test_field_bar() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<foo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo),
+                "::",
+                stringify!(bar)
+            )
+        );
+    }
+    test_field_bar();
 }
 impl Clone for foo {
     fn clone(&self) -> Self {
diff --git a/tests/expectations/tests/union_with_anon_unnamed_struct.rs b/tests/expectations/tests/union_with_anon_unnamed_struct.rs
index 94380d1..968e20f 100644
--- a/tests/expectations/tests/union_with_anon_unnamed_struct.rs
+++ b/tests/expectations/tests/union_with_anon_unnamed_struct.rs
@@ -31,58 +31,78 @@
         1usize,
         concat!("Alignment of ", stringify!(pixel__bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<pixel__bindgen_ty_1>())).r as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(pixel__bindgen_ty_1),
-            "::",
-            stringify!(r)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<pixel__bindgen_ty_1>())).g as *const _
-                as usize
-        },
-        1usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(pixel__bindgen_ty_1),
-            "::",
-            stringify!(g)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<pixel__bindgen_ty_1>())).b as *const _
-                as usize
-        },
-        2usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(pixel__bindgen_ty_1),
-            "::",
-            stringify!(b)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<pixel__bindgen_ty_1>())).a as *const _
-                as usize
-        },
-        3usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(pixel__bindgen_ty_1),
-            "::",
-            stringify!(a)
-        )
-    );
+    fn test_field_r() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<pixel__bindgen_ty_1>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).r) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(pixel__bindgen_ty_1),
+                "::",
+                stringify!(r)
+            )
+        );
+    }
+    test_field_r();
+    fn test_field_g() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<pixel__bindgen_ty_1>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).g) as usize - ptr as usize
+            },
+            1usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(pixel__bindgen_ty_1),
+                "::",
+                stringify!(g)
+            )
+        );
+    }
+    test_field_g();
+    fn test_field_b() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<pixel__bindgen_ty_1>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize
+            },
+            2usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(pixel__bindgen_ty_1),
+                "::",
+                stringify!(b)
+            )
+        );
+    }
+    test_field_b();
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<pixel__bindgen_ty_1>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            3usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(pixel__bindgen_ty_1),
+                "::",
+                stringify!(a)
+            )
+        );
+    }
+    test_field_a();
 }
 #[test]
 fn bindgen_test_layout_pixel() {
@@ -96,16 +116,23 @@
         4usize,
         concat!("Alignment of ", stringify!(pixel))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<pixel>())).rgba as *const _ as usize },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(pixel),
-            "::",
-            stringify!(rgba)
-        )
-    );
+    fn test_field_rgba() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<pixel>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).rgba) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(pixel),
+                "::",
+                stringify!(rgba)
+            )
+        );
+    }
+    test_field_rgba();
 }
 impl Default for pixel {
     fn default() -> Self {
diff --git a/tests/expectations/tests/union_with_anon_unnamed_struct_1_0.rs b/tests/expectations/tests/union_with_anon_unnamed_struct_1_0.rs
index cbdac70..b6f315b 100644
--- a/tests/expectations/tests/union_with_anon_unnamed_struct_1_0.rs
+++ b/tests/expectations/tests/union_with_anon_unnamed_struct_1_0.rs
@@ -75,58 +75,78 @@
         1usize,
         concat!("Alignment of ", stringify!(pixel__bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<pixel__bindgen_ty_1>())).r as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(pixel__bindgen_ty_1),
-            "::",
-            stringify!(r)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<pixel__bindgen_ty_1>())).g as *const _
-                as usize
-        },
-        1usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(pixel__bindgen_ty_1),
-            "::",
-            stringify!(g)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<pixel__bindgen_ty_1>())).b as *const _
-                as usize
-        },
-        2usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(pixel__bindgen_ty_1),
-            "::",
-            stringify!(b)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<pixel__bindgen_ty_1>())).a as *const _
-                as usize
-        },
-        3usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(pixel__bindgen_ty_1),
-            "::",
-            stringify!(a)
-        )
-    );
+    fn test_field_r() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<pixel__bindgen_ty_1>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).r) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(pixel__bindgen_ty_1),
+                "::",
+                stringify!(r)
+            )
+        );
+    }
+    test_field_r();
+    fn test_field_g() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<pixel__bindgen_ty_1>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).g) as usize - ptr as usize
+            },
+            1usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(pixel__bindgen_ty_1),
+                "::",
+                stringify!(g)
+            )
+        );
+    }
+    test_field_g();
+    fn test_field_b() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<pixel__bindgen_ty_1>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize
+            },
+            2usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(pixel__bindgen_ty_1),
+                "::",
+                stringify!(b)
+            )
+        );
+    }
+    test_field_b();
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<pixel__bindgen_ty_1>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            3usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(pixel__bindgen_ty_1),
+                "::",
+                stringify!(a)
+            )
+        );
+    }
+    test_field_a();
 }
 impl Clone for pixel__bindgen_ty_1 {
     fn clone(&self) -> Self {
@@ -145,16 +165,23 @@
         4usize,
         concat!("Alignment of ", stringify!(pixel))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<pixel>())).rgba as *const _ as usize },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(pixel),
-            "::",
-            stringify!(rgba)
-        )
-    );
+    fn test_field_rgba() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<pixel>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).rgba) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(pixel),
+                "::",
+                stringify!(rgba)
+            )
+        );
+    }
+    test_field_rgba();
 }
 impl Clone for pixel {
     fn clone(&self) -> Self {
diff --git a/tests/expectations/tests/union_with_anon_unnamed_union.rs b/tests/expectations/tests/union_with_anon_unnamed_union.rs
index 2004ff4..f7defd0 100644
--- a/tests/expectations/tests/union_with_anon_unnamed_union.rs
+++ b/tests/expectations/tests/union_with_anon_unnamed_union.rs
@@ -29,30 +29,42 @@
         2usize,
         concat!("Alignment of ", stringify!(foo__bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1>())).b as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1),
-            "::",
-            stringify!(b)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1>())).c as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1),
-            "::",
-            stringify!(c)
-        )
-    );
+    fn test_field_b() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<foo__bindgen_ty_1>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo__bindgen_ty_1),
+                "::",
+                stringify!(b)
+            )
+        );
+    }
+    test_field_b();
+    fn test_field_c() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<foo__bindgen_ty_1>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).c) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo__bindgen_ty_1),
+                "::",
+                stringify!(c)
+            )
+        );
+    }
+    test_field_c();
 }
 impl Default for foo__bindgen_ty_1 {
     fn default() -> Self {
@@ -75,11 +87,18 @@
         4usize,
         concat!("Alignment of ", stringify!(foo))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<foo>())).a as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(foo), "::", stringify!(a))
-    );
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<foo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            0usize,
+            concat!("Offset of field: ", stringify!(foo), "::", stringify!(a))
+        );
+    }
+    test_field_a();
 }
 impl Default for foo {
     fn default() -> Self {
diff --git a/tests/expectations/tests/union_with_anon_unnamed_union_1_0.rs b/tests/expectations/tests/union_with_anon_unnamed_union_1_0.rs
index 910f588..72239a3 100644
--- a/tests/expectations/tests/union_with_anon_unnamed_union_1_0.rs
+++ b/tests/expectations/tests/union_with_anon_unnamed_union_1_0.rs
@@ -74,30 +74,42 @@
         2usize,
         concat!("Alignment of ", stringify!(foo__bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1>())).b as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1),
-            "::",
-            stringify!(b)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1>())).c as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1),
-            "::",
-            stringify!(c)
-        )
-    );
+    fn test_field_b() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<foo__bindgen_ty_1>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo__bindgen_ty_1),
+                "::",
+                stringify!(b)
+            )
+        );
+    }
+    test_field_b();
+    fn test_field_c() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<foo__bindgen_ty_1>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).c) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo__bindgen_ty_1),
+                "::",
+                stringify!(c)
+            )
+        );
+    }
+    test_field_c();
 }
 impl Clone for foo__bindgen_ty_1 {
     fn clone(&self) -> Self {
@@ -116,11 +128,18 @@
         4usize,
         concat!("Alignment of ", stringify!(foo))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<foo>())).a as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(foo), "::", stringify!(a))
-    );
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<foo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            0usize,
+            concat!("Offset of field: ", stringify!(foo), "::", stringify!(a))
+        );
+    }
+    test_field_a();
 }
 impl Clone for foo {
     fn clone(&self) -> Self {
diff --git a/tests/expectations/tests/union_with_big_member.rs b/tests/expectations/tests/union_with_big_member.rs
index 3f9294d..72210c8 100644
--- a/tests/expectations/tests/union_with_big_member.rs
+++ b/tests/expectations/tests/union_with_big_member.rs
@@ -23,30 +23,40 @@
         4usize,
         concat!("Alignment of ", stringify!(WithBigArray))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<WithBigArray>())).a as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(WithBigArray),
-            "::",
-            stringify!(a)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<WithBigArray>())).b as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(WithBigArray),
-            "::",
-            stringify!(b)
-        )
-    );
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<WithBigArray>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(WithBigArray),
+                "::",
+                stringify!(a)
+            )
+        );
+    }
+    test_field_a();
+    fn test_field_b() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<WithBigArray>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(WithBigArray),
+                "::",
+                stringify!(b)
+            )
+        );
+    }
+    test_field_b();
 }
 impl Default for WithBigArray {
     fn default() -> Self {
@@ -75,30 +85,40 @@
         4usize,
         concat!("Alignment of ", stringify!(WithBigArray2))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<WithBigArray2>())).a as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(WithBigArray2),
-            "::",
-            stringify!(a)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<WithBigArray2>())).b as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(WithBigArray2),
-            "::",
-            stringify!(b)
-        )
-    );
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<WithBigArray2>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(WithBigArray2),
+                "::",
+                stringify!(a)
+            )
+        );
+    }
+    test_field_a();
+    fn test_field_b() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<WithBigArray2>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(WithBigArray2),
+                "::",
+                stringify!(b)
+            )
+        );
+    }
+    test_field_b();
 }
 impl Default for WithBigArray2 {
     fn default() -> Self {
@@ -127,30 +147,40 @@
         4usize,
         concat!("Alignment of ", stringify!(WithBigMember))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<WithBigMember>())).a as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(WithBigMember),
-            "::",
-            stringify!(a)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<WithBigMember>())).b as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(WithBigMember),
-            "::",
-            stringify!(b)
-        )
-    );
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<WithBigMember>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(WithBigMember),
+                "::",
+                stringify!(a)
+            )
+        );
+    }
+    test_field_a();
+    fn test_field_b() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<WithBigMember>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(WithBigMember),
+                "::",
+                stringify!(b)
+            )
+        );
+    }
+    test_field_b();
 }
 impl Default for WithBigMember {
     fn default() -> Self {
diff --git a/tests/expectations/tests/union_with_big_member_1_0.rs b/tests/expectations/tests/union_with_big_member_1_0.rs
index 541c9d4..8be46be 100644
--- a/tests/expectations/tests/union_with_big_member_1_0.rs
+++ b/tests/expectations/tests/union_with_big_member_1_0.rs
@@ -67,30 +67,40 @@
         4usize,
         concat!("Alignment of ", stringify!(WithBigArray))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<WithBigArray>())).a as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(WithBigArray),
-            "::",
-            stringify!(a)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<WithBigArray>())).b as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(WithBigArray),
-            "::",
-            stringify!(b)
-        )
-    );
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<WithBigArray>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(WithBigArray),
+                "::",
+                stringify!(a)
+            )
+        );
+    }
+    test_field_a();
+    fn test_field_b() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<WithBigArray>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(WithBigArray),
+                "::",
+                stringify!(b)
+            )
+        );
+    }
+    test_field_b();
 }
 impl Clone for WithBigArray {
     fn clone(&self) -> Self {
@@ -125,30 +135,40 @@
         4usize,
         concat!("Alignment of ", stringify!(WithBigArray2))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<WithBigArray2>())).a as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(WithBigArray2),
-            "::",
-            stringify!(a)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<WithBigArray2>())).b as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(WithBigArray2),
-            "::",
-            stringify!(b)
-        )
-    );
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<WithBigArray2>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(WithBigArray2),
+                "::",
+                stringify!(a)
+            )
+        );
+    }
+    test_field_a();
+    fn test_field_b() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<WithBigArray2>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(WithBigArray2),
+                "::",
+                stringify!(b)
+            )
+        );
+    }
+    test_field_b();
 }
 impl Clone for WithBigArray2 {
     fn clone(&self) -> Self {
@@ -174,30 +194,40 @@
         4usize,
         concat!("Alignment of ", stringify!(WithBigMember))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<WithBigMember>())).a as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(WithBigMember),
-            "::",
-            stringify!(a)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<WithBigMember>())).b as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(WithBigMember),
-            "::",
-            stringify!(b)
-        )
-    );
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<WithBigMember>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(WithBigMember),
+                "::",
+                stringify!(a)
+            )
+        );
+    }
+    test_field_a();
+    fn test_field_b() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<WithBigMember>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(WithBigMember),
+                "::",
+                stringify!(b)
+            )
+        );
+    }
+    test_field_b();
 }
 impl Clone for WithBigMember {
     fn clone(&self) -> Self {
diff --git a/tests/expectations/tests/union_with_nesting.rs b/tests/expectations/tests/union_with_nesting.rs
index 54a3179..3ef99f7 100644
--- a/tests/expectations/tests/union_with_nesting.rs
+++ b/tests/expectations/tests/union_with_nesting.rs
@@ -35,32 +35,44 @@
         2usize,
         concat!("Alignment of ", stringify!(foo__bindgen_ty_1__bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1__bindgen_ty_1>())).b1
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1__bindgen_ty_1),
-            "::",
-            stringify!(b1)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1__bindgen_ty_1>())).b2
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1__bindgen_ty_1),
-            "::",
-            stringify!(b2)
-        )
-    );
+    fn test_field_b1() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    foo__bindgen_ty_1__bindgen_ty_1,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).b1) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo__bindgen_ty_1__bindgen_ty_1),
+                "::",
+                stringify!(b1)
+            )
+        );
+    }
+    test_field_b1();
+    fn test_field_b2() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    foo__bindgen_ty_1__bindgen_ty_1,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).b2) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo__bindgen_ty_1__bindgen_ty_1),
+                "::",
+                stringify!(b2)
+            )
+        );
+    }
+    test_field_b2();
 }
 impl Default for foo__bindgen_ty_1__bindgen_ty_1 {
     fn default() -> Self {
@@ -89,32 +101,44 @@
         2usize,
         concat!("Alignment of ", stringify!(foo__bindgen_ty_1__bindgen_ty_2))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1__bindgen_ty_2>())).c1
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1__bindgen_ty_2),
-            "::",
-            stringify!(c1)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1__bindgen_ty_2>())).c2
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1__bindgen_ty_2),
-            "::",
-            stringify!(c2)
-        )
-    );
+    fn test_field_c1() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    foo__bindgen_ty_1__bindgen_ty_2,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).c1) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo__bindgen_ty_1__bindgen_ty_2),
+                "::",
+                stringify!(c1)
+            )
+        );
+    }
+    test_field_c1();
+    fn test_field_c2() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    foo__bindgen_ty_1__bindgen_ty_2,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).c2) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo__bindgen_ty_1__bindgen_ty_2),
+                "::",
+                stringify!(c2)
+            )
+        );
+    }
+    test_field_c2();
 }
 impl Default for foo__bindgen_ty_1__bindgen_ty_2 {
     fn default() -> Self {
@@ -159,11 +183,18 @@
         4usize,
         concat!("Alignment of ", stringify!(foo))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<foo>())).a as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(foo), "::", stringify!(a))
-    );
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<foo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            0usize,
+            concat!("Offset of field: ", stringify!(foo), "::", stringify!(a))
+        );
+    }
+    test_field_a();
 }
 impl Default for foo {
     fn default() -> Self {
diff --git a/tests/expectations/tests/union_with_nesting_1_0.rs b/tests/expectations/tests/union_with_nesting_1_0.rs
index 3f105c3..9d4fc4d 100644
--- a/tests/expectations/tests/union_with_nesting_1_0.rs
+++ b/tests/expectations/tests/union_with_nesting_1_0.rs
@@ -80,32 +80,44 @@
         2usize,
         concat!("Alignment of ", stringify!(foo__bindgen_ty_1__bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1__bindgen_ty_1>())).b1
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1__bindgen_ty_1),
-            "::",
-            stringify!(b1)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1__bindgen_ty_1>())).b2
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1__bindgen_ty_1),
-            "::",
-            stringify!(b2)
-        )
-    );
+    fn test_field_b1() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    foo__bindgen_ty_1__bindgen_ty_1,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).b1) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo__bindgen_ty_1__bindgen_ty_1),
+                "::",
+                stringify!(b1)
+            )
+        );
+    }
+    test_field_b1();
+    fn test_field_b2() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    foo__bindgen_ty_1__bindgen_ty_1,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).b2) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo__bindgen_ty_1__bindgen_ty_1),
+                "::",
+                stringify!(b2)
+            )
+        );
+    }
+    test_field_b2();
 }
 impl Clone for foo__bindgen_ty_1__bindgen_ty_1 {
     fn clone(&self) -> Self {
@@ -131,32 +143,44 @@
         2usize,
         concat!("Alignment of ", stringify!(foo__bindgen_ty_1__bindgen_ty_2))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1__bindgen_ty_2>())).c1
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1__bindgen_ty_2),
-            "::",
-            stringify!(c1)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1__bindgen_ty_2>())).c2
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1__bindgen_ty_2),
-            "::",
-            stringify!(c2)
-        )
-    );
+    fn test_field_c1() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    foo__bindgen_ty_1__bindgen_ty_2,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).c1) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo__bindgen_ty_1__bindgen_ty_2),
+                "::",
+                stringify!(c1)
+            )
+        );
+    }
+    test_field_c1();
+    fn test_field_c2() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<
+                    foo__bindgen_ty_1__bindgen_ty_2,
+                >::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).c2) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo__bindgen_ty_1__bindgen_ty_2),
+                "::",
+                stringify!(c2)
+            )
+        );
+    }
+    test_field_c2();
 }
 impl Clone for foo__bindgen_ty_1__bindgen_ty_2 {
     fn clone(&self) -> Self {
@@ -193,11 +217,18 @@
         4usize,
         concat!("Alignment of ", stringify!(foo))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<foo>())).a as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(foo), "::", stringify!(a))
-    );
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<foo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            0usize,
+            concat!("Offset of field: ", stringify!(foo), "::", stringify!(a))
+        );
+    }
+    test_field_a();
 }
 impl Clone for foo {
     fn clone(&self) -> Self {
diff --git a/tests/expectations/tests/unknown_attr.rs b/tests/expectations/tests/unknown_attr.rs
index 8dbda00..cc29d8b 100644
--- a/tests/expectations/tests/unknown_attr.rs
+++ b/tests/expectations/tests/unknown_attr.rs
@@ -25,30 +25,40 @@
         16usize,
         concat!("Alignment of ", stringify!(max_align_t))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<max_align_t>())).__clang_max_align_nonce1
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(max_align_t),
-            "::",
-            stringify!(__clang_max_align_nonce1)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<max_align_t>())).__clang_max_align_nonce2
-                as *const _ as usize
-        },
-        16usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(max_align_t),
-            "::",
-            stringify!(__clang_max_align_nonce2)
-        )
-    );
+    fn test_field___clang_max_align_nonce1() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<max_align_t>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).__clang_max_align_nonce1) as usize -
+                    ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(max_align_t),
+                "::",
+                stringify!(__clang_max_align_nonce1)
+            )
+        );
+    }
+    test_field___clang_max_align_nonce1();
+    fn test_field___clang_max_align_nonce2() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<max_align_t>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).__clang_max_align_nonce2) as usize -
+                    ptr as usize
+            },
+            16usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(max_align_t),
+                "::",
+                stringify!(__clang_max_align_nonce2)
+            )
+        );
+    }
+    test_field___clang_max_align_nonce2();
 }
diff --git a/tests/expectations/tests/use-core.rs b/tests/expectations/tests/use-core.rs
index d919b6e..cc58821 100644
--- a/tests/expectations/tests/use-core.rs
+++ b/tests/expectations/tests/use-core.rs
@@ -4,7 +4,7 @@
     non_camel_case_types,
     non_upper_case_globals
 )]
-
+#![cfg(not(target_os = "windows"))]
 extern crate core;
 
 #[repr(C)]
@@ -26,21 +26,47 @@
         8usize,
         concat!("Alignment of ", stringify!(foo))
     );
-    assert_eq!(
-        unsafe { &(*(::core::ptr::null::<foo>())).a as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(foo), "::", stringify!(a))
-    );
-    assert_eq!(
-        unsafe { &(*(::core::ptr::null::<foo>())).b as *const _ as usize },
-        4usize,
-        concat!("Offset of field: ", stringify!(foo), "::", stringify!(b))
-    );
-    assert_eq!(
-        unsafe { &(*(::core::ptr::null::<foo>())).bar as *const _ as usize },
-        8usize,
-        concat!("Offset of field: ", stringify!(foo), "::", stringify!(bar))
-    );
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::core::mem::MaybeUninit::<foo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::core::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            0usize,
+            concat!("Offset of field: ", stringify!(foo), "::", stringify!(a))
+        );
+    }
+    test_field_a();
+    fn test_field_b() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::core::mem::MaybeUninit::<foo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::core::ptr::addr_of!((*ptr).b) as usize - ptr as usize
+            },
+            4usize,
+            concat!("Offset of field: ", stringify!(foo), "::", stringify!(b))
+        );
+    }
+    test_field_b();
+    fn test_field_bar() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::core::mem::MaybeUninit::<foo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::core::ptr::addr_of!((*ptr).bar) as usize - ptr as usize
+            },
+            8usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo),
+                "::",
+                stringify!(bar)
+            )
+        );
+    }
+    test_field_bar();
 }
 impl Default for foo {
     fn default() -> Self {
@@ -69,30 +95,42 @@
         8usize,
         concat!("Alignment of ", stringify!(_bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::core::ptr::null::<_bindgen_ty_1>())).bar as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(_bindgen_ty_1),
-            "::",
-            stringify!(bar)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::core::ptr::null::<_bindgen_ty_1>())).baz as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(_bindgen_ty_1),
-            "::",
-            stringify!(baz)
-        )
-    );
+    fn test_field_bar() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::core::mem::MaybeUninit::<_bindgen_ty_1>::uninit();
+                let ptr = uninit.as_ptr();
+                ::core::ptr::addr_of!((*ptr).bar) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(_bindgen_ty_1),
+                "::",
+                stringify!(bar)
+            )
+        );
+    }
+    test_field_bar();
+    fn test_field_baz() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::core::mem::MaybeUninit::<_bindgen_ty_1>::uninit();
+                let ptr = uninit.as_ptr();
+                ::core::ptr::addr_of!((*ptr).baz) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(_bindgen_ty_1),
+                "::",
+                stringify!(baz)
+            )
+        );
+    }
+    test_field_baz();
 }
 impl Default for _bindgen_ty_1 {
     fn default() -> Self {
diff --git a/tests/expectations/tests/use-core_1_0.rs b/tests/expectations/tests/use-core_1_0.rs
index 61ddfc4..bb5ce95 100644
--- a/tests/expectations/tests/use-core_1_0.rs
+++ b/tests/expectations/tests/use-core_1_0.rs
@@ -69,21 +69,47 @@
         8usize,
         concat!("Alignment of ", stringify!(foo))
     );
-    assert_eq!(
-        unsafe { &(*(::core::ptr::null::<foo>())).a as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(foo), "::", stringify!(a))
-    );
-    assert_eq!(
-        unsafe { &(*(::core::ptr::null::<foo>())).b as *const _ as usize },
-        4usize,
-        concat!("Offset of field: ", stringify!(foo), "::", stringify!(b))
-    );
-    assert_eq!(
-        unsafe { &(*(::core::ptr::null::<foo>())).bar as *const _ as usize },
-        8usize,
-        concat!("Offset of field: ", stringify!(foo), "::", stringify!(bar))
-    );
+    fn test_field_a() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::core::mem::MaybeUninit::<foo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::core::ptr::addr_of!((*ptr).a) as usize - ptr as usize
+            },
+            0usize,
+            concat!("Offset of field: ", stringify!(foo), "::", stringify!(a))
+        );
+    }
+    test_field_a();
+    fn test_field_b() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::core::mem::MaybeUninit::<foo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::core::ptr::addr_of!((*ptr).b) as usize - ptr as usize
+            },
+            4usize,
+            concat!("Offset of field: ", stringify!(foo), "::", stringify!(b))
+        );
+    }
+    test_field_b();
+    fn test_field_bar() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::core::mem::MaybeUninit::<foo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::core::ptr::addr_of!((*ptr).bar) as usize - ptr as usize
+            },
+            8usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo),
+                "::",
+                stringify!(bar)
+            )
+        );
+    }
+    test_field_bar();
 }
 impl Clone for foo {
     fn clone(&self) -> Self {
@@ -118,30 +144,42 @@
         8usize,
         concat!("Alignment of ", stringify!(_bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::core::ptr::null::<_bindgen_ty_1>())).bar as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(_bindgen_ty_1),
-            "::",
-            stringify!(bar)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::core::ptr::null::<_bindgen_ty_1>())).baz as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(_bindgen_ty_1),
-            "::",
-            stringify!(baz)
-        )
-    );
+    fn test_field_bar() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::core::mem::MaybeUninit::<_bindgen_ty_1>::uninit();
+                let ptr = uninit.as_ptr();
+                ::core::ptr::addr_of!((*ptr).bar) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(_bindgen_ty_1),
+                "::",
+                stringify!(bar)
+            )
+        );
+    }
+    test_field_bar();
+    fn test_field_baz() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::core::mem::MaybeUninit::<_bindgen_ty_1>::uninit();
+                let ptr = uninit.as_ptr();
+                ::core::ptr::addr_of!((*ptr).baz) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(_bindgen_ty_1),
+                "::",
+                stringify!(baz)
+            )
+        );
+    }
+    test_field_baz();
 }
 impl Clone for _bindgen_ty_1 {
     fn clone(&self) -> Self {
diff --git a/tests/expectations/tests/var-tracing.rs b/tests/expectations/tests/var-tracing.rs
index 2931f91..2ce6853 100644
--- a/tests/expectations/tests/var-tracing.rs
+++ b/tests/expectations/tests/var-tracing.rs
@@ -22,16 +22,23 @@
         4usize,
         concat!("Alignment of ", stringify!(Bar))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Bar>())).m_baz as *const _ as usize },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(Bar),
-            "::",
-            stringify!(m_baz)
-        )
-    );
+    fn test_field_m_baz() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Bar>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).m_baz) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Bar),
+                "::",
+                stringify!(m_baz)
+            )
+        );
+    }
+    test_field_m_baz();
 }
 extern "C" {
     #[link_name = "\u{1}_ZN3BarC1Ei"]
diff --git a/tests/expectations/tests/vector.rs b/tests/expectations/tests/vector.rs
index 04f4de7..936d29c 100644
--- a/tests/expectations/tests/vector.rs
+++ b/tests/expectations/tests/vector.rs
@@ -22,16 +22,23 @@
         8usize,
         concat!("Alignment of ", stringify!(foo))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<foo>())).mMember as *const _ as usize },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo),
-            "::",
-            stringify!(mMember)
-        )
-    );
+    fn test_field_mMember() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<foo>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mMember) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(foo),
+                "::",
+                stringify!(mMember)
+            )
+        );
+    }
+    test_field_mMember();
 }
 pub type __m128 = [f32; 4usize];
 pub type __m128d = [f64; 2usize];
diff --git a/tests/expectations/tests/virtual_inheritance.rs b/tests/expectations/tests/virtual_inheritance.rs
index eac6aa6..9e56c82 100644
--- a/tests/expectations/tests/virtual_inheritance.rs
+++ b/tests/expectations/tests/virtual_inheritance.rs
@@ -22,11 +22,18 @@
         4usize,
         concat!("Alignment of ", stringify!(A))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<A>())).foo as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(A), "::", stringify!(foo))
-    );
+    fn test_field_foo() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<A>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).foo) as usize - ptr as usize
+            },
+            0usize,
+            concat!("Offset of field: ", stringify!(A), "::", stringify!(foo))
+        );
+    }
+    test_field_foo();
 }
 #[repr(C)]
 pub struct B__bindgen_vtable(::std::os::raw::c_void);
@@ -48,11 +55,18 @@
         8usize,
         concat!("Alignment of ", stringify!(B))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<B>())).bar as *const _ as usize },
-        8usize,
-        concat!("Offset of field: ", stringify!(B), "::", stringify!(bar))
-    );
+    fn test_field_bar() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<B>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize
+            },
+            8usize,
+            concat!("Offset of field: ", stringify!(B), "::", stringify!(bar))
+        );
+    }
+    test_field_bar();
 }
 impl Default for B {
     fn default() -> Self {
@@ -83,11 +97,18 @@
         8usize,
         concat!("Alignment of ", stringify!(C))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<C>())).baz as *const _ as usize },
-        8usize,
-        concat!("Offset of field: ", stringify!(C), "::", stringify!(baz))
-    );
+    fn test_field_baz() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<C>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).baz) as usize - ptr as usize
+            },
+            8usize,
+            concat!("Offset of field: ", stringify!(C), "::", stringify!(baz))
+        );
+    }
+    test_field_baz();
 }
 impl Default for C {
     fn default() -> Self {
diff --git a/tests/expectations/tests/virtual_interface.rs b/tests/expectations/tests/virtual_interface.rs
new file mode 100644
index 0000000..be94f23
--- /dev/null
+++ b/tests/expectations/tests/virtual_interface.rs
@@ -0,0 +1,128 @@
+#![allow(
+    dead_code,
+    non_snake_case,
+    non_camel_case_types,
+    non_upper_case_globals
+)]
+
+#[repr(C)]
+pub struct PureVirtualIFace__bindgen_vtable {
+    pub PureVirtualIFace_Foo: unsafe extern "C" fn(this: *mut PureVirtualIFace),
+    pub PureVirtualIFace_Bar: unsafe extern "C" fn(
+        this: *mut PureVirtualIFace,
+        arg1: ::std::os::raw::c_uint,
+    ),
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct PureVirtualIFace {
+    pub vtable_: *const PureVirtualIFace__bindgen_vtable,
+}
+#[test]
+fn bindgen_test_layout_PureVirtualIFace() {
+    assert_eq!(
+        ::std::mem::size_of::<PureVirtualIFace>(),
+        8usize,
+        concat!("Size of: ", stringify!(PureVirtualIFace))
+    );
+    assert_eq!(
+        ::std::mem::align_of::<PureVirtualIFace>(),
+        8usize,
+        concat!("Alignment of ", stringify!(PureVirtualIFace))
+    );
+}
+impl Default for PureVirtualIFace {
+    fn default() -> Self {
+        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
+        unsafe {
+            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
+            s.assume_init()
+        }
+    }
+}
+#[repr(C)]
+pub struct AnotherInterface__bindgen_vtable {
+    pub AnotherInterface_Baz: unsafe extern "C" fn(this: *mut AnotherInterface),
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct AnotherInterface {
+    pub vtable_: *const AnotherInterface__bindgen_vtable,
+}
+#[test]
+fn bindgen_test_layout_AnotherInterface() {
+    assert_eq!(
+        ::std::mem::size_of::<AnotherInterface>(),
+        8usize,
+        concat!("Size of: ", stringify!(AnotherInterface))
+    );
+    assert_eq!(
+        ::std::mem::align_of::<AnotherInterface>(),
+        8usize,
+        concat!("Alignment of ", stringify!(AnotherInterface))
+    );
+}
+impl Default for AnotherInterface {
+    fn default() -> Self {
+        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
+        unsafe {
+            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
+            s.assume_init()
+        }
+    }
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct Implementation {
+    pub _base: PureVirtualIFace,
+}
+#[test]
+fn bindgen_test_layout_Implementation() {
+    assert_eq!(
+        ::std::mem::size_of::<Implementation>(),
+        8usize,
+        concat!("Size of: ", stringify!(Implementation))
+    );
+    assert_eq!(
+        ::std::mem::align_of::<Implementation>(),
+        8usize,
+        concat!("Alignment of ", stringify!(Implementation))
+    );
+}
+impl Default for Implementation {
+    fn default() -> Self {
+        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
+        unsafe {
+            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
+            s.assume_init()
+        }
+    }
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct DoubleImpl {
+    pub _base: PureVirtualIFace,
+    pub _base_1: AnotherInterface,
+}
+#[test]
+fn bindgen_test_layout_DoubleImpl() {
+    assert_eq!(
+        ::std::mem::size_of::<DoubleImpl>(),
+        16usize,
+        concat!("Size of: ", stringify!(DoubleImpl))
+    );
+    assert_eq!(
+        ::std::mem::align_of::<DoubleImpl>(),
+        8usize,
+        concat!("Alignment of ", stringify!(DoubleImpl))
+    );
+}
+impl Default for DoubleImpl {
+    fn default() -> Self {
+        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
+        unsafe {
+            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
+            s.assume_init()
+        }
+    }
+}
diff --git a/tests/expectations/tests/virtual_overloaded.rs b/tests/expectations/tests/virtual_overloaded.rs
index 4556b1b..c117d9e 100644
--- a/tests/expectations/tests/virtual_overloaded.rs
+++ b/tests/expectations/tests/virtual_overloaded.rs
@@ -6,7 +6,12 @@
 )]
 
 #[repr(C)]
-pub struct C__bindgen_vtable(::std::os::raw::c_void);
+pub struct C__bindgen_vtable {
+    pub C_do_thing:
+        unsafe extern "C" fn(this: *mut C, arg1: ::std::os::raw::c_char),
+    pub C_do_thing1:
+        unsafe extern "C" fn(this: *mut C, arg1: ::std::os::raw::c_int),
+}
 #[repr(C)]
 #[derive(Debug, Copy, Clone)]
 pub struct C {
diff --git a/tests/expectations/tests/vtable_recursive_sig.rs b/tests/expectations/tests/vtable_recursive_sig.rs
index ca77bc8..74e1dc7 100644
--- a/tests/expectations/tests/vtable_recursive_sig.rs
+++ b/tests/expectations/tests/vtable_recursive_sig.rs
@@ -6,7 +6,9 @@
 )]
 
 #[repr(C)]
-pub struct Base__bindgen_vtable(::std::os::raw::c_void);
+pub struct Base__bindgen_vtable {
+    pub Base_AsDerived: unsafe extern "C" fn(this: *mut Base) -> *mut Derived,
+}
 #[repr(C)]
 #[derive(Debug, Copy, Clone)]
 pub struct Base {
diff --git a/tests/expectations/tests/weird_bitfields.rs b/tests/expectations/tests/weird_bitfields.rs
index c4dfa55..c524b90 100644
--- a/tests/expectations/tests/weird_bitfields.rs
+++ b/tests/expectations/tests/weird_bitfields.rs
@@ -131,158 +131,218 @@
         4usize,
         concat!("Alignment of ", stringify!(Weird))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<Weird>())).mStrokeDasharrayLength as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(Weird),
-            "::",
-            stringify!(mStrokeDasharrayLength)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<Weird>())).mClipRule as *const _ as usize
-        },
-        8usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(Weird),
-            "::",
-            stringify!(mClipRule)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<Weird>())).mColorInterpolation as *const _
-                as usize
-        },
-        9usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(Weird),
-            "::",
-            stringify!(mColorInterpolation)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<Weird>())).mColorInterpolationFilters
-                as *const _ as usize
-        },
-        10usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(Weird),
-            "::",
-            stringify!(mColorInterpolationFilters)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<Weird>())).mFillRule as *const _ as usize
-        },
-        11usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(Weird),
-            "::",
-            stringify!(mFillRule)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<Weird>())).mImageRendering as *const _
-                as usize
-        },
-        12usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(Weird),
-            "::",
-            stringify!(mImageRendering)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<Weird>())).mPaintOrder as *const _ as usize
-        },
-        13usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(Weird),
-            "::",
-            stringify!(mPaintOrder)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<Weird>())).mShapeRendering as *const _
-                as usize
-        },
-        14usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(Weird),
-            "::",
-            stringify!(mShapeRendering)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<Weird>())).mStrokeLinecap as *const _
-                as usize
-        },
-        15usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(Weird),
-            "::",
-            stringify!(mStrokeLinecap)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<Weird>())).mStrokeLinejoin as *const _
-                as usize
-        },
-        16usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(Weird),
-            "::",
-            stringify!(mStrokeLinejoin)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<Weird>())).mTextAnchor as *const _ as usize
-        },
-        17usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(Weird),
-            "::",
-            stringify!(mTextAnchor)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<Weird>())).mTextRendering as *const _
-                as usize
-        },
-        18usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(Weird),
-            "::",
-            stringify!(mTextRendering)
-        )
-    );
+    fn test_field_mStrokeDasharrayLength() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Weird>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mStrokeDasharrayLength) as usize -
+                    ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Weird),
+                "::",
+                stringify!(mStrokeDasharrayLength)
+            )
+        );
+    }
+    test_field_mStrokeDasharrayLength();
+    fn test_field_mClipRule() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Weird>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mClipRule) as usize - ptr as usize
+            },
+            8usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Weird),
+                "::",
+                stringify!(mClipRule)
+            )
+        );
+    }
+    test_field_mClipRule();
+    fn test_field_mColorInterpolation() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Weird>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mColorInterpolation) as usize -
+                    ptr as usize
+            },
+            9usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Weird),
+                "::",
+                stringify!(mColorInterpolation)
+            )
+        );
+    }
+    test_field_mColorInterpolation();
+    fn test_field_mColorInterpolationFilters() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Weird>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mColorInterpolationFilters) as usize -
+                    ptr as usize
+            },
+            10usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Weird),
+                "::",
+                stringify!(mColorInterpolationFilters)
+            )
+        );
+    }
+    test_field_mColorInterpolationFilters();
+    fn test_field_mFillRule() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Weird>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mFillRule) as usize - ptr as usize
+            },
+            11usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Weird),
+                "::",
+                stringify!(mFillRule)
+            )
+        );
+    }
+    test_field_mFillRule();
+    fn test_field_mImageRendering() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Weird>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mImageRendering) as usize -
+                    ptr as usize
+            },
+            12usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Weird),
+                "::",
+                stringify!(mImageRendering)
+            )
+        );
+    }
+    test_field_mImageRendering();
+    fn test_field_mPaintOrder() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Weird>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mPaintOrder) as usize - ptr as usize
+            },
+            13usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Weird),
+                "::",
+                stringify!(mPaintOrder)
+            )
+        );
+    }
+    test_field_mPaintOrder();
+    fn test_field_mShapeRendering() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Weird>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mShapeRendering) as usize -
+                    ptr as usize
+            },
+            14usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Weird),
+                "::",
+                stringify!(mShapeRendering)
+            )
+        );
+    }
+    test_field_mShapeRendering();
+    fn test_field_mStrokeLinecap() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Weird>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mStrokeLinecap) as usize -
+                    ptr as usize
+            },
+            15usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Weird),
+                "::",
+                stringify!(mStrokeLinecap)
+            )
+        );
+    }
+    test_field_mStrokeLinecap();
+    fn test_field_mStrokeLinejoin() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Weird>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mStrokeLinejoin) as usize -
+                    ptr as usize
+            },
+            16usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Weird),
+                "::",
+                stringify!(mStrokeLinejoin)
+            )
+        );
+    }
+    test_field_mStrokeLinejoin();
+    fn test_field_mTextAnchor() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Weird>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mTextAnchor) as usize - ptr as usize
+            },
+            17usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Weird),
+                "::",
+                stringify!(mTextAnchor)
+            )
+        );
+    }
+    test_field_mTextAnchor();
+    fn test_field_mTextRendering() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<Weird>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).mTextRendering) as usize -
+                    ptr as usize
+            },
+            18usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(Weird),
+                "::",
+                stringify!(mTextRendering)
+            )
+        );
+    }
+    test_field_mTextRendering();
 }
 impl Default for Weird {
     fn default() -> Self {
diff --git a/tests/expectations/tests/libclang-4/error-E0600-cannot-apply-unary-negation-to-u32.rs b/tests/expectations/tests/win32-vectorcall-1_0.rs
similarity index 60%
rename from tests/expectations/tests/libclang-4/error-E0600-cannot-apply-unary-negation-to-u32.rs
rename to tests/expectations/tests/win32-vectorcall-1_0.rs
index 5787859..131dbdf 100644
--- a/tests/expectations/tests/libclang-4/error-E0600-cannot-apply-unary-negation-to-u32.rs
+++ b/tests/expectations/tests/win32-vectorcall-1_0.rs
@@ -4,6 +4,3 @@
     non_camel_case_types,
     non_upper_case_globals
 )]
-#![allow(overflowing_literals)]
-
-pub const a: u32 = 4294967291;
diff --git a/tests/expectations/tests/win32-vectorcall-nightly.rs b/tests/expectations/tests/win32-vectorcall-nightly.rs
new file mode 100644
index 0000000..163741d
--- /dev/null
+++ b/tests/expectations/tests/win32-vectorcall-nightly.rs
@@ -0,0 +1,16 @@
+#![allow(
+    dead_code,
+    non_snake_case,
+    non_camel_case_types,
+    non_upper_case_globals
+)]
+#![cfg(feature = "nightly")]
+#![feature(abi_vectorcall)]
+
+extern "vectorcall" {
+    #[link_name = "\u{1}test_vectorcall@@16"]
+    pub fn test_vectorcall(
+        a: ::std::os::raw::c_int,
+        b: ::std::os::raw::c_int,
+    ) -> ::std::os::raw::c_int;
+}
diff --git a/tests/expectations/tests/zero-size-array-align.rs b/tests/expectations/tests/zero-size-array-align.rs
index 92b6798..31eff38 100644
--- a/tests/expectations/tests/zero-size-array-align.rs
+++ b/tests/expectations/tests/zero-size-array-align.rs
@@ -54,40 +54,55 @@
         8usize,
         concat!("Alignment of ", stringify!(dm_deps))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<dm_deps>())).count as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(dm_deps),
-            "::",
-            stringify!(count)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<dm_deps>())).filler as *const _ as usize
-        },
-        4usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(dm_deps),
-            "::",
-            stringify!(filler)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<dm_deps>())).device as *const _ as usize
-        },
-        8usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(dm_deps),
-            "::",
-            stringify!(device)
-        )
-    );
+    fn test_field_count() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<dm_deps>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).count) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(dm_deps),
+                "::",
+                stringify!(count)
+            )
+        );
+    }
+    test_field_count();
+    fn test_field_filler() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<dm_deps>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).filler) as usize - ptr as usize
+            },
+            4usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(dm_deps),
+                "::",
+                stringify!(filler)
+            )
+        );
+    }
+    test_field_filler();
+    fn test_field_device() {
+        assert_eq!(
+            unsafe {
+                let uninit = ::std::mem::MaybeUninit::<dm_deps>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).device) as usize - ptr as usize
+            },
+            8usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(dm_deps),
+                "::",
+                stringify!(device)
+            )
+        );
+    }
+    test_field_device();
 }
diff --git a/tests/expectations/tests/zero-sized-array.rs b/tests/expectations/tests/zero-sized-array.rs
index 347c226..c12afa5 100644
--- a/tests/expectations/tests/zero-sized-array.rs
+++ b/tests/expectations/tests/zero-sized-array.rs
@@ -53,18 +53,24 @@
         1usize,
         concat!("Alignment of ", stringify!(ZeroSizedArray))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ZeroSizedArray>())).arr as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(ZeroSizedArray),
-            "::",
-            stringify!(arr)
-        )
-    );
+    fn test_field_arr() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<ZeroSizedArray>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).arr) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(ZeroSizedArray),
+                "::",
+                stringify!(arr)
+            )
+        );
+    }
+    test_field_arr();
 }
 /// And nor should this get an `_address` field.
 #[repr(C)]
@@ -84,19 +90,24 @@
         1usize,
         concat!("Alignment of ", stringify!(ContainsZeroSizedArray))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ContainsZeroSizedArray>())).zsa as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(ContainsZeroSizedArray),
-            "::",
-            stringify!(zsa)
-        )
-    );
+    fn test_field_zsa() {
+        assert_eq!(
+            unsafe {
+                let uninit =
+                    ::std::mem::MaybeUninit::<ContainsZeroSizedArray>::uninit();
+                let ptr = uninit.as_ptr();
+                ::std::ptr::addr_of!((*ptr).zsa) as usize - ptr as usize
+            },
+            0usize,
+            concat!(
+                "Offset of field: ",
+                stringify!(ContainsZeroSizedArray),
+                "::",
+                stringify!(zsa)
+            )
+        );
+    }
+    test_field_zsa();
 }
 /// Inheriting from ZeroSizedArray shouldn't cause an `_address` to be inserted
 /// either.
diff --git a/tests/headers/allowlist-file.hpp b/tests/headers/allowlist-file.hpp
new file mode 100644
index 0000000..b0354a0
--- /dev/null
+++ b/tests/headers/allowlist-file.hpp
@@ -0,0 +1,21 @@
+// bindgen-flags: --allowlist-file ".*/allowlisted/file.*" --allowlist-type AllowlistMe -- -Itests/headers
+
+
+// Forward declaration of struct that's defined in an allowlisted file.
+struct StructWithAllowlistedDefinition;
+
+#include "allowlisted/file.hpp"
+
+// Actual definition of struct that has a forward declaration in an allowlisted file.
+struct StructWithAllowlistedFwdDecl {
+    int b;
+};
+
+class Ignored {
+    char c;
+};
+
+// Also have an explicitly allowlisted type
+class AllowlistMe {
+    int foo;
+};
diff --git a/tests/headers/allowlisted/file.hpp b/tests/headers/allowlisted/file.hpp
new file mode 100644
index 0000000..5f360e5
--- /dev/null
+++ b/tests/headers/allowlisted/file.hpp
@@ -0,0 +1,22 @@
+void SomeFunction();
+extern int someVar;
+#define SOME_DEFUN 123
+
+class someClass {
+  void somePrivateMethod();
+public:
+  void somePublicMethod(int foo);
+};
+
+extern "C" void ExternFunction();
+
+namespace foo {
+  void NamespacedFunction();
+}
+
+
+struct StructWithAllowlistedFwdDecl;
+
+struct StructWithAllowlistedDefinition {
+    StructWithAllowlistedFwdDecl* other;
+};
diff --git a/tests/headers/bitfield_align_2.h b/tests/headers/bitfield_align_2.h
index b6a6cd2..cb0f2e2 100644
--- a/tests/headers/bitfield_align_2.h
+++ b/tests/headers/bitfield_align_2.h
@@ -1,4 +1,4 @@
-// bindgen-flags: --rustified-enum ".*"
+// bindgen-flags: --rustified-enum ".*" --raw-line '#![cfg(not(target_os="windows"))]'
 enum MyEnum {
     ONE,
     TWO,
diff --git a/tests/headers/blocklist-file.hpp b/tests/headers/blocklist-file.hpp
new file mode 100644
index 0000000..ad8bcd6
--- /dev/null
+++ b/tests/headers/blocklist-file.hpp
@@ -0,0 +1,18 @@
+// bindgen-flags: --blocklist-file ".*/blocklisted/file.*" -- -Itests/headers
+
+// Forward declaration of struct that's defined in a blocklisted file.
+struct StructWithBlocklistedDefinition;
+
+#include "blocklisted/file.hpp"
+#include "blocklisted/fake-stdint.h"
+
+struct SizedIntegers {
+    uint8_t x;
+    uint16_t y;
+    uint32_t z;
+};
+
+// Actual definition of struct that has a forward declaration in a blocklisted file.
+struct StructWithBlocklistedFwdDecl {
+    uint8_t b;
+};
diff --git a/tests/headers/blocklisted/fake-stdint.h b/tests/headers/blocklisted/fake-stdint.h
new file mode 100644
index 0000000..a8cfe01
--- /dev/null
+++ b/tests/headers/blocklisted/fake-stdint.h
@@ -0,0 +1,7 @@
+// <stdint.h>-like types get special treatment even when blocklisted.
+typedef signed char      int8_t;
+typedef unsigned char    uint8_t;
+typedef signed short     int16_t;
+typedef unsigned short   uint16_t;
+typedef signed int       int32_t;
+typedef unsigned int     uint32_t;
diff --git a/tests/headers/blocklisted/file.hpp b/tests/headers/blocklisted/file.hpp
new file mode 100644
index 0000000..4bcb589
--- /dev/null
+++ b/tests/headers/blocklisted/file.hpp
@@ -0,0 +1,26 @@
+void SomeFunction();
+extern int someVar;
+#define SOME_DEFUN 123
+
+class someClass {
+  void somePrivateMethod();
+public:
+  void somePublicMethod(int foo);
+};
+
+extern "C" void ExternFunction();
+
+namespace foo {
+  void NamespacedFunction();
+}
+
+namespace bar {
+  void NamespacedFunction();
+}
+
+
+struct StructWithBlocklistedFwdDecl;
+
+struct StructWithBlocklistedDefinition {
+    StructWithBlocklistedFwdDecl* other;
+};
diff --git a/tests/headers/convert-cpp-comment-to-rust.hpp b/tests/headers/convert-cpp-comment-to-rust.hpp
index 649c236..f5bbbf5 100644
--- a/tests/headers/convert-cpp-comment-to-rust.hpp
+++ b/tests/headers/convert-cpp-comment-to-rust.hpp
@@ -1,4 +1,4 @@
-
+// bindgen-flags: --no-layout-tests
 typedef unsigned mbedtls_mpi_uint;
 
 /**
diff --git a/tests/headers/derive-custom.h b/tests/headers/derive-custom.h
index 83f2ce0..8c57278 100644
--- a/tests/headers/derive-custom.h
+++ b/tests/headers/derive-custom.h
@@ -1,4 +1,4 @@
-// bindgen-flags: --no-derive-debug --no-derive-copy --default-enum-style rust
+// bindgen-flags: --no-derive-debug --no-derive-copy --default-enum-style rust --no-layout-tests
 
 /** <div rustbindgen derive="Debug"></div> */
 struct my_type;
diff --git a/tests/headers/dynamic_loading_attributes.h b/tests/headers/dynamic_loading_attributes.h
new file mode 100644
index 0000000..e2ca62b
--- /dev/null
+++ b/tests/headers/dynamic_loading_attributes.h
@@ -0,0 +1,11 @@
+// bindgen-flags: --dynamic-loading TestLib --dynamic-link-require-all --enable-function-attribute-detection
+/**
+ * @brief A function
+ * 
+ * @param x 
+ * @param y 
+ * @return int 
+ */
+__attribute__((warn_unused_result))
+int foo(int x, int y);
+int baz() ;
diff --git a/tests/headers/enum_explicit_type_constants.hpp b/tests/headers/enum_explicit_type_constants.hpp
index 7deab36..e1ecf6f 100644
--- a/tests/headers/enum_explicit_type_constants.hpp
+++ b/tests/headers/enum_explicit_type_constants.hpp
@@ -1,4 +1,4 @@
-// bindgen-flags: -- -std=c++11
+// bindgen-flags: --raw-line '#![cfg(not(target_os="windows"))]' -- -std=c++11 
 //
 // This test is much like enum_explicit_type, but without --rustified-enum.
 
diff --git a/tests/headers/func_return_must_use.h b/tests/headers/func_return_must_use.h
new file mode 100644
index 0000000..f05bd2d
--- /dev/null
+++ b/tests/headers/func_return_must_use.h
@@ -0,0 +1,36 @@
+// bindgen-flags: --must-use-type 'MustUse.*'
+
+typedef int MustUseInt;
+
+MustUseInt return_int();
+
+struct MustUseStruct;
+
+struct MustUseStruct return_struct();
+
+/**
+ * <div rustbindgen mustusetype></div>
+ */
+typedef int AnnotatedInt;
+
+AnnotatedInt return_annotated_int();
+
+int return_plain_int();
+
+/**
+ * <div rustbindgen mustusetype></div>
+ */
+struct AnnotatedStruct {};
+
+struct AnnotatedStruct return_annotated_struct();
+
+struct PlainStruct {};
+
+/**
+ * <div rustbindgen mustusetype></div>
+ */
+typedef struct PlainStruct TypedefPlainStruct;
+
+struct PlainStruct return_plain_struct();
+
+TypedefPlainStruct return_typedef_struct();
diff --git a/tests/headers/issue-739-pointer-wide-bitfield.h b/tests/headers/issue-739-pointer-wide-bitfield.h
index 611dab1..eeb7ae9 100644
--- a/tests/headers/issue-739-pointer-wide-bitfield.h
+++ b/tests/headers/issue-739-pointer-wide-bitfield.h
@@ -1,3 +1,4 @@
+// bindgen-flags: --raw-line '#![cfg(not(target_os="windows"))]'
 #define POINTER_WIDTH (sizeof(void*) * 8)
 
 struct Foo {
diff --git a/tests/headers/keywords.h b/tests/headers/keywords.h
index 78ad278..d7fe206 100644
--- a/tests/headers/keywords.h
+++ b/tests/headers/keywords.h
@@ -34,6 +34,7 @@
 int super;
 int trait;
 int true;
+int try;
 int type;
 int unsafe;
 int use;
diff --git a/tests/headers/macro_const_1_0.h b/tests/headers/macro_const_1_0.h
new file mode 100644
index 0000000..3be86b4
--- /dev/null
+++ b/tests/headers/macro_const_1_0.h
@@ -0,0 +1,10 @@
+// bindgen-flags: --rust-target 1.0
+
+#define foo "bar"
+#define CHAR 'b'
+#define CHARR '\0'
+#define FLOAT 5.09f
+#define FLOAT_EXPR (5 / 1000.0f)
+#define LONG 3L
+
+#define INVALID_UTF8 "\xf0\x28\x8c\x28"
diff --git a/tests/headers/objc_allowlist.h b/tests/headers/objc_allowlist.h
index 8c93996..b5406d0 100644
--- a/tests/headers/objc_allowlist.h
+++ b/tests/headers/objc_allowlist.h
@@ -1,4 +1,4 @@
-// bindgen-flags: --objc-extern-crate --allowlist-type AllowlistMe --allowlist-type AllowlistMe_InterestingCategory -- -x objective-c
+// bindgen-flags: --allowlist-type IAllowlistMe --allowlist-type AllowlistMe_InterestingCategory -- -x objective-c
 // bindgen-osx-only
 
 
diff --git a/tests/headers/objc_category.h b/tests/headers/objc_category.h
index c464b72..b8e60d5 100644
--- a/tests/headers/objc_category.h
+++ b/tests/headers/objc_category.h
@@ -1,4 +1,4 @@
-// bindgen-flags: --objc-extern-crate -- -x objective-c
+// bindgen-flags: -- -x objective-c
 // bindgen-osx-only
 
 @interface Foo
diff --git a/tests/headers/objc_class.h b/tests/headers/objc_class.h
index cea72e7..f5ec950 100644
--- a/tests/headers/objc_class.h
+++ b/tests/headers/objc_class.h
@@ -1,4 +1,4 @@
-// bindgen-flags: --objc-extern-crate -- -x objective-c
+// bindgen-flags: -- -x objective-c
 // bindgen-osx-only
 
 @class Foo;
diff --git a/tests/headers/objc_class_method.h b/tests/headers/objc_class_method.h
index ddda742..1a68ed3 100644
--- a/tests/headers/objc_class_method.h
+++ b/tests/headers/objc_class_method.h
@@ -1,4 +1,4 @@
-// bindgen-flags: --objc-extern-crate -- -x objective-c
+// bindgen-flags: -- -x objective-c
 // bindgen-osx-only
 
 @interface Foo
diff --git a/tests/headers/objc_inheritance.h b/tests/headers/objc_inheritance.h
index 8f96e45..985f159 100644
--- a/tests/headers/objc_inheritance.h
+++ b/tests/headers/objc_inheritance.h
@@ -1,4 +1,4 @@
-// bindgen-flags: --objc-extern-crate -- -x objective-c
+// bindgen-flags: -- -x objective-c
 // bindgen-osx-only
 
 @interface Foo
diff --git a/tests/headers/objc_interface.h b/tests/headers/objc_interface.h
index af84bf9..df16e92 100644
--- a/tests/headers/objc_interface.h
+++ b/tests/headers/objc_interface.h
@@ -1,4 +1,4 @@
-// bindgen-flags: --objc-extern-crate -- -x objective-c
+// bindgen-flags: -- -x objective-c
 // bindgen-osx-only
 
 @interface Foo
diff --git a/tests/headers/objc_interface_type.h b/tests/headers/objc_interface_type.h
index 31d3366..4667ce2 100644
--- a/tests/headers/objc_interface_type.h
+++ b/tests/headers/objc_interface_type.h
@@ -1,4 +1,4 @@
-// bindgen-flags: --objc-extern-crate -- -x objective-c
+// bindgen-flags: -- -x objective-c
 // bindgen-osx-only
 
 @interface Foo
diff --git a/tests/headers/objc_method.h b/tests/headers/objc_method.h
index c4d375b..b89d162 100644
--- a/tests/headers/objc_method.h
+++ b/tests/headers/objc_method.h
@@ -1,4 +1,4 @@
-// bindgen-flags: --objc-extern-crate -- -x objective-c
+// bindgen-flags: -- -x objective-c
 // bindgen-osx-only
 
 @interface Foo
diff --git a/tests/headers/objc_method_clash.h b/tests/headers/objc_method_clash.h
index a56e39d..d99d369 100644
--- a/tests/headers/objc_method_clash.h
+++ b/tests/headers/objc_method_clash.h
@@ -1,4 +1,4 @@
-// bindgen-flags: --objc-extern-crate -- -x objective-c
+// bindgen-flags: -- -x objective-c
 // bindgen-osx-only
 
 @interface Foo
diff --git a/tests/headers/objc_pointer_return_types.h b/tests/headers/objc_pointer_return_types.h
index e289a8a..4d1a6de 100644
--- a/tests/headers/objc_pointer_return_types.h
+++ b/tests/headers/objc_pointer_return_types.h
@@ -1,4 +1,4 @@
-// bindgen-flags: --objc-extern-crate -- -x objective-c
+// bindgen-flags: -- -x objective-c
 // bindgen-osx-only
 
 @interface Bar
diff --git a/tests/headers/objc_property_fnptr.h b/tests/headers/objc_property_fnptr.h
index bac0c77..fe3e7fc 100644
--- a/tests/headers/objc_property_fnptr.h
+++ b/tests/headers/objc_property_fnptr.h
@@ -1,4 +1,4 @@
-// bindgen-flags: --objc-extern-crate -- -x objective-c
+// bindgen-flags: -- -x objective-c
 // bindgen-osx-only
 
 @interface Foo
diff --git a/tests/headers/objc_protocol.h b/tests/headers/objc_protocol.h
index 0c760fa..46978a3 100644
--- a/tests/headers/objc_protocol.h
+++ b/tests/headers/objc_protocol.h
@@ -1,4 +1,4 @@
-// bindgen-flags: --objc-extern-crate -- -x objective-c
+// bindgen-flags: -- -x objective-c
 // bindgen-osx-only
 
 @protocol Foo
diff --git a/tests/headers/objc_protocol_inheritance.h b/tests/headers/objc_protocol_inheritance.h
index d5f3a49..13135fd 100644
--- a/tests/headers/objc_protocol_inheritance.h
+++ b/tests/headers/objc_protocol_inheritance.h
@@ -1,4 +1,4 @@
-// bindgen-flags: --objc-extern-crate -- -x objective-c
+// bindgen-flags: -- -x objective-c
 // bindgen-osx-only
 
 @protocol Foo
diff --git a/tests/headers/objc_sel_and_id.h b/tests/headers/objc_sel_and_id.h
index 3c8c656..6491a54 100644
--- a/tests/headers/objc_sel_and_id.h
+++ b/tests/headers/objc_sel_and_id.h
@@ -1,4 +1,4 @@
-// bindgen-flags: --objc-extern-crate -- -x objective-c
+// bindgen-flags: -- -x objective-c
 // bindgen-osx-only
 
 id object;
diff --git a/tests/headers/objc_template.h b/tests/headers/objc_template.h
index a4d0055..b616da0 100644
--- a/tests/headers/objc_template.h
+++ b/tests/headers/objc_template.h
@@ -1,4 +1,4 @@
-// bindgen-flags: --objc-extern-crate -- -x objective-c
+// bindgen-flags: -- -x objective-c
 // bindgen-osx-only
 
 @interface Foo<__covariant ObjectType>
diff --git a/tests/headers/template.hpp b/tests/headers/template.hpp
index eea2c4d..bc32a35 100644
--- a/tests/headers/template.hpp
+++ b/tests/headers/template.hpp
@@ -32,9 +32,7 @@
     B<const int&> mBConstRef;
     B<int*&> mPtrRef;
     B<int(&)[1]> mArrayRef;
-    // clang 3.x ignores const in this case, so they generate different
-    // result than clang 4.0.
-    // B<const int[1]> mBConstArray;
+    B<const int[1]> mBConstArray;
 };
 
 template<typename T>
diff --git a/tests/headers/use-core.h b/tests/headers/use-core.h
index b4135b4..5ee0ac6 100644
--- a/tests/headers/use-core.h
+++ b/tests/headers/use-core.h
@@ -1,4 +1,4 @@
-// bindgen-flags: --use-core --raw-line "extern crate core;" --with-derive-hash --with-derive-partialeq --with-derive-eq
+// bindgen-flags: --use-core --raw-line '#![cfg(not(target_os="windows"))] extern crate core;' --with-derive-hash --with-derive-partialeq --with-derive-eq
 
 struct foo {
   int a, b;
diff --git a/tests/headers/virtual_interface.hpp b/tests/headers/virtual_interface.hpp
new file mode 100644
index 0000000..00ab073
--- /dev/null
+++ b/tests/headers/virtual_interface.hpp
@@ -0,0 +1,24 @@
+class PureVirtualIFace {
+public:
+    virtual void Foo() = 0;
+    virtual void Bar(unsigned int) = 0;
+};
+
+class AnotherInterface {
+public:
+    virtual void Baz() = 0;
+};
+
+class Implementation : public PureVirtualIFace {
+public:
+    void Foo() override {}
+    void Bar(unsigned int) override {}
+};
+
+class DoubleImpl : public PureVirtualIFace, public AnotherInterface {
+public:
+    void Foo() override {}
+    void Bar(unsigned int) override {}
+
+    void Baz() override {}
+};
diff --git a/tests/headers/win32-vectorcall-1_0.h b/tests/headers/win32-vectorcall-1_0.h
new file mode 100644
index 0000000..a1f852b
--- /dev/null
+++ b/tests/headers/win32-vectorcall-1_0.h
@@ -0,0 +1,3 @@
+// bindgen-flags: --rust-target 1.0 -- --target=x86_64-pc-windows-msvc
+
+int __vectorcall test_vectorcall(int a, int b);
diff --git a/tests/headers/win32-vectorcall-nightly.h b/tests/headers/win32-vectorcall-nightly.h
new file mode 100644
index 0000000..c099bb5
--- /dev/null
+++ b/tests/headers/win32-vectorcall-nightly.h
@@ -0,0 +1,3 @@
+// bindgen-flags: --rust-target nightly --raw-line '#![cfg(feature = "nightly")]' --raw-line '#![feature(abi_vectorcall)]' -- --target=x86_64-pc-windows-msvc
+
+int __vectorcall test_vectorcall(int a, int b);
diff --git a/tests/stylo_sanity.rs b/tests/stylo_sanity.rs
index 39777cd..52b9635 100755
--- a/tests/stylo_sanity.rs
+++ b/tests/stylo_sanity.rs
@@ -16,8 +16,6 @@
 #[test]
 #[cfg(not(any(debug_assertions, feature = "testing_only_extra_assertions",)))]
 #[cfg(any(
-    feature = "testing_only_libclang_3_9",
-    feature = "testing_only_libclang_4",
     feature = "testing_only_libclang_5",
     feature = "testing_only_libclang_9"
 ))]
diff --git a/tests/tests.rs b/tests/tests.rs
index 323cf16..cc64cfd 100644
--- a/tests/tests.rs
+++ b/tests/tests.rs
@@ -9,7 +9,7 @@
 use std::env;
 use std::fs;
 use std::io::{self, BufRead, BufReader, Error, ErrorKind, Read, Write};
-use std::path::PathBuf;
+use std::path::{Path, PathBuf};
 use std::process;
 use std::sync::Once;
 
@@ -115,15 +115,70 @@
     (bindings, stderr)
 }
 
+fn should_overwrite_expected() -> bool {
+    if let Some(var) = env::var_os("BINDGEN_OVERWRITE_EXPECTED") {
+        if var == "1" {
+            return true;
+        }
+        if var != "0" && var != "" {
+            panic!("Invalid value of BINDGEN_OVERWRITE_EXPECTED");
+        }
+    }
+    false
+}
+
+fn error_diff_mismatch(
+    actual: &str,
+    expected: &str,
+    header: Option<&Path>,
+    filename: &Path,
+) -> Result<(), Error> {
+    println!("diff expected generated");
+    println!("--- expected: {:?}", filename);
+    if let Some(header) = header {
+        println!("+++ generated from: {:?}", header);
+    }
+
+    for diff in diff::lines(&expected, &actual) {
+        match diff {
+            diff::Result::Left(l) => println!("-{}", l),
+            diff::Result::Both(l, _) => println!(" {}", l),
+            diff::Result::Right(r) => println!("+{}", r),
+        }
+    }
+
+    if should_overwrite_expected() {
+        // Overwrite the expectation with actual output.
+        let mut expectation_file = fs::File::create(filename)?;
+        expectation_file.write_all(actual.as_bytes())?;
+    }
+
+    if let Some(var) = env::var_os("BINDGEN_TESTS_DIFFTOOL") {
+        //usecase: var = "meld" -> You can hand check differences
+        let name = match filename.components().last() {
+            Some(std::path::Component::Normal(name)) => name,
+            _ => panic!("Why is the header variable so weird?"),
+        };
+        let actual_result_path =
+            PathBuf::from(env::var("OUT_DIR").unwrap()).join(name);
+        let mut actual_result_file = fs::File::create(&actual_result_path)?;
+        actual_result_file.write_all(actual.as_bytes())?;
+        std::process::Command::new(var)
+            .args(&[filename, &actual_result_path])
+            .output()?;
+    }
+
+    return Err(Error::new(ErrorKind::Other, "Header and binding differ! Run with BINDGEN_OVERWRITE_EXPECTED=1 in the environment to automatically overwrite the expectation or with BINDGEN_TESTS_DIFFTOOL=meld to do this manually."));
+}
+
 fn compare_generated_header(
-    header: &PathBuf,
+    header: &Path,
     builder: BuilderState,
     check_roundtrip: bool,
 ) -> Result<(), Error> {
-    let file_name = header.file_name().ok_or(Error::new(
-        ErrorKind::Other,
-        "compare_generated_header expects a file",
-    ))?;
+    let file_name = header.file_name().ok_or_else(|| {
+        Error::new(ErrorKind::Other, "compare_generated_header expects a file")
+    })?;
 
     let mut expectation = PathBuf::from(header);
     expectation.pop();
@@ -142,10 +197,6 @@
             expectation.push("libclang-9");
         } else if cfg!(feature = "testing_only_libclang_5") {
             expectation.push("libclang-5");
-        } else if cfg!(feature = "testing_only_libclang_4") {
-            expectation.push("libclang-4");
-        } else if cfg!(feature = "testing_only_libclang_3_9") {
-            expectation.push("libclang-3.9");
         } else {
             match clang_version().parsed {
                 None => expectation.push("libclang-9"),
@@ -200,7 +251,7 @@
             let actual = bindings.to_string();
             rustfmt(actual)
         }
-        Err(()) => ("<error generating bindings>".to_string(), "".to_string()),
+        Err(_) => ("<error generating bindings>".to_string(), "".to_string()),
     };
     println!("{}", rustfmt_stderr);
 
@@ -216,51 +267,17 @@
 
     if actual != expected {
         println!("{}", rustfmt_stderr);
-
-        println!("diff expected generated");
-        println!("--- expected: {:?}", looked_at.last().unwrap());
-        println!("+++ generated from: {:?}", header);
-
-        for diff in diff::lines(&expected, &actual) {
-            match diff {
-                diff::Result::Left(l) => println!("-{}", l),
-                diff::Result::Both(l, _) => println!(" {}", l),
-                diff::Result::Right(r) => println!("+{}", r),
-            }
-        }
-
-        if let Some(var) = env::var_os("BINDGEN_OVERWRITE_EXPECTED") {
-            if var == "1" {
-                // Overwrite the expectation with actual output.
-                let mut expectation_file =
-                    fs::File::create(looked_at.last().unwrap())?;
-                expectation_file.write_all(actual.as_bytes())?;
-            } else if var != "0" && var != "" {
-                panic!("Invalid value of BINDGEN_OVERWRITE_EXPECTED");
-            }
-        }
-
-        if let Some(var) = env::var_os("BINDGEN_TESTS_DIFFTOOL") {
-            //usecase: var = "meld" -> You can hand check differences
-            let filename = match header.components().last() {
-                Some(std::path::Component::Normal(name)) => name,
-                _ => panic!("Why is the header variable so weird?"),
-            };
-            let actual_result_path =
-                PathBuf::from(env::var("OUT_DIR").unwrap()).join(filename);
-            let mut actual_result_file = fs::File::create(&actual_result_path)?;
-            actual_result_file.write_all(actual.as_bytes())?;
-            std::process::Command::new(var)
-                .args(&[looked_at.last().unwrap(), &actual_result_path])
-                .output()?;
-        }
-
-        return Err(Error::new(ErrorKind::Other, "Header and binding differ! Run with BINDGEN_OVERWRITE_EXPECTED=1 in the environment to automatically overwrite the expectation or with BINDGEN_TESTS_DIFFTOOL=meld to do this manually."));
+        return error_diff_mismatch(
+            &actual,
+            &expected,
+            Some(header),
+            looked_at.last().unwrap(),
+        );
     }
 
     if let Some(roundtrip_builder) = roundtrip_builder {
         if let Err(e) =
-            compare_generated_header(&header, roundtrip_builder, false)
+            compare_generated_header(header, roundtrip_builder, false)
         {
             return Err(Error::new(ErrorKind::Other, format!("Checking CLI flags roundtrip errored! You probably need to fix Builder::command_line_flags. {}", e)));
         }
@@ -292,7 +309,7 @@
             let mut builder = builder_from_flags(flags.into_iter())?.0;
             if let Some(ref parse_cb) = self.parse_callbacks {
                 builder =
-                    builder.parse_callbacks(parse_callbacks::lookup(&parse_cb));
+                    builder.parse_callbacks(parse_callbacks::lookup(parse_cb));
             }
             Some(BuilderState {
                 builder,
@@ -305,7 +322,7 @@
     }
 }
 
-fn create_bindgen_builder(header: &PathBuf) -> Result<BuilderState, Error> {
+fn create_bindgen_builder(header: &Path) -> Result<BuilderState, Error> {
     #[cfg(feature = "logging")]
     let _ = env_logger::try_init();
 
@@ -357,9 +374,9 @@
     // - add header filename as 1st element
     // - prepend raw lines so they're in the right order for expected output
     // - append the test header's bindgen flags
-    let header_str = header
-        .to_str()
-        .ok_or(Error::new(ErrorKind::Other, "Invalid header file name"))?;
+    let header_str = header.to_str().ok_or_else(|| {
+        Error::new(ErrorKind::Other, "Invalid header file name")
+    })?;
 
     let prepend = [
         "bindgen",
@@ -368,6 +385,7 @@
         "--no-rustfmt-bindings",
         "--with-derive-default",
         "--disable-header-comment",
+        "--vtable-generation",
         header_str,
         "--raw-line",
         "",
@@ -384,7 +402,7 @@
 
     let mut builder = builder_from_flags(args)?.0;
     if let Some(ref parse_cb) = parse_callbacks {
-        builder = builder.parse_callbacks(parse_callbacks::lookup(&parse_cb));
+        builder = builder.parse_callbacks(parse_callbacks::lookup(parse_cb));
     }
     Ok(BuilderState {
         builder,
@@ -414,6 +432,7 @@
 include!(concat!(env!("OUT_DIR"), "/tests.rs"));
 
 #[test]
+#[cfg_attr(target_os = "windows", ignore)]
 fn test_clang_env_args() {
     std::env::set_var(
         "BINDGEN_EXTRA_CLANG_ARGS",
@@ -488,6 +507,10 @@
     let (actual, stderr) = rustfmt(actual);
     println!("{}", stderr);
 
+    let expected_filename = concat!(
+        env!("CARGO_MANIFEST_DIR"),
+        "/tests/expectations/tests/test_multiple_header_calls_in_builder.rs"
+    );
     let expected = include_str!(concat!(
         env!("CARGO_MANIFEST_DIR"),
         "/tests/expectations/tests/test_multiple_header_calls_in_builder.rs"
@@ -496,16 +519,13 @@
 
     if actual != expected {
         println!("Generated bindings differ from expected!");
-
-        for diff in diff::lines(&actual, &expected) {
-            match diff {
-                diff::Result::Left(l) => println!("-{}", l),
-                diff::Result::Both(l, _) => println!(" {}", l),
-                diff::Result::Right(r) => println!("+{}", r),
-            }
-        }
-
-        panic!();
+        error_diff_mismatch(
+            &actual,
+            &expected,
+            None,
+            Path::new(expected_filename),
+        )
+        .unwrap();
     }
 }
 
@@ -554,13 +574,24 @@
     let (actual, stderr) = rustfmt(actual);
     println!("{}", stderr);
 
+    let expected_filename = concat!(
+        env!("CARGO_MANIFEST_DIR"),
+        "/tests/expectations/tests/test_mixed_header_and_header_contents.rs"
+    );
     let expected = include_str!(concat!(
         env!("CARGO_MANIFEST_DIR"),
         "/tests/expectations/tests/test_mixed_header_and_header_contents.rs"
     ));
     let (expected, _) = rustfmt(expected.to_string());
-
-    assert_eq!(expected, actual);
+    if expected != actual {
+        error_diff_mismatch(
+            &actual,
+            &expected,
+            None,
+            Path::new(expected_filename),
+        )
+        .unwrap();
+    }
 }
 
 #[test]
@@ -631,11 +662,11 @@
     let empty_layout = slurp(empty_layout);
 
     assert!(
-        bindgen_ii.find(&arg_keyword).is_some(),
+        bindgen_ii.contains(&arg_keyword),
         "arg_keyword.hpp is in the preprocessed file"
     );
     assert!(
-        bindgen_ii.find(&empty_layout).is_some(),
+        bindgen_ii.contains(&empty_layout),
         "cpp-empty-layout.hpp is in the preprocessed file"
     );
 }