ABI compat check: detect unadjusted ABI mismatches

This commit is contained in:
Ralf Jung 2024-08-27 09:04:59 +02:00
parent bf662eb808
commit ab7b03e3f4
4 changed files with 26 additions and 6 deletions

View file

@ -1700,7 +1700,9 @@ impl<FieldIdx: Idx, VariantIdx: Idx> LayoutS<FieldIdx, VariantIdx> {
/// Checks if these two `Layout` are equal enough to be considered "the same for all function
/// call ABIs". Note however that real ABIs depend on more details that are not reflected in the
/// `Layout`; the `PassMode` need to be compared as well.
/// `Layout`; the `PassMode` need to be compared as well. Also note that we assume
/// aggregates are passed via `PassMode::Indirect` or `PassMode::Cast`; more strict
/// checks would otherwise be required.
pub fn eq_abi(&self, other: &Self) -> bool {
// The one thing that we are not capturing here is that for unsized types, the metadata must
// also have the same ABI, and moreover that the same metadata leads to the same size. The