1
Fork 0
rust/compiler/rustc_hir/src
bors 0ce1369bde Auto merge of #136974 - m-ou-se:fmt-options-64-bit, r=scottmcm
Reduce FormattingOptions to 64 bits

This is part of https://github.com/rust-lang/rust/issues/99012

This reduces FormattingOptions from 6-7 machine words (384 bits on 64-bit platforms, 224 bits on 32-bit platforms) to just 64 bits (a single register on 64-bit platforms).

Before:

```rust
pub struct FormattingOptions {
    flags: u32, // only 6 bits used
    fill: char,
    align: Option<Alignment>,
    width: Option<usize>,
    precision: Option<usize>,
}
```

After:

```rust
pub struct FormattingOptions {
    /// Bits:
    ///  - 0-20: fill character (21 bits, a full `char`)
    ///  - 21: `+` flag
    ///  - 22: `-` flag
    ///  - 23: `#` flag
    ///  - 24: `0` flag
    ///  - 25: `x?` flag
    ///  - 26: `X?` flag
    ///  - 27: Width flag (if set, the width field below is used)
    ///  - 28: Precision flag (if set, the precision field below is used)
    ///  - 29-30: Alignment (0: Left, 1: Right, 2: Center, 3: Unknown)
    ///  - 31: Always set to 1
    flags: u32,
    /// Width if width flag above is set. Otherwise, always 0.
    width: u16,
    /// Precision if precision flag above is set. Otherwise, always 0.
    precision: u16,
}
```
2025-03-22 10:56:14 +00:00
..
hir Fix binding mode problems 2025-02-22 00:13:19 +00:00
arena.rs Add hir::Attribute 2024-12-15 19:18:46 +01:00
def.rs Rollup merge of #138040 - thaliaarchi:use-prelude-size-of.compiler, r=compiler-errors 2025-03-09 10:34:49 +01:00
def_path_hash_map.rs Move hashes from rustc_data_structure to rustc_hashes so they can be shared with rust-analyzer 2025-02-16 16:18:30 -05:00
definitions.rs Make synthetic RPITIT assoc ty name handling more rigorous. 2025-03-07 20:59:45 +11:00
diagnostic_items.rs Reformat using the new identifier sorting from rustfmt 2024-09-22 19:11:29 -04:00
hir.rs Use Option<Ident> for lowered param names. 2025-03-19 20:54:10 +11:00
hir_id.rs Reformat using the new identifier sorting from rustfmt 2024-09-22 19:11:29 -04:00
intravisit.rs Use Option<Ident> for lowered param names. 2025-03-19 20:54:10 +11:00
lang_items.rs Reduce FormattingOptions to 64 bits. 2025-03-12 16:32:00 +01:00
lib.rs Auto merge of #138414 - matthiaskrgr:rollup-9ablqdb, r=matthiaskrgr 2025-03-12 17:27:43 +00:00
pat_util.rs Eliminate PatKind::Path 2025-01-29 15:45:13 +00:00
stable_hash_impls.rs Implement #[define_opaque] attribute for functions. 2025-03-11 12:05:02 +00:00
target.rs Implment #[cfg] and #[cfg_attr] in where clauses 2025-03-01 22:02:46 +08:00
tests.rs Move hashes from rustc_data_structure to rustc_hashes so they can be shared with rust-analyzer 2025-02-16 16:18:30 -05:00
weak_lang_items.rs Re-export more rustc_span::symbol things from rustc_span. 2024-12-18 13:38:53 +11:00