layout computation: eagerly error for unexpected unsized fields

This commit is contained in:
Lukas Markeffsky
2024-09-15 22:16:21 +02:00
parent 16be6666d4
commit 697450151c
25 changed files with 1246 additions and 1115 deletions

View File

@@ -26,7 +26,7 @@ mod layout;
#[cfg(test)]
mod tests;
pub use layout::LayoutCalculator;
pub use layout::{LayoutCalculator, LayoutCalculatorError};
/// Requirements for a `StableHashingContext` to be used in this crate.
/// This is a hack to allow using the `HashStable_Generic` derive macro
@@ -393,6 +393,14 @@ impl HasDataLayout for TargetDataLayout {
}
}
// used by rust-analyzer
impl HasDataLayout for &TargetDataLayout {
#[inline]
fn data_layout(&self) -> &TargetDataLayout {
(**self).data_layout()
}
}
/// Endianness of the target, which must match cfg(target-endian).
#[derive(Copy, Clone, PartialEq, Eq)]
pub enum Endian {