Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: bitflags/bitflags
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 2.9.2
Choose a base ref
...
head repository: bitflags/bitflags
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 2.9.3
Choose a head ref
  • 5 commits
  • 5 files changed
  • 3 contributors

Commits on Aug 20, 2025

  1. Avoid local variables in generated code.

    The generated code for various operations has local variables:
    ```
            pub const fn union(self, other: Self) -> Self {
                let f = self;
                let other = other;
                { Self::from_bits_retain(f.bits() | other.bits()) }
            }
    ```
    These are present due to the way the relevant macros are structured.
    This commit restructures the `__impl_bitflags` macro to avoid these
    indirections, resulting in this code instead:
    ```
            pub const fn union(self, other: Self) -> Self {
                Self(self.0 | other.0)
            }
    ```
    Benefits:
    - `cargo expand` output is nicer.
    - It is a little faster to compile.
    - `__impl_bitflags!` becomes simpler, with many fewer parameters. E.g.
      `$self` instead of `$union0`, `$intersect0`, etc.
    - The `__impl_bitflags!` call sites are also a little nicer, using
      `&self` instead of `f`.
    nnethercote committed Aug 20, 2025
    Configuration menu
    Copy the full SHA
    aead794 View commit details
    Browse the repository at this point in the history
  2. Avoid calling InternalBitFlags::{bits,from_bits_retain}.

    It's simpler to just use `Self()` and `.0`. Here's an example of how
    that changes the output for one method:
    ```
             pub const fn union(self, other: Self) -> Self {
    -            Self::from_bits_retain(self.bits() | other.bits())
    +            Self(self.0 | other.0)
             }
    ```
    As well as being simpler, this change makes the code a tiny bit faster
    to compile, and results in much better code quality (no function calls)
    in dev builds.
    nnethercote committed Aug 20, 2025
    Configuration menu
    Copy the full SHA
    a3f1f78 View commit details
    Browse the repository at this point in the history

Commits on Aug 22, 2025

  1. Merge pull request #458 from nnethercote/streamline-generated-code

    Streamline generated code
    KodrAus authored Aug 22, 2025
    Configuration menu
    Copy the full SHA
    9e1cf3e View commit details
    Browse the repository at this point in the history
  2. prepare for 2.9.3 release

    KodrAus committed Aug 22, 2025
    Configuration menu
    Copy the full SHA
    2c3a4f4 View commit details
    Browse the repository at this point in the history
  3. Merge pull request #459 from KodrAus/cargo/2.9.3

    Prepare for 2.9.3 release
    KodrAus authored Aug 22, 2025
    Configuration menu
    Copy the full SHA
    f59ad49 View commit details
    Browse the repository at this point in the history
Loading