Skip to content

Commit

Permalink
Merge branch 'bitflags:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
f-gagel committed Jan 20, 2024
2 parents 0efb392 + a5f9ce2 commit 2902bad
Show file tree
Hide file tree
Showing 11 changed files with 115 additions and 101 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,18 @@
# 2.4.2

## What's Changed
* Cargo.toml: Anchor excludes to root of the package by @jamessan in https://github.com/bitflags/bitflags/pull/387
* Update error messages by @KodrAus in https://github.com/bitflags/bitflags/pull/390
* Add support for impl mode structs to be repr(packed) by @GnomedDev in https://github.com/bitflags/bitflags/pull/388
* Remove old `unused_tuple_struct_fields` lint by @dtolnay in https://github.com/bitflags/bitflags/pull/393
* Delete use of `local_inner_macros` by @dtolnay in https://github.com/bitflags/bitflags/pull/392

## New Contributors
* @jamessan made their first contribution in https://github.com/bitflags/bitflags/pull/387
* @GnomedDev made their first contribution in https://github.com/bitflags/bitflags/pull/388

**Full Changelog**: https://github.com/bitflags/bitflags/compare/2.4.1...2.4.2

# 2.4.1

## What's Changed
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "bitflags"
# NB: When modifying, also modify the number in readme (for breaking changes)
version = "2.4.1"
version = "2.4.2"
edition = "2021"
rust-version = "1.56.0"
authors = ["The Rust Project Developers"]
Expand Down
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -28,7 +28,7 @@ Add this to your `Cargo.toml`:

```toml
[dependencies]
bitflags = "2.4.1"
bitflags = "2.4.2"
```

and this to your source code:
Expand Down
24 changes: 12 additions & 12 deletions src/external.rs
Expand Up @@ -14,7 +14,7 @@ Next, re-export the library from the `__private` module here.
Next, define a macro like so:
```rust
#[macro_export(local_inner_macros)]
#[macro_export]
#[doc(hidden)]
#[cfg(feature = "serde")]
macro_rules! __impl_external_bitflags_my_library {
Expand All @@ -30,7 +30,7 @@ macro_rules! __impl_external_bitflags_my_library {
};
}
#[macro_export(local_inner_macros)]
#[macro_export]
#[doc(hidden)]
#[cfg(not(feature = "my_library"))]
macro_rules! __impl_external_bitflags_my_library {
Expand Down Expand Up @@ -77,7 +77,7 @@ pub(crate) mod __private {
}

/// Implements traits from external libraries for the internal bitflags type.
#[macro_export(local_inner_macros)]
#[macro_export]
#[doc(hidden)]
macro_rules! __impl_external_bitflags {
(
Expand All @@ -92,7 +92,7 @@ macro_rules! __impl_external_bitflags {
// Use `serde` as an example: generate code when the feature is available,
// and a no-op when it isn't

__impl_external_bitflags_serde! {
$crate::__impl_external_bitflags_serde! {
$InternalBitFlags: $T, $PublicBitFlags {
$(
$(#[$inner $($args)*])*
Expand All @@ -101,7 +101,7 @@ macro_rules! __impl_external_bitflags {
}
}

__impl_external_bitflags_arbitrary! {
$crate::__impl_external_bitflags_arbitrary! {
$InternalBitFlags: $T, $PublicBitFlags {
$(
$(#[$inner $($args)*])*
Expand All @@ -110,7 +110,7 @@ macro_rules! __impl_external_bitflags {
}
}

__impl_external_bitflags_bytemuck! {
$crate::__impl_external_bitflags_bytemuck! {
$InternalBitFlags: $T, $PublicBitFlags {
$(
$(#[$inner $($args)*])*
Expand All @@ -125,7 +125,7 @@ macro_rules! __impl_external_bitflags {
pub mod serde;

/// Implement `Serialize` and `Deserialize` for the internal bitflags type.
#[macro_export(local_inner_macros)]
#[macro_export]
#[doc(hidden)]
#[cfg(feature = "serde")]
macro_rules! __impl_external_bitflags_serde {
Expand Down Expand Up @@ -161,7 +161,7 @@ macro_rules! __impl_external_bitflags_serde {
};
}

#[macro_export(local_inner_macros)]
#[macro_export]
#[doc(hidden)]
#[cfg(not(feature = "serde"))]
macro_rules! __impl_external_bitflags_serde {
Expand All @@ -182,7 +182,7 @@ pub mod arbitrary;
mod bytemuck;

/// Implement `Arbitrary` for the internal bitflags type.
#[macro_export(local_inner_macros)]
#[macro_export]
#[doc(hidden)]
#[cfg(feature = "arbitrary")]
macro_rules! __impl_external_bitflags_arbitrary {
Expand All @@ -204,7 +204,7 @@ macro_rules! __impl_external_bitflags_arbitrary {
};
}

#[macro_export(local_inner_macros)]
#[macro_export]
#[doc(hidden)]
#[cfg(not(feature = "arbitrary"))]
macro_rules! __impl_external_bitflags_arbitrary {
Expand All @@ -219,7 +219,7 @@ macro_rules! __impl_external_bitflags_arbitrary {
}

/// Implement `Pod` and `Zeroable` for the internal bitflags type.
#[macro_export(local_inner_macros)]
#[macro_export]
#[doc(hidden)]
#[cfg(feature = "bytemuck")]
macro_rules! __impl_external_bitflags_bytemuck {
Expand Down Expand Up @@ -247,7 +247,7 @@ macro_rules! __impl_external_bitflags_bytemuck {
};
}

#[macro_export(local_inner_macros)]
#[macro_export]
#[doc(hidden)]
#[cfg(not(feature = "bytemuck"))]
macro_rules! __impl_external_bitflags_bytemuck {
Expand Down
10 changes: 5 additions & 5 deletions src/internal.rs
Expand Up @@ -6,7 +6,7 @@
/// Declare the `bitflags`-facing bitflags struct.
///
/// This type is part of the `bitflags` crate's public API, but not part of the user's.
#[macro_export(local_inner_macros)]
#[macro_export]
#[doc(hidden)]
macro_rules! __declare_internal_bitflags {
(
Expand All @@ -25,7 +25,7 @@ macro_rules! __declare_internal_bitflags {
///
/// Methods and trait implementations can be freely added here without breaking end-users.
/// If we want to expose new functionality to `#[derive]`, this is the place to do it.
#[macro_export(local_inner_macros)]
#[macro_export]
#[doc(hidden)]
macro_rules! __impl_internal_bitflags {
(
Expand Down Expand Up @@ -97,7 +97,7 @@ macro_rules! __impl_internal_bitflags {

// The internal flags type offers a similar API to the public one

__impl_public_bitflags! {
$crate::__impl_public_bitflags! {
$InternalBitFlags: $T, $PublicBitFlags {
$(
$(#[$inner $($args)*])*
Expand All @@ -106,11 +106,11 @@ macro_rules! __impl_internal_bitflags {
}
}

__impl_public_bitflags_ops! {
$crate::__impl_public_bitflags_ops! {
$InternalBitFlags
}

__impl_public_bitflags_iter! {
$crate::__impl_public_bitflags_iter! {
$InternalBitFlags: $T, $PublicBitFlags
}

Expand Down
44 changes: 22 additions & 22 deletions src/lib.rs
Expand Up @@ -17,7 +17,7 @@ Add `bitflags` to your `Cargo.toml`:
```toml
[dependencies.bitflags]
version = "2.4.1"
version = "2.4.2"
```
## Generating flags types
Expand Down Expand Up @@ -444,7 +444,7 @@ bitflags! {
}
```
*/
#[macro_export(local_inner_macros)]
#[macro_export]
macro_rules! bitflags {
(
$(#[atomic_attr($outer_atomic:meta)])*
Expand Down Expand Up @@ -489,13 +489,13 @@ macro_rules! bitflags {
) => {
// Declared in the scope of the `bitflags!` call
// This type appears in the end-user's API
__declare_public_bitflags! {
$crate::__declare_public_bitflags! {
$(#[$outer])*
$vis struct $BitFlags
}

// Workaround for: https://github.com/bitflags/bitflags/issues/320
__impl_public_bitflags_consts! {
$crate::__impl_public_bitflags_consts! {
$BitFlags: $T {
$(
$(#[$inner $($args)*])*
Expand All @@ -520,11 +520,11 @@ macro_rules! bitflags {
const _: () = {
// Declared in a "hidden" scope that can't be reached directly
// These types don't appear in the end-user's API
__declare_internal_bitflags! {
$crate::__declare_internal_bitflags! {
$vis struct InternalBitFlags: $T
}

__impl_internal_bitflags! {
$crate::__impl_internal_bitflags! {
InternalBitFlags: $T, $BitFlags {
$(
$(#[$inner $($args)*])*
Expand All @@ -534,7 +534,7 @@ macro_rules! bitflags {
}

// This is where new library trait implementations can be added
__impl_external_bitflags! {
$crate::__impl_external_bitflags! {
InternalBitFlags: $T, $BitFlags {
$(
$(#[$inner $($args)*])*
Expand All @@ -543,20 +543,20 @@ macro_rules! bitflags {
}
}

__impl_public_bitflags_forward! {
$crate::__impl_public_bitflags_forward! {
$BitFlags: $T, InternalBitFlags
}

__impl_public_bitflags_ops! {
$crate::__impl_public_bitflags_ops! {
$BitFlags
}

__impl_public_bitflags_iter! {
$crate::__impl_public_bitflags_iter! {
$BitFlags: $T, $BitFlags
}
};

bitflags! {
$crate::bitflags! {
$($t)*
}
};
Expand All @@ -570,7 +570,7 @@ macro_rules! bitflags {

$($t:tt)*
) => {
__impl_public_bitflags_consts! {
$crate::__impl_public_bitflags_consts! {
$BitFlags: $T {
$(
$(#[$inner $($args)*])*
Expand All @@ -591,7 +591,7 @@ macro_rules! bitflags {
clippy::iter_without_into_iter,
)]
const _: () = {
__impl_public_bitflags! {
$crate::__impl_public_bitflags! {
$BitFlags: $T, $BitFlags {
$(
$(#[$inner $($args)*])*
Expand All @@ -600,16 +600,16 @@ macro_rules! bitflags {
}
}

__impl_public_bitflags_ops! {
$crate::__impl_public_bitflags_ops! {
$BitFlags
}

__impl_public_bitflags_iter! {
$crate::__impl_public_bitflags_iter! {
$BitFlags: $T, $BitFlags
}
};

bitflags! {
$crate::bitflags! {
$($t)*
}
};
Expand All @@ -620,7 +620,7 @@ macro_rules! bitflags {
///
/// We need to be careful about adding new methods and trait implementations here because they
/// could conflict with items added by the end-user.
#[macro_export(local_inner_macros)]
#[macro_export]
#[doc(hidden)]
macro_rules! __impl_bitflags {
(
Expand Down Expand Up @@ -829,7 +829,7 @@ macro_rules! __impl_bitflags {
///
/// If you find yourself with an attribute that should be considered expression-safe
/// and isn't, it can be added here.
#[macro_export(local_inner_macros)]
#[macro_export]
#[doc(hidden)]
macro_rules! __bitflags_expr_safe_attrs {
// Entrypoint: Move all flags and all attributes into `unprocessed` lists
Expand All @@ -838,7 +838,7 @@ macro_rules! __bitflags_expr_safe_attrs {
$(#[$inner:ident $($args:tt)*])*
{ $e:expr }
) => {
__bitflags_expr_safe_attrs! {
$crate::__bitflags_expr_safe_attrs! {
expr: { $e },
attrs: {
// All attributes start here
Expand All @@ -863,7 +863,7 @@ macro_rules! __bitflags_expr_safe_attrs {
processed: [$($expr:tt)*],
},
) => {
__bitflags_expr_safe_attrs! {
$crate::__bitflags_expr_safe_attrs! {
expr: { $e },
attrs: {
unprocessed: [
Expand All @@ -890,7 +890,7 @@ macro_rules! __bitflags_expr_safe_attrs {
processed: [$($expr:tt)*],
},
) => {
__bitflags_expr_safe_attrs! {
$crate::__bitflags_expr_safe_attrs! {
expr: { $e },
attrs: {
unprocessed: [
Expand All @@ -917,7 +917,7 @@ macro_rules! __bitflags_expr_safe_attrs {
}

/// Implement a flag, which may be a wildcard `_`.
#[macro_export(local_inner_macros)]
#[macro_export]
#[doc(hidden)]
macro_rules! __bitflags_flag {
(
Expand Down

0 comments on commit 2902bad

Please sign in to comment.