diff options
| author | bors <bors@rust-lang.org> | 2024-07-04 23:45:56 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-07-04 23:45:56 +0000 |
| commit | 5b91a1a6c2e239b635295682ecba8c0d0346ca52 (patch) | |
| tree | 5b076590e28fcdb6c0b1ae0df3ce8b89e41d5a30 | |
| parent | ea943850008130e698f03cdbd54e95616c44ab2b (diff) | |
| parent | 12ede216e661f430ab98b0c6fe018c068473763c (diff) | |
| download | rust-5b91a1a6c2e239b635295682ecba8c0d0346ca52.tar.gz rust-5b91a1a6c2e239b635295682ecba8c0d0346ca52.zip | |
Auto merge of #123781 - RalfJung:miri-fn-identity, r=oli-obk
Miri function identity hack: account for possible inlining Having a non-lifetime generic is not the only reason a function can be duplicated. Another possibility is that the function may be eligible for cross-crate inlining. So also take into account the inlining attribute in this Miri hack for function pointer identity. That said, `cross_crate_inlinable` will still sometimes return true even for `inline(never)` functions: - when they are `DefKind::Ctor(..) | DefKind::Closure` -- I assume those cannot be `InlineAttr::Never` anyway? - when `cross_crate_inline_threshold == InliningThreshold::Always` so maybe this is still not quite the right criterion to use for function pointer identity.
| -rw-r--r-- | src/common.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/common.rs b/src/common.rs index 230fe4f5871..fa8a1ec037c 100644 --- a/src/common.rs +++ b/src/common.rs @@ -220,7 +220,7 @@ impl<'gcc, 'tcx> ConstMethods<'tcx> for CodegenCx<'gcc, 'tcx> { } value } - GlobalAlloc::Function(fn_instance) => self.get_fn_addr(fn_instance), + GlobalAlloc::Function { instance, .. } => self.get_fn_addr(instance), GlobalAlloc::VTable(ty, trait_ref) => { let alloc = self .tcx |
