Skip to content

Conversation

@CieriA
Copy link
Contributor

@CieriA CieriA commented Jan 12, 2026

This PR improves documentation to std::mem::uninitialized. While the function is deprecated, it currently lacks a formal # Safety section and clear examples on how to use it, even if it is almost always UB.

Documentation of `std::mem::uninitialized` now have a # Safety section and a # Examples section.
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Jan 12, 2026
@rustbot
Copy link
Collaborator

rustbot commented Jan 12, 2026

r? @tgross35

rustbot has assigned @tgross35.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@CieriA CieriA marked this pull request as draft January 12, 2026 22:01
@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 12, 2026
@CieriA CieriA marked this pull request as ready for review January 12, 2026 22:06
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jan 12, 2026
@tgross35
Copy link
Contributor

Cc @rust-lang/libs for thoughts but I feel like we may not want this. There is never a time when mem::uninitialized should be preferred over MaybeUninit::uninit, demonstrating a "correct use" seems to indicate that it may be okay in some cases.

I think that if somebody is interested in the actual semantics here, it's okay for them to read the source code.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer
Copy link
Collaborator

The job aarch64-gnu-llvm-20-1 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
diff of stdout:

68                                             )
69                                             else_block: None
70                                             lint_level: Explicit(HirId(DefId(offset_of::concrete).10))
-                                             span: $DIR/offset_of.rs:37:5: 1440:57 (#0)
+                                             span: $DIR/offset_of.rs:37:5: 1473:57 (#0)
72                                         }
73                                     }
74                                     Stmt {

117                                             )
118                                             else_block: None
119                                             lint_level: Explicit(HirId(DefId(offset_of::concrete).20))
-                                             span: $DIR/offset_of.rs:38:5: 1440:57 (#0)
+                                             span: $DIR/offset_of.rs:38:5: 1473:57 (#0)
121                                         }
122                                     }
123                                     Stmt {

166                                             )
167                                             else_block: None
168                                             lint_level: Explicit(HirId(DefId(offset_of::concrete).30))
-                                             span: $DIR/offset_of.rs:39:5: 1440:57 (#0)
+                                             span: $DIR/offset_of.rs:39:5: 1473:57 (#0)
170                                         }
171                                     }
172                                     Stmt {

215                                             )
216                                             else_block: None
217                                             lint_level: Explicit(HirId(DefId(offset_of::concrete).40))
-                                             span: $DIR/offset_of.rs:40:5: 1440:57 (#0)
+                                             span: $DIR/offset_of.rs:40:5: 1473:57 (#0)
219                                         }
220                                     }
221                                     Stmt {

264                                             )
265                                             else_block: None
266                                             lint_level: Explicit(HirId(DefId(offset_of::concrete).50))
-                                             span: $DIR/offset_of.rs:41:5: 1440:57 (#0)
+                                             span: $DIR/offset_of.rs:41:5: 1473:57 (#0)
268                                         }
269                                     }
270                                 ]

864                                             )
865                                             else_block: None
866                                             lint_level: Explicit(HirId(DefId(offset_of::generic).12))
-                                             span: $DIR/offset_of.rs:45:5: 1440:57 (#0)
+                                             span: $DIR/offset_of.rs:45:5: 1473:57 (#0)
868                                         }
869                                     }
870                                     Stmt {

913                                             )
914                                             else_block: None
915                                             lint_level: Explicit(HirId(DefId(offset_of::generic).24))
-                                             span: $DIR/offset_of.rs:46:5: 1440:57 (#0)
+                                             span: $DIR/offset_of.rs:46:5: 1473:57 (#0)
917                                         }
918                                     }
919                                     Stmt {

962                                             )
963                                             else_block: None
964                                             lint_level: Explicit(HirId(DefId(offset_of::generic).36))
-                                             span: $DIR/offset_of.rs:47:5: 1440:57 (#0)
+                                             span: $DIR/offset_of.rs:47:5: 1473:57 (#0)
966                                         }
967                                     }
968                                     Stmt {

1011                                             )
1012                                             else_block: None
1013                                             lint_level: Explicit(HirId(DefId(offset_of::generic).48))
-                                             span: $DIR/offset_of.rs:48:5: 1440:57 (#0)
+                                             span: $DIR/offset_of.rs:48:5: 1473:57 (#0)
1015                                         }
1016                                     }
1017                                 ]


The actual stdout differed from the expected stdout
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args thir-print/offset_of.rs`

error: 1 errors occurred comparing output.
status: exit status: 0
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/thir-print/offset_of.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/thir-print/offset_of" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers" "-Zunpretty=thir-tree" "--crate-type=lib"
--- stdout -------------------------------
DefId(0:29 ~ offset_of[9c26]::concrete):
params: [
]
body:
    Expr {
        ty: ()
        temp_scope_id: 52
        span: /checkout/tests/ui/thir-print/offset_of.rs:36:19: 42:2 (#0)
        kind: 
            Scope {
                region_scope: Node(52)
                lint_level: Explicit(HirId(DefId(0:29 ~ offset_of[9c26]::concrete).52))
                value:
                    Expr {
                        ty: ()
                        temp_scope_id: 52
                        span: /checkout/tests/ui/thir-print/offset_of.rs:36:19: 42:2 (#0)
                        kind: 
                            Block {
                                targeted_by_break: false
                                span: /checkout/tests/ui/thir-print/offset_of.rs:36:19: 42:2 (#0)
                                region_scope: Node(1)
                                safety_mode: Safe
                                stmts: [
                                    Stmt {
                                        kind: Let {
                                            remainder_scope: Remainder { block: 1, first_statement_index: 0}
                                            init_scope: Node(2)
                                            pattern: 
                                                Pat: {
                                                    ty: usize
                                                    span: /checkout/tests/ui/thir-print/offset_of.rs:37:9: 37:10 (#0)
                                                    kind: PatKind {
                                                        Binding {
                                                            name: "x"
                                                            mode: BindingMode(No, Not)
                                                            var: LocalVarId(HirId(DefId(0:29 ~ offset_of[9c26]::concrete).11))
                                                            ty: usize
                                                            is_primary: true
                                                            is_shorthand: false
                                                            subpattern: None
                                                        }
                                                    }
---
                                                    span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:5: 1473:57 (#4)
                                                    kind: 
                                                        Scope {
                                                            region_scope: Node(3)
                                                            lint_level: Explicit(HirId(DefId(0:29 ~ offset_of[9c26]::concrete).3))
                                                            value:
                                                                Expr {
                                                                    ty: usize
                                                                    temp_scope_id: 3
                                                                    span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:5: 1473:57 (#4)
                                                                    kind: 
                                                                        ConstBlock {
                                                                            did: DefId(0:32 ~ offset_of[9c26]::concrete::{constant#0})
                                                                            args: [usize]
                                                                        }
                                                                }
                                                        }
                                                }
                                            )
                                            else_block: None
                                            lint_level: Explicit(HirId(DefId(0:29 ~ offset_of[9c26]::concrete).10))
                                            span: /checkout/tests/ui/thir-print/offset_of.rs:37:5: 1473:57 (#0)
                                        }
                                    }
                                    Stmt {
                                        kind: Let {
                                            remainder_scope: Remainder { block: 1, first_statement_index: 1}
                                            init_scope: Node(12)
                                            pattern: 
                                                Pat: {
                                                    ty: usize
                                                    span: /checkout/tests/ui/thir-print/offset_of.rs:38:9: 38:10 (#0)
                                                    kind: PatKind {
                                                        Binding {
                                                            name: "y"
                                                            mode: BindingMode(No, Not)
                                                            var: LocalVarId(HirId(DefId(0:29 ~ offset_of[9c26]::concrete).21))
                                                            ty: usize
                                                            is_primary: true
                                                            is_shorthand: false
                                                            subpattern: None
                                                        }
                                                    }
---
                                                    span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:5: 1473:57 (#5)
                                                    kind: 
                                                        Scope {
                                                            region_scope: Node(13)
                                                            lint_level: Explicit(HirId(DefId(0:29 ~ offset_of[9c26]::concrete).13))
                                                            value:
                                                                Expr {
                                                                    ty: usize
                                                                    temp_scope_id: 13
                                                                    span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:5: 1473:57 (#5)
                                                                    kind: 
                                                                        ConstBlock {
                                                                            did: DefId(0:33 ~ offset_of[9c26]::concrete::{constant#1})
                                                                            args: [usize]
                                                                        }
                                                                }
                                                        }
                                                }
                                            )
                                            else_block: None
                                            lint_level: Explicit(HirId(DefId(0:29 ~ offset_of[9c26]::concrete).20))
                                            span: /checkout/tests/ui/thir-print/offset_of.rs:38:5: 1473:57 (#0)
                                        }
                                    }
                                    Stmt {
                                        kind: Let {
                                            remainder_scope: Remainder { block: 1, first_statement_index: 2}
                                            init_scope: Node(22)
                                            pattern: 
                                                Pat: {
                                                    ty: usize
                                                    span: /checkout/tests/ui/thir-print/offset_of.rs:39:9: 39:10 (#0)
                                                    kind: PatKind {
                                                        Binding {
                                                            name: "h"
                                                            mode: BindingMode(No, Not)
                                                            var: LocalVarId(HirId(DefId(0:29 ~ offset_of[9c26]::concrete).31))
                                                            ty: usize
                                                            is_primary: true
                                                            is_shorthand: false
                                                            subpattern: None
                                                        }
                                                    }
---
                                                    span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:5: 1473:57 (#6)
                                                    kind: 
                                                        Scope {
                                                            region_scope: Node(23)
                                                            lint_level: Explicit(HirId(DefId(0:29 ~ offset_of[9c26]::concrete).23))
                                                            value:
                                                                Expr {
                                                                    ty: usize
                                                                    temp_scope_id: 23
                                                                    span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:5: 1473:57 (#6)
                                                                    kind: 
                                                                        ConstBlock {
                                                                            did: DefId(0:34 ~ offset_of[9c26]::concrete::{constant#2})
                                                                            args: [usize]
                                                                        }
                                                                }
                                                        }
                                                }
                                            )
                                            else_block: None
                                            lint_level: Explicit(HirId(DefId(0:29 ~ offset_of[9c26]::concrete).30))
                                            span: /checkout/tests/ui/thir-print/offset_of.rs:39:5: 1473:57 (#0)
                                        }
                                    }
                                    Stmt {
                                        kind: Let {
                                            remainder_scope: Remainder { block: 1, first_statement_index: 3}
                                            init_scope: Node(32)
                                            pattern: 
                                                Pat: {
                                                    ty: usize
                                                    span: /checkout/tests/ui/thir-print/offset_of.rs:40:9: 40:11 (#0)
                                                    kind: PatKind {
                                                        Binding {
                                                            name: "z0"
                                                            mode: BindingMode(No, Not)
                                                            var: LocalVarId(HirId(DefId(0:29 ~ offset_of[9c26]::concrete).41))
                                                            ty: usize
                                                            is_primary: true
                                                            is_shorthand: false
                                                            subpattern: None
                                                        }
                                                    }
---
                                                    span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:5: 1473:57 (#7)
                                                    kind: 
                                                        Scope {
                                                            region_scope: Node(33)
                                                            lint_level: Explicit(HirId(DefId(0:29 ~ offset_of[9c26]::concrete).33))
                                                            value:
                                                                Expr {
                                                                    ty: usize
                                                                    temp_scope_id: 33
                                                                    span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:5: 1473:57 (#7)
                                                                    kind: 
                                                                        ConstBlock {
                                                                            did: DefId(0:35 ~ offset_of[9c26]::concrete::{constant#3})
                                                                            args: [usize]
                                                                        }
                                                                }
                                                        }
                                                }
                                            )
                                            else_block: None
                                            lint_level: Explicit(HirId(DefId(0:29 ~ offset_of[9c26]::concrete).40))
                                            span: /checkout/tests/ui/thir-print/offset_of.rs:40:5: 1473:57 (#0)
                                        }
                                    }
                                    Stmt {
                                        kind: Let {
                                            remainder_scope: Remainder { block: 1, first_statement_index: 4}
                                            init_scope: Node(42)
                                            pattern: 
                                                Pat: {
                                                    ty: usize
                                                    span: /checkout/tests/ui/thir-print/offset_of.rs:41:9: 41:11 (#0)
                                                    kind: PatKind {
                                                        Binding {
                                                            name: "z1"
                                                            mode: BindingMode(No, Not)
                                                            var: LocalVarId(HirId(DefId(0:29 ~ offset_of[9c26]::concrete).51))
                                                            ty: usize
                                                            is_primary: true
                                                            is_shorthand: false
                                                            subpattern: None
                                                        }
                                                    }
---
                                                    span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:5: 1473:57 (#8)
                                                    kind: 
                                                        Scope {
                                                            region_scope: Node(43)
                                                            lint_level: Explicit(HirId(DefId(0:29 ~ offset_of[9c26]::concrete).43))
                                                            value:
                                                                Expr {
                                                                    ty: usize
                                                                    temp_scope_id: 43
                                                                    span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:5: 1473:57 (#8)
                                                                    kind: 
                                                                        ConstBlock {
                                                                            did: DefId(0:36 ~ offset_of[9c26]::concrete::{constant#4})
                                                                            args: [usize]
                                                                        }
                                                                }
                                                        }
                                                }
                                            )
                                            else_block: None
                                            lint_level: Explicit(HirId(DefId(0:29 ~ offset_of[9c26]::concrete).50))
                                            span: /checkout/tests/ui/thir-print/offset_of.rs:41:5: 1473:57 (#0)
                                        }
                                    }
                                ]
                                expr: []
                            }
                    }
            }
    }


DefId(0:32 ~ offset_of[9c26]::concrete::{constant#0}):
params: [
]
body:
    Expr {
        ty: usize
        temp_scope_id: 5
        span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:11: 1473:57 (#4)
        kind: 
            Scope {
                region_scope: Node(5)
                lint_level: Explicit(HirId(DefId(0:29 ~ offset_of[9c26]::concrete).5))
                value:
                    Expr {
                        ty: usize
                        temp_scope_id: 5
                        span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:11: 1473:57 (#4)
                        kind: 
                            Block {
                                targeted_by_break: false
                                span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:11: 1473:57 (#4)
                                region_scope: Node(6)
                                safety_mode: Safe
                                stmts: []
                                expr:
                                    Expr {
                                        ty: usize
                                        temp_scope_id: 7
                                        span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:12: 1473:56 (#4)
                                        kind: 
                                            Scope {
                                                region_scope: Node(7)
                                                lint_level: Explicit(HirId(DefId(0:29 ~ offset_of[9c26]::concrete).7))
                                                value:
                                                    Expr {
                                                        ty: usize
                                                        temp_scope_id: 7
                                                        span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:12: 1473:56 (#4)
                                                        kind: 
                                                            Call {
                                                                ty: FnDef(DefId(2:2102 ~ core[f954]::intrinsics::offset_of), [Alpha])
                                                                from_hir_call: false
                                                                fn_span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:12: 1473:56 (#4)
                                                                fun:
                                                                    Expr {
                                                                        ty: FnDef(DefId(2:2102 ~ core[f954]::intrinsics::offset_of), [Alpha])
                                                                        temp_scope_id: 7
                                                                        span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:12: 1473:56 (#4)
                                                                        kind: 
                                                                            ZstLiteral(user_ty: None)
                                                                    }
                                                                args: [
                                                                    Expr {
                                                                        ty: u32
                                                                        temp_scope_id: 7
                                                                        span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:12: 1473:56 (#4)
                                                                        kind: 
                                                                            NonHirLiteral {
                                                                                lit: 0x00000000
                                                                                user_ty: None
                                                                            }
                                                                    }
                                                                    Expr {
                                                                        ty: u32
                                                                        temp_scope_id: 7
                                                                        span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:12: 1473:56 (#4)
                                                                        kind: 
                                                                            NonHirLiteral {
                                                                                lit: 0x00000000
                                                                                user_ty: None
                                                                            }
                                                                    }
                                                                ]
                                                            }
                                                    }
---
            }
    }


DefId(0:33 ~ offset_of[9c26]::concrete::{constant#1}):
params: [
]
body:
    Expr {
        ty: usize
        temp_scope_id: 15
        span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:11: 1473:57 (#5)
        kind: 
            Scope {
                region_scope: Node(15)
                lint_level: Explicit(HirId(DefId(0:29 ~ offset_of[9c26]::concrete).15))
                value:
                    Expr {
                        ty: usize
                        temp_scope_id: 15
                        span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:11: 1473:57 (#5)
                        kind: 
                            Block {
                                targeted_by_break: false
                                span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:11: 1473:57 (#5)
                                region_scope: Node(16)
                                safety_mode: Safe
                                stmts: []
                                expr:
                                    Expr {
                                        ty: usize
                                        temp_scope_id: 17
                                        span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:12: 1473:56 (#5)
                                        kind: 
                                            Scope {
                                                region_scope: Node(17)
                                                lint_level: Explicit(HirId(DefId(0:29 ~ offset_of[9c26]::concrete).17))
                                                value:
                                                    Expr {
                                                        ty: usize
                                                        temp_scope_id: 17
                                                        span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:12: 1473:56 (#5)
                                                        kind: 
                                                            Call {
                                                                ty: FnDef(DefId(2:2102 ~ core[f954]::intrinsics::offset_of), [Alpha])
                                                                from_hir_call: false
                                                                fn_span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:12: 1473:56 (#5)
                                                                fun:
                                                                    Expr {
                                                                        ty: FnDef(DefId(2:2102 ~ core[f954]::intrinsics::offset_of), [Alpha])
                                                                        temp_scope_id: 17
                                                                        span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:12: 1473:56 (#5)
                                                                        kind: 
                                                                            ZstLiteral(user_ty: None)
                                                                    }
                                                                args: [
                                                                    Expr {
                                                                        ty: u32
                                                                        temp_scope_id: 17
                                                                        span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:12: 1473:56 (#5)
                                                                        kind: 
                                                                            NonHirLiteral {
                                                                                lit: 0x00000000
                                                                                user_ty: None
                                                                            }
                                                                    }
                                                                    Expr {
                                                                        ty: u32
                                                                        temp_scope_id: 17
                                                                        span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:12: 1473:56 (#5)
                                                                        kind: 
                                                                            NonHirLiteral {
                                                                                lit: 0x00000001
                                                                                user_ty: None
                                                                            }
                                                                    }
                                                                ]
                                                            }
                                                    }
---
            }
    }


DefId(0:34 ~ offset_of[9c26]::concrete::{constant#2}):
params: [
]
body:
    Expr {
        ty: usize
        temp_scope_id: 25
        span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:11: 1473:57 (#6)
        kind: 
            Scope {
                region_scope: Node(25)
                lint_level: Explicit(HirId(DefId(0:29 ~ offset_of[9c26]::concrete).25))
                value:
                    Expr {
                        ty: usize
                        temp_scope_id: 25
                        span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:11: 1473:57 (#6)
                        kind: 
                            Block {
                                targeted_by_break: false
                                span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:11: 1473:57 (#6)
                                region_scope: Node(26)
                                safety_mode: Safe
                                stmts: []
                                expr:
                                    Expr {
                                        ty: usize
                                        temp_scope_id: 27
                                        span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:12: 1473:56 (#6)
                                        kind: 
                                            Scope {
                                                region_scope: Node(27)
                                                lint_level: Explicit(HirId(DefId(0:29 ~ offset_of[9c26]::concrete).27))
                                                value:
                                                    Expr {
                                                        ty: usize
                                                        temp_scope_id: 27
                                                        span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:12: 1473:56 (#6)
                                                        kind: 
                                                            Call {
                                                                ty: FnDef(DefId(2:2102 ~ core[f954]::intrinsics::offset_of), [Blah])
                                                                from_hir_call: false
                                                                fn_span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:12: 1473:56 (#6)
                                                                fun:
                                                                    Expr {
                                                                        ty: FnDef(DefId(2:2102 ~ core[f954]::intrinsics::offset_of), [Blah])
                                                                        temp_scope_id: 27
                                                                        span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:12: 1473:56 (#6)
                                                                        kind: 
                                                                            ZstLiteral(user_ty: None)
                                                                    }
                                                                args: [
                                                                    Expr {
                                                                        ty: u32
                                                                        temp_scope_id: 27
                                                                        span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:12: 1473:56 (#6)
                                                                        kind: 
                                                                            NonHirLiteral {
                                                                                lit: 0x00000001
                                                                                user_ty: None
                                                                            }
                                                                    }
                                                                    Expr {
                                                                        ty: u32
                                                                        temp_scope_id: 27
                                                                        span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:12: 1473:56 (#6)
                                                                        kind: 
                                                                            NonHirLiteral {
                                                                                lit: 0x00000001
                                                                                user_ty: None
                                                                            }
                                                                    }
                                                                ]
                                                            }
                                                    }
---
            }
    }


DefId(0:35 ~ offset_of[9c26]::concrete::{constant#3}):
params: [
]
body:
    Expr {
        ty: usize
        temp_scope_id: 35
        span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:11: 1473:57 (#7)
        kind: 
            Scope {
                region_scope: Node(35)
                lint_level: Explicit(HirId(DefId(0:29 ~ offset_of[9c26]::concrete).35))
                value:
                    Expr {
                        ty: usize
                        temp_scope_id: 35
                        span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:11: 1473:57 (#7)
                        kind: 
                            Block {
                                targeted_by_break: false
                                span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:11: 1473:57 (#7)
                                region_scope: Node(36)
                                safety_mode: Safe
                                stmts: []
                                expr:
                                    Expr {
                                        ty: usize
                                        temp_scope_id: 37
                                        span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:12: 1473:56 (#7)
                                        kind: 
                                            Scope {
                                                region_scope: Node(37)
                                                lint_level: Explicit(HirId(DefId(0:29 ~ offset_of[9c26]::concrete).37))
                                                value:
                                                    Expr {
                                                        ty: usize
                                                        temp_scope_id: 37
                                                        span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:12: 1473:56 (#7)
---
                                                                        temp_scope_id: 37
                                                                        span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:12: 1473:56 (#7)
                                                                        kind: 
                                                                            Call {
                                                                                ty: FnDef(DefId(2:2102 ~ core[f954]::intrinsics::offset_of), [Alpha])
                                                                                from_hir_call: false
                                                                                fn_span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:12: 1473:56 (#7)
                                                                                fun:
                                                                                    Expr {
                                                                                        ty: FnDef(DefId(2:2102 ~ core[f954]::intrinsics::offset_of), [Alpha])
                                                                                        temp_scope_id: 37
                                                                                        span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:12: 1473:56 (#7)
                                                                                        kind: 
                                                                                            ZstLiteral(user_ty: None)
                                                                                    }
                                                                                args: [
                                                                                    Expr {
                                                                                        ty: u32
                                                                                        temp_scope_id: 37
                                                                                        span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:12: 1473:56 (#7)
                                                                                        kind: 
                                                                                            NonHirLiteral {
                                                                                                lit: 0x00000000
                                                                                                user_ty: None
                                                                                            }
                                                                                    }
                                                                                    Expr {
                                                                                        ty: u32
                                                                                        temp_scope_id: 37
                                                                                        span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:12: 1473:56 (#7)
                                                                                        kind: 
                                                                                            NonHirLiteral {
                                                                                                lit: 0x00000002
                                                                                                user_ty: None
                                                                                            }
                                                                                    }
                                                                                ]
                                                                            }
                                                                    }
                                                                rhs:
                                                                    Expr {
                                                                        ty: usize
                                                                        temp_scope_id: 37
                                                                        span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:12: 1473:56 (#7)
                                                                        kind: 
                                                                            Call {
                                                                                ty: FnDef(DefId(2:2102 ~ core[f954]::intrinsics::offset_of), [Beta])
                                                                                from_hir_call: false
                                                                                fn_span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:12: 1473:56 (#7)
                                                                                fun:
                                                                                    Expr {
                                                                                        ty: FnDef(DefId(2:2102 ~ core[f954]::intrinsics::offset_of), [Beta])
                                                                                        temp_scope_id: 37
                                                                                        span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:12: 1473:56 (#7)
                                                                                        kind: 
                                                                                            ZstLiteral(user_ty: None)
                                                                                    }
                                                                                args: [
                                                                                    Expr {
                                                                                        ty: u32
                                                                                        temp_scope_id: 37
                                                                                        span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:12: 1473:56 (#7)
                                                                                        kind: 
                                                                                            NonHirLiteral {
                                                                                                lit: 0x00000000
                                                                                                user_ty: None
                                                                                            }
                                                                                    }
                                                                                    Expr {
                                                                                        ty: u32
                                                                                        temp_scope_id: 37
                                                                                        span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:12: 1473:56 (#7)
                                                                                        kind: 
                                                                                            NonHirLiteral {
                                                                                                lit: 0x00000000
                                                                                                user_ty: None
                                                                                            }
                                                                                    }
                                                                                ]
                                                                            }
                                                                    }
---
            }
    }


DefId(0:36 ~ offset_of[9c26]::concrete::{constant#4}):
params: [
]
body:
    Expr {
        ty: usize
        temp_scope_id: 45
        span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:11: 1473:57 (#8)
        kind: 
            Scope {
                region_scope: Node(45)
                lint_level: Explicit(HirId(DefId(0:29 ~ offset_of[9c26]::concrete).45))
                value:
                    Expr {
                        ty: usize
                        temp_scope_id: 45
                        span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:11: 1473:57 (#8)
                        kind: 
                            Block {
                                targeted_by_break: false
                                span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:11: 1473:57 (#8)
                                region_scope: Node(46)
                                safety_mode: Safe
                                stmts: []
                                expr:
                                    Expr {
                                        ty: usize
                                        temp_scope_id: 47
                                        span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:12: 1473:56 (#8)
                                        kind: 
                                            Scope {
                                                region_scope: Node(47)
                                                lint_level: Explicit(HirId(DefId(0:29 ~ offset_of[9c26]::concrete).47))
                                                value:
                                                    Expr {
                                                        ty: usize
                                                        temp_scope_id: 47
                                                        span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:12: 1473:56 (#8)
---
                                                                        temp_scope_id: 47
                                                                        span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:12: 1473:56 (#8)
                                                                        kind: 
                                                                            Call {
                                                                                ty: FnDef(DefId(2:2102 ~ core[f954]::intrinsics::offset_of), [Alpha])
                                                                                from_hir_call: false
                                                                                fn_span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:12: 1473:56 (#8)
                                                                                fun:
                                                                                    Expr {
                                                                                        ty: FnDef(DefId(2:2102 ~ core[f954]::intrinsics::offset_of), [Alpha])
                                                                                        temp_scope_id: 47
                                                                                        span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:12: 1473:56 (#8)
                                                                                        kind: 
                                                                                            ZstLiteral(user_ty: None)
                                                                                    }
                                                                                args: [
                                                                                    Expr {
                                                                                        ty: u32
                                                                                        temp_scope_id: 47
                                                                                        span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:12: 1473:56 (#8)
                                                                                        kind: 
                                                                                            NonHirLiteral {
                                                                                                lit: 0x00000000
                                                                                                user_ty: None
                                                                                            }
                                                                                    }
                                                                                    Expr {
                                                                                        ty: u32
                                                                                        temp_scope_id: 47
                                                                                        span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:12: 1473:56 (#8)
                                                                                        kind: 
                                                                                            NonHirLiteral {
                                                                                                lit: 0x00000002
                                                                                                user_ty: None
                                                                                            }
                                                                                    }
                                                                                ]
                                                                            }
                                                                    }
                                                                rhs:
                                                                    Expr {
                                                                        ty: usize
                                                                        temp_scope_id: 47
                                                                        span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:12: 1473:56 (#8)
                                                                        kind: 
                                                                            Call {
                                                                                ty: FnDef(DefId(2:2102 ~ core[f954]::intrinsics::offset_of), [Beta])
                                                                                from_hir_call: false
                                                                                fn_span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:12: 1473:56 (#8)
                                                                                fun:
                                                                                    Expr {
                                                                                        ty: FnDef(DefId(2:2102 ~ core[f954]::intrinsics::offset_of), [Beta])
                                                                                        temp_scope_id: 47
                                                                                        span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:12: 1473:56 (#8)
                                                                                        kind: 
                                                                                            ZstLiteral(user_ty: None)
                                                                                    }
                                                                                args: [
                                                                                    Expr {
                                                                                        ty: u32
                                                                                        temp_scope_id: 47
                                                                                        span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:12: 1473:56 (#8)
                                                                                        kind: 
                                                                                            NonHirLiteral {
                                                                                                lit: 0x00000000
                                                                                                user_ty: None
                                                                                            }
                                                                                    }
                                                                                    Expr {
                                                                                        ty: u32
                                                                                        temp_scope_id: 47
                                                                                        span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:12: 1473:56 (#8)
                                                                                        kind: 
                                                                                            NonHirLiteral {
                                                                                                lit: 0x00000001
                                                                                                user_ty: None
                                                                                            }
                                                                                    }
                                                                                ]
                                                                            }
                                                                    }
---
            }
    }


DefId(0:30 ~ offset_of[9c26]::generic):
params: [
]
body:
    Expr {
        ty: ()
        temp_scope_id: 50
        span: /checkout/tests/ui/thir-print/offset_of.rs:44:21: 49:2 (#0)
        kind: 
            Scope {
                region_scope: Node(50)
                lint_level: Explicit(HirId(DefId(0:30 ~ offset_of[9c26]::generic).50))
                value:
                    Expr {
                        ty: ()
                        temp_scope_id: 50
                        span: /checkout/tests/ui/thir-print/offset_of.rs:44:21: 49:2 (#0)
                        kind: 
                            Block {
                                targeted_by_break: false
                                span: /checkout/tests/ui/thir-print/offset_of.rs:44:21: 49:2 (#0)
                                region_scope: Node(1)
                                safety_mode: Safe
                                stmts: [
                                    Stmt {
                                        kind: Let {
                                            remainder_scope: Remainder { block: 1, first_statement_index: 0}
                                            init_scope: Node(2)
                                            pattern: 
                                                Pat: {
                                                    ty: usize
                                                    span: /checkout/tests/ui/thir-print/offset_of.rs:45:9: 45:11 (#0)
                                                    kind: PatKind {
                                                        Binding {
                                                            name: "gx"
                                                            mode: BindingMode(No, Not)
                                                            var: LocalVarId(HirId(DefId(0:30 ~ offset_of[9c26]::generic).13))
                                                            ty: usize
                                                            is_primary: true
                                                            is_shorthand: false
                                                            subpattern: None
                                                        }
                                                    }
---
                                                    span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:5: 1473:57 (#9)
                                                    kind: 
                                                        Scope {
                                                            region_scope: Node(3)
                                                            lint_level: Explicit(HirId(DefId(0:30 ~ offset_of[9c26]::generic).3))
                                                            value:
                                                                Expr {
                                                                    ty: usize
                                                                    temp_scope_id: 3
                                                                    span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:5: 1473:57 (#9)
                                                                    kind: 
                                                                        ConstBlock {
                                                                            did: DefId(0:37 ~ offset_of[9c26]::generic::{constant#0})
                                                                            args: [T/#0, usize]
                                                                        }
                                                                }
                                                        }
                                                }
                                            )
                                            else_block: None
                                            lint_level: Explicit(HirId(DefId(0:30 ~ offset_of[9c26]::generic).12))
                                            span: /checkout/tests/ui/thir-print/offset_of.rs:45:5: 1473:57 (#0)
                                        }
                                    }
                                    Stmt {
                                        kind: Let {
                                            remainder_scope: Remainder { block: 1, first_statement_index: 1}
                                            init_scope: Node(14)
                                            pattern: 
                                                Pat: {
                                                    ty: usize
                                                    span: /checkout/tests/ui/thir-print/offset_of.rs:46:9: 46:11 (#0)
                                                    kind: PatKind {
                                                        Binding {
                                                            name: "gy"
                                                            mode: BindingMode(No, Not)
                                                            var: LocalVarId(HirId(DefId(0:30 ~ offset_of[9c26]::generic).25))
                                                            ty: usize
                                                            is_primary: true
                                                            is_shorthand: false
                                                            subpattern: None
                                                        }
                                                    }
---
                                                    span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:5: 1473:57 (#10)
                                                    kind: 
                                                        Scope {
                                                            region_scope: Node(15)
                                                            lint_level: Explicit(HirId(DefId(0:30 ~ offset_of[9c26]::generic).15))
                                                            value:
                                                                Expr {
                                                                    ty: usize
                                                                    temp_scope_id: 15
                                                                    span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:5: 1473:57 (#10)
                                                                    kind: 
                                                                        ConstBlock {
                                                                            did: DefId(0:38 ~ offset_of[9c26]::generic::{constant#1})
                                                                            args: [T/#0, usize]
                                                                        }
                                                                }
                                                        }
                                                }
                                            )
                                            else_block: None
                                            lint_level: Explicit(HirId(DefId(0:30 ~ offset_of[9c26]::generic).24))
                                            span: /checkout/tests/ui/thir-print/offset_of.rs:46:5: 1473:57 (#0)
                                        }
                                    }
                                    Stmt {
                                        kind: Let {
                                            remainder_scope: Remainder { block: 1, first_statement_index: 2}
                                            init_scope: Node(26)
                                            pattern: 
                                                Pat: {
                                                    ty: usize
                                                    span: /checkout/tests/ui/thir-print/offset_of.rs:47:9: 47:11 (#0)
                                                    kind: PatKind {
                                                        Binding {
                                                            name: "dx"
                                                            mode: BindingMode(No, Not)
                                                            var: LocalVarId(HirId(DefId(0:30 ~ offset_of[9c26]::generic).37))
                                                            ty: usize
                                                            is_primary: true
                                                            is_shorthand: false
                                                            subpattern: None
                                                        }
                                                    }
---
                                                    span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:5: 1473:57 (#11)
                                                    kind: 
                                                        Scope {
                                                            region_scope: Node(27)
                                                            lint_level: Explicit(HirId(DefId(0:30 ~ offset_of[9c26]::generic).27))
                                                            value:
                                                                Expr {
                                                                    ty: usize
                                                                    temp_scope_id: 27
                                                                    span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:5: 1473:57 (#11)
                                                                    kind: 
                                                                        ConstBlock {
                                                                            did: DefId(0:39 ~ offset_of[9c26]::generic::{constant#2})
                                                                            args: [T/#0, usize]
                                                                        }
                                                                }
                                                        }
                                                }
                                            )
                                            else_block: None
                                            lint_level: Explicit(HirId(DefId(0:30 ~ offset_of[9c26]::generic).36))
                                            span: /checkout/tests/ui/thir-print/offset_of.rs:47:5: 1473:57 (#0)
                                        }
                                    }
                                    Stmt {
                                        kind: Let {
                                            remainder_scope: Remainder { block: 1, first_statement_index: 3}
                                            init_scope: Node(38)
                                            pattern: 
                                                Pat: {
                                                    ty: usize
                                                    span: /checkout/tests/ui/thir-print/offset_of.rs:48:9: 48:11 (#0)
                                                    kind: PatKind {
                                                        Binding {
                                                            name: "dy"
                                                            mode: BindingMode(No, Not)
                                                            var: LocalVarId(HirId(DefId(0:30 ~ offset_of[9c26]::generic).49))
                                                            ty: usize
                                                            is_primary: true
                                                            is_shorthand: false
                                                            subpattern: None
                                                        }
                                                    }
---
                                                    span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:5: 1473:57 (#12)
                                                    kind: 
                                                        Scope {
                                                            region_scope: Node(39)
                                                            lint_level: Explicit(HirId(DefId(0:30 ~ offset_of[9c26]::generic).39))
                                                            value:
                                                                Expr {
                                                                    ty: usize
                                                                    temp_scope_id: 39
                                                                    span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:5: 1473:57 (#12)
                                                                    kind: 
                                                                        ConstBlock {
                                                                            did: DefId(0:40 ~ offset_of[9c26]::generic::{constant#3})
                                                                            args: [T/#0, usize]
                                                                        }
                                                                }
                                                        }
                                                }
                                            )
                                            else_block: None
                                            lint_level: Explicit(HirId(DefId(0:30 ~ offset_of[9c26]::generic).48))
                                            span: /checkout/tests/ui/thir-print/offset_of.rs:48:5: 1473:57 (#0)
                                        }
                                    }
                                ]
                                expr: []
                            }
                    }
            }
    }


DefId(0:37 ~ offset_of[9c26]::generic::{constant#0}):
params: [
]
body:
    Expr {
        ty: usize
        temp_scope_id: 5
        span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:11: 1473:57 (#9)
        kind: 
            Scope {
                region_scope: Node(5)
                lint_level: Explicit(HirId(DefId(0:30 ~ offset_of[9c26]::generic).5))
                value:
                    Expr {
                        ty: usize
                        temp_scope_id: 5
                        span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:11: 1473:57 (#9)
                        kind: 
                            Block {
                                targeted_by_break: false
                                span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:11: 1473:57 (#9)
                                region_scope: Node(6)
                                safety_mode: Safe
                                stmts: []
                                expr:
                                    Expr {
                                        ty: usize
                                        temp_scope_id: 7
                                        span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:12: 1473:56 (#9)
                                        kind: 
                                            Scope {
                                                region_scope: Node(7)
                                                lint_level: Explicit(HirId(DefId(0:30 ~ offset_of[9c26]::generic).7))
                                                value:
                                                    Expr {
                                                        ty: usize
                                                        temp_scope_id: 7
                                                        span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:12: 1473:56 (#9)
                                                        kind: 
                                                            Call {
                                                                ty: FnDef(DefId(2:2102 ~ core[f954]::intrinsics::offset_of), [Gamma<T/#0>])
                                                                from_hir_call: false
                                                                fn_span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:12: 1473:56 (#9)
                                                                fun:
                                                                    Expr {
                                                                        ty: FnDef(DefId(2:2102 ~ core[f954]::intrinsics::offset_of), [Gamma<T/#0>])
                                                                        temp_scope_id: 7
                                                                        span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:12: 1473:56 (#9)
                                                                        kind: 
                                                                            ZstLiteral(user_ty: None)
                                                                    }
                                                                args: [
                                                                    Expr {
                                                                        ty: u32
                                                                        temp_scope_id: 7
                                                                        span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:12: 1473:56 (#9)
                                                                        kind: 
                                                                            NonHirLiteral {
                                                                                lit: 0x00000000
                                                                                user_ty: None
                                                                            }
                                                                    }
                                                                    Expr {
                                                                        ty: u32
                                                                        temp_scope_id: 7
                                                                        span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:12: 1473:56 (#9)
                                                                        kind: 
                                                                            NonHirLiteral {
                                                                                lit: 0x00000000
                                                                                user_ty: None
                                                                            }
                                                                    }
                                                                ]
                                                            }
                                                    }
---
            }
    }


DefId(0:38 ~ offset_of[9c26]::generic::{constant#1}):
params: [
]
body:
    Expr {
        ty: usize
        temp_scope_id: 17
        span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:11: 1473:57 (#10)
        kind: 
            Scope {
                region_scope: Node(17)
                lint_level: Explicit(HirId(DefId(0:30 ~ offset_of[9c26]::generic).17))
                value:
                    Expr {
                        ty: usize
                        temp_scope_id: 17
                        span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:11: 1473:57 (#10)
                        kind: 
                            Block {
                                targeted_by_break: false
                                span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:11: 1473:57 (#10)
                                region_scope: Node(18)
                                safety_mode: Safe
                                stmts: []
                                expr:
                                    Expr {
                                        ty: usize
                                        temp_scope_id: 19
                                        span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:12: 1473:56 (#10)
                                        kind: 
                                            Scope {
                                                region_scope: Node(19)
                                                lint_level: Explicit(HirId(DefId(0:30 ~ offset_of[9c26]::generic).19))
                                                value:
                                                    Expr {
                                                        ty: usize
                                                        temp_scope_id: 19
                                                        span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:12: 1473:56 (#10)
                                                        kind: 
                                                            Call {
                                                                ty: FnDef(DefId(2:2102 ~ core[f954]::intrinsics::offset_of), [Gamma<T/#0>])
                                                                from_hir_call: false
                                                                fn_span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:12: 1473:56 (#10)
                                                                fun:
                                                                    Expr {
                                                                        ty: FnDef(DefId(2:2102 ~ core[f954]::intrinsics::offset_of), [Gamma<T/#0>])
                                                                        temp_scope_id: 19
                                                                        span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:12: 1473:56 (#10)
                                                                        kind: 
                                                                            ZstLiteral(user_ty: None)
                                                                    }
                                                                args: [
                                                                    Expr {
                                                                        ty: u32
                                                                        temp_scope_id: 19
                                                                        span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:12: 1473:56 (#10)
                                                                        kind: 
                                                                            NonHirLiteral {
                                                                                lit: 0x00000000
                                                                                user_ty: None
                                                                            }
                                                                    }
                                                                    Expr {
                                                                        ty: u32
                                                                        temp_scope_id: 19
                                                                        span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:12: 1473:56 (#10)
                                                                        kind: 
                                                                            NonHirLiteral {
                                                                                lit: 0x00000001
                                                                                user_ty: None
                                                                            }
                                                                    }
                                                                ]
                                                            }
                                                    }
---
            }
    }


DefId(0:39 ~ offset_of[9c26]::generic::{constant#2}):
params: [
]
body:
    Expr {
        ty: usize
        temp_scope_id: 29
        span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:11: 1473:57 (#11)
        kind: 
            Scope {
                region_scope: Node(29)
                lint_level: Explicit(HirId(DefId(0:30 ~ offset_of[9c26]::generic).29))
                value:
                    Expr {
                        ty: usize
                        temp_scope_id: 29
                        span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:11: 1473:57 (#11)
                        kind: 
                            Block {
                                targeted_by_break: false
                                span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:11: 1473:57 (#11)
                                region_scope: Node(30)
                                safety_mode: Safe
                                stmts: []
                                expr:
                                    Expr {
                                        ty: usize
                                        temp_scope_id: 31
                                        span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:12: 1473:56 (#11)
                                        kind: 
                                            Scope {
                                                region_scope: Node(31)
                                                lint_level: Explicit(HirId(DefId(0:30 ~ offset_of[9c26]::generic).31))
                                                value:
                                                    Expr {
                                                        ty: usize
                                                        temp_scope_id: 31
                                                        span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:12: 1473:56 (#11)
                                                        kind: 
                                                            Call {
                                                                ty: FnDef(DefId(2:2102 ~ core[f954]::intrinsics::offset_of), [Delta<T/#0>])
                                                                from_hir_call: false
                                                                fn_span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:12: 1473:56 (#11)
                                                                fun:
                                                                    Expr {
                                                                        ty: FnDef(DefId(2:2102 ~ core[f954]::intrinsics::offset_of), [Delta<T/#0>])
                                                                        temp_scope_id: 31
                                                                        span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:12: 1473:56 (#11)
                                                                        kind: 
                                                                            ZstLiteral(user_ty: None)
                                                                    }
                                                                args: [
                                                                    Expr {
                                                                        ty: u32
                                                                        temp_scope_id: 31
                                                                        span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:12: 1473:56 (#11)
                                                                        kind: 
                                                                            NonHirLiteral {
                                                                                lit: 0x00000000
                                                                                user_ty: None
                                                                            }
                                                                    }
                                                                    Expr {
                                                                        ty: u32
                                                                        temp_scope_id: 31
                                                                        span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:12: 1473:56 (#11)
                                                                        kind: 
                                                                            NonHirLiteral {
                                                                                lit: 0x00000001
                                                                                user_ty: None
                                                                            }
                                                                    }
                                                                ]
                                                            }
                                                    }
---
            }
    }


DefId(0:40 ~ offset_of[9c26]::generic::{constant#3}):
params: [
]
body:
    Expr {
        ty: usize
        temp_scope_id: 41
        span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:11: 1473:57 (#12)
        kind: 
            Scope {
                region_scope: Node(41)
                lint_level: Explicit(HirId(DefId(0:30 ~ offset_of[9c26]::generic).41))
                value:
                    Expr {
                        ty: usize
                        temp_scope_id: 41
                        span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:11: 1473:57 (#12)
                        kind: 
                            Block {
                                targeted_by_break: false
                                span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:11: 1473:57 (#12)
                                region_scope: Node(42)
                                safety_mode: Safe
                                stmts: []
                                expr:
                                    Expr {
                                        ty: usize
                                        temp_scope_id: 43
                                        span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:12: 1473:56 (#12)
                                        kind: 
                                            Scope {
                                                region_scope: Node(43)
                                                lint_level: Explicit(HirId(DefId(0:30 ~ offset_of[9c26]::generic).43))
                                                value:
                                                    Expr {
                                                        ty: usize
                                                        temp_scope_id: 43
                                                        span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:12: 1473:56 (#12)
                                                        kind: 
                                                            Call {
                                                                ty: FnDef(DefId(2:2102 ~ core[f954]::intrinsics::offset_of), [Delta<T/#0>])
                                                                from_hir_call: false
                                                                fn_span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:12: 1473:56 (#12)
                                                                fun:
                                                                    Expr {
                                                                        ty: FnDef(DefId(2:2102 ~ core[f954]::intrinsics::offset_of), [Delta<T/#0>])
                                                                        temp_scope_id: 43
                                                                        span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:12: 1473:56 (#12)
                                                                        kind: 
                                                                            ZstLiteral(user_ty: None)
                                                                    }
                                                                args: [
                                                                    Expr {
                                                                        ty: u32
                                                                        temp_scope_id: 43
                                                                        span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:12: 1473:56 (#12)
                                                                        kind: 
                                                                            NonHirLiteral {
                                                                                lit: 0x00000000
                                                                                user_ty: None
                                                                            }
                                                                    }
                                                                    Expr {
                                                                        ty: u32
                                                                        temp_scope_id: 43
                                                                        span: /rustc/FAKE_PREFIX/library/core/src/mem/mod.rs:1473:12: 1473:56 (#12)
                                                                        kind: 
                                                                            NonHirLiteral {
                                                                                lit: 0x00000002
                                                                                user_ty: None
                                                                            }
                                                                    }
                                                                ]
                                                            }
                                                    }

@cuviper
Copy link
Member

cuviper commented Jan 13, 2026

I feel like we may not want this.

Agreed, we should let this deprecated function die. I'm especially wary that explicitly documenting safety conditions is really an API guarantee of sorts, while we really don't want anything that encourages its use. The current ambiguity serves as an additional warning flag not to use it.

@Noratrieb
Copy link
Member

I agree with not having an example, but I think listing out safety preconditions is still good (I'd reword them a bit though to clearly discourage use)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants