repo stringclasses 1
value | problem_statement stringlengths 79 2.53k | hints_text stringlengths 0 2.82k | instance_id stringlengths 21 22 | issue_numbers sequencelengths 1 2 | base_commit stringlengths 40 40 | test_patch stringlengths 336 78k | version stringlengths 3 3 | pull_number int64 24 380 | created_at stringlengths 20 20 | patch stringlengths 251 103k | environment_setup_commit stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
bitflags/bitflags | Implement Arbitrary for bitflags?
Would it be worth it to have an optional implementation of [`Arbitrary`](https://docs.rs/arbitrary/1.0.1/arbitrary/trait.Arbitrary.html) (in the [arbitrary crate](https://crates.io/crates/arbitrary)) for bitflags types, to make it easier to use them in fuzzing?
I'm imagining somethi... | Can we think of any other implementation for `Arbitrary` that a consumer might want to add themselves? If not then this seems like a reasonable addition to me, since as I understand it, `Arbitrary` is meant to be a general API that different fuzzer implementations can lean on. Anything that makes fuzzing easier to get ... | bitflags__bitflags-324 | [
"248"
] | 11640f19a7644f3967631733f33ec87b9f911951 | diff --git /dev/null b/src/external/arbitrary_support.rs
new file mode 100644
--- /dev/null
+++ b/src/external/arbitrary_support.rs
@@ -0,0 +1,19 @@
+#[cfg(test)]
+mod tests {
+ use arbitrary::Arbitrary;
+
+ bitflags! {
+ #[derive(Arbitrary)]
+ struct Color: u32 {
+ const RED = 0x1;
+ ... | 2.0 | 324 | 2023-03-25T01:34:21Z | diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml
--- a/.github/workflows/rust.yml
+++ b/.github/workflows/rust.yml
@@ -49,7 +49,7 @@ jobs:
run: cargo install cargo-hack
- name: Powerset
- run: cargo hack test --feature-powerset --lib --optional-deps "std serde" --depth 3 --skip ru... | 11640f19a7644f3967631733f33ec87b9f911951 |
bitflags/bitflags | Support bytemuck
From #310
Add a `bytemuck` Cargo feature that derives `bytemuck` traits on the generated inner flags type so end-users can then `#[derive(bytemuck::*)]` traits on their own flags types.
| bitflags__bitflags-336 | [
"311"
] | 597d40749224d3eee125a6ea9d6ac4c92b898ee8 | diff --git /dev/null b/src/external/bytemuck_support.rs
new file mode 100644
--- /dev/null
+++ b/src/external/bytemuck_support.rs
@@ -0,0 +1,19 @@
+#[cfg(test)]
+mod tests {
+ use bytemuck::{Pod, Zeroable};
+
+ bitflags! {
+ #[derive(Pod, Zeroable, Clone, Copy)]
+ #[repr(transparent)]
+ s... | 2.1 | 336 | 2023-04-11T01:30:12Z | diff --git a/Cargo.toml b/Cargo.toml
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -22,6 +22,7 @@ exclude = ["tests", ".github"]
[dependencies]
serde = { version = "1.0", optional = true, default-features = false }
arbitrary = { version = "1.0", optional = true }
+bytemuck = { version = "1.0", optional = true }
core = { ver... | dc971042c8132a5381ab3e2165983ee7f9d44c63 | |
bitflags/bitflags | `usize` / `isize` aren't supported anymore in `v2.0`
This doesn't seem intentional at least and isn't mentioned in the changelog.
| In what way are they not supported? What error message do they give? Or is there some other problem with them?
They don't implement the new `Bits` trait, which is required to use bitflags: https://github.com/bitflags/bitflags/blob/main/src/traits.rs#L135-L141
Thanks for pointing this out @CryZe. This is a total oversig... | bitflags__bitflags-321 | [
"319"
] | 8b43d2bb7efbd3d4189fdac92e411ad20c5140b5 | diff --git a/src/lib.rs b/src/lib.rs
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1548,4 +1548,57 @@ mod tests {
assert_eq!(flags, rebuilt);
}
+
+ #[test]
+ fn bits_types() {
+ bitflags! {
+ pub struct I8: i8 {
+ const A = 1;
+ }
+
+ pub struct I16: ... | 2.0 | 321 | 2023-03-19T08:31:22Z | diff --git a/src/traits.rs b/src/traits.rs
--- a/src/traits.rs
+++ b/src/traits.rs
@@ -138,6 +138,7 @@ impl_bits! {
u32, i32,
u64, i64,
u128, i128,
+ usize, isize,
}
/// A trait for referencing the `bitflags`-owned internal type
| 11640f19a7644f3967631733f33ec87b9f911951 |
bitflags/bitflags | Display missing extra bits for multi-bit flags
See: https://github.com/bitflags/bitflags/issues/310#issuecomment-1470122112
Given a flags type with two flags, `BIT = 0b0000_0001` and `MASK = 0b0001_1110`, formatting the value `3` should result in `BIT | 0x2`, but instead it gives `BIT`. That extra bit gets lost, so ... | bitflags__bitflags-316 | [
"315"
] | ad0271116e28a79ea880334dd3d06212a224ec09 | diff --git a/src/lib.rs b/src/lib.rs
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1154,17 +1154,39 @@ mod tests {
#[test]
fn test_display_from_str_roundtrip() {
- fn format_parse_case(flags: FmtFlags) {
+ fn format_parse_case<T: fmt::Debug + fmt::Display + str::FromStr + PartialEq>(flags: T) where <T... | 2.0 | 316 | 2023-03-16T00:19:13Z | diff --git a/src/internal.rs b/src/internal.rs
--- a/src/internal.rs
+++ b/src/internal.rs
@@ -89,7 +89,8 @@ macro_rules! __impl_internal_bitflags {
// Iterate over the valid flags
let mut first = true;
- for (name, _) in self.iter_names() {
+ let mut it... | 11640f19a7644f3967631733f33ec87b9f911951 | |
bitflags/bitflags | Cannot use `#[doc(alias)]`
The following code:
```rs
bitflags::bitflags! {
#[doc(alias = "SYMBOLIC_LINK_FLAGS")]
pub struct SymbolicLinkFlags:u32 {
#[doc(alias = "SYMBOLIC_LINK_FLAG_DIRECTORY")]
const DIRECTORY = 0x1;
#[doc(alias = "SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE")]
const ALLOW... | This is a general problem for attributes that can't be applied to expressions now. In methods like `from_name` we now generate code like this:
```rust
#[inline]
pub fn from_name(name: &str) -> ::bitflags::__private::core::option::Option<Self> {
match name {
#[doc(alias = "SYMBOLIC_LINK_FLAG_DIRECTORY... | bitflags__bitflags-341 | [
"308"
] | dc971042c8132a5381ab3e2165983ee7f9d44c63 | diff --git /dev/null b/tests/compile-pass/doc_alias.rs
new file mode 100644
--- /dev/null
+++ b/tests/compile-pass/doc_alias.rs
@@ -0,0 +1,14 @@
+#[macro_use]
+extern crate bitflags;
+
+bitflags! {
+ #[doc(alias = "FLAG")]
+ pub struct Flags: u8 {
+ #[doc(alias = "FLAG_A")]
+ const A = 1;
+ }
+}
... | 2.1 | 341 | 2023-04-18T00:36:26Z | diff --git a/src/lib.rs b/src/lib.rs
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -558,6 +558,315 @@ macro_rules! bitflags {
}
$($t:tt)*
+ ) => {
+ __declare_bitflags!(
+ $(#[$outer])*
+ $vis struct $BitFlags: $T {
+ $(
+ $(#[$inner $($args)*... | dc971042c8132a5381ab3e2165983ee7f9d44c63 |
bitflags/bitflags | Clippy warnings around "manual implementation of an assign operation"
Hi.
I've run into a new clippy lint warnings such as the following:
> manual implementation of an assign operation
> for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assign_op_pattern
> `#[warn(clippy::a... | bitflags__bitflags-355 | [
"357"
] | 31d3e4afefc964045156d7fe3622733f48511353 | diff --git a/tests/compile-fail/bitflags_custom_bits.rs b/tests/compile-fail/bitflags_custom_bits.rs
--- a/tests/compile-fail/bitflags_custom_bits.rs
+++ b/tests/compile-fail/bitflags_custom_bits.rs
@@ -19,7 +19,7 @@ use std::{
},
};
-use bitflags::{bitflags, Bits, parser::{ParseError, FromHex}};
+use bitflags:... | 2.3 | 355 | 2023-05-17T11:22:15Z | diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml
--- a/.github/workflows/rust.yml
+++ b/.github/workflows/rust.yml
@@ -81,6 +81,23 @@ jobs:
- name: Default features
run: cross test --target mips-unknown-linux-gnu
+ clippy:
+ name: Clippy
+ runs-on: ubuntu-latest
+ steps:
... | 09f71f492d0f76d63cd286c3869c70676297e204 | |
bitflags/bitflags | Bug: debug pretty-printing unknown flags display 0x0x
main.rs
```rust
use bitflags::bitflags;
bitflags! {
struct Flags: u8 {
const TWO = 0x2;
}
}
fn main() {
let value = 0b11;
let flags = unsafe { Flags::from_bits_unchecked(value) };
println!("{:?}", flags);
println!("---... | bitflags__bitflags-268 | [
"267"
] | 1aa25e1b3baf35d3d3840f12fe7e8b55adc0164a | diff --git a/tests/compile-fail/trait/custom_impl.rs b/tests/compile-fail/trait/custom_impl.rs
--- a/tests/compile-fail/trait/custom_impl.rs
+++ b/tests/compile-fail/trait/custom_impl.rs
@@ -62,4 +62,4 @@ impl BitFlags for BootlegFlags {
}
}
-fn main() { }
+fn main() {}
diff --git a/tests/compile-pass/impls/co... | 1.3 | 268 | 2022-01-02T17:22:14Z | diff --git a/src/lib.rs b/src/lib.rs
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -494,8 +494,7 @@ macro_rules! __impl_bitflags {
f.write_str(" | ")?;
}
first = false;
- f.write_str("0x")?;
- $crate::_core::fmt::LowerHex::f... | 810dc35aba3df7314de01b93c7aa137968e925d4 | |
bitflags/bitflags | The bitflags macro is not sanitary wrt. standard library types and enumerations
The `bitflags` macro, expanded in the prescence of a definition of the type/value `Ok` errors.
Reproduction code:
https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=3fda3e36c7c6a57e0f7a83c84e56df20
Interestingly, t... | bitflags__bitflags-266 | [
"265"
] | 1aa25e1b3baf35d3d3840f12fe7e8b55adc0164a | diff --git /dev/null b/tests/compile-pass/redefinition/result.rs
new file mode 100644
--- /dev/null
+++ b/tests/compile-pass/redefinition/result.rs
@@ -0,0 +1,15 @@
+use bitflags::bitflags;
+
+// Checks for possible errors caused by overriding names used by `bitflags!` internally.
+
+// bug #265 (https://github.com/bit... | 1.3 | 266 | 2021-12-16T09:38:14Z | diff --git a/src/lib.rs b/src/lib.rs
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -500,7 +500,7 @@ macro_rules! __impl_bitflags {
if first {
f.write_str("(empty)")?;
}
- Ok(())
+ $crate::_core::fmt::Result::Ok(())
}
}
... | 810dc35aba3df7314de01b93c7aa137968e925d4 | |
bitflags/bitflags | Documenting bitflags: how to get documentation for the generated bitflags
Some code that I'm writing uses the `#![warn(missing_docs)]` macro to enforce a requirement that all public interfaces have documentation. I haven't been able to figure out how to generate documentation when using the `bitflags!` macro; I also ha... | https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=530756068e54aa56eb519dd66c9fdfc5
https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=f782c74e49e8c4c4ae940125265eb7ed
Thanks @rusty-snake! Those would actually make some great compile-pass tests 🤔 | bitflags__bitflags-380 | [
"378"
] | 472e392c0d082c0894b18fb31f4e68e0b145e29c | diff --git a/src/tests/iter.rs b/src/tests/iter.rs
--- a/src/tests/iter.rs
+++ b/src/tests/iter.rs
@@ -3,6 +3,7 @@ use super::*;
use crate::Flags;
#[test]
+#[cfg(not(miri))] // Very slow in miri
fn roundtrip() {
for a in 0u8..=255 {
for b in 0u8..=255 {
diff --git a/src/tests/parser.rs b/src/tests/p... | 2.4 | 380 | 2023-10-09T04:48:32Z | diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml
--- a/.github/workflows/rust.yml
+++ b/.github/workflows/rust.yml
@@ -84,18 +84,19 @@ jobs:
cd ./tests/smoke-test
cargo +$msrv build
- mips:
- name: Tests / MIPS (Big Endian)
+ miri:
+ name: "Miri"
runs-on: ubuntu-... | 472e392c0d082c0894b18fb31f4e68e0b145e29c |
bitflags/bitflags | Empty bitflags definitions fail to parse
This doesn't parse:
```rust
bitflags::bitflags! {
pub struct BoxFlags: u8 {
}
}
```
| Hmm, it looks like we're using `+` rather than `*` as the repetition control. I can't imagine an empty set of `bitflags` would be very useful. Do you have a case where you've run into this?
It might useful when introducing the type and designing the API first, before you even actually add the various bitflags
Yeh that ... | bitflags__bitflags-225 | [
"179"
] | bd24f9d8d266bfb2dfe4b8238b196ecf5e37dee1 | diff --git a/src/lib.rs b/src/lib.rs
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -992,6 +1026,11 @@ mod tests {
}
}
+ bitflags! {
+ struct EmptyFlags: u32 {
+ }
+ }
+
#[test]
fn test_bits() {
assert_eq!(Flags::empty().bits(), 0b00000000);
diff --git a/src/lib.rs b/src/li... | 1.2 | 225 | 2020-10-01T16:10:42Z | diff --git a/src/lib.rs b/src/lib.rs
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -360,7 +360,7 @@ macro_rules! bitflags {
$(
$(#[$inner:ident $($args:tt)*])*
const $Flag:ident = $value:expr;
- )+
+ )*
}
$($t:tt)*
) => {
diff --git a/s... | bd24f9d8d266bfb2dfe4b8238b196ecf5e37dee1 |
bitflags/bitflags | from_bits accepts non existing flags
```rs
#[test]
fn test_from_bits_edge_cases() {
bitflags! {
struct Flags: u8 {
const A = 0b00000001;
const BC = 0b00000110;
}
}
let flags = Flags::from_bits(0b00000100);
asse... | bitflags__bitflags-276 | [
"275"
] | 0141a07e55184304857384b0093d00959f0acfa6 | diff --git a/src/lib.rs b/src/lib.rs
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1891,6 +1907,37 @@ mod tests {
}
}
+ #[test]
+ fn test_from_bits_edge_cases() {
+ bitflags! {
+ struct Flags: u8 {
+ const A = 0b00000001;
+ const BC = 0b00000110;
+ ... | 1.3 | 276 | 2022-04-19T09:54:30Z | diff --git a/src/lib.rs b/src/lib.rs
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -559,10 +559,11 @@ macro_rules! __impl_bitflags {
/// representation contains bits that do not correspond to a flag.
#[inline]
pub const fn from_bits(bits: $T) -> $crate::_core::option::Option<Self> {
- ... | 810dc35aba3df7314de01b93c7aa137968e925d4 | |
bitflags/bitflags | `cargo build --test` fails on Windows
[One of the tests](https://github.com/bitflags/bitflags/blob/8a10bdc144bb2a4b97c63cfa76be90228954d029/src/lib.rs#L920) for `bitflags-1.1.0` fails to compile on Windows with a stable rustc (version 1.36.0).
```
[INFO] [stderr] error[E0425]: cannot find value `_CFG_A` in this sco... | Thanks for the report @ecstatic-morse! I'm not in front of my Windows box right now, but will look into this when I am, unless somebody else checks it first.
I would guess that swapping `#[cfg(unix)]` and `#[cfg(windows)]` in that test will result in a failure on *nix. Btw, this arose while testing out `crater` runs on... | bitflags__bitflags-186 | [
"185"
] | 8a10bdc144bb2a4b97c63cfa76be90228954d029 | diff --git a/src/lib.rs b/src/lib.rs
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1111,7 +1111,7 @@ mod tests {
#[cfg(bitflags_const_fn)]
#[test]
fn test_const_fn() {
- const M1: Flags = Flags::empty();
+ const _M1: Flags = Flags::empty();
const M2: Flags = Flags::A;
assert_eq!... | 1.1 | 186 | 2019-07-20T12:27:25Z | diff --git a/src/lib.rs b/src/lib.rs
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -919,12 +919,12 @@ mod tests {
bitflags! {
struct _CfgFlags: u32 {
- #[cfg(windows)]
- const _CFG_A = 0b01;
#[cfg(unix)]
- const _CFG_B = 0b01;
+ const _CFG_A = 0b01;
... | 8a10bdc144bb2a4b97c63cfa76be90228954d029 |
bitflags/bitflags | Bitflags values of zero are considered always present
When a bitflag is built with a zero valued item then it is treated as always present by bitflags functions.
This may cause bugs but it definitely causes confusion when printing such a value. See the following for an example:
```
#[macro_use]
extern crate bitfl... | I agree, a zero value should only show up in Debug output if no bits are set. Would you be interested in sending a PR to fix this?
I would definitely be interested in doing so, where should I start?
The Debug impls are constructed [here](https://github.com/rust-lang-nursery/bitflags/blob/1.0.2/src/lib.rs#L401).
After l... | bitflags__bitflags-157 | [
"151"
] | 74aa397b0e6899c8b5131da34351e7d87d247038 | diff --git a/src/lib.rs b/src/lib.rs
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1157,4 +1191,22 @@ mod tests {
assert_eq!(module::value(), 1)
}
+
+ #[test]
+ fn test_zero_value_flags() {
+ bitflags! {
+ struct Flags: u32 {
+ const NONE = 0b0;
+ const SOME... | 1.0 | 157 | 2018-04-30T12:18:19Z | diff --git a/src/lib.rs b/src/lib.rs
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -215,6 +215,36 @@
//! assert_eq!(implemented_default, (Flags::A | Flags::C));
//! }
//! ```
+//!
+//! # Zero Flags
+//!
+//! Flags with a value equal to zero will have some strange behavior that one should be aware of.
+//!
+//! ```
+//! #... | 74aa397b0e6899c8b5131da34351e7d87d247038 |
bitflags/bitflags | pub(restricted) bitflags
cc https://github.com/rust-lang/rust/issues/32409 - maybe no action is warranted until this feature is stable.
```rust
bitflags! {
pub(super) flags Flags: u8 {
const A = 1
}
}
```
| pub(restricted) is now stable. But I think it is still blocked by `:vis` matcher (rust-lang/rust#41022) to allow a proper fix.
----
Currently the straightforward fix using `:vis` causes an error in `example_generated.rs`
```rust
error: local ambiguity: multiple parsing options: built-in NTs vis ('vis') or 1 o... | bitflags__bitflags-135 | [
"72"
] | 8e163c64ec3ce242a9fef0347c73a82f5ea84b90 | diff --git a/src/lib.rs b/src/lib.rs
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1092,4 +1111,46 @@ mod tests {
}
}
}
+
+ #[test]
+ fn test_pub_crate() {
+ mod module {
+ bitflags! {
+ pub (crate) struct Test: u8 {
+ const FOO = 1;
+ ... | 1.0 | 135 | 2017-11-08T05:38:51Z | diff --git a/src/lib.rs b/src/lib.rs
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -336,6 +336,25 @@ macro_rules! bitflags {
}
}
};
+ (
+ $(#[$outer:meta])*
+ pub ($($vis:tt)+) struct $BitFlags:ident: $T:ty {
+ $(
+ $(#[$inner:ident $($args:tt)*])*
+ ... | 74aa397b0e6899c8b5131da34351e7d87d247038 |
bitflags/bitflags | Bitflags reverses order of multiline doc comments
When compiling code like
```
bitflags! {
pub struct AdjustFlags: u32 {
/// Add buf.time to the current time. If buf.status includes the ADJ_NANO flag, then buf.time.tv_usec is interpreted as a nanosecond value;
/// otherwise it is interpreted as... | This should be trivially fixed by swapping the order attributes are "pushed" in `__declare_bitflags`. We've already yanked `2.2.0` because it requires a lot more recursion, but will keep this open to make sure any new approach doesn't reverse the order of attributes. | bitflags__bitflags-345 | [
"344"
] | cbcafa710fc31172511e62efa06ad9eb214e4734 | diff --git /dev/null b/tests/compile-pass/large.rs
new file mode 100644
--- /dev/null
+++ b/tests/compile-pass/large.rs
@@ -0,0 +1,311 @@
+/*
+Copyright (c) 2016 Anatoly Ikorsky
+
+Permission is hereby granted, free of charge, to any
+person obtaining a copy of this software and associated
+documentation files (the "So... | 2.2 | 345 | 2023-04-24T04:29:26Z | diff --git a/src/example_generated.rs b/src/example_generated.rs
--- a/src/example_generated.rs
+++ b/src/example_generated.rs
@@ -33,8 +33,17 @@ __impl_public_bitflags! {
__impl_public_bitflags_consts! {
Flags {
+ /// Field `A`.
+ ///
+ /// This flag has the value `0b00000001`.
A ... | cbcafa710fc31172511e62efa06ad9eb214e4734 |
bitflags/bitflags | serde support
Are there any plans to support `Serialize` and `Deserialize` for generated types? I'm writing the impls manually in my code, but this falls apart once there's a ton of `bitflags` generated types. If others are interested in such a feature, maybe I can find the time to implement it myself and submit a pull... | During the libs blitz evaluation we saw that a grand total of 8 crates have dependencies on both bitflags and Serde, so we decided not to pursue it at the time. I would welcome a PR that adds Serialize and Deserialize impls behind a cfg.
Adding `#[derive(Serialize, Deserialize)]` to the struct seems to work fine, I'm n... | bitflags__bitflags-125 | [
"108"
] | 29e60b23708123121a540fa9bde3254260952511 | diff --git /dev/null b/tests/serde.rs
new file mode 100644
--- /dev/null
+++ b/tests/serde.rs
@@ -0,0 +1,35 @@
+#[macro_use]
+extern crate bitflags;
+
+#[macro_use]
+extern crate serde_derive;
+extern crate serde;
+extern crate serde_json;
+
+bitflags! {
+ #[derive(Serialize, Deserialize)]
+ struct Flags: u32 {
+... | 1.0 | 125 | 2017-10-11T15:27:55Z | diff --git a/Cargo.toml b/Cargo.toml
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -28,5 +28,8 @@ example_generated = []
[dev-dependencies]
# Trick Cargo into testing this crate when we run `cargo test --all`.
bitflags-compiletest = { path = "compiletest" }
+serde = "1.0"
+serde_derive = "1.0"
+serde_json = "1.0"
[workspa... | 74aa397b0e6899c8b5131da34351e7d87d247038 |
bitflags/bitflags | is_all() vs. from_bits_unchecked()
[`unsafe from_bits_unchecked()`](https://docs.rs/bitflags/1.2.1/bitflags/example_generated/struct.Flags.html#method.from_bits_unchecked) allows creating instances with extra bits. The caller of the `bitflags!` macro can decide if this is allowed for their type. Let's assume it is for ... | bitflags__bitflags-211 | [
"208"
] | 15e911c304d5bd8805af55d7e4f8c5324ed798ee | diff --git a/src/lib.rs b/src/lib.rs
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1048,6 +1048,11 @@ mod tests {
assert!(!Flags::A.is_all());
assert!(Flags::ABC.is_all());
+ let extra = unsafe { Flags::from_bits_unchecked(0b1000) };
+ assert!(!extra.is_all());
+ assert!(!(Flags::A | ex... | 1.2 | 211 | 2020-02-04T10:52:16Z | diff --git a/src/lib.rs b/src/lib.rs
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -664,7 +664,7 @@ macro_rules! __impl_bitflags {
/// Returns `true` if all flags are currently set.
#[inline]
pub const fn is_all(&self) -> bool {
- self.bits == $BitFlags::all(... | bd24f9d8d266bfb2dfe4b8238b196ecf5e37dee1 | |
bitflags/bitflags | Create a test suite crate
#61 adds an `unstable_testing` feature that is only considered by tests. It seems unfortunate to leak this into the public API.
Having a separate crate for tests ([like in Serde](https://github.com/serde-rs/serde/tree/master/test_suite)) would avoid this.
| bitflags__bitflags-127 | [
"68"
] | 862582d107bb74ce4c7b505b2490eb815bc3a8c2 | diff --git a/.travis.yml b/.travis.yml
--- a/.travis.yml
+++ b/.travis.yml
@@ -9,23 +10,14 @@ rust:
- beta
- nightly
sudo: false
-before_script:
- - pip install -v 'travis-cargo<0.2' --user && export PATH=$HOME/.local/bin:$PATH
- - if [[ -e ~/Library/Python/2.7/bin ]]; then export PATH=~/Library/Python/2.7/bin... | 1.0 | 127 | 2017-10-17T16:27:59Z | diff --git a/.gitignore b/.gitignore
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,2 @@
-/target
-/Cargo.lock
+target
+Cargo.lock
diff --git a/.travis.yml b/.travis.yml
--- a/.travis.yml
+++ b/.travis.yml
@@ -2,6 +2,7 @@ os:
- linux
- osx
language: rust
+cache: cargo
rust:
# This version is tested to avoid u... | 74aa397b0e6899c8b5131da34351e7d87d247038 |
End of preview. Expand in Data Studio
README.md exists but content is empty.
- Downloads last month
- 3