Skip to content

Commit 5b91a1a

Browse files
committed
Auto merge of rust-lang#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.
2 parents ea94385 + 12ede21 commit 5b91a1a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/common.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ impl<'gcc, 'tcx> ConstMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
220220
}
221221
value
222222
}
223-
GlobalAlloc::Function(fn_instance) => self.get_fn_addr(fn_instance),
223+
GlobalAlloc::Function { instance, .. } => self.get_fn_addr(instance),
224224
GlobalAlloc::VTable(ty, trait_ref) => {
225225
let alloc = self
226226
.tcx

0 commit comments

Comments
 (0)