Rollup merge of #118693 - saethlin:alignment-check-symbol-reachable, r=bjorn3

Tell MirUsedCollector that the pointer alignment checks calls its panic symbol

Fixes https://github.com/rust-lang/rust/pull/118683 (not an issue, but that PR is a basically a bug report)

When we had `panic_immediate_abort` start adding `#[inline]` to this panic function, builds started breaking because we failed to write up the MIR assert terminator to the correct panic shim. Things happened to work before by pure luck because without this feature enabled, the function we're inserting calls to is `#[inline(never)]` so we always generated code for it.

r? bjorn3
This commit is contained in:
Matthias Krüger 2023-12-08 06:44:42 +01:00 committed by GitHub
commit 646d627661
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -844,6 +844,9 @@ fn visit_terminator(&mut self, terminator: &mir::Terminator<'tcx>, location: Loc
mir::TerminatorKind::Assert { ref msg, .. } => {
let lang_item = match &**msg {
mir::AssertKind::BoundsCheck { .. } => LangItem::PanicBoundsCheck,
mir::AssertKind::MisalignedPointerDereference { .. } => {
LangItem::PanicMisalignedPointerDereference
}
_ => LangItem::Panic,
};
push_mono_lang_item(self, lang_item);