Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 8d3100e

Browse files
authoredSep 17, 2024
Merge branch 'rust-lang:master' into feature-rustdoc-sort-traits
2 parents 0e4be77 + f609b7e commit 8d3100e

File tree

455 files changed

+5580
-5047
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

455 files changed

+5580
-5047
lines changed
 

‎compiler/rustc_abi/src/layout.rs

Lines changed: 952 additions & 920 deletions
Large diffs are not rendered by default.

‎compiler/rustc_abi/src/lib.rs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ mod layout;
2626
#[cfg(test)]
2727
mod tests;
2828

29-
pub use layout::LayoutCalculator;
29+
pub use layout::{LayoutCalculator, LayoutCalculatorError};
3030

3131
/// Requirements for a `StableHashingContext` to be used in this crate.
3232
/// This is a hack to allow using the `HashStable_Generic` derive macro
@@ -393,6 +393,14 @@ impl HasDataLayout for TargetDataLayout {
393393
}
394394
}
395395

396+
// used by rust-analyzer
397+
impl HasDataLayout for &TargetDataLayout {
398+
#[inline]
399+
fn data_layout(&self) -> &TargetDataLayout {
400+
(**self).data_layout()
401+
}
402+
}
403+
396404
/// Endianness of the target, which must match cfg(target-endian).
397405
#[derive(Copy, Clone, PartialEq, Eq)]
398406
pub enum Endian {
@@ -781,6 +789,14 @@ impl Align {
781789
}
782790

783791
/// A pair of alignments, ABI-mandated and preferred.
792+
///
793+
/// The "preferred" alignment is an LLVM concept that is virtually meaningless to Rust code:
794+
/// it is not exposed semantically to programmers nor can they meaningfully affect it.
795+
/// The only concern for us is that preferred alignment must not be less than the mandated alignment
796+
/// and thus in practice the two values are almost always identical.
797+
///
798+
/// An example of a rare thing actually affected by preferred alignment is aligning of statics.
799+
/// It is of effectively no consequence for layout in structs and on the stack.
784800
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
785801
#[cfg_attr(feature = "nightly", derive(HashStable_Generic))]
786802
pub struct AbiAndPrefAlign {

0 commit comments

Comments
 (0)