Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare for 1.3.0 release #250

Merged
merged 10 commits into from Aug 11, 2021
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
@@ -1,3 +1,4 @@
wip
target
Cargo.lock

Expand Down
42 changes: 42 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,45 @@
# 1.3.0

KodrAus marked this conversation as resolved.
Show resolved Hide resolved
- End empty doc comment with full stop ([#202])
KodrAus marked this conversation as resolved.
Show resolved Hide resolved

- Fix typo in crate root docs ([#206])

- Document from_bits_unchecked unsafety ([#207])

- Let `is_all()` ignore extra bits ([#211])
KodrAus marked this conversation as resolved.
Show resolved Hide resolved

- Allows empty flag definition ([#225])

- Making crate accessible from std ([#227])

- Make `from_bits` a const fn ([#229])

- Allow multiple bitflags structs in one macro invocation ([#235])

- Add named functions to perform set operations ([#244])

- Fix typos in method docs ([#245])

- Modernization of the `bitflags` macro to take advantage of newer features and 2018 idioms ([#246])

- Fix regression (in an unreleased feature) and simplify tests ([#247])

- Use `Self` and fix bug when overriding `stringify!` ([#249])

KodrAus marked this conversation as resolved.
Show resolved Hide resolved
[#202]: https://github.com/bitflags/bitflags/pull/202
[#206]: https://github.com/bitflags/bitflags/pull/206
[#207]: https://github.com/bitflags/bitflags/pull/207
[#211]: https://github.com/bitflags/bitflags/pull/211
[#225]: https://github.com/bitflags/bitflags/pull/225
[#227]: https://github.com/bitflags/bitflags/pull/227
[#229]: https://github.com/bitflags/bitflags/pull/229
[#235]: https://github.com/bitflags/bitflags/pull/235
[#244]: https://github.com/bitflags/bitflags/pull/244
[#245]: https://github.com/bitflags/bitflags/pull/245
[#246]: https://github.com/bitflags/bitflags/pull/246
[#247]: https://github.com/bitflags/bitflags/pull/247
[#249]: https://github.com/bitflags/bitflags/pull/249

# 1.2.1

- Remove extraneous `#[inline]` attributes ([#194])
Expand Down
3 changes: 2 additions & 1 deletion Cargo.toml
Expand Up @@ -3,7 +3,7 @@ name = "bitflags"
# NB: When modifying, also modify:
# 1. html_root_url in lib.rs
# 2. number in readme (for breaking changes)
version = "1.2.1"
version = "1.3.0"
edition = "2018"
authors = ["The Rust Project Developers"]
license = "MIT/Apache-2.0"
Expand All @@ -24,6 +24,7 @@ compiler_builtins = { version = '0.1.2', optional = true }

[dev-dependencies]
trybuild = "1.0"
rustversion = "1.0"
serde = "1.0"
serde_derive = "1.0"
serde_json = "1.0"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -18,7 +18,7 @@ Add this to your `Cargo.toml`:

```toml
[dependencies]
bitflags = "1.2"
bitflags = "1.3"
```

and this to your source code:
Expand Down
6 changes: 4 additions & 2 deletions src/lib.rs
Expand Up @@ -254,9 +254,11 @@
//! assert!(none.is_empty());
//! }
//! ```
//!
//! Users should generally avoid defining a flag with a value of zero.

#![cfg_attr(not(test), no_std)]
#![doc(html_root_url = "https://docs.rs/bitflags/1.2.1")]
#![doc(html_root_url = "https://docs.rs/bitflags/1.3.0")]

#[doc(hidden)]
pub extern crate core as _core;
Expand Down Expand Up @@ -1203,7 +1205,7 @@ mod tests {
#[test]
fn test_set_ops_const() {
// These just test that these compile and don't cause use-site panics
// (would be possible if we had some sort of UB), which is enoug
// (would be possible if we had some sort of UB)
const INTERSECT: Flags = Flags::all().intersection(Flags::C);
const UNION: Flags = Flags::A.union(Flags::C);
const DIFFERENCE: Flags = Flags::all().difference(Flags::A);
Expand Down
1 change: 1 addition & 0 deletions tests/compile-fail/.gitignore
@@ -0,0 +1 @@
*.stderr
18 changes: 18 additions & 0 deletions tests/compile-fail/private_flags.stderr.beta
@@ -0,0 +1,18 @@
error[E0603]: struct `Flags2` is private
--> $DIR/private_flags.rs:17:26
|
17 | let flag2 = example::Flags2::FLAG_B;
| ^^^^^^ private struct
|
note: the struct `Flags2` is defined here
--> $DIR/private_flags.rs:4:5
|
4 | / bitflags! {
5 | | pub struct Flags1: u32 {
6 | | const FLAG_A = 0b00000001;
7 | | }
... |
11 | | }
12 | | }
| |_____^
= note: this error originates in the macro `bitflags` (in Nightly builds, run with -Z macro-backtrace for more info)
39 changes: 39 additions & 0 deletions tests/compiletest.rs
@@ -1,5 +1,44 @@
use std::{
fs,
ffi::OsStr,
io,
path::Path,
};

#[test]
fn compile_fail() {
prepare_stderr_files("tests/compile-fail").unwrap();

let t = trybuild::TestCases::new();
t.compile_fail("tests/compile-fail/*.rs");
}

fn prepare_stderr_files(path: impl AsRef<Path>) -> io::Result<()> {
for entry in fs::read_dir(path)? {
let entry = entry?;

if entry.path().extension().and_then(OsStr::to_str) == Some("beta") {
let renamed = entry.path().with_extension("");

if renamed.exists() {
fs::remove_file(&renamed)?;
}

rename_beta_stderr(entry.path(), renamed)?;
}
}

Ok(())
}

#[rustversion::beta]
fn rename_beta_stderr(from: impl AsRef<Path>, to: impl AsRef<Path>) -> io::Result<()> {
fs::copy(from, to)?;

Ok(())
}

#[rustversion::not(beta)]
fn rename_beta_stderr(_: impl AsRef<Path>, _: impl AsRef<Path>) -> io::Result<()> {
Ok(())
}