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 | 489233170abcc97f59a1ee2211535f0ff67a0b43 (patch) | |
| tree | 6c0aa43dade23cab3ff64c61f5d960ec78a403d1 /compiler/rustc_middle/src/ty/print | |
| parent | cc8da78a036dc3c15c35a97651b02af9a6d30c1e (diff) | |
| parent | 41b98da42d0500e38b9dd85c82110ba177ac4de1 (diff) | |
| download | rust-489233170abcc97f59a1ee2211535f0ff67a0b43.tar.gz rust-489233170abcc97f59a1ee2211535f0ff67a0b43.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.
Diffstat (limited to 'compiler/rustc_middle/src/ty/print')
| -rw-r--r-- | compiler/rustc_middle/src/ty/print/pretty.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_middle/src/ty/print/pretty.rs b/compiler/rustc_middle/src/ty/print/pretty.rs index d2f32cafb9d..7e64c507406 100644 --- a/compiler/rustc_middle/src/ty/print/pretty.rs +++ b/compiler/rustc_middle/src/ty/print/pretty.rs @@ -1667,7 +1667,7 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write { Some(GlobalAlloc::Static(def_id)) => { p!(write("<static({:?})>", def_id)) } - Some(GlobalAlloc::Function(_)) => p!("<function>"), + Some(GlobalAlloc::Function { .. }) => p!("<function>"), Some(GlobalAlloc::VTable(..)) => p!("<vtable>"), None => p!("<dangling pointer>"), } @@ -1679,7 +1679,7 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write { ty::FnPtr(_) => { // FIXME: We should probably have a helper method to share code with the "Byte strings" // printing above (which also has to handle pointers to all sorts of things). - if let Some(GlobalAlloc::Function(instance)) = + if let Some(GlobalAlloc::Function { instance, .. }) = self.tcx().try_get_global_alloc(prov.alloc_id()) { self.typed_value( |
