diff -Naur vendor-41.0.5/bitflags/benches/parse.rs vendor-41.0.7/bitflags/benches/parse.rs
--- vendor-41.0.5/bitflags/benches/parse.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags/benches/parse.rs	1969-12-31 19:00:00.000000000 -0500
@@ -0,0 +1,96 @@
+#![feature(test)]
+
+extern crate test;
+
+use std::{
+    fmt::{self, Display},
+    str::FromStr,
+};
+
+bitflags::bitflags! {
+    struct Flags10: u32 {
+        const A = 0b0000_0000_0000_0001;
+        const B = 0b0000_0000_0000_0010;
+        const C = 0b0000_0000_0000_0100;
+        const D = 0b0000_0000_0000_1000;
+        const E = 0b0000_0000_0001_0000;
+        const F = 0b0000_0000_0010_0000;
+        const G = 0b0000_0000_0100_0000;
+        const H = 0b0000_0000_1000_0000;
+        const I = 0b0000_0001_0000_0000;
+        const J = 0b0000_0010_0000_0000;
+    }
+}
+
+impl FromStr for Flags10 {
+    type Err = bitflags::parser::ParseError;
+
+    fn from_str(flags: &str) -> Result<Self, Self::Err> {
+        Ok(Flags10(flags.parse()?))
+    }
+}
+
+impl Display for Flags10 {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        Display::fmt(&self.0, f)
+    }
+}
+
+#[bench]
+fn format_flags_1_present(b: &mut test::Bencher) {
+    b.iter(|| Flags10::J.to_string())
+}
+
+#[bench]
+fn format_flags_5_present(b: &mut test::Bencher) {
+    b.iter(|| (Flags10::F | Flags10::G | Flags10::H | Flags10::I | Flags10::J).to_string())
+}
+
+#[bench]
+fn format_flags_10_present(b: &mut test::Bencher) {
+    b.iter(|| {
+        (Flags10::A
+            | Flags10::B
+            | Flags10::C
+            | Flags10::D
+            | Flags10::E
+            | Flags10::F
+            | Flags10::G
+            | Flags10::H
+            | Flags10::I
+            | Flags10::J)
+            .to_string()
+    })
+}
+
+#[bench]
+fn parse_flags_1_10(b: &mut test::Bencher) {
+    b.iter(|| {
+        let flags: Flags10 = "J".parse().unwrap();
+        flags
+    })
+}
+
+#[bench]
+fn parse_flags_5_10(b: &mut test::Bencher) {
+    b.iter(|| {
+        let flags: Flags10 = "F | G | H | I | J".parse().unwrap();
+        flags
+    })
+}
+
+#[bench]
+fn parse_flags_10_10(b: &mut test::Bencher) {
+    b.iter(|| {
+        let flags: Flags10 = "A | B | C | D | E | F | G | H | I | J".parse().unwrap();
+        flags
+    })
+}
+
+#[bench]
+fn parse_flags_1_10_hex(b: &mut test::Bencher) {
+    b.iter(|| {
+        let flags: Flags10 = "0xFF".parse().unwrap();
+        flags
+    })
+}
diff -Naur vendor-41.0.5/bitflags/.cargo-checksum.json vendor-41.0.7/bitflags/.cargo-checksum.json
--- vendor-41.0.5/bitflags/.cargo-checksum.json	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags/.cargo-checksum.json	1969-12-31 19:00:00.000000000 -0500
@@ -1 +1 @@
-{"files":{"CHANGELOG.md":"d362fc1fccaaf4d421bcf0fe8b80ddb4f625dade0c1ee52d08bd0b95509a49d1","CODE_OF_CONDUCT.md":"42634d0f6d922f49857175af991802822f7f920487aefa2ee250a50d12251a66","Cargo.toml":"87aced7532a7974eb37ab5fe6037f0abafc36d6b2d74891ecd2bf2f14f50d11e","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"6485b8ed310d3f0340bf1ad1f47645069ce4069dcc6bb46c7d5c6faf41de1fdb","README.md":"baa8604f8afb34fd93b9c79729daafb884dedcaf34023e4af8ad037d916061fd","src/example_generated.rs":"e43eb59e90f317f38d436670a6067d2fd9eb35fb319fe716184e4a04e24ed1b2","src/lib.rs":"e6477688535ee326d27238aeedc9cb4320ac35b9d17a4deda09e0587b0ccdbd4","tests/basic.rs":"146f1cbf6279bc609242cd3349f29cb21b41294f5e4921875f5ec95bd83529a2","tests/compile-fail/impls/copy.rs":"b791371237ddc75a7c04d2130e03b462c9c00a80dca08bd45aa97433d9c0d13a","tests/compile-fail/impls/copy.stderr.beta":"77d83484ce221d4b6ff2f7de843929a452d779fcfff428122710dd8218c298e3","tests/compile-fail/impls/eq.rs":"0cee8b9e07d537890e0189710293b53972d0fab63c09366f33c391065afafa99","tests/compile-fail/impls/eq.stderr.beta":"381fc6143d45ce76d7cecc47aa59cb69fe5e79c0b60a4a85d5c6163b400b3cc7","tests/compile-fail/non_integer_base/all_defined.rs":"95e14cad9e94560262f2862c3c01865ac30369b69da1001b0e7285cb55e6cb75","tests/compile-fail/non_integer_base/all_defined.stderr.beta":"1760739a276690903bb03844025587d37939f5dfcbfab309db3c86f32bdbf748","tests/compile-fail/non_integer_base/all_missing.rs":"b3d9da619d23213731ba2581aa7999c796c3c79aaf4f0ee6b11ceec08a11537f","tests/compile-fail/non_integer_base/all_missing.stderr.beta":"37e102290d3867e175b21976be798939f294efb17580d5b51e7b17b590d55132","tests/compile-fail/visibility/private_field.rs":"38e4d3fe6471829360d12c8d09b097f6a21aa93fb51eac3b215d96bdae23316b","tests/compile-fail/visibility/private_field.stderr.beta":"5aa24a3ebb39326f31927721c5017b8beb66c3e501fb865a3fa814c9763bfa0f","tests/compile-fail/visibility/private_flags.rs":"2ce4235802aa4e9c96c4e77d9e31d8401ef58dcda4741325184f0764ab1fe393","tests/compile-fail/visibility/private_flags.stderr.beta":"f3eb9f7baf2689258f3519ff7ee5c6ec3c237264ebcfe63f40c40f2023e5022f","tests/compile-fail/visibility/pub_const.rs":"8f813a97ac518c5ea8ac65b184101912452384afaf7b8d6c5e62f8370eca3c0a","tests/compile-fail/visibility/pub_const.stderr.beta":"823976ae1794d7f5372e2ec9aabba497e7bb88004722904c38da342ed98e8962","tests/compile-pass/impls/convert.rs":"88fe80bfb9cd5779f0e1d92c9ec02a8b6bb67e334c07f2309e9c0ba5ef776eb0","tests/compile-pass/impls/default.rs":"c508f9a461691f44b45142fa5ad599f02326e1de4c0cbca6c0593f4652eba109","tests/compile-pass/impls/inherent_methods.rs":"ecc26388e9a394bfa7a5bb69a5d621ab3d4d1e53f28f657bb8e78fe79f437913","tests/compile-pass/redefinition/core.rs":"ff5b6e72f87acc6ebb12405d3c0f6e3fa62e669933656a454bb63b30ea44179c","tests/compile-pass/redefinition/stringify.rs":"1edbce42b900c14425d7ffa14e83e165ebe452d7dccd8c0a8a821bdec64f5c93","tests/compile-pass/repr/c.rs":"6fda17f7c2edfcd155314579e83d0fc8a16209e400f1f9a5ca77bd9a799041f2","tests/compile-pass/repr/transparent.rs":"6cdc87a2137d8a4e0c8ce9b6cba83c82255f8ea125951bf614418685600489ce","tests/compile-pass/visibility/bits_field.rs":"1f3e5ba5a047440066a9f6bf7b7af33f5b06f6b1da3dd9af6886168199a7ea0a","tests/compile-pass/visibility/pub_in.rs":"e95312ff60966d42ec4bc00225507895a9b8ec24056ce6a9edd9145be35d730f","tests/compile.rs":"f27c67a7dd183ca30efea1b6e0880e3469a6dd63b92b1fd711c082df182c9eec"},"package":"bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"}
\ No newline at end of file
+{"files":{"CHANGELOG.md":"0905d91abfd8162750daeb51b69e1a4add85cd0e8e2b136a4fd20ea28df4da42","CODE_OF_CONDUCT.md":"42634d0f6d922f49857175af991802822f7f920487aefa2ee250a50d12251a66","CONTRIBUTING.md":"6c9f96eacb20af877ae2d16f024904f3038b93448a8488e9dbcac0df7f6439a5","Cargo.lock":"fb581ed64bd34dbdbcc2386c394394d5f46db3186edc7b129f1669cef66a0b57","Cargo.toml":"418f0ef5e370bf88b0d7bd8c3b2f25b533ae2b671036d30f7c524dc39133045c","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"6485b8ed310d3f0340bf1ad1f47645069ce4069dcc6bb46c7d5c6faf41de1fdb","README.md":"a403792a6099aeda15dc7bf3da529409652039b5dd2227dfc5549bd2f3fad7db","SECURITY.md":"68704c8128fa2e776ed7cbda741fbf61ad52f998a96350ee7ee4dbf64c6573bc","benches/parse.rs":"f1390d62322c6880d65bd931e183d49b313f287879a6bfaa36b1cb1921090b51","examples/custom_bits_type.rs":"e53b32051adc5d97860e0b48c8f3a301a041d73b4939c0d7caa5f0cfcc0b9739","examples/custom_derive.rs":"29dd7b845345a103ca31e91b579aeb01fb74935b8223c29184eb42223edadb65","examples/fmt.rs":"87ba37a1fb8528570c74ea26d8e8948e1179c3d867b928bea1080880258e0a99","examples/macro_free.rs":"69e7f284b53b5214d51228a686e87f127b52a3b74711e45537ebfa5583a180e5","examples/serde.rs":"08b21b35d5c10fdca132fe0f36c8067bb44f559e96617a9257ab6316a20cbc75","spec.md":"fcdd939df30c59b0643be09027df664b71cbea9b9989185441482c5576160fed","src/example_generated.rs":"d018caf059f6ffc4c2403b771a6d76679fa5af03c329a91bd9252957df695e7f","src/external.rs":"11599248db17d395c6b45bf2400266f221d3eb1523908e5f17715964bf8d99ed","src/external/arbitrary.rs":"fa8c9187028b9bc54856977b0914676f62101010e7a9450abd577fd78c89552f","src/external/bytemuck.rs":"3afcef382122867040fddd5e4153d633d1ed5596fe5d7dfac66a8e61c2513df5","src/external/serde.rs":"4a09db12534a20fe554a08dc5f1c8124b379292d41fa75628abcd2ca21587573","src/internal.rs":"fd939154cbebf43bfc329a4a3cd08618ca30a6a5f6e6abea07d23f75bf5b3b2d","src/iter.rs":"dbaa6437c1c044f689185ce3fafe43df8796bed19bbdd2c20334a52de5eeee73","src/lib.rs":"e45c07f43b0e142c41e99de8d20ceb909148762c876d765c11ac8b8ceaca0af5","src/parser.rs":"52f6352620ce3d5973bc38b42d56a760307294162c9d5668eb774eb92a6ef941","src/public.rs":"72b41639711bab95e8e75f37401a487088e7be1a427715cea40563fb3f64ed60","src/tests.rs":"b120c27ff0c67a819527de9d8171f1f4c5d37ba4009c54abeb869c70e6035f14","src/traits.rs":"0a8764c3e2378043e2724cf1bfc514d4ff1985026db33509f6451a7897e2675d"},"package":"327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07"}
\ No newline at end of file
diff -Naur vendor-41.0.5/bitflags/Cargo.lock vendor-41.0.7/bitflags/Cargo.lock
--- vendor-41.0.5/bitflags/Cargo.lock	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags/Cargo.lock	1969-12-31 19:00:00.000000000 -0500
@@ -0,0 +1,268 @@
+# This file is automatically @generated by Cargo.
+# It is not intended for manual editing.
+version = 3
+
+[[package]]
+name = "arbitrary"
+version = "1.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a2e1373abdaa212b704512ec2bd8b26bd0b7d5c3f70117411a5d9a451383c859"
+dependencies = [
+ "derive_arbitrary",
+]
+
+[[package]]
+name = "basic-toml"
+version = "0.1.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7bfc506e7a2370ec239e1d072507b2a80c833083699d3c6fa176fbb4de8448c6"
+dependencies = [
+ "serde",
+]
+
+[[package]]
+name = "bitflags"
+version = "2.4.1"
+dependencies = [
+ "arbitrary",
+ "bytemuck",
+ "compiler_builtins",
+ "rustc-std-workspace-core",
+ "rustversion",
+ "serde",
+ "serde_derive",
+ "serde_json",
+ "serde_test",
+ "trybuild",
+ "zerocopy",
+]
+
+[[package]]
+name = "bytemuck"
+version = "1.14.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "374d28ec25809ee0e23827c2ab573d729e293f281dfe393500e7ad618baa61c6"
+dependencies = [
+ "bytemuck_derive",
+]
+
+[[package]]
+name = "bytemuck_derive"
+version = "1.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "965ab7eb5f8f97d2a083c799f3a1b994fc397b2fe2da5d1da1626ce15a39f2b1"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "byteorder"
+version = "1.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
+
+[[package]]
+name = "compiler_builtins"
+version = "0.1.101"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "01a6d58e9c3408138099a396a98fd0d0e6cfb25d723594d2ae48b5004513fd5b"
+
+[[package]]
+name = "derive_arbitrary"
+version = "1.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "53e0efad4403bfc52dc201159c4b842a246a14b98c64b55dfd0f2d89729dfeb8"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "glob"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"
+
+[[package]]
+name = "itoa"
+version = "1.0.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38"
+
+[[package]]
+name = "once_cell"
+version = "1.18.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d"
+
+[[package]]
+name = "proc-macro2"
+version = "1.0.69"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da"
+dependencies = [
+ "unicode-ident",
+]
+
+[[package]]
+name = "quote"
+version = "1.0.33"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae"
+dependencies = [
+ "proc-macro2",
+]
+
+[[package]]
+name = "rustc-std-workspace-core"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1956f5517128a2b6f23ab2dadf1a976f4f5b27962e7724c2bf3d45e539ec098c"
+
+[[package]]
+name = "rustversion"
+version = "1.0.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4"
+
+[[package]]
+name = "ryu"
+version = "1.0.15"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741"
+
+[[package]]
+name = "serde"
+version = "1.0.189"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8e422a44e74ad4001bdc8eede9a4570ab52f71190e9c076d14369f38b9200537"
+dependencies = [
+ "serde_derive",
+]
+
+[[package]]
+name = "serde_derive"
+version = "1.0.189"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1e48d1f918009ce3145511378cf68d613e3b3d9137d67272562080d68a2b32d5"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "serde_json"
+version = "1.0.107"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6b420ce6e3d8bd882e9b243c6eed35dbc9a6110c9769e74b584e0d68d1f20c65"
+dependencies = [
+ "itoa",
+ "ryu",
+ "serde",
+]
+
+[[package]]
+name = "serde_test"
+version = "1.0.176"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5a2f49ace1498612d14f7e0b8245519584db8299541dfe31a06374a828d620ab"
+dependencies = [
+ "serde",
+]
+
+[[package]]
+name = "syn"
+version = "2.0.38"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "unicode-ident",
+]
+
+[[package]]
+name = "termcolor"
+version = "1.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6093bad37da69aab9d123a8091e4be0aa4a03e4d601ec641c327398315f62b64"
+dependencies = [
+ "winapi-util",
+]
+
+[[package]]
+name = "trybuild"
+version = "1.0.85"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "196a58260a906cedb9bf6d8034b6379d0c11f552416960452f267402ceeddff1"
+dependencies = [
+ "basic-toml",
+ "glob",
+ "once_cell",
+ "serde",
+ "serde_derive",
+ "serde_json",
+ "termcolor",
+]
+
+[[package]]
+name = "unicode-ident"
+version = "1.0.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
+
+[[package]]
+name = "winapi"
+version = "0.3.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
+dependencies = [
+ "winapi-i686-pc-windows-gnu",
+ "winapi-x86_64-pc-windows-gnu",
+]
+
+[[package]]
+name = "winapi-i686-pc-windows-gnu"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
+
+[[package]]
+name = "winapi-util"
+version = "0.1.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596"
+dependencies = [
+ "winapi",
+]
+
+[[package]]
+name = "winapi-x86_64-pc-windows-gnu"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
+
+[[package]]
+name = "zerocopy"
+version = "0.6.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "20707b61725734c595e840fb3704378a0cd2b9c74cc9e6e20724838fc6a1e2f9"
+dependencies = [
+ "byteorder",
+ "zerocopy-derive",
+]
+
+[[package]]
+name = "zerocopy-derive"
+version = "0.6.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "56097d5b91d711293a42be9289403896b68654625021732067eac7a4ca388a1f"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
diff -Naur vendor-41.0.5/bitflags/Cargo.toml vendor-41.0.7/bitflags/Cargo.toml
--- vendor-41.0.5/bitflags/Cargo.toml	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags/Cargo.toml	1969-12-31 19:00:00.000000000 -0500
@@ -3,29 +3,49 @@
 # When uploading crates to the registry Cargo will automatically
 # "normalize" Cargo.toml files for maximal compatibility
 # with all versions of Cargo and also rewrite `path` dependencies
-# to registry (e.g., crates.io) dependencies
+# to registry (e.g., crates.io) dependencies.
 #
-# If you believe there's an error in this file please file an
-# issue against the rust-lang/cargo repository. If you're
-# editing this file be aware that the upstream Cargo.toml
-# will likely look very different (and much more reasonable)
+# If you are reading this file be aware that the original Cargo.toml
+# will likely look very different (and much more reasonable).
+# See Cargo.toml.orig for the original contents.
 
 [package]
-edition = "2018"
+edition = "2021"
+rust-version = "1.56.0"
 name = "bitflags"
-version = "1.3.2"
+version = "2.4.1"
 authors = ["The Rust Project Developers"]
-exclude = ["bors.toml"]
-description = "A macro to generate structures which behave like bitflags.\n"
+exclude = [
+    "tests",
+    ".github",
+]
+description = """
+A macro to generate structures which behave like bitflags.
+"""
 homepage = "https://github.com/bitflags/bitflags"
 documentation = "https://docs.rs/bitflags"
 readme = "README.md"
-keywords = ["bit", "bitmask", "bitflags", "flags"]
+keywords = [
+    "bit",
+    "bitmask",
+    "bitflags",
+    "flags",
+]
 categories = ["no-std"]
-license = "MIT/Apache-2.0"
+license = "MIT OR Apache-2.0"
 repository = "https://github.com/bitflags/bitflags"
+
 [package.metadata.docs.rs]
 features = ["example_generated"]
+
+[dependencies.arbitrary]
+version = "1.0"
+optional = true
+
+[dependencies.bytemuck]
+version = "1.0"
+optional = true
+
 [dependencies.compiler_builtins]
 version = "0.1.2"
 optional = true
@@ -34,10 +54,21 @@
 version = "1.0.0"
 optional = true
 package = "rustc-std-workspace-core"
-[dev-dependencies.rustversion]
+
+[dependencies.serde]
 version = "1.0"
+optional = true
+default-features = false
 
-[dev-dependencies.serde]
+[dev-dependencies.arbitrary]
+version = "1.0"
+features = ["derive"]
+
+[dev-dependencies.bytemuck]
+version = "1.0"
+features = ["derive"]
+
+[dev-dependencies.rustversion]
 version = "1.0"
 
 [dev-dependencies.serde_derive]
@@ -46,13 +77,19 @@
 [dev-dependencies.serde_json]
 version = "1.0"
 
+[dev-dependencies.serde_test]
+version = "1.0"
+
 [dev-dependencies.trybuild]
 version = "1.0"
 
-[dev-dependencies.walkdir]
-version = "2.3"
+[dev-dependencies.zerocopy]
+version = "0.6"
 
 [features]
-default = []
 example_generated = []
-rustc-dep-of-std = ["core", "compiler_builtins"]
+rustc-dep-of-std = [
+    "core",
+    "compiler_builtins",
+]
+std = []
diff -Naur vendor-41.0.5/bitflags/CHANGELOG.md vendor-41.0.7/bitflags/CHANGELOG.md
--- vendor-41.0.5/bitflags/CHANGELOG.md	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags/CHANGELOG.md	1969-12-31 19:00:00.000000000 -0500
@@ -1,8 +1,242 @@
+# 2.4.1
+
+## What's Changed
+* Allow some new pedantic clippy lints by @KodrAus in https://github.com/bitflags/bitflags/pull/380
+
+**Full Changelog**: https://github.com/bitflags/bitflags/compare/2.4.0...2.4.1
+
+# 2.4.0
+
+## What's Changed
+* Remove html_root_url by @eldruin in https://github.com/bitflags/bitflags/pull/368
+* Support unnamed flags by @KodrAus in https://github.com/bitflags/bitflags/pull/371
+* Update smoke test to verify all Clippy and rustc lints by @MitMaro in https://github.com/bitflags/bitflags/pull/374
+* Specify the behavior of bitflags by @KodrAus in https://github.com/bitflags/bitflags/pull/369
+
+## New Contributors
+* @eldruin made their first contribution in https://github.com/bitflags/bitflags/pull/368
+* @MitMaro made their first contribution in https://github.com/bitflags/bitflags/pull/374
+
+**Full Changelog**: https://github.com/bitflags/bitflags/compare/2.3.3...2.4.0
+
+# 2.3.3
+
+## Changes to `-=`
+
+The `-=` operator was incorrectly changed to truncate bits that didn't correspond to valid flags in `2.3.0`. This has
+been fixed up so it once again behaves the same as `-` and `difference`.
+
+## Changes to `!`
+
+The `!` operator previously called `Self::from_bits_truncate`, which would truncate any bits that only partially
+overlapped with a valid flag. It will now use `bits & Self::all().bits()`, so any bits that overlap any bits
+specified by any flag will be respected. This is unlikely to have any practical implications, but enables defining
+a flag like `const ALL = !0` as a way to signal that any bit pattern is a known set of flags.
+
+## Changes to formatting
+
+Zero-valued flags will never be printed. You'll either get `0x0` for empty flags using debug formatting, or the
+set of flags with zero-valued flags omitted for others.
+
+Composite flags will no longer be redundantly printed if there are extra bits to print at the end that don't correspond
+to a valid flag.
+
+## What's Changed
+* Fix up incorrect sub assign behavior and other cleanups by @KodrAus in https://github.com/bitflags/bitflags/pull/366
+
+**Full Changelog**: https://github.com/bitflags/bitflags/compare/2.3.2...2.3.3
+
+# 2.3.2
+
+## What's Changed
+* [doc] [src/lib.rs]  delete redundant path prefix by @OccupyMars2025 in https://github.com/bitflags/bitflags/pull/361
+
+## New Contributors
+* @OccupyMars2025 made their first contribution in https://github.com/bitflags/bitflags/pull/361
+
+**Full Changelog**: https://github.com/bitflags/bitflags/compare/2.3.1...2.3.2
+
+# 2.3.1
+
+## What's Changed
+* Fix Self in flags value expressions by @KodrAus in https://github.com/bitflags/bitflags/pull/355
+
+**Full Changelog**: https://github.com/bitflags/bitflags/compare/2.3.0...2.3.1
+
+# 2.3.0
+
+## What's Changed
+* Support ejecting flags types from the bitflags macro by @KodrAus in https://github.com/bitflags/bitflags/pull/351
+
+**Full Changelog**: https://github.com/bitflags/bitflags/compare/2.2.1...2.3.0
+
+# 2.2.1
+
+## What's Changed
+* Refactor attribute filtering to apply per-flag by @KodrAus in https://github.com/bitflags/bitflags/pull/345
+
+**Full Changelog**: https://github.com/bitflags/bitflags/compare/2.2.0...2.2.1
+
+# 2.2.0
+
+## What's Changed
+* Create SECURITY.md by @KodrAus in https://github.com/bitflags/bitflags/pull/338
+* add docs to describe the behavior of multi-bit flags by @nicholasbishop in https://github.com/bitflags/bitflags/pull/340
+* Add support for bytemuck by @KodrAus in https://github.com/bitflags/bitflags/pull/336
+* Add a top-level macro for filtering attributes by @KodrAus in https://github.com/bitflags/bitflags/pull/341
+
+## New Contributors
+* @nicholasbishop made their first contribution in https://github.com/bitflags/bitflags/pull/340
+
+**Full Changelog**: https://github.com/bitflags/bitflags/compare/2.1.0...2.2.0
+
+# 2.1.0
+
+## What's Changed
+* Add docs for the internal Field0 and examples of formatting/parsing by @KodrAus in https://github.com/bitflags/bitflags/pull/328
+* Add support for arbitrary by @KodrAus in https://github.com/bitflags/bitflags/pull/324
+* Fix up missing docs for consts within consts by @KodrAus in https://github.com/bitflags/bitflags/pull/330
+* Ignore clippy lint in generated code by @Jake-Shadle in https://github.com/bitflags/bitflags/pull/331
+
+## New Contributors
+* @Jake-Shadle made their first contribution in https://github.com/bitflags/bitflags/pull/331
+
+**Full Changelog**: https://github.com/bitflags/bitflags/compare/2.0.2...2.1.0
+
+# 2.0.2
+
+## What's Changed
+* Fix up missing isize and usize Bits impls by @KodrAus in https://github.com/bitflags/bitflags/pull/321
+
+**Full Changelog**: https://github.com/bitflags/bitflags/compare/2.0.1...2.0.2
+
+# 2.0.1
+
+## What's Changed
+* Fix up some docs issues by @KodrAus in https://github.com/bitflags/bitflags/pull/309
+* Make empty_flag() const. by @tormeh in https://github.com/bitflags/bitflags/pull/313
+* Fix formatting of multi-bit flags with partial overlap by @KodrAus in https://github.com/bitflags/bitflags/pull/316
+
+## New Contributors
+* @tormeh made their first contribution in https://github.com/bitflags/bitflags/pull/313
+
+**Full Changelog**: https://github.com/bitflags/bitflags/compare/2.0.0...2.0.1
+
+# 2.0.0
+
+## What's Changed
+* Fix a typo and call out MSRV bump by @KodrAus in https://github.com/bitflags/bitflags/pull/259
+* BitFlags trait by @arturoc in https://github.com/bitflags/bitflags/pull/220
+* Add a hidden trait to discourage manual impls of BitFlags by @KodrAus in https://github.com/bitflags/bitflags/pull/261
+* Sanitize `Ok` by @konsumlamm in https://github.com/bitflags/bitflags/pull/266
+* Fix bug in `Debug` implementation by @konsumlamm in https://github.com/bitflags/bitflags/pull/268
+* Fix a typo in the generated documentation by @wackbyte in https://github.com/bitflags/bitflags/pull/271
+* Use SPDX license format by @atouchet in https://github.com/bitflags/bitflags/pull/272
+* serde tests fail in CI by @arturoc in https://github.com/bitflags/bitflags/pull/277
+* Fix beta test output by @KodrAus in https://github.com/bitflags/bitflags/pull/279
+* Add example to the README.md file by @tiaanl in https://github.com/bitflags/bitflags/pull/270
+* Iterator over all the enabled options by @arturoc in https://github.com/bitflags/bitflags/pull/278
+* from_bits_(truncate) fail with composite flags by @arturoc in https://github.com/bitflags/bitflags/pull/276
+* Add more platform coverage to CI by @KodrAus in https://github.com/bitflags/bitflags/pull/280
+* rework the way cfgs are handled by @KodrAus in https://github.com/bitflags/bitflags/pull/281
+* Split generated code into two types by @KodrAus in https://github.com/bitflags/bitflags/pull/282
+* expose bitflags iters using nameable types by @KodrAus in https://github.com/bitflags/bitflags/pull/286
+* Support creating flags from their names by @KodrAus in https://github.com/bitflags/bitflags/pull/287
+* Update README.md by @KodrAus in https://github.com/bitflags/bitflags/pull/288
+* Prepare for 2.0.0-rc.1 release by @KodrAus in https://github.com/bitflags/bitflags/pull/289
+* Add missing "if" to contains doc-comment in traits.rs by @rusty-snake in https://github.com/bitflags/bitflags/pull/291
+* Forbid unsafe_code by @fintelia in https://github.com/bitflags/bitflags/pull/294
+* serde: enable no-std support by @nim65s in https://github.com/bitflags/bitflags/pull/296
+* Add a parser for flags formatted as bar-separated-values by @KodrAus in https://github.com/bitflags/bitflags/pull/297
+* Prepare for 2.0.0-rc.2 release by @KodrAus in https://github.com/bitflags/bitflags/pull/299
+* Use strip_prefix instead of starts_with + slice by @QuinnPainter in https://github.com/bitflags/bitflags/pull/301
+* Fix up some clippy lints by @KodrAus in https://github.com/bitflags/bitflags/pull/302
+* Prepare for 2.0.0-rc.3 release by @KodrAus in https://github.com/bitflags/bitflags/pull/303
+* feat: Add minimum permissions to rust.yml workflow by @gabibguti in https://github.com/bitflags/bitflags/pull/305
+
+## New Contributors
+* @wackbyte made their first contribution in https://github.com/bitflags/bitflags/pull/271
+* @atouchet made their first contribution in https://github.com/bitflags/bitflags/pull/272
+* @tiaanl made their first contribution in https://github.com/bitflags/bitflags/pull/270
+* @rusty-snake made their first contribution in https://github.com/bitflags/bitflags/pull/291
+* @fintelia made their first contribution in https://github.com/bitflags/bitflags/pull/294
+* @nim65s made their first contribution in https://github.com/bitflags/bitflags/pull/296
+* @QuinnPainter made their first contribution in https://github.com/bitflags/bitflags/pull/301
+* @gabibguti made their first contribution in https://github.com/bitflags/bitflags/pull/305
+
+**Full Changelog**: https://github.com/bitflags/bitflags/compare/1.3.2...2.0.0
+
+# 2.0.0-rc.3
+
+## What's Changed
+* Use strip_prefix instead of starts_with + slice by @QuinnPainter in https://github.com/bitflags/bitflags/pull/301
+* Fix up some clippy lints by @KodrAus in https://github.com/bitflags/bitflags/pull/302
+
+## New Contributors
+* @QuinnPainter made their first contribution in https://github.com/bitflags/bitflags/pull/301
+
+**Full Changelog**: https://github.com/bitflags/bitflags/compare/2.0.0-rc.2...2.0.0-rc.3
+
+# 2.0.0-rc.2
+
+## Changes to `serde` serialization
+
+**⚠️ NOTE ⚠️** This release changes the default serialization you'll get if you `#[derive(Serialize, Deserialize)]`
+on your generated flags types. It will now use a formatted string for human-readable formats and the underlying bits
+type for compact formats.
+
+To keep the old behavior, see the [`bitflags-serde-legacy`](https://github.com/KodrAus/bitflags-serde-legacy) library.
+
+## What's Changed
+
+* Add missing "if" to contains doc-comment in traits.rs by @rusty-snake in https://github.com/bitflags/bitflags/pull/291
+* Forbid unsafe_code by @fintelia in https://github.com/bitflags/bitflags/pull/294
+* serde: enable no-std support by @nim65s in https://github.com/bitflags/bitflags/pull/296
+* Add a parser for flags formatted as bar-separated-values by @KodrAus in https://github.com/bitflags/bitflags/pull/297
+
+## New Contributors
+* @rusty-snake made their first contribution in https://github.com/bitflags/bitflags/pull/291
+* @fintelia made their first contribution in https://github.com/bitflags/bitflags/pull/294
+* @nim65s made their first contribution in https://github.com/bitflags/bitflags/pull/296
+
+**Full Changelog**: https://github.com/bitflags/bitflags/compare/2.0.0-rc.1...2.0.0-rc.2
+
+# 2.0.0-rc.1
+
+This is a big release including a few years worth of work on a new `BitFlags` trait, iteration, and better macro organization for future extensibility.
+
+## What's Changed
+* Fix a typo and call out MSRV bump by @KodrAus in https://github.com/bitflags/bitflags/pull/259
+* BitFlags trait by @arturoc in https://github.com/bitflags/bitflags/pull/220
+* Add a hidden trait to discourage manual impls of BitFlags by @KodrAus in https://github.com/bitflags/bitflags/pull/261
+* Sanitize `Ok` by @konsumlamm in https://github.com/bitflags/bitflags/pull/266
+* Fix bug in `Debug` implementation by @konsumlamm in https://github.com/bitflags/bitflags/pull/268
+* Fix a typo in the generated documentation by @wackbyte in https://github.com/bitflags/bitflags/pull/271
+* Use SPDX license format by @atouchet in https://github.com/bitflags/bitflags/pull/272
+* serde tests fail in CI by @arturoc in https://github.com/bitflags/bitflags/pull/277
+* Fix beta test output by @KodrAus in https://github.com/bitflags/bitflags/pull/279
+* Add example to the README.md file by @tiaanl in https://github.com/bitflags/bitflags/pull/270
+* Iterator over all the enabled options by @arturoc in https://github.com/bitflags/bitflags/pull/278
+* from_bits_(truncate) fail with composite flags by @arturoc in https://github.com/bitflags/bitflags/pull/276
+* Add more platform coverage to CI by @KodrAus in https://github.com/bitflags/bitflags/pull/280
+* rework the way cfgs are handled by @KodrAus in https://github.com/bitflags/bitflags/pull/281
+* Split generated code into two types by @KodrAus in https://github.com/bitflags/bitflags/pull/282
+* expose bitflags iters using nameable types by @KodrAus in https://github.com/bitflags/bitflags/pull/286
+* Support creating flags from their names by @KodrAus in https://github.com/bitflags/bitflags/pull/287
+* Update README.md by @KodrAus in https://github.com/bitflags/bitflags/pull/288
+
+## New Contributors
+* @wackbyte made their first contribution in https://github.com/bitflags/bitflags/pull/271
+* @atouchet made their first contribution in https://github.com/bitflags/bitflags/pull/272
+* @tiaanl made their first contribution in https://github.com/bitflags/bitflags/pull/270
+
+**Full Changelog**: https://github.com/bitflags/bitflags/compare/1.3.2...2.0.0-rc.1
+
 # 1.3.2
 
 - Allow `non_snake_case` in generated flags types ([#256])
 
-[#252]: https://github.com/bitflags/bitflags/pull/256
+[#256]: https://github.com/bitflags/bitflags/pull/256
 
 # 1.3.1
 
@@ -12,6 +246,8 @@
 
 # 1.3.0 (yanked)
 
+**This release bumps the Minimum Supported Rust Version to `1.46.0`**
+
 - Add `#[repr(transparent)]` ([#187])
 
 - End `empty` doc comment with full stop ([#202])
diff -Naur vendor-41.0.5/bitflags/CONTRIBUTING.md vendor-41.0.7/bitflags/CONTRIBUTING.md
--- vendor-41.0.5/bitflags/CONTRIBUTING.md	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags/CONTRIBUTING.md	1969-12-31 19:00:00.000000000 -0500
@@ -0,0 +1,9 @@
+# Updating compile-fail test outputs
+
+`bitflags` uses the `trybuild` crate to integration test its macros. Since Rust error messages change frequently enough that `nightly` builds produce spurious failures, we only check the compiler output in `beta` builds. If you run:
+
+```
+TRYBUILD=overwrite cargo +beta test --all
+```
+
+it will run the tests and update the `trybuild` output files.
diff -Naur vendor-41.0.5/bitflags/examples/custom_bits_type.rs vendor-41.0.7/bitflags/examples/custom_bits_type.rs
--- vendor-41.0.5/bitflags/examples/custom_bits_type.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags/examples/custom_bits_type.rs	1969-12-31 19:00:00.000000000 -0500
@@ -0,0 +1,97 @@
+use std::ops::{BitAnd, BitOr, BitXor, Not};
+
+use bitflags::{Bits, Flag, Flags};
+
+// Define a custom container that can be used in flags types
+// Note custom bits types can't be used in `bitflags!`
+// without making the trait impls `const`. This is currently
+// unstable
+#[derive(Clone, Copy, Debug)]
+pub struct CustomBits([bool; 3]);
+
+impl Bits for CustomBits {
+    const EMPTY: Self = CustomBits([false; 3]);
+
+    const ALL: Self = CustomBits([true; 3]);
+}
+
+impl PartialEq for CustomBits {
+    fn eq(&self, other: &Self) -> bool {
+        self.0 == other.0
+    }
+}
+
+impl BitAnd for CustomBits {
+    type Output = Self;
+
+    fn bitand(self, other: Self) -> Self {
+        CustomBits([
+            self.0[0] & other.0[0],
+            self.0[1] & other.0[1],
+            self.0[2] & other.0[2],
+        ])
+    }
+}
+
+impl BitOr for CustomBits {
+    type Output = Self;
+
+    fn bitor(self, other: Self) -> Self {
+        CustomBits([
+            self.0[0] | other.0[0],
+            self.0[1] | other.0[1],
+            self.0[2] | other.0[2],
+        ])
+    }
+}
+
+impl BitXor for CustomBits {
+    type Output = Self;
+
+    fn bitxor(self, other: Self) -> Self {
+        CustomBits([
+            self.0[0] & other.0[0],
+            self.0[1] & other.0[1],
+            self.0[2] & other.0[2],
+        ])
+    }
+}
+
+impl Not for CustomBits {
+    type Output = Self;
+
+    fn not(self) -> Self {
+        CustomBits([!self.0[0], !self.0[1], !self.0[2]])
+    }
+}
+
+#[derive(Clone, Copy, Debug)]
+pub struct CustomFlags(CustomBits);
+
+impl CustomFlags {
+    pub const A: Self = CustomFlags(CustomBits([true, false, false]));
+    pub const B: Self = CustomFlags(CustomBits([false, true, false]));
+    pub const C: Self = CustomFlags(CustomBits([false, false, true]));
+}
+
+impl Flags for CustomFlags {
+    const FLAGS: &'static [Flag<Self>] = &[
+        Flag::new("A", Self::A),
+        Flag::new("B", Self::B),
+        Flag::new("C", Self::C),
+    ];
+
+    type Bits = CustomBits;
+
+    fn bits(&self) -> Self::Bits {
+        self.0
+    }
+
+    fn from_bits_retain(bits: Self::Bits) -> Self {
+        CustomFlags(bits)
+    }
+}
+
+fn main() {
+    println!("{:?}", CustomFlags::A.union(CustomFlags::C));
+}
diff -Naur vendor-41.0.5/bitflags/examples/custom_derive.rs vendor-41.0.7/bitflags/examples/custom_derive.rs
--- vendor-41.0.5/bitflags/examples/custom_derive.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags/examples/custom_derive.rs	1969-12-31 19:00:00.000000000 -0500
@@ -0,0 +1,23 @@
+//! An example of implementing the `BitFlags` trait manually for a flags type.
+
+use std::str;
+
+use bitflags::bitflags;
+
+// Define a flags type outside of the `bitflags` macro as a newtype
+// It can accept custom derives for libaries `bitflags` doesn't support natively
+#[derive(zerocopy::AsBytes, zerocopy::FromBytes)]
+#[repr(transparent)]
+pub struct ManualFlags(u32);
+
+// Next: use `impl Flags` instead of `struct Flags`
+bitflags! {
+    impl ManualFlags: u32 {
+        const A = 0b00000001;
+        const B = 0b00000010;
+        const C = 0b00000100;
+        const ABC = Self::A.bits() | Self::B.bits() | Self::C.bits();
+    }
+}
+
+fn main() {}
diff -Naur vendor-41.0.5/bitflags/examples/fmt.rs vendor-41.0.7/bitflags/examples/fmt.rs
--- vendor-41.0.5/bitflags/examples/fmt.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags/examples/fmt.rs	1969-12-31 19:00:00.000000000 -0500
@@ -0,0 +1,49 @@
+//! An example of implementing Rust's standard formatting and parsing traits for flags types.
+
+use core::{fmt, str};
+
+bitflags::bitflags! {
+    // You can `#[derive]` the `Debug` trait, but implementing it manually
+    // can produce output like `A | B` instead of `Flags(A | B)`.
+    // #[derive(Debug)]
+    #[derive(PartialEq, Eq)]
+    pub struct Flags: u32 {
+        const A = 1;
+        const B = 2;
+        const C = 4;
+        const D = 8;
+    }
+}
+
+impl fmt::Debug for Flags {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        bitflags::parser::to_writer(self, f)
+    }
+}
+
+impl fmt::Display for Flags {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        bitflags::parser::to_writer(self, f)
+    }
+}
+
+impl str::FromStr for Flags {
+    type Err = bitflags::parser::ParseError;
+
+    fn from_str(flags: &str) -> Result<Self, Self::Err> {
+        bitflags::parser::from_str(flags)
+    }
+}
+
+fn main() -> Result<(), bitflags::parser::ParseError> {
+    let flags = Flags::A | Flags::B;
+
+    println!("{}", flags);
+
+    let formatted = flags.to_string();
+    let parsed: Flags = formatted.parse()?;
+
+    assert_eq!(flags, parsed);
+
+    Ok(())
+}
diff -Naur vendor-41.0.5/bitflags/examples/macro_free.rs vendor-41.0.7/bitflags/examples/macro_free.rs
--- vendor-41.0.5/bitflags/examples/macro_free.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags/examples/macro_free.rs	1969-12-31 19:00:00.000000000 -0500
@@ -0,0 +1,61 @@
+//! An example of implementing the `BitFlags` trait manually for a flags type.
+//!
+//! This example doesn't use any macros.
+
+use std::{fmt, str};
+
+use bitflags::{Flag, Flags};
+
+// First: Define your flags type. It just needs to be `Sized + 'static`.
+pub struct ManualFlags(u32);
+
+// Not required: Define some constants for valid flags
+impl ManualFlags {
+    pub const A: ManualFlags = ManualFlags(0b00000001);
+    pub const B: ManualFlags = ManualFlags(0b00000010);
+    pub const C: ManualFlags = ManualFlags(0b00000100);
+    pub const ABC: ManualFlags = ManualFlags(0b00000111);
+}
+
+// Next: Implement the `BitFlags` trait, specifying your set of valid flags
+// and iterators
+impl Flags for ManualFlags {
+    const FLAGS: &'static [Flag<Self>] = &[
+        Flag::new("A", Self::A),
+        Flag::new("B", Self::B),
+        Flag::new("C", Self::C),
+    ];
+
+    type Bits = u32;
+
+    fn bits(&self) -> u32 {
+        self.0
+    }
+
+    fn from_bits_retain(bits: u32) -> Self {
+        Self(bits)
+    }
+}
+
+// Not required: Add parsing support
+impl str::FromStr for ManualFlags {
+    type Err = bitflags::parser::ParseError;
+
+    fn from_str(input: &str) -> Result<Self, Self::Err> {
+        bitflags::parser::from_str(input)
+    }
+}
+
+// Not required: Add formatting support
+impl fmt::Display for ManualFlags {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        bitflags::parser::to_writer(self, f)
+    }
+}
+
+fn main() {
+    println!(
+        "{}",
+        ManualFlags::A.union(ManualFlags::B).union(ManualFlags::C)
+    );
+}
diff -Naur vendor-41.0.5/bitflags/examples/serde.rs vendor-41.0.7/bitflags/examples/serde.rs
--- vendor-41.0.5/bitflags/examples/serde.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags/examples/serde.rs	1969-12-31 19:00:00.000000000 -0500
@@ -0,0 +1,36 @@
+//! An example of implementing `serde::Serialize` and `serde::Deserialize`.
+//! The `#[serde(transparent)]` attribute is recommended to serialize directly
+//! to the underlying bits type without wrapping it in a `serde` newtype.
+
+#[cfg(feature = "serde")]
+fn main() {
+    use serde_derive::*;
+
+    bitflags::bitflags! {
+        #[derive(Serialize, Deserialize, Debug, PartialEq, Eq)]
+        #[serde(transparent)]
+        pub struct Flags: u32 {
+            const A = 1;
+            const B = 2;
+            const C = 4;
+            const D = 8;
+        }
+    }
+
+    let flags = Flags::A | Flags::B;
+
+    let serialized = serde_json::to_string(&flags).unwrap();
+
+    println!("{:?} -> {}", flags, serialized);
+
+    assert_eq!(serialized, r#""A | B""#);
+
+    let deserialized: Flags = serde_json::from_str(&serialized).unwrap();
+
+    println!("{} -> {:?}", serialized, flags);
+
+    assert_eq!(deserialized, flags);
+}
+
+#[cfg(not(feature = "serde"))]
+fn main() {}
diff -Naur vendor-41.0.5/bitflags/README.md vendor-41.0.7/bitflags/README.md
--- vendor-41.0.5/bitflags/README.md	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags/README.md	1969-12-31 19:00:00.000000000 -0500
@@ -2,14 +2,24 @@
 ========
 
 [![Rust](https://github.com/bitflags/bitflags/workflows/Rust/badge.svg)](https://github.com/bitflags/bitflags/actions)
-[![Join the chat at https://gitter.im/bitflags/Lobby](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/bitflags/Lobby?utm_source=badge&utm_medium=badge&utm_content=badge)
 [![Latest version](https://img.shields.io/crates/v/bitflags.svg)](https://crates.io/crates/bitflags)
 [![Documentation](https://docs.rs/bitflags/badge.svg)](https://docs.rs/bitflags)
 ![License](https://img.shields.io/crates/l/bitflags.svg)
 
-A Rust macro to generate structures which behave like a set of bitflags
+`bitflags` generates flags enums with well-defined semantics and ergonomic end-user APIs.
+
+You can use `bitflags` to:
+
+- provide more user-friendly bindings to C APIs where flags may or may not be fully known in advance.
+- generate efficient options types with string parsing and formatting support.
+
+You can't use `bitflags` to:
+
+- guarantee only bits corresponding to defined flags will ever be set. `bitflags` allows access to the underlying bits type so arbitrary bits may be set.
+- define bitfields. `bitflags` only generates types where set bits denote the presence of some combination of flags.
 
 - [Documentation](https://docs.rs/bitflags)
+- [Specification](https://github.com/bitflags/bitflags/blob/main/spec.md)
 - [Release notes](https://github.com/bitflags/bitflags/releases)
 
 ## Usage
@@ -18,7 +28,7 @@
 
 ```toml
 [dependencies]
-bitflags = "1.3"
+bitflags = "2.4.1"
 ```
 
 and this to your source code:
@@ -27,6 +37,41 @@
 use bitflags::bitflags;
 ```
 
+## Example
+
+Generate a flags structure:
+
+```rust
+use bitflags::bitflags;
+
+// The `bitflags!` macro generates `struct`s that manage a set of flags.
+bitflags! {
+    /// Represents a set of flags.
+    #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
+    struct Flags: u32 {
+        /// The value `A`, at bit position `0`.
+        const A = 0b00000001;
+        /// The value `B`, at bit position `1`.
+        const B = 0b00000010;
+        /// The value `C`, at bit position `2`.
+        const C = 0b00000100;
+
+        /// The combination of `A`, `B`, and `C`.
+        const ABC = Self::A.bits() | Self::B.bits() | Self::C.bits();
+    }
+}
+
+fn main() {
+    let e1 = Flags::A | Flags::C;
+    let e2 = Flags::B | Flags::C;
+    assert_eq!((e1 | e2), Flags::ABC);   // union
+    assert_eq!((e1 & e2), Flags::C);     // intersection
+    assert_eq!((e1 - e2), Flags::A);     // set difference
+    assert_eq!(!e2, Flags::A);           // set complement
+}
+```
+
 ## Rust Version Support
 
-The minimum supported Rust version is 1.46 due to use of associated constants and const functions.
+The minimum supported Rust version is documented in the `Cargo.toml` file.
+This may be bumped in minor releases as necessary.
diff -Naur vendor-41.0.5/bitflags/SECURITY.md vendor-41.0.7/bitflags/SECURITY.md
--- vendor-41.0.5/bitflags/SECURITY.md	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags/SECURITY.md	1969-12-31 19:00:00.000000000 -0500
@@ -0,0 +1,13 @@
+# Security Policy
+
+## Supported Versions
+
+Security updates are applied only to the latest release.
+
+## Reporting a Vulnerability
+
+If you have discovered a security vulnerability in this project, please report it privately. **Do not disclose it as a public issue.** This gives us time to work with you to fix the issue before public exposure, reducing the chance that the exploit will be used before a patch is released.
+
+Please disclose it at [security advisory](https://github.com/bitflags/bitflags/security/advisories/new).
+
+This project is maintained by a team of volunteers on a reasonable-effort basis. As such, please give us at least 90 days to work on a fix before public exposure.
diff -Naur vendor-41.0.5/bitflags/spec.md vendor-41.0.7/bitflags/spec.md
--- vendor-41.0.5/bitflags/spec.md	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags/spec.md	1969-12-31 19:00:00.000000000 -0500
@@ -0,0 +1,552 @@
+# Bitflags
+
+`bitflags` generates flags enums with well-defined semantics and ergonomic end-user APIs.
+
+You can use `bitflags` to:
+
+- provide more user-friendly bindings to C APIs where flags may or may not be fully known in advance.
+- generate efficient options types with string parsing and formatting support.
+
+You can't use `bitflags` to:
+
+- guarantee only bits corresponding to defined flags will ever be set. `bitflags` allows access to the underlying bits type so arbitrary bits may be set.
+- define bitfields. `bitflags` only generates types where set bits denote the presence of some combination of flags.
+
+## Definitions
+
+This section formally defines the terminology and semantics of `bitflags`. It's organized so more fundamental concepts are introduced before those that build on them. It may be helpful to start from the bottom of the section and refer back up to concepts defined earlier.
+
+Examples use `bitflags` syntax with `u8` as the bits type.
+
+### Bits type
+
+A type that defines a fixed number of bits at specific locations.
+
+----
+
+Bits types are typically fixed-width unsigned integers. For example, `u8` is a bits type that defines 8 bits; bit-0 through bit-7.
+
+### Bits value
+
+An instance of a bits type where each bit may be set (`1`) or unset (`0`).
+
+----
+
+Some examples of bits values for the bits type `u8` are:
+
+```rust
+0b0000_0000
+0b1111_1111
+0b1010_0101
+```
+
+#### Equality
+
+Two bits values are equal if their bits are in the same configuration; set bits in one are set in the other, and unset bits in one are unset in the other.
+
+#### Operations
+
+Bits values define the bitwise operators and (`&`), or (`|`), exclusive-or (`^`), and negation (`!`) that apply to each of their bits.
+
+### Flag
+
+A set of bits in a bits type that may have a unique name.
+
+----
+
+Bits are not required to be exclusive to a flag. Bits are not required to be contiguous.
+
+The following is a flag for `u8` with the name `A` that includes bit-0:
+
+```rust
+const A = 0b0000_0001;
+```
+
+The following is a flag for `u8` with the name `B` that includes bit-0, and bit-5:
+
+```rust
+const B = 0b0010_0001;
+```
+
+#### Named flag
+
+A flag with a name.
+
+----
+
+The following is a named flag, where the name is `A`:
+
+```rust
+const A = 0b0000_0001;
+```
+
+#### Unnamed flag
+
+A flag without a name.
+
+----
+
+The following is an unnamed flag:
+
+```rust
+const _ = 0b0000_0001;
+```
+
+#### Zero-bit flag
+
+A flag with a set of zero bits.
+
+----
+
+The following is a zero-bit flag:
+
+```rust
+const ZERO = 0b0000_0000;
+```
+
+#### Single-bit flag
+
+A flag with a set of one bit.
+
+----
+
+The following are single-bit flags:
+
+```rust
+const A = 0b0000_0001;
+const B = 0b0000_0010;
+```
+
+#### Multi-bit flag
+
+A flag with a set of more than one bit.
+
+----
+
+The following are multi-bit flags:
+
+```rust
+const A = 0b0000_0011;
+const B = 0b1111_1111;
+```
+
+### Flags type
+
+A set of defined flags over a specific bits type.
+
+#### Known bit
+
+A bit in any defined flag.
+
+----
+
+In the following flags type:
+
+```rust
+struct Flags {
+    const A = 0b0000_0001;
+    const B = 0b0000_0010;
+    const C = 0b0000_0100;
+}
+```
+
+the known bits are:
+
+```rust
+0b0000_0111
+```
+
+#### Unknown bit
+
+A bit not in any defined flag.
+
+----
+
+In the following flags type:
+
+```rust
+struct Flags {
+    const A = 0b0000_0001;
+    const B = 0b0000_0010;
+    const C = 0b0000_0100;
+}
+```
+
+the unknown bits are:
+
+```rust
+0b1111_1000
+```
+
+### Flags value
+
+An instance of a flags type using its specific bits value for storage.
+
+The flags value of a flag is one where each of its bits is set, and all others are unset.
+
+#### Contains
+
+Whether all set bits in a source flags value are also set in a target flags value.
+
+----
+
+Given the flags value:
+
+```rust
+0b0000_0011
+```
+
+the following flags values are contained:
+
+```rust
+0b0000_0000
+0b0000_0010
+0b0000_0001
+0b0000_0011
+```
+
+but the following flags values are not contained:
+
+```rust
+0b0000_1000
+0b0000_0110
+```
+
+#### Intersects
+
+Whether any set bits in a source flags value are also set in a target flags value.
+
+----
+
+Given the flags value:
+
+```rust
+0b0000_0011
+```
+
+the following flags intersect:
+
+```rust
+0b0000_0010
+0b0000_0001
+0b1111_1111
+```
+
+but the following flags values do not intersect:
+
+```rust
+0b0000_0000
+0b1111_0000
+```
+
+#### Empty
+
+Whether all bits in a flags value are unset.
+
+----
+
+The following flags value is empty:
+
+```rust
+0b0000_0000
+```
+
+The following flags values are not empty:
+
+```rust
+0b0000_0001
+0b0110_0000
+```
+
+#### All
+
+Whether all defined flags are contained in a flags value.
+
+----
+
+Given a flags type:
+
+```rust
+struct Flags {
+    const A   = 0b0000_0001;
+    const B   = 0b0000_0010;
+}
+```
+
+the following flags values all satisfy all:
+
+```rust
+0b0000_0011
+0b1000_0011
+0b1111_1111
+```
+
+### Operations
+
+Examples in this section all use the given flags type:
+
+```rust
+struct Flags {
+    const A = 0b0000_0001;
+    const B = 0b0000_0010;
+    const C = 0b0000_1100;
+}
+```
+
+#### Truncate
+
+Unset all unknown bits in a flags value.
+
+----
+
+Given the flags value:
+
+```rust
+0b1111_1111
+```
+
+the result of truncation will be:
+
+```rust
+0b0000_1111
+```
+
+----
+
+Truncating doesn't guarantee that a non-empty result will contain any defined flags. Given the following flags type:
+
+```rust
+struct Flags {
+    const A = 0b0000_0101;
+}
+```
+
+and the following flags value:
+
+```rust
+0b0000_1110;
+```
+
+The result of truncation will be:
+
+```rust
+0b0000_0100;
+```
+
+which intersects the flag `A`, but doesn't contain it.
+
+This behavior is possible even when only operating with flags values containing defined flags. Given the following flags type:
+
+```rust
+struct Flags {
+    const A = 0b0000_0101;
+    const B = 0b0000_0001;
+}
+```
+
+The result of `A ^ B` is `0b0000_0100`, which also doesn't contain any defined flag.
+
+----
+
+If all known bits are in the set of at least one defined single-bit flag, then all operations that produce non-empty results will always contain defined flags.
+
+#### Union
+
+The bitwise or (`|`) of the bits in two flags values.
+
+----
+
+The following are examples of the result of unioning flags values:
+
+```rust
+0b0000_0001 | 0b0000_0010 = 0b0000_0011
+0b0000_0000 | 0b1111_1111 = 0b1111_1111
+```
+
+#### Intersection
+
+The bitwise and (`&`) of the bits in two flags values.
+
+----
+
+The following are examples of the result of intersecting flags values:
+
+```rust
+0b0000_0001 & 0b0000_0010 = 0b0000_0000
+0b1111_1100 & 0b1111_0111 = 0b1111_0100
+0b1111_1111 & 0b1111_1111 = 0b1111_1111
+```
+
+#### Symmetric difference
+
+The bitwise exclusive-or (`^`) of the bits in two flags values.
+
+----
+
+The following are examples of the symmetric difference between two flags values:
+
+```rust
+0b0000_0001 ^ 0b0000_0010 = 0b0000_0011
+0b0000_1111 ^ 0b0000_0011 = 0b0000_1100
+0b1100_0000 ^ 0b0011_0000 = 0b1111_0000
+```
+
+#### Complement
+
+The bitwise negation (`!`) of the bits in a flags value, truncating the result.
+
+----
+
+The following are examples of the complement of a flags value:
+
+```rust
+!0b0000_0000 = 0b0000_1111
+!0b0000_1111 = 0b0000_0000
+!0b1111_1000 = 0b0000_0111
+```
+
+#### Difference
+
+The bitwise union (`|`) of the bits in one flags value and the bitwise negation (`!`) of the bits in another.
+
+----
+
+This operation is not equivalent to the intersection of one flags value with the complement of another (`&!`).
+The former will truncate the result, where difference will not.
+
+----
+
+The following are examples of the difference between two flags values:
+
+```rust
+0b0000_0001 & !0b0000_0010 = 0b0000_0001
+0b0000_1101 & !0b0000_0011 = 0b0000_1100
+0b1111_1111 & !0b0000_0001 = 0b1111_1110
+```
+
+### Iteration
+
+Yield the bits of a source flags value in a set of contained flags values.
+
+----
+
+To be most useful, each yielded flags value should set exactly the bits of a defined flag contained in the source. Any known bits that aren't in the set of any contained flag should be yielded together as a final flags value.
+
+----
+
+Given the following flags type:
+
+```rust
+struct Flags {
+    const A  = 0b0000_0001;
+    const B  = 0b0000_0010;
+    const AB = 0b0000_0011;
+}
+```
+
+and the following flags value:
+
+```rust
+0b0000_1111
+```
+
+When iterated it may yield a flags value for `A` and `B`, then a final flag with the unknown bits:
+
+```rust
+0b0000_0001
+0b0000_0010
+0b0000_1100
+```
+
+It may also yield a flags value for `AB`, then a final flag with the unknown bits:
+
+```rust
+0b0000_0011
+0b0000_1100
+```
+
+----
+
+Given the following flags type:
+
+```rust
+struct Flags {
+    const A = 0b0000_0011;
+}
+```
+
+and the following flags value:
+
+```rust
+0b0000_0001
+```
+
+When iterated it will still yield a flags value for the known bit `0b0000_0001` even though it doesn't contain a flag.
+
+### Formatting
+
+Format and parse a flags value as text using the following grammar:
+
+- _Flags:_ (_Whitespace_ _Flag_ _Whitespace_)`|`*
+- _Flag:_ _Name_ | _Hex Number_
+- _Name:_ The name of any defined flag
+- _Hex Number_: `0x`([0-9a-fA-F])*
+- _Whitespace_: (\s)*
+
+Flags values can be formatted as _Flags_ by iterating over them, formatting each yielded flags value as a _Flag_. Any yielded flags value that sets exactly the bits of a defined flag with a name should be formatted as a _Name_. Otherwise it must be formatted as a _Hex Number_.
+
+Formatting and parsing supports three modes:
+
+- **Retain**: Formatting and parsing roundtrips exactly the bits of the source flags value. This is the default behavior.
+- **Truncate**: Flags values are truncated before formatting, and truncated after parsing.
+- **Strict**: A _Flag_ may only be formatted and parsed as a _Name_. _Hex numbers_ are not allowed. A consequence of this is that unknown bits and any bits that aren't in a contained named flag will be ignored. This is recommended for flags values serialized across API boundaries, like web services.
+
+Text that is empty or whitespace is an empty flags value.
+
+----
+
+Given the following flags type:
+
+```rust
+struct Flags {
+    const A  = 0b0000_0001;
+    const B  = 0b0000_0010;
+    const AB = 0b0000_0011;
+    const C  = 0b0000_1100;
+}
+```
+
+The following are examples of how flags values can be formatted using any mode:
+
+```rust
+0b0000_0000 = ""
+0b0000_0001 = "A"
+0b0000_0010 = "B"
+0b0000_0011 = "A | B"
+0b0000_0011 = "AB"
+0b0000_1111 = "A | B | C"
+```
+
+Truncate mode will unset any unknown bits:
+
+```rust
+0b1000_0000 = ""
+0b1111_1111 = "A | B | C"
+0b0000_1000 = "0x8"
+```
+
+Retain mode will include any unknown bits as a final _Flag_:
+
+```rust
+0b1000_0000 = "0x80"
+0b1111_1111 = "A | B | C | 0xf0"
+0b0000_1000 = "0x8"
+```
+
+Strict mode will unset any unknown bits, as well as bits not contained in any defined named flags:
+
+```rust
+0b1000_0000 = ""
+0b1111_1111 = "A | B | C"
+0b0000_1000 = ""
+```
diff -Naur vendor-41.0.5/bitflags/src/example_generated.rs vendor-41.0.7/bitflags/src/example_generated.rs
--- vendor-41.0.5/bitflags/src/example_generated.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags/src/example_generated.rs	1969-12-31 19:00:00.000000000 -0500
@@ -1,14 +1,65 @@
 //! This module shows an example of code generated by the macro. **IT MUST NOT BE USED OUTSIDE THIS
 //! CRATE**.
+//!
+//! Usually, when you call the `bitflags!` macro, only the `Flags` type would be visible. In this
+//! example, the `Field0`, `Iter`, and `IterRaw` types are also exposed so that you can explore
+//! their APIs. The `Field0` type can be accessed as `self.0` on an instance of `Flags`.
 
-bitflags! {
+__declare_public_bitflags! {
     /// This is the same `Flags` struct defined in the [crate level example](../index.html#example).
     /// Note that this struct is just for documentation purposes only, it must not be used outside
     /// this crate.
-    pub struct Flags: u32 {
+    pub struct Flags
+}
+
+__declare_internal_bitflags! {
+    pub struct Field0: u32
+}
+
+__impl_internal_bitflags! {
+    Field0: u32, Flags {
+        // Field `A`.
+        ///
+        /// This flag has the value `0b00000001`.
+        const A = 0b00000001;
+        /// Field `B`.
+        ///
+        /// This flag has the value `0b00000010`.
+        const B = 0b00000010;
+        /// Field `C`.
+        ///
+        /// This flag has the value `0b00000100`.
+        const C = 0b00000100;
+        const ABC = Self::A.bits() | Self::B.bits() | Self::C.bits();
+    }
+}
+
+__impl_public_bitflags_forward! {
+    Flags: u32, Field0
+}
+
+__impl_public_bitflags_ops! {
+    Flags
+}
+
+__impl_public_bitflags_iter! {
+    Flags: u32, Flags
+}
+
+__impl_public_bitflags_consts! {
+    Flags: u32 {
+        /// Field `A`.
+        ///
+        /// This flag has the value `0b00000001`.
         const A = 0b00000001;
+        /// Field `B`.
+        ///
+        /// This flag has the value `0b00000010`.
         const B = 0b00000010;
+        /// Field `C`.
+        ///
+        /// This flag has the value `0b00000100`.
         const C = 0b00000100;
-        const ABC = Self::A.bits | Self::B.bits | Self::C.bits;
+        const ABC = Self::A.bits() | Self::B.bits() | Self::C.bits();
     }
 }
diff -Naur vendor-41.0.5/bitflags/src/external/arbitrary.rs vendor-41.0.7/bitflags/src/external/arbitrary.rs
--- vendor-41.0.5/bitflags/src/external/arbitrary.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags/src/external/arbitrary.rs	1969-12-31 19:00:00.000000000 -0500
@@ -0,0 +1,33 @@
+//! Specialized fuzzing for flags types using `arbitrary`.
+
+use crate::Flags;
+
+/**
+Generate some arbitrary flags value with only known bits set.
+*/
+pub fn arbitrary<'a, B: Flags>(u: &mut arbitrary::Unstructured<'a>) -> arbitrary::Result<B>
+where
+    B::Bits: arbitrary::Arbitrary<'a>,
+{
+    B::from_bits(u.arbitrary()?).ok_or_else(|| arbitrary::Error::IncorrectFormat)
+}
+
+#[cfg(test)]
+mod tests {
+    use arbitrary::Arbitrary;
+
+    bitflags! {
+        #[derive(Arbitrary)]
+        struct Color: u32 {
+            const RED = 0x1;
+            const GREEN = 0x2;
+            const BLUE = 0x4;
+        }
+    }
+
+    #[test]
+    fn test_arbitrary() {
+        let mut unstructured = arbitrary::Unstructured::new(&[0_u8; 256]);
+        let _color = Color::arbitrary(&mut unstructured);
+    }
+}
diff -Naur vendor-41.0.5/bitflags/src/external/bytemuck.rs vendor-41.0.7/bitflags/src/external/bytemuck.rs
--- vendor-41.0.5/bitflags/src/external/bytemuck.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags/src/external/bytemuck.rs	1969-12-31 19:00:00.000000000 -0500
@@ -0,0 +1,19 @@
+#[cfg(test)]
+mod tests {
+    use bytemuck::{Pod, Zeroable};
+
+    bitflags! {
+        #[derive(Pod, Zeroable, Clone, Copy)]
+        #[repr(transparent)]
+        struct Color: u32 {
+            const RED = 0x1;
+            const GREEN = 0x2;
+            const BLUE = 0x4;
+        }
+    }
+
+    #[test]
+    fn test_bytemuck() {
+        assert_eq!(0x1, bytemuck::cast::<Color, u32>(Color::RED));
+    }
+}
diff -Naur vendor-41.0.5/bitflags/src/external/serde.rs vendor-41.0.7/bitflags/src/external/serde.rs
--- vendor-41.0.5/bitflags/src/external/serde.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags/src/external/serde.rs	1969-12-31 19:00:00.000000000 -0500
@@ -0,0 +1,93 @@
+//! Specialized serialization for flags types using `serde`.
+
+use crate::{
+    parser::{self, ParseHex, WriteHex},
+    Flags,
+};
+use core::{fmt, str};
+use serde::{
+    de::{Error, Visitor},
+    Deserialize, Deserializer, Serialize, Serializer,
+};
+
+/**
+Serialize a set of flags as a human-readable string or their underlying bits.
+
+Any unknown bits will be retained.
+*/
+pub fn serialize<B: Flags, S: Serializer>(flags: &B, serializer: S) -> Result<S::Ok, S::Error>
+where
+    B::Bits: WriteHex + Serialize,
+{
+    // Serialize human-readable flags as a string like `"A | B"`
+    if serializer.is_human_readable() {
+        serializer.collect_str(&parser::AsDisplay(flags))
+    }
+    // Serialize non-human-readable flags directly as the underlying bits
+    else {
+        flags.bits().serialize(serializer)
+    }
+}
+
+/**
+Deserialize a set of flags from a human-readable string or their underlying bits.
+
+Any unknown bits will be retained.
+*/
+pub fn deserialize<'de, B: Flags, D: Deserializer<'de>>(deserializer: D) -> Result<B, D::Error>
+where
+    B::Bits: ParseHex + Deserialize<'de>,
+{
+    if deserializer.is_human_readable() {
+        // Deserialize human-readable flags by parsing them from strings like `"A | B"`
+        struct FlagsVisitor<B>(core::marker::PhantomData<B>);
+
+        impl<'de, B: Flags> Visitor<'de> for FlagsVisitor<B>
+        where
+            B::Bits: ParseHex,
+        {
+            type Value = B;
+
+            fn expecting(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
+                formatter.write_str("a string value of `|` separated flags")
+            }
+
+            fn visit_str<E: Error>(self, flags: &str) -> Result<Self::Value, E> {
+                parser::from_str(flags).map_err(|e| E::custom(e))
+            }
+        }
+
+        deserializer.deserialize_str(FlagsVisitor(Default::default()))
+    } else {
+        // Deserialize non-human-readable flags directly from the underlying bits
+        let bits = B::Bits::deserialize(deserializer)?;
+
+        Ok(B::from_bits_retain(bits))
+    }
+}
+
+#[cfg(test)]
+mod tests {
+    use serde_test::{assert_tokens, Configure, Token::*};
+    bitflags! {
+        #[derive(serde_derive::Serialize, serde_derive::Deserialize, Debug, PartialEq, Eq)]
+        #[serde(transparent)]
+        struct SerdeFlags: u32 {
+            const A = 1;
+            const B = 2;
+            const C = 4;
+            const D = 8;
+        }
+    }
+
+    #[test]
+    fn test_serde_bitflags_default() {
+        assert_tokens(&SerdeFlags::empty().readable(), &[Str("")]);
+
+        assert_tokens(&SerdeFlags::empty().compact(), &[U32(0)]);
+
+        assert_tokens(&(SerdeFlags::A | SerdeFlags::B).readable(), &[Str("A | B")]);
+
+        assert_tokens(&(SerdeFlags::A | SerdeFlags::B).compact(), &[U32(1 | 2)]);
+    }
+}
diff -Naur vendor-41.0.5/bitflags/src/external.rs vendor-41.0.7/bitflags/src/external.rs
--- vendor-41.0.5/bitflags/src/external.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags/src/external.rs	1969-12-31 19:00:00.000000000 -0500
@@ -0,0 +1,262 @@
+//! Conditional trait implementations for external libraries.
+
+/*
+How do I support a new external library?
+
+Let's say we want to add support for `my_library`.
+
+First, we create a module under `external`, like `serde` with any specialized code.
+Ideally, any utilities in here should just work off the `Flags` trait and maybe a
+few other assumed bounds.
+
+Next, re-export the library from the `__private` module here.
+
+Next, define a macro like so:
+
+```rust
+#[macro_export(local_inner_macros)]
+#[doc(hidden)]
+#[cfg(feature = "serde")]
+macro_rules! __impl_external_bitflags_my_library {
+    (
+        $InternalBitFlags:ident: $T:ty, $PublicBitFlags:ident {
+            $(
+                $(#[$inner:ident $($args:tt)*])*
+                const $Flag:tt;
+            )*
+        }
+    ) => {
+        // Implementation goes here
+    };
+}
+
+#[macro_export(local_inner_macros)]
+#[doc(hidden)]
+#[cfg(not(feature = "my_library"))]
+macro_rules! __impl_external_bitflags_my_library {
+    (
+        $InternalBitFlags:ident: $T:ty, $PublicBitFlags:ident {
+            $(
+                $(#[$inner:ident $($args:tt)*])*
+                const $Flag:tt;
+            )*
+        }
+    ) => {};
+}
+```
+
+Note that the macro is actually defined twice; once for when the `my_library` feature
+is available, and once for when it's not. This is because the `__impl_external_bitflags_my_library`
+macro is called in an end-user's library, not in `bitflags`. In an end-user's library we don't
+know whether or not a particular feature of `bitflags` is enabled, so we unconditionally call
+the macro, where the body of that macro depends on the feature flag.
+
+Now, we add our macro call to the `__impl_external_bitflags` macro body:
+
+```rust
+__impl_external_bitflags_my_library! {
+    $InternalBitFlags: $T, $PublicBitFlags {
+        $(
+            $(#[$inner $($args)*])*
+            const $Flag;
+        )*
+    }
+}
+```
+*/
+
+pub(crate) mod __private {
+    #[cfg(feature = "serde")]
+    pub use serde;
+
+    #[cfg(feature = "arbitrary")]
+    pub use arbitrary;
+
+    #[cfg(feature = "bytemuck")]
+    pub use bytemuck;
+}
+
+/// Implements traits from external libraries for the internal bitflags type.
+#[macro_export(local_inner_macros)]
+#[doc(hidden)]
+macro_rules! __impl_external_bitflags {
+    (
+        $InternalBitFlags:ident: $T:ty, $PublicBitFlags:ident {
+            $(
+                $(#[$inner:ident $($args:tt)*])*
+                const $Flag:tt;
+            )*
+        }
+    ) => {
+        // Any new library traits impls should be added here
+        // Use `serde` as an example: generate code when the feature is available,
+        // and a no-op when it isn't
+
+        __impl_external_bitflags_serde! {
+            $InternalBitFlags: $T, $PublicBitFlags {
+                $(
+                    $(#[$inner $($args)*])*
+                    const $Flag;
+                )*
+            }
+        }
+
+        __impl_external_bitflags_arbitrary! {
+            $InternalBitFlags: $T, $PublicBitFlags {
+                $(
+                    $(#[$inner $($args)*])*
+                    const $Flag;
+                )*
+            }
+        }
+
+        __impl_external_bitflags_bytemuck! {
+            $InternalBitFlags: $T, $PublicBitFlags {
+                $(
+                    $(#[$inner $($args)*])*
+                    const $Flag;
+                )*
+            }
+        }
+    };
+}
+
+#[cfg(feature = "serde")]
+pub mod serde;
+
+/// Implement `Serialize` and `Deserialize` for the internal bitflags type.
+#[macro_export(local_inner_macros)]
+#[doc(hidden)]
+#[cfg(feature = "serde")]
+macro_rules! __impl_external_bitflags_serde {
+    (
+        $InternalBitFlags:ident: $T:ty, $PublicBitFlags:ident {
+            $(
+                $(#[$inner:ident $($args:tt)*])*
+                const $Flag:tt;
+            )*
+        }
+    ) => {
+        impl $crate::__private::serde::Serialize for $InternalBitFlags {
+            fn serialize<S: $crate::__private::serde::Serializer>(
+                &self,
+                serializer: S,
+            ) -> $crate::__private::core::result::Result<S::Ok, S::Error> {
+                $crate::serde::serialize(
+                    &$PublicBitFlags::from_bits_retain(self.bits()),
+                    serializer,
+                )
+            }
+        }
+
+        impl<'de> $crate::__private::serde::Deserialize<'de> for $InternalBitFlags {
+            fn deserialize<D: $crate::__private::serde::Deserializer<'de>>(
+                deserializer: D,
+            ) -> $crate::__private::core::result::Result<Self, D::Error> {
+                let flags: $PublicBitFlags = $crate::serde::deserialize(deserializer)?;
+
+                Ok(flags.0)
+            }
+        }
+    };
+}
+
+#[macro_export(local_inner_macros)]
+#[doc(hidden)]
+#[cfg(not(feature = "serde"))]
+macro_rules! __impl_external_bitflags_serde {
+    (
+        $InternalBitFlags:ident: $T:ty, $PublicBitFlags:ident {
+            $(
+                $(#[$inner:ident $($args:tt)*])*
+                const $Flag:tt;
+            )*
+        }
+    ) => {};
+}
+
+#[cfg(feature = "arbitrary")]
+pub mod arbitrary;
+
+#[cfg(feature = "bytemuck")]
+mod bytemuck;
+
+/// Implement `Arbitrary` for the internal bitflags type.
+#[macro_export(local_inner_macros)]
+#[doc(hidden)]
+#[cfg(feature = "arbitrary")]
+macro_rules! __impl_external_bitflags_arbitrary {
+    (
+            $InternalBitFlags:ident: $T:ty, $PublicBitFlags:ident {
+                $(
+                    $(#[$inner:ident $($args:tt)*])*
+                    const $Flag:tt;
+                )*
+            }
+    ) => {
+        impl<'a> $crate::__private::arbitrary::Arbitrary<'a> for $InternalBitFlags {
+            fn arbitrary(
+                u: &mut $crate::__private::arbitrary::Unstructured<'a>,
+            ) -> $crate::__private::arbitrary::Result<Self> {
+                $crate::arbitrary::arbitrary::<$PublicBitFlags>(u).map(|flags| flags.0)
+            }
+        }
+    };
+}
+
+#[macro_export(local_inner_macros)]
+#[doc(hidden)]
+#[cfg(not(feature = "arbitrary"))]
+macro_rules! __impl_external_bitflags_arbitrary {
+    (
+        $InternalBitFlags:ident: $T:ty, $PublicBitFlags:ident {
+            $(
+                $(#[$inner:ident $($args:tt)*])*
+                const $Flag:tt;
+            )*
+        }
+    ) => {};
+}
+
+/// Implement `Pod` and `Zeroable` for the internal bitflags type.
+#[macro_export(local_inner_macros)]
+#[doc(hidden)]
+#[cfg(feature = "bytemuck")]
+macro_rules! __impl_external_bitflags_bytemuck {
+    (
+        $InternalBitFlags:ident: $T:ty, $PublicBitFlags:ident {
+            $(
+                $(#[$inner:ident $($args:tt)*])*
+                const $Flag:tt;
+            )*
+        }
+    ) => {
+        // SAFETY: $InternalBitFlags is guaranteed to have the same ABI as $T,
+        // and $T implements Pod
+        unsafe impl $crate::__private::bytemuck::Pod for $InternalBitFlags where
+            $T: $crate::__private::bytemuck::Pod
+        {
+        }
+
+        // SAFETY: $InternalBitFlags is guaranteed to have the same ABI as $T,
+        // and $T implements Zeroable
+        unsafe impl $crate::__private::bytemuck::Zeroable for $InternalBitFlags where
+            $T: $crate::__private::bytemuck::Zeroable
+        {
+        }
+    };
+}
+
+#[macro_export(local_inner_macros)]
+#[doc(hidden)]
+#[cfg(not(feature = "bytemuck"))]
+macro_rules! __impl_external_bitflags_bytemuck {
+    (
+        $InternalBitFlags:ident: $T:ty, $PublicBitFlags:ident {
+            $(
+                $(#[$inner:ident $($args:tt)*])*
+                const $Flag:tt;
+            )*
+        }
+    ) => {};
+}
diff -Naur vendor-41.0.5/bitflags/src/internal.rs vendor-41.0.7/bitflags/src/internal.rs
--- vendor-41.0.5/bitflags/src/internal.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags/src/internal.rs	1969-12-31 19:00:00.000000000 -0500
@@ -0,0 +1,125 @@
+//! Generate the internal `bitflags`-facing flags type.
+//!
+//! The code generated here is owned by `bitflags`, but still part of its public API.
+//! Changes to the types generated here need to be considered like any other public API change.
+
+/// 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)]
+#[doc(hidden)]
+macro_rules! __declare_internal_bitflags {
+    (
+        $vis:vis struct $InternalBitFlags:ident: $T:ty
+    ) => {
+        // NOTE: The ABI of this type is _guaranteed_ to be the same as `T`
+        // This is relied on by some external libraries like `bytemuck` to make
+        // its `unsafe` trait impls sound.
+        #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
+        #[repr(transparent)]
+        $vis struct $InternalBitFlags($T);
+    };
+}
+
+/// Implement functions on the private (bitflags-facing) bitflags type.
+///
+/// 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)]
+#[doc(hidden)]
+macro_rules! __impl_internal_bitflags {
+    (
+        $InternalBitFlags:ident: $T:ty, $PublicBitFlags:ident {
+            $(
+                $(#[$inner:ident $($args:tt)*])*
+                const $Flag:tt = $value:expr;
+            )*
+        }
+    ) => {
+        // NOTE: This impl is also used to prevent using bits types from non-primitive types
+        // in the `bitflags` macro. If this approach is changed, this guard will need to be
+        // retained somehow
+        impl $crate::__private::PublicFlags for $PublicBitFlags {
+            type Primitive = $T;
+            type Internal = $InternalBitFlags;
+        }
+
+        impl $crate::__private::core::default::Default for $InternalBitFlags {
+            #[inline]
+            fn default() -> Self {
+                $InternalBitFlags::empty()
+            }
+        }
+
+        impl $crate::__private::core::fmt::Debug for $InternalBitFlags {
+            fn fmt(&self, f: &mut $crate::__private::core::fmt::Formatter<'_>) -> $crate::__private::core::fmt::Result {
+                if self.is_empty() {
+                    // If no flags are set then write an empty hex flag to avoid
+                    // writing an empty string. In some contexts, like serialization,
+                    // an empty string is preferable, but it may be unexpected in
+                    // others for a format not to produce any output.
+                    //
+                    // We can remove this `0x0` and remain compatible with `FromStr`,
+                    // because an empty string will still parse to an empty set of flags,
+                    // just like `0x0` does.
+                    $crate::__private::core::write!(f, "{:#x}", <$T as $crate::Bits>::EMPTY)
+                } else {
+                    $crate::__private::core::fmt::Display::fmt(self, f)
+                }
+            }
+        }
+
+        impl $crate::__private::core::fmt::Display for $InternalBitFlags {
+            fn fmt(&self, f: &mut $crate::__private::core::fmt::Formatter<'_>) -> $crate::__private::core::fmt::Result {
+                $crate::parser::to_writer(&$PublicBitFlags(*self), f)
+            }
+        }
+
+        impl $crate::__private::core::str::FromStr for $InternalBitFlags {
+            type Err = $crate::parser::ParseError;
+
+            fn from_str(s: &str) -> $crate::__private::core::result::Result<Self, Self::Err> {
+                $crate::parser::from_str::<$PublicBitFlags>(s).map(|flags| flags.0)
+            }
+        }
+
+        impl $crate::__private::core::convert::AsRef<$T> for $InternalBitFlags {
+            fn as_ref(&self) -> &$T {
+                &self.0
+            }
+        }
+
+        impl $crate::__private::core::convert::From<$T> for $InternalBitFlags {
+            fn from(bits: $T) -> Self {
+                Self::from_bits_retain(bits)
+            }
+        }
+
+        // The internal flags type offers a similar API to the public one
+
+        __impl_public_bitflags! {
+            $InternalBitFlags: $T, $PublicBitFlags {
+                $(
+                    $(#[$inner $($args)*])*
+                    const $Flag = $value;
+                )*
+            }
+        }
+
+        __impl_public_bitflags_ops! {
+            $InternalBitFlags
+        }
+
+        __impl_public_bitflags_iter! {
+            $InternalBitFlags: $T, $PublicBitFlags
+        }
+
+        impl $InternalBitFlags {
+            /// Returns a mutable reference to the raw value of the flags currently stored.
+            #[inline]
+            pub fn bits_mut(&mut self) -> &mut $T {
+                &mut self.0
+            }
+        }
+    };
+}
diff -Naur vendor-41.0.5/bitflags/src/iter.rs vendor-41.0.7/bitflags/src/iter.rs
--- vendor-41.0.5/bitflags/src/iter.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags/src/iter.rs	1969-12-31 19:00:00.000000000 -0500
@@ -0,0 +1,145 @@
+/*!
+Yield the bits of a source flags value in a set of contained flags values.
+*/
+
+use crate::{Flag, Flags};
+
+/**
+An iterator over flags values.
+
+This iterator will yield flags values for contained, defined flags first, with any remaining bits yielded
+as a final flags value.
+*/
+pub struct Iter<B: 'static> {
+    inner: IterNames<B>,
+    done: bool,
+}
+
+impl<B: Flags> Iter<B> {
+    pub(crate) fn new(flags: &B) -> Self {
+        Iter {
+            inner: IterNames::new(flags),
+            done: false,
+        }
+    }
+}
+
+impl<B: 'static> Iter<B> {
+    // Used by the `bitflags` macro
+    #[doc(hidden)]
+    pub const fn __private_const_new(flags: &'static [Flag<B>], source: B, remaining: B) -> Self {
+        Iter {
+            inner: IterNames::__private_const_new(flags, source, remaining),
+            done: false,
+        }
+    }
+}
+
+impl<B: Flags> Iterator for Iter<B> {
+    type Item = B;
+
+    fn next(&mut self) -> Option<Self::Item> {
+        match self.inner.next() {
+            Some((_, flag)) => Some(flag),
+            None if !self.done => {
+                self.done = true;
+
+                // After iterating through valid names, if there are any bits left over
+                // then return one final value that includes them. This makes `into_iter`
+                // and `from_iter` roundtrip
+                if !self.inner.remaining().is_empty() {
+                    Some(B::from_bits_retain(self.inner.remaining.bits()))
+                } else {
+                    None
+                }
+            }
+            None => None,
+        }
+    }
+}
+
+/**
+An iterator over flags values.
+
+This iterator only yields flags values for contained, defined, named flags. Any remaining bits
+won't be yielded, but can be found with the [`IterNames::remaining`] method.
+*/
+pub struct IterNames<B: 'static> {
+    flags: &'static [Flag<B>],
+    idx: usize,
+    source: B,
+    remaining: B,
+}
+
+impl<B: Flags> IterNames<B> {
+    pub(crate) fn new(flags: &B) -> Self {
+        IterNames {
+            flags: B::FLAGS,
+            idx: 0,
+            remaining: B::from_bits_retain(flags.bits()),
+            source: B::from_bits_retain(flags.bits()),
+        }
+    }
+}
+
+impl<B: 'static> IterNames<B> {
+    // Used by the bitflags macro
+    #[doc(hidden)]
+    pub const fn __private_const_new(flags: &'static [Flag<B>], source: B, remaining: B) -> Self {
+        IterNames {
+            flags,
+            idx: 0,
+            remaining,
+            source,
+        }
+    }
+
+    /// Get a flags value of any remaining bits that haven't been yielded yet.
+    ///
+    /// Once the iterator has finished, this method can be used to
+    /// check whether or not there are any bits that didn't correspond
+    /// to a contained, defined, named flag remaining.
+    pub fn remaining(&self) -> &B {
+        &self.remaining
+    }
+}
+
+impl<B: Flags> Iterator for IterNames<B> {
+    type Item = (&'static str, B);
+
+    fn next(&mut self) -> Option<Self::Item> {
+        while let Some(flag) = self.flags.get(self.idx) {
+            // Short-circuit if our state is empty
+            if self.remaining.is_empty() {
+                return None;
+            }
+
+            self.idx += 1;
+
+            // Skip unnamed flags
+            if flag.name().is_empty() {
+                continue;
+            }
+
+            let bits = flag.value().bits();
+
+            // If the flag is set in the original source _and_ it has bits that haven't
+            // been covered by a previous flag yet then yield it. These conditions cover
+            // two cases for multi-bit flags:
+            //
+            // 1. When flags partially overlap, such as `0b00000001` and `0b00000101`, we'll
+            // yield both flags.
+            // 2. When flags fully overlap, such as in convenience flags that are a shorthand for others,
+            // we won't yield both flags.
+            if self.source.contains(B::from_bits_retain(bits))
+                && self.remaining.intersects(B::from_bits_retain(bits))
+            {
+                self.remaining.remove(B::from_bits_retain(bits));
+
+                return Some((flag.name(), B::from_bits_retain(bits)));
+            }
+        }
+
+        None
+    }
+}
diff -Naur vendor-41.0.5/bitflags/src/lib.rs vendor-41.0.7/bitflags/src/lib.rs
--- vendor-41.0.5/bitflags/src/lib.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags/src/lib.rs	1969-12-31 19:00:00.000000000 -0500
@@ -8,1722 +8,914 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-//! A typesafe bitmask flag generator useful for sets of C-style bitmask flags.
-//! It can be used for creating typesafe wrappers around C APIs.
-//!
-//! The `bitflags!` macro generates `struct`s that manage a set of flags. The
-//! flags should only be defined for integer types, otherwise unexpected type
-//! errors may occur at compile time.
-//!
-//! # Example
-//!
-//! ```
-//! use bitflags::bitflags;
-//!
-//! bitflags! {
-//!     struct Flags: u32 {
-//!         const A = 0b00000001;
-//!         const B = 0b00000010;
-//!         const C = 0b00000100;
-//!         const ABC = Self::A.bits | Self::B.bits | Self::C.bits;
-//!     }
-//! }
-//!
-//! fn main() {
-//!     let e1 = Flags::A | Flags::C;
-//!     let e2 = Flags::B | Flags::C;
-//!     assert_eq!((e1 | e2), Flags::ABC);   // union
-//!     assert_eq!((e1 & e2), Flags::C);     // intersection
-//!     assert_eq!((e1 - e2), Flags::A);     // set difference
-//!     assert_eq!(!e2, Flags::A);           // set complement
-//! }
-//! ```
-//!
-//! See [`example_generated::Flags`](./example_generated/struct.Flags.html) for documentation of code
-//! generated by the above `bitflags!` expansion.
-//!
-//! The generated `struct`s can also be extended with type and trait
-//! implementations:
-//!
-//! ```
-//! use std::fmt;
-//!
-//! use bitflags::bitflags;
-//!
-//! bitflags! {
-//!     struct Flags: u32 {
-//!         const A = 0b00000001;
-//!         const B = 0b00000010;
-//!     }
-//! }
-//!
-//! impl Flags {
-//!     pub fn clear(&mut self) {
-//!         self.bits = 0;  // The `bits` field can be accessed from within the
-//!                         // same module where the `bitflags!` macro was invoked.
-//!     }
-//! }
-//!
-//! impl fmt::Display for Flags {
-//!     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-//!         write!(f, "hi!")
-//!     }
-//! }
-//!
-//! fn main() {
-//!     let mut flags = Flags::A | Flags::B;
-//!     flags.clear();
-//!     assert!(flags.is_empty());
-//!     assert_eq!(format!("{}", flags), "hi!");
-//!     assert_eq!(format!("{:?}", Flags::A | Flags::B), "A | B");
-//!     assert_eq!(format!("{:?}", Flags::B), "B");
-//! }
-//! ```
-//!
-//! # Visibility
-//!
-//! The generated structs and their associated flag constants are not exported
-//! out of the current module by default. A definition can be exported out of
-//! the current module by adding `pub` before `struct`:
-//!
-//! ```
-//! mod example {
-//!     use bitflags::bitflags;
-//!
-//!     bitflags! {
-//!         pub struct Flags1: u32 {
-//!             const A = 0b00000001;
-//!         }
-//!
-//! #       pub
-//!         struct Flags2: u32 {
-//!             const B = 0b00000010;
-//!         }
-//!     }
-//! }
-//!
-//! fn main() {
-//!     let flag1 = example::Flags1::A;
-//!     let flag2 = example::Flags2::B; // error: const `B` is private
-//! }
-//! ```
-//!
-//! # Attributes
-//!
-//! Attributes can be attached to the generated `struct`s by placing them
-//! before the `struct` keyword.
-//!
-//! ## Representations
-//!
-//! It's valid to add a `#[repr(C)]` or `#[repr(transparent)]` attribute to a type
-//! generated by `bitflags!`. In these cases, the type is guaranteed to be a newtype.
-//!
-//! ```
-//! use bitflags::bitflags;
-//!
-//! bitflags! {
-//!     #[repr(transparent)]
-//!     struct Flags: u32 {
-//!         const A = 0b00000001;
-//!         const B = 0b00000010;
-//!         const C = 0b00000100;
-//!     }
-//! }
-//! ```
-//!
-//! # Trait implementations
-//!
-//! The `Copy`, `Clone`, `PartialEq`, `Eq`, `PartialOrd`, `Ord` and `Hash`
-//! traits are automatically derived for the `struct`s using the `derive` attribute.
-//! Additional traits can be derived by providing an explicit `derive`
-//! attribute on `struct`.
-//!
-//! The `Extend` and `FromIterator` traits are implemented for the `struct`s,
-//! too: `Extend` adds the union of the instances of the `struct` iterated over,
-//! while `FromIterator` calculates the union.
-//!
-//! The `Binary`, `Debug`, `LowerHex`, `Octal` and `UpperHex` traits are also
-//! implemented by displaying the bits value of the internal struct.
-//!
-//! ## Operators
-//!
-//! The following operator traits are implemented for the generated `struct`s:
-//!
-//! - `BitOr` and `BitOrAssign`: union
-//! - `BitAnd` and `BitAndAssign`: intersection
-//! - `BitXor` and `BitXorAssign`: toggle
-//! - `Sub` and `SubAssign`: set difference
-//! - `Not`: set complement
-//!
-//! # Methods
-//!
-//! The following methods are defined for the generated `struct`s:
-//!
-//! - `empty`: an empty set of flags
-//! - `all`: the set of all defined flags
-//! - `bits`: the raw value of the flags currently stored
-//! - `from_bits`: convert from underlying bit representation, unless that
-//!                representation contains bits that do not correspond to a
-//!                defined flag
-//! - `from_bits_truncate`: convert from underlying bit representation, dropping
-//!                         any bits that do not correspond to defined flags
-//! - `from_bits_unchecked`: convert from underlying bit representation, keeping
-//!                          all bits (even those not corresponding to defined
-//!                          flags)
-//! - `is_empty`: `true` if no flags are currently stored
-//! - `is_all`: `true` if currently set flags exactly equal all defined flags
-//! - `intersects`: `true` if there are flags common to both `self` and `other`
-//! - `contains`: `true` if all of the flags in `other` are contained within `self`
-//! - `insert`: inserts the specified flags in-place
-//! - `remove`: removes the specified flags in-place
-//! - `toggle`: the specified flags will be inserted if not present, and removed
-//!             if they are.
-//! - `set`: inserts or removes the specified flags depending on the passed value
-//! - `intersection`: returns a new set of flags, containing only the flags present
-//!                   in both `self` and `other` (the argument to the function).
-//! - `union`: returns a new set of flags, containing any flags present in
-//!            either `self` or `other` (the argument to the function).
-//! - `difference`: returns a new set of flags, containing all flags present in
-//!                 `self` without any of the flags present in `other` (the
-//!                 argument to the function).
-//! - `symmetric_difference`: returns a new set of flags, containing all flags
-//!                           present in either `self` or `other` (the argument
-//!                           to the function), but not both.
-//! - `complement`: returns a new set of flags, containing all flags which are
-//!                 not set in `self`, but which are allowed for this type.
-//!
-//! ## Default
-//!
-//! The `Default` trait is not automatically implemented for the generated structs.
-//!
-//! If your default value is equal to `0` (which is the same value as calling `empty()`
-//! on the generated struct), you can simply derive `Default`:
-//!
-//! ```
-//! use bitflags::bitflags;
-//!
-//! bitflags! {
-//!     // Results in default value with bits: 0
-//!     #[derive(Default)]
-//!     struct Flags: u32 {
-//!         const A = 0b00000001;
-//!         const B = 0b00000010;
-//!         const C = 0b00000100;
-//!     }
-//! }
-//!
-//! fn main() {
-//!     let derived_default: Flags = Default::default();
-//!     assert_eq!(derived_default.bits(), 0);
-//! }
-//! ```
-//!
-//! If your default value is not equal to `0` you need to implement `Default` yourself:
-//!
-//! ```
-//! use bitflags::bitflags;
-//!
-//! bitflags! {
-//!     struct Flags: u32 {
-//!         const A = 0b00000001;
-//!         const B = 0b00000010;
-//!         const C = 0b00000100;
-//!     }
-//! }
-//!
-//! // explicit `Default` implementation
-//! impl Default for Flags {
-//!     fn default() -> Flags {
-//!         Flags::A | Flags::C
-//!     }
-//! }
-//!
-//! fn main() {
-//!     let implemented_default: Flags = Default::default();
-//!     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.
-//!
-//! ```
-//! use bitflags::bitflags;
-//!
-//! bitflags! {
-//!     struct Flags: u32 {
-//!         const NONE = 0b00000000;
-//!         const SOME = 0b00000001;
-//!     }
-//! }
-//!
-//! fn main() {
-//!     let empty = Flags::empty();
-//!     let none = Flags::NONE;
-//!     let some = Flags::SOME;
-//!
-//!     // Zero flags are treated as always present
-//!     assert!(empty.contains(Flags::NONE));
-//!     assert!(none.contains(Flags::NONE));
-//!     assert!(some.contains(Flags::NONE));
-//!
-//!     // Zero flags will be ignored when testing for emptiness
-//!     assert!(none.is_empty());
-//! }
-//! ```
-//!
-//! Users should generally avoid defining a flag with a value of zero.
+/*!
+Generate types for C-style flags with ergonomic APIs.
 
-#![cfg_attr(not(test), no_std)]
-#![doc(html_root_url = "https://docs.rs/bitflags/1.3.2")]
+# Getting started
 
-#[doc(hidden)]
-pub extern crate core as _core;
+Add `bitflags` to your `Cargo.toml`:
 
-/// The macro used to generate the flag structures.
-///
-/// See the [crate level docs](../bitflags/index.html) for complete documentation.
-///
-/// # Example
-///
-/// ```
-/// use bitflags::bitflags;
-///
-/// bitflags! {
-///     struct Flags: u32 {
-///         const A = 0b00000001;
-///         const B = 0b00000010;
-///         const C = 0b00000100;
-///         const ABC = Self::A.bits | Self::B.bits | Self::C.bits;
-///     }
-/// }
-///
-/// fn main() {
-///     let e1 = Flags::A | Flags::C;
-///     let e2 = Flags::B | Flags::C;
-///     assert_eq!((e1 | e2), Flags::ABC);   // union
-///     assert_eq!((e1 & e2), Flags::C);     // intersection
-///     assert_eq!((e1 - e2), Flags::A);     // set difference
-///     assert_eq!(!e2, Flags::A);           // set complement
-/// }
-/// ```
-///
-/// The generated `struct`s can also be extended with type and trait
-/// implementations:
-///
-/// ```
-/// use std::fmt;
-///
-/// use bitflags::bitflags;
-///
-/// bitflags! {
-///     struct Flags: u32 {
-///         const A = 0b00000001;
-///         const B = 0b00000010;
-///     }
-/// }
-///
-/// impl Flags {
-///     pub fn clear(&mut self) {
-///         self.bits = 0;  // The `bits` field can be accessed from within the
-///                         // same module where the `bitflags!` macro was invoked.
-///     }
-/// }
-///
-/// impl fmt::Display for Flags {
-///     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-///         write!(f, "hi!")
-///     }
-/// }
-///
-/// fn main() {
-///     let mut flags = Flags::A | Flags::B;
-///     flags.clear();
-///     assert!(flags.is_empty());
-///     assert_eq!(format!("{}", flags), "hi!");
-///     assert_eq!(format!("{:?}", Flags::A | Flags::B), "A | B");
-///     assert_eq!(format!("{:?}", Flags::B), "B");
-/// }
-/// ```
-#[macro_export(local_inner_macros)]
-macro_rules! bitflags {
-    (
-        $(#[$outer:meta])*
-        $vis:vis struct $BitFlags:ident: $T:ty {
-            $(
-                $(#[$inner:ident $($args:tt)*])*
-                const $Flag:ident = $value:expr;
-            )*
-        }
+```toml
+[dependencies.bitflags]
+version = "2.4.1"
+```
 
-        $($t:tt)*
-    ) => {
-        $(#[$outer])*
-        #[derive(Copy, PartialEq, Eq, Clone, PartialOrd, Ord, Hash)]
-        $vis struct $BitFlags {
-            bits: $T,
-        }
+## Generating flags types
 
-        __impl_bitflags! {
-            $BitFlags: $T {
-                $(
-                    $(#[$inner $($args)*])*
-                    $Flag = $value;
-                )*
-            }
-        }
+Use the [`bitflags`] macro to generate flags types:
 
-        bitflags! {
-            $($t)*
-        }
-    };
-    () => {};
-}
+```rust
+use bitflags::bitflags;
 
-// A helper macro to implement the `all` function.
-#[macro_export(local_inner_macros)]
-#[doc(hidden)]
-macro_rules! __impl_all_bitflags {
-    (
-        $BitFlags:ident: $T:ty {
-            $(
-                $(#[$attr:ident $($args:tt)*])*
-                $Flag:ident = $value:expr;
-            )+
-        }
-    ) => {
-        // See `Debug::fmt` for why this approach is taken.
-        #[allow(non_snake_case)]
-        trait __BitFlags {
-            $(
-                const $Flag: $T = 0;
-            )+
-        }
-        #[allow(non_snake_case)]
-        impl __BitFlags for $BitFlags {
-            $(
-                __impl_bitflags! {
-                    #[allow(deprecated)]
-                    $(? #[$attr $($args)*])*
-                    const $Flag: $T = Self::$Flag.bits;
-                }
-            )+
-        }
-        Self { bits: $(<Self as __BitFlags>::$Flag)|+ }
-    };
-    (
-        $BitFlags:ident: $T:ty { }
-    ) => {
-        Self { bits: 0 }
-    };
+bitflags! {
+    pub struct Flags: u32 {
+        const A = 0b00000001;
+        const B = 0b00000010;
+        const C = 0b00000100;
+    }
 }
+```
 
-#[macro_export(local_inner_macros)]
-#[doc(hidden)]
-macro_rules! __impl_bitflags {
-    (
-        $BitFlags:ident: $T:ty {
-            $(
-                $(#[$attr:ident $($args:tt)*])*
-                $Flag:ident = $value:expr;
-            )*
-        }
-    ) => {
-        impl $crate::_core::fmt::Debug for $BitFlags {
-            fn fmt(&self, f: &mut $crate::_core::fmt::Formatter) -> $crate::_core::fmt::Result {
-                // This convoluted approach is to handle #[cfg]-based flag
-                // omission correctly. For example it needs to support:
-                //
-                //    #[cfg(unix)] const A: Flag = /* ... */;
-                //    #[cfg(windows)] const B: Flag = /* ... */;
-
-                // Unconditionally define a check for every flag, even disabled
-                // ones.
-                #[allow(non_snake_case)]
-                trait __BitFlags {
-                    $(
-                        #[inline]
-                        fn $Flag(&self) -> bool { false }
-                    )*
-                }
-
-                // Conditionally override the check for just those flags that
-                // are not #[cfg]ed away.
-                #[allow(non_snake_case)]
-                impl __BitFlags for $BitFlags {
-                    $(
-                        __impl_bitflags! {
-                            #[allow(deprecated)]
-                            #[inline]
-                            $(? #[$attr $($args)*])*
-                            fn $Flag(&self) -> bool {
-                                if Self::$Flag.bits == 0 && self.bits != 0 {
-                                    false
-                                } else {
-                                    self.bits & Self::$Flag.bits == Self::$Flag.bits
-                                }
-                            }
-                        }
-                    )*
-                }
+See the docs for the `bitflags` macro for the full syntax.
 
-                let mut first = true;
-                $(
-                    if <Self as __BitFlags>::$Flag(self) {
-                        if !first {
-                            f.write_str(" | ")?;
-                        }
-                        first = false;
-                        f.write_str($crate::_core::stringify!($Flag))?;
-                    }
-                )*
-                let extra_bits = self.bits & !Self::all().bits();
-                if extra_bits != 0 {
-                    if !first {
-                        f.write_str(" | ")?;
-                    }
-                    first = false;
-                    f.write_str("0x")?;
-                    $crate::_core::fmt::LowerHex::fmt(&extra_bits, f)?;
-                }
-                if first {
-                    f.write_str("(empty)")?;
-                }
-                Ok(())
-            }
-        }
-        impl $crate::_core::fmt::Binary for $BitFlags {
-            fn fmt(&self, f: &mut $crate::_core::fmt::Formatter) -> $crate::_core::fmt::Result {
-                $crate::_core::fmt::Binary::fmt(&self.bits, f)
-            }
-        }
-        impl $crate::_core::fmt::Octal for $BitFlags {
-            fn fmt(&self, f: &mut $crate::_core::fmt::Formatter) -> $crate::_core::fmt::Result {
-                $crate::_core::fmt::Octal::fmt(&self.bits, f)
-            }
-        }
-        impl $crate::_core::fmt::LowerHex for $BitFlags {
-            fn fmt(&self, f: &mut $crate::_core::fmt::Formatter) -> $crate::_core::fmt::Result {
-                $crate::_core::fmt::LowerHex::fmt(&self.bits, f)
-            }
-        }
-        impl $crate::_core::fmt::UpperHex for $BitFlags {
-            fn fmt(&self, f: &mut $crate::_core::fmt::Formatter) -> $crate::_core::fmt::Result {
-                $crate::_core::fmt::UpperHex::fmt(&self.bits, f)
-            }
-        }
+Also see the [`example_generated`] module for an example of what the `bitflags` macro generates for a flags type.
 
-        #[allow(dead_code)]
-        impl $BitFlags {
-            $(
-                $(#[$attr $($args)*])*
-                pub const $Flag: Self = Self { bits: $value };
-            )*
+### Externally defined flags
 
-            /// Returns an empty set of flags.
-            #[inline]
-            pub const fn empty() -> Self {
-                Self { bits: 0 }
-            }
+If you're generating flags types for an external source, such as a C API, you can define
+an extra unnamed flag as a mask of all bits the external source may ever set. Usually this would be all bits (`!0`):
 
-            /// Returns the set containing all flags.
-            #[inline]
-            pub const fn all() -> Self {
-                __impl_all_bitflags! {
-                    $BitFlags: $T {
-                        $(
-                            $(#[$attr $($args)*])*
-                            $Flag = $value;
-                        )*
-                    }
-                }
-            }
+```rust
+# use bitflags::bitflags;
+bitflags! {
+    pub struct Flags: u32 {
+        const A = 0b00000001;
+        const B = 0b00000010;
+        const C = 0b00000100;
 
-            /// Returns the raw value of the flags currently stored.
-            #[inline]
-            pub const fn bits(&self) -> $T {
-                self.bits
-            }
+        // The source may set any bits
+        const _ = !0;
+    }
+}
+```
 
-            /// Convert from underlying bit representation, unless that
-            /// representation contains bits that do not correspond to a flag.
-            #[inline]
-            pub const fn from_bits(bits: $T) -> $crate::_core::option::Option<Self> {
-                if (bits & !Self::all().bits()) == 0 {
-                    $crate::_core::option::Option::Some(Self { bits })
-                } else {
-                    $crate::_core::option::Option::None
-                }
-            }
+Why should you do this? Generated methods like `all` and truncating operators like `!` only consider
+bits in defined flags. Adding an unnamed flag makes those methods consider additional bits,
+without generating additional constants for them. It helps compatibility when the external source
+may start setting additional bits at any time. The [known and unknown bits](#known-and-unknown-bits)
+section has more details on this behavior.
+
+### Custom derives
+
+You can derive some traits on generated flags types if you enable Cargo features. The following
+libraries are currently supported:
+
+- `serde`: Support `#[derive(Serialize, Deserialize)]`, using text for human-readable formats,
+and a raw number for binary formats.
+- `arbitrary`: Support `#[derive(Arbitrary)]`, only generating flags values with known bits.
+- `bytemuck`: Support `#[derive(Pod, Zeroable)]`, for casting between flags values and their
+underlying bits values.
+
+You can also define your own flags type outside of the [`bitflags`] macro and then use it to generate methods.
+This can be useful if you need a custom `#[derive]` attribute for a library that `bitflags` doesn't
+natively support:
+
+```rust
+# use std::fmt::Debug as SomeTrait;
+# use bitflags::bitflags;
+#[derive(SomeTrait)]
+pub struct Flags(u32);
+
+bitflags! {
+    impl Flags: u32 {
+        const A = 0b00000001;
+        const B = 0b00000010;
+        const C = 0b00000100;
+    }
+}
+```
 
-            /// Convert from underlying bit representation, dropping any bits
-            /// that do not correspond to flags.
-            #[inline]
-            pub const fn from_bits_truncate(bits: $T) -> Self {
-                Self { bits: bits & Self::all().bits }
-            }
+### Adding custom methods
 
-            /// Convert from underlying bit representation, preserving all
-            /// bits (even those not corresponding to a defined flag).
-            ///
-            /// # Safety
-            ///
-            /// The caller of the `bitflags!` macro can chose to allow or
-            /// disallow extra bits for their bitflags type.
-            ///
-            /// The caller of `from_bits_unchecked()` has to ensure that
-            /// all bits correspond to a defined flag or that extra bits
-            /// are valid for this bitflags type.
-            #[inline]
-            pub const unsafe fn from_bits_unchecked(bits: $T) -> Self {
-                Self { bits }
-            }
+The [`bitflags`] macro supports attributes on generated flags types within the macro itself, while
+`impl` blocks can be added outside of it:
 
-            /// Returns `true` if no flags are currently stored.
-            #[inline]
-            pub const fn is_empty(&self) -> bool {
-                self.bits() == Self::empty().bits()
-            }
+```rust
+# use bitflags::bitflags;
+bitflags! {
+    // Attributes can be applied to flags types
+    #[repr(transparent)]
+    #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
+    pub struct Flags: u32 {
+        const A = 0b00000001;
+        const B = 0b00000010;
+        const C = 0b00000100;
+    }
+}
 
-            /// Returns `true` if all flags are currently set.
-            #[inline]
-            pub const fn is_all(&self) -> bool {
-                Self::all().bits | self.bits == self.bits
-            }
+// Impl blocks can be added to flags types
+impl Flags {
+    pub fn as_u64(&self) -> u64 {
+        self.bits() as u64
+    }
+}
+```
 
-            /// Returns `true` if there are flags common to both `self` and `other`.
-            #[inline]
-            pub const fn intersects(&self, other: Self) -> bool {
-                !(Self { bits: self.bits & other.bits}).is_empty()
-            }
+## Working with flags values
 
-            /// Returns `true` if all of the flags in `other` are contained within `self`.
-            #[inline]
-            pub const fn contains(&self, other: Self) -> bool {
-                (self.bits & other.bits) == other.bits
-            }
+Use generated constants and standard bitwise operators to interact with flags values:
 
-            /// Inserts the specified flags in-place.
-            #[inline]
-            pub fn insert(&mut self, other: Self) {
-                self.bits |= other.bits;
-            }
+```rust
+# use bitflags::bitflags;
+# bitflags! {
+#     #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
+#     pub struct Flags: u32 {
+#         const A = 0b00000001;
+#         const B = 0b00000010;
+#         const C = 0b00000100;
+#     }
+# }
+// union
+let ab = Flags::A | Flags::B;
 
-            /// Removes the specified flags in-place.
-            #[inline]
-            pub fn remove(&mut self, other: Self) {
-                self.bits &= !other.bits;
-            }
+// intersection
+let a = ab & Flags::A;
 
-            /// Toggles the specified flags in-place.
-            #[inline]
-            pub fn toggle(&mut self, other: Self) {
-                self.bits ^= other.bits;
-            }
+// difference
+let b = ab - Flags::A;
 
-            /// Inserts or removes the specified flags depending on the passed value.
-            #[inline]
-            pub fn set(&mut self, other: Self, value: bool) {
-                if value {
-                    self.insert(other);
-                } else {
-                    self.remove(other);
-                }
-            }
+// complement
+let c = !ab;
+```
 
-            /// Returns the intersection between the flags in `self` and
-            /// `other`.
-            ///
-            /// Specifically, the returned set contains only the flags which are
-            /// present in *both* `self` *and* `other`.
-            ///
-            /// This is equivalent to using the `&` operator (e.g.
-            /// [`ops::BitAnd`]), as in `flags & other`.
-            ///
-            /// [`ops::BitAnd`]: https://doc.rust-lang.org/std/ops/trait.BitAnd.html
-            #[inline]
-            #[must_use]
-            pub const fn intersection(self, other: Self) -> Self {
-                Self { bits: self.bits & other.bits }
-            }
+See the docs for the [`Flags`] trait for more details on operators and how they behave.
 
-            /// Returns the union of between the flags in `self` and `other`.
-            ///
-            /// Specifically, the returned set contains all flags which are
-            /// present in *either* `self` *or* `other`, including any which are
-            /// present in both (see [`Self::symmetric_difference`] if that
-            /// is undesirable).
-            ///
-            /// This is equivalent to using the `|` operator (e.g.
-            /// [`ops::BitOr`]), as in `flags | other`.
-            ///
-            /// [`ops::BitOr`]: https://doc.rust-lang.org/std/ops/trait.BitOr.html
-            #[inline]
-            #[must_use]
-            pub const fn union(self, other: Self) -> Self {
-                Self { bits: self.bits | other.bits }
-            }
+# Formatting and parsing
 
-            /// Returns the difference between the flags in `self` and `other`.
-            ///
-            /// Specifically, the returned set contains all flags present in
-            /// `self`, except for the ones present in `other`.
-            ///
-            /// It is also conceptually equivalent to the "bit-clear" operation:
-            /// `flags & !other` (and this syntax is also supported).
-            ///
-            /// This is equivalent to using the `-` operator (e.g.
-            /// [`ops::Sub`]), as in `flags - other`.
-            ///
-            /// [`ops::Sub`]: https://doc.rust-lang.org/std/ops/trait.Sub.html
-            #[inline]
-            #[must_use]
-            pub const fn difference(self, other: Self) -> Self {
-                Self { bits: self.bits & !other.bits }
-            }
+`bitflags` defines a text format that can be used to convert any flags value to and from strings.
 
-            /// Returns the [symmetric difference][sym-diff] between the flags
-            /// in `self` and `other`.
-            ///
-            /// Specifically, the returned set contains the flags present which
-            /// are present in `self` or `other`, but that are not present in
-            /// both. Equivalently, it contains the flags present in *exactly
-            /// one* of the sets `self` and `other`.
-            ///
-            /// This is equivalent to using the `^` operator (e.g.
-            /// [`ops::BitXor`]), as in `flags ^ other`.
-            ///
-            /// [sym-diff]: https://en.wikipedia.org/wiki/Symmetric_difference
-            /// [`ops::BitXor`]: https://doc.rust-lang.org/std/ops/trait.BitXor.html
-            #[inline]
-            #[must_use]
-            pub const fn symmetric_difference(self, other: Self) -> Self {
-                Self { bits: self.bits ^ other.bits }
-            }
+See the [`parser`] module for more details.
 
-            /// Returns the complement of this set of flags.
-            ///
-            /// Specifically, the returned set contains all the flags which are
-            /// not set in `self`, but which are allowed for this type.
-            ///
-            /// Alternatively, it can be thought of as the set difference
-            /// between [`Self::all()`] and `self` (e.g. `Self::all() - self`)
-            ///
-            /// This is equivalent to using the `!` operator (e.g.
-            /// [`ops::Not`]), as in `!flags`.
-            ///
-            /// [`Self::all()`]: Self::all
-            /// [`ops::Not`]: https://doc.rust-lang.org/std/ops/trait.Not.html
-            #[inline]
-            #[must_use]
-            pub const fn complement(self) -> Self {
-                Self::from_bits_truncate(!self.bits)
-            }
+# Specification
 
-        }
+The terminology and behavior of generated flags types is
+[specified in the source repository](https://github.com/bitflags/bitflags/blob/main/spec.md).
+Details are repeated in these docs where appropriate, but is exhaustively listed in the spec. Some
+things are worth calling out explicitly here.
 
-        impl $crate::_core::ops::BitOr for $BitFlags {
-            type Output = Self;
+## Flags types, flags values, flags
 
-            /// Returns the union of the two sets of flags.
-            #[inline]
-            fn bitor(self, other: $BitFlags) -> Self {
-                Self { bits: self.bits | other.bits }
-            }
-        }
+The spec and these docs use consistent terminology to refer to things in the bitflags domain:
 
-        impl $crate::_core::ops::BitOrAssign for $BitFlags {
-            /// Adds the set of flags.
-            #[inline]
-            fn bitor_assign(&mut self, other: Self) {
-                self.bits |= other.bits;
-            }
-        }
+- **Bits type**: A type that defines a fixed number of bits at specific locations.
+- **Flag**: A set of bits in a bits type that may have a unique name.
+- **Flags type**: A set of defined flags over a specific bits type.
+- **Flags value**: An instance of a flags type using its specific bits value for storage.
 
-        impl $crate::_core::ops::BitXor for $BitFlags {
-            type Output = Self;
+```
+# use bitflags::bitflags;
+bitflags! {
+    struct FlagsType: u8 {
+//                    -- Bits type
+//         --------- Flags type
+        const A = 1;
+//            ----- Flag
+    }
+}
 
-            /// Returns the left flags, but with all the right flags toggled.
-            #[inline]
-            fn bitxor(self, other: Self) -> Self {
-                Self { bits: self.bits ^ other.bits }
-            }
-        }
+let flag = FlagsType::A;
+//  ---- Flags value
+```
+
+## Known and unknown bits
+
+Any bits in a flag you define are called _known bits_. Any other bits are _unknown bits_.
+In the following flags type:
+
+```
+# use bitflags::bitflags;
+bitflags! {
+    struct Flags: u8 {
+        const A = 1;
+        const B = 1 << 1;
+        const C = 1 << 2;
+    }
+}
+```
 
-        impl $crate::_core::ops::BitXorAssign for $BitFlags {
-            /// Toggles the set of flags.
-            #[inline]
-            fn bitxor_assign(&mut self, other: Self) {
-                self.bits ^= other.bits;
-            }
-        }
+The known bits are `0b0000_0111` and the unknown bits are `0b1111_1000`.
 
-        impl $crate::_core::ops::BitAnd for $BitFlags {
-            type Output = Self;
+`bitflags` doesn't guarantee that a flags value will only ever have known bits set, but some operators
+will unset any unknown bits they encounter. In a future version of `bitflags`, all operators will
+unset unknown bits.
 
-            /// Returns the intersection between the two sets of flags.
-            #[inline]
-            fn bitand(self, other: Self) -> Self {
-                Self { bits: self.bits & other.bits }
-            }
-        }
+If you're using `bitflags` for flags types defined externally, such as from C, you probably want all
+bits to be considered known, in case that external source changes. You can do this using an unnamed
+flag, as described in [externally defined flags](#externally-defined-flags).
 
-        impl $crate::_core::ops::BitAndAssign for $BitFlags {
-            /// Disables all flags disabled in the set.
-            #[inline]
-            fn bitand_assign(&mut self, other: Self) {
-                self.bits &= other.bits;
-            }
-        }
+## Zero-bit flags
 
-        impl $crate::_core::ops::Sub for $BitFlags {
-            type Output = Self;
+Flags with no bits set should be avoided because they interact strangely with [`Flags::contains`]
+and [`Flags::intersects`]. A zero-bit flag is always contained, but is never intersected. The
+names of zero-bit flags can be parsed, but are never formatted.
 
-            /// Returns the set difference of the two sets of flags.
-            #[inline]
-            fn sub(self, other: Self) -> Self {
-                Self { bits: self.bits & !other.bits }
-            }
-        }
+## Multi-bit flags
 
-        impl $crate::_core::ops::SubAssign for $BitFlags {
-            /// Disables all flags enabled in the set.
-            #[inline]
-            fn sub_assign(&mut self, other: Self) {
-                self.bits &= !other.bits;
-            }
-        }
+Flags that set multiple bits should be avoided unless each bit is also in a single-bit flag.
+Take the following flags type as an example:
 
-        impl $crate::_core::ops::Not for $BitFlags {
-            type Output = Self;
+```
+# use bitflags::bitflags;
+bitflags! {
+    struct Flags: u8 {
+        const A = 1;
+        const B = 1 | 1 << 1;
+    }
+}
+```
 
-            /// Returns the complement of this set of flags.
-            #[inline]
-            fn not(self) -> Self {
-                Self { bits: !self.bits } & Self::all()
-            }
-        }
+The result of `Flags::A ^ Flags::B` is `0b0000_0010`, which doesn't correspond to either
+`Flags::A` or `Flags::B` even though it's still a known bit.
+*/
 
-        impl $crate::_core::iter::Extend<$BitFlags> for $BitFlags {
-            fn extend<T: $crate::_core::iter::IntoIterator<Item=Self>>(&mut self, iterator: T) {
-                for item in iterator {
-                    self.insert(item)
-                }
-            }
-        }
+#![cfg_attr(not(any(feature = "std", test)), no_std)]
+#![cfg_attr(not(test), forbid(unsafe_code))]
+#![cfg_attr(test, allow(mixed_script_confusables))]
 
-        impl $crate::_core::iter::FromIterator<$BitFlags> for $BitFlags {
-            fn from_iter<T: $crate::_core::iter::IntoIterator<Item=Self>>(iterator: T) -> Self {
-                let mut result = Self::empty();
-                result.extend(iterator);
-                result
-            }
-        }
-    };
+#[doc(inline)]
+pub use traits::{Bits, Flag, Flags};
 
-    // Every attribute that the user writes on a const is applied to the
-    // corresponding const that we generate, but within the implementation of
-    // Debug and all() we want to ignore everything but #[cfg] attributes. In
-    // particular, including a #[deprecated] attribute on those items would fail
-    // to compile.
-    // https://github.com/bitflags/bitflags/issues/109
-    //
-    // Input:
-    //
-    //     ? #[cfg(feature = "advanced")]
-    //     ? #[deprecated(note = "Use something else.")]
-    //     ? #[doc = r"High quality documentation."]
-    //     fn f() -> i32 { /* ... */ }
-    //
-    // Output:
-    //
-    //     #[cfg(feature = "advanced")]
-    //     fn f() -> i32 { /* ... */ }
-    (
-        $(#[$filtered:meta])*
-        ? #[cfg $($cfgargs:tt)*]
-        $(? #[$rest:ident $($restargs:tt)*])*
-        fn $($item:tt)*
-    ) => {
-        __impl_bitflags! {
-            $(#[$filtered])*
-            #[cfg $($cfgargs)*]
-            $(? #[$rest $($restargs)*])*
-            fn $($item)*
-        }
-    };
-    (
-        $(#[$filtered:meta])*
-        // $next != `cfg`
-        ? #[$next:ident $($nextargs:tt)*]
-        $(? #[$rest:ident $($restargs:tt)*])*
-        fn $($item:tt)*
-    ) => {
-        __impl_bitflags! {
-            $(#[$filtered])*
-            // $next filtered out
-            $(? #[$rest $($restargs)*])*
-            fn $($item)*
-        }
-    };
-    (
-        $(#[$filtered:meta])*
-        fn $($item:tt)*
-    ) => {
-        $(#[$filtered])*
-        fn $($item)*
-    };
+pub mod iter;
+pub mod parser;
 
-    // Every attribute that the user writes on a const is applied to the
-    // corresponding const that we generate, but within the implementation of
-    // Debug and all() we want to ignore everything but #[cfg] attributes. In
-    // particular, including a #[deprecated] attribute on those items would fail
-    // to compile.
-    // https://github.com/bitflags/bitflags/issues/109
-    //
-    // const version
-    //
-    // Input:
-    //
-    //     ? #[cfg(feature = "advanced")]
-    //     ? #[deprecated(note = "Use something else.")]
-    //     ? #[doc = r"High quality documentation."]
-    //     const f: i32 { /* ... */ }
-    //
-    // Output:
-    //
-    //     #[cfg(feature = "advanced")]
-    //     const f: i32 { /* ... */ }
-    (
-        $(#[$filtered:meta])*
-        ? #[cfg $($cfgargs:tt)*]
-        $(? #[$rest:ident $($restargs:tt)*])*
-        const $($item:tt)*
-    ) => {
-        __impl_bitflags! {
-            $(#[$filtered])*
-            #[cfg $($cfgargs)*]
-            $(? #[$rest $($restargs)*])*
-            const $($item)*
-        }
-    };
-    (
-        $(#[$filtered:meta])*
-        // $next != `cfg`
-        ? #[$next:ident $($nextargs:tt)*]
-        $(? #[$rest:ident $($restargs:tt)*])*
-        const $($item:tt)*
-    ) => {
-        __impl_bitflags! {
-            $(#[$filtered])*
-            // $next filtered out
-            $(? #[$rest $($restargs)*])*
-            const $($item)*
-        }
-    };
-    (
-        $(#[$filtered:meta])*
-        const $($item:tt)*
-    ) => {
-        $(#[$filtered])*
-        const $($item)*
-    };
-}
+mod traits;
 
-#[cfg(feature = "example_generated")]
-pub mod example_generated;
+#[doc(hidden)]
+pub mod __private {
+    pub use crate::{external::__private::*, traits::__private::*};
 
-#[cfg(test)]
-mod tests {
-    use std::collections::hash_map::DefaultHasher;
-    use std::hash::{Hash, Hasher};
-
-    bitflags! {
-        #[doc = "> The first principle is that you must not fool yourself — and"]
-        #[doc = "> you are the easiest person to fool."]
-        #[doc = "> "]
-        #[doc = "> - Richard Feynman"]
-        #[derive(Default)]
-        struct Flags: u32 {
-            const A = 0b00000001;
-            #[doc = "<pcwalton> macros are way better at generating code than trans is"]
-            const B = 0b00000010;
-            const C = 0b00000100;
-            #[doc = "* cmr bed"]
-            #[doc = "* strcat table"]
-            #[doc = "<strcat> wait what?"]
-            const ABC = Self::A.bits | Self::B.bits | Self::C.bits;
-        }
+    pub use core;
+}
 
-        struct _CfgFlags: u32 {
-            #[cfg(unix)]
-            const _CFG_A = 0b01;
-            #[cfg(windows)]
-            const _CFG_B = 0b01;
-            #[cfg(unix)]
-            const _CFG_C = Self::_CFG_A.bits | 0b10;
-        }
+#[allow(unused_imports)]
+pub use external::*;
 
-        struct AnotherSetOfFlags: i8 {
-            const ANOTHER_FLAG = -1_i8;
-        }
+#[allow(deprecated)]
+pub use traits::BitFlags;
 
-        struct LongFlags: u32 {
-            const LONG_A = 0b1111111111111111;
-        }
-    }
+/*
+How does the bitflags crate work?
 
-    bitflags! {
-        struct EmptyFlags: u32 {
-        }
+This library generates a `struct` in the end-user's crate with a bunch of constants on it that represent flags.
+The difference between `bitflags` and a lot of other libraries is that we don't actually control the generated `struct` in the end.
+It's part of the end-user's crate, so it belongs to them. That makes it difficult to extend `bitflags` with new functionality
+because we could end up breaking valid code that was already written.
+
+Our solution is to split the type we generate into two: the public struct owned by the end-user, and an internal struct owned by `bitflags` (us).
+To give you an example, let's say we had a crate that called `bitflags!`:
+
+```rust
+bitflags! {
+    pub struct MyFlags: u32 {
+        const A = 1;
+        const B = 2;
     }
+}
+```
 
-    #[test]
-    fn test_bits() {
-        assert_eq!(Flags::empty().bits(), 0b00000000);
-        assert_eq!(Flags::A.bits(), 0b00000001);
-        assert_eq!(Flags::ABC.bits(), 0b00000111);
+What they'd end up with looks something like this:
 
-        assert_eq!(AnotherSetOfFlags::empty().bits(), 0b00);
-        assert_eq!(AnotherSetOfFlags::ANOTHER_FLAG.bits(), !0_i8);
+```rust
+pub struct MyFlags(<MyFlags as PublicFlags>::InternalBitFlags);
 
-        assert_eq!(EmptyFlags::empty().bits(), 0b00000000);
+const _: () = {
+    #[repr(transparent)]
+    #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
+    pub struct MyInternalBitFlags {
+        bits: u32,
     }
 
-    #[test]
-    fn test_from_bits() {
-        assert_eq!(Flags::from_bits(0), Some(Flags::empty()));
-        assert_eq!(Flags::from_bits(0b1), Some(Flags::A));
-        assert_eq!(Flags::from_bits(0b10), Some(Flags::B));
-        assert_eq!(Flags::from_bits(0b11), Some(Flags::A | Flags::B));
-        assert_eq!(Flags::from_bits(0b1000), None);
-
-        assert_eq!(
-            AnotherSetOfFlags::from_bits(!0_i8),
-            Some(AnotherSetOfFlags::ANOTHER_FLAG)
-        );
-
-        assert_eq!(EmptyFlags::from_bits(0), Some(EmptyFlags::empty()));
-        assert_eq!(EmptyFlags::from_bits(0b1), None);
+    impl PublicFlags for MyFlags {
+        type Internal = InternalBitFlags;
     }
+};
+```
 
-    #[test]
-    fn test_from_bits_truncate() {
-        assert_eq!(Flags::from_bits_truncate(0), Flags::empty());
-        assert_eq!(Flags::from_bits_truncate(0b1), Flags::A);
-        assert_eq!(Flags::from_bits_truncate(0b10), Flags::B);
-        assert_eq!(Flags::from_bits_truncate(0b11), (Flags::A | Flags::B));
-        assert_eq!(Flags::from_bits_truncate(0b1000), Flags::empty());
-        assert_eq!(Flags::from_bits_truncate(0b1001), Flags::A);
-
-        assert_eq!(
-            AnotherSetOfFlags::from_bits_truncate(0_i8),
-            AnotherSetOfFlags::empty()
-        );
-
-        assert_eq!(EmptyFlags::from_bits_truncate(0), EmptyFlags::empty());
-        assert_eq!(EmptyFlags::from_bits_truncate(0b1), EmptyFlags::empty());
-    }
-
-    #[test]
-    fn test_from_bits_unchecked() {
-        let extra = unsafe { Flags::from_bits_unchecked(0b1000) };
-        assert_eq!(unsafe { Flags::from_bits_unchecked(0) }, Flags::empty());
-        assert_eq!(unsafe { Flags::from_bits_unchecked(0b1) }, Flags::A);
-        assert_eq!(unsafe { Flags::from_bits_unchecked(0b10) }, Flags::B);
-
-        assert_eq!(
-            unsafe { Flags::from_bits_unchecked(0b11) },
-            (Flags::A | Flags::B)
-        );
-        assert_eq!(
-            unsafe { Flags::from_bits_unchecked(0b1000) },
-            (extra | Flags::empty())
-        );
-        assert_eq!(
-            unsafe { Flags::from_bits_unchecked(0b1001) },
-            (extra | Flags::A)
-        );
-
-        let extra = unsafe { EmptyFlags::from_bits_unchecked(0b1000) };
-        assert_eq!(
-            unsafe { EmptyFlags::from_bits_unchecked(0b1000) },
-            (extra | EmptyFlags::empty())
-        );
-    }
+If we want to expose something like a new trait impl for generated flags types, we add it to our generated `MyInternalBitFlags`,
+and let `#[derive]` on `MyFlags` pick up that implementation, if an end-user chooses to add one.
 
-    #[test]
-    fn test_is_empty() {
-        assert!(Flags::empty().is_empty());
-        assert!(!Flags::A.is_empty());
-        assert!(!Flags::ABC.is_empty());
+The public API is generated in the `__impl_public_flags!` macro, and the internal API is generated in
+the `__impl_internal_flags!` macro.
 
-        assert!(!AnotherSetOfFlags::ANOTHER_FLAG.is_empty());
+The macros are split into 3 modules:
 
-        assert!(EmptyFlags::empty().is_empty());
-        assert!(EmptyFlags::all().is_empty());
-    }
+- `public`: where the user-facing flags types are generated.
+- `internal`: where the `bitflags`-facing flags types are generated.
+- `external`: where external library traits are implemented conditionally.
+*/
 
-    #[test]
-    fn test_is_all() {
-        assert!(Flags::all().is_all());
-        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 | extra).is_all());
-        assert!((Flags::ABC | extra).is_all());
+/**
+Generate a flags type.
 
-        assert!(AnotherSetOfFlags::ANOTHER_FLAG.is_all());
+# `struct` mode
 
-        assert!(EmptyFlags::all().is_all());
-        assert!(EmptyFlags::empty().is_all());
-    }
+A declaration that begins with `$vis struct` will generate a `struct` for a flags type, along with
+methods and trait implementations for it. The body of the declaration defines flags as constants,
+where each constant is a flags value of the generated flags type.
 
-    #[test]
-    fn test_two_empties_do_not_intersect() {
-        let e1 = Flags::empty();
-        let e2 = Flags::empty();
-        assert!(!e1.intersects(e2));
+## Examples
 
-        assert!(AnotherSetOfFlags::ANOTHER_FLAG.intersects(AnotherSetOfFlags::ANOTHER_FLAG));
-    }
+Generate a flags type using `u8` as the bits type:
 
-    #[test]
-    fn test_empty_does_not_intersect_with_full() {
-        let e1 = Flags::empty();
-        let e2 = Flags::ABC;
-        assert!(!e1.intersects(e2));
+```
+# use bitflags::bitflags;
+bitflags! {
+    struct Flags: u8 {
+        const A = 1;
+        const B = 1 << 1;
+        const C = 0b0000_0100;
     }
+}
+```
 
-    #[test]
-    fn test_disjoint_intersects() {
-        let e1 = Flags::A;
-        let e2 = Flags::B;
-        assert!(!e1.intersects(e2));
-    }
+Flags types are private by default and accept standard visibility modifiers. Flags themselves
+are always public:
 
-    #[test]
-    fn test_overlapping_intersects() {
-        let e1 = Flags::A;
-        let e2 = Flags::A | Flags::B;
-        assert!(e1.intersects(e2));
+```
+# use bitflags::bitflags;
+bitflags! {
+    pub struct Flags: u8 {
+        // Constants are always `pub`
+        const A = 1;
     }
+}
+```
 
-    #[test]
-    fn test_contains() {
-        let e1 = Flags::A;
-        let e2 = Flags::A | Flags::B;
-        assert!(!e1.contains(e2));
-        assert!(e2.contains(e1));
-        assert!(Flags::ABC.contains(e2));
-
-        assert!(AnotherSetOfFlags::ANOTHER_FLAG.contains(AnotherSetOfFlags::ANOTHER_FLAG));
+Flags may refer to other flags using their [`Flags::bits`] value:
 
-        assert!(EmptyFlags::empty().contains(EmptyFlags::empty()));
+```
+# use bitflags::bitflags;
+bitflags! {
+    struct Flags: u8 {
+        const A = 1;
+        const B = 1 << 1;
+        const AB = Flags::A.bits() | Flags::B.bits();
     }
+}
+```
 
-    #[test]
-    fn test_insert() {
-        let mut e1 = Flags::A;
-        let e2 = Flags::A | Flags::B;
-        e1.insert(e2);
-        assert_eq!(e1, e2);
-
-        let mut e3 = AnotherSetOfFlags::empty();
-        e3.insert(AnotherSetOfFlags::ANOTHER_FLAG);
-        assert_eq!(e3, AnotherSetOfFlags::ANOTHER_FLAG);
-    }
+A single `bitflags` invocation may include zero or more flags type declarations:
 
-    #[test]
-    fn test_remove() {
-        let mut e1 = Flags::A | Flags::B;
-        let e2 = Flags::A | Flags::C;
-        e1.remove(e2);
-        assert_eq!(e1, Flags::B);
-
-        let mut e3 = AnotherSetOfFlags::ANOTHER_FLAG;
-        e3.remove(AnotherSetOfFlags::ANOTHER_FLAG);
-        assert_eq!(e3, AnotherSetOfFlags::empty());
-    }
+```
+# use bitflags::bitflags;
+bitflags! {}
 
-    #[test]
-    fn test_operators() {
-        let e1 = Flags::A | Flags::C;
-        let e2 = Flags::B | Flags::C;
-        assert_eq!((e1 | e2), Flags::ABC); // union
-        assert_eq!((e1 & e2), Flags::C); // intersection
-        assert_eq!((e1 - e2), Flags::A); // set difference
-        assert_eq!(!e2, Flags::A); // set complement
-        assert_eq!(e1 ^ e2, Flags::A | Flags::B); // toggle
-        let mut e3 = e1;
-        e3.toggle(e2);
-        assert_eq!(e3, Flags::A | Flags::B);
-
-        let mut m4 = AnotherSetOfFlags::empty();
-        m4.toggle(AnotherSetOfFlags::empty());
-        assert_eq!(m4, AnotherSetOfFlags::empty());
+bitflags! {
+    struct Flags1: u8 {
+        const A = 1;
     }
 
-    #[test]
-    fn test_operators_unchecked() {
-        let extra = unsafe { Flags::from_bits_unchecked(0b1000) };
-        let e1 = Flags::A | Flags::C | extra;
-        let e2 = Flags::B | Flags::C;
-        assert_eq!((e1 | e2), (Flags::ABC | extra)); // union
-        assert_eq!((e1 & e2), Flags::C); // intersection
-        assert_eq!((e1 - e2), (Flags::A | extra)); // set difference
-        assert_eq!(!e2, Flags::A); // set complement
-        assert_eq!(!e1, Flags::B); // set complement
-        assert_eq!(e1 ^ e2, Flags::A | Flags::B | extra); // toggle
-        let mut e3 = e1;
-        e3.toggle(e2);
-        assert_eq!(e3, Flags::A | Flags::B | extra);
+    struct Flags2: u8 {
+        const A = 1;
     }
+}
+```
 
-    #[test]
-    fn test_set_ops_basic() {
-        let ab = Flags::A.union(Flags::B);
-        let ac = Flags::A.union(Flags::C);
-        let bc = Flags::B.union(Flags::C);
-        assert_eq!(ab.bits, 0b011);
-        assert_eq!(bc.bits, 0b110);
-        assert_eq!(ac.bits, 0b101);
-
-        assert_eq!(ab, Flags::B.union(Flags::A));
-        assert_eq!(ac, Flags::C.union(Flags::A));
-        assert_eq!(bc, Flags::C.union(Flags::B));
-
-        assert_eq!(ac, Flags::A | Flags::C);
-        assert_eq!(bc, Flags::B | Flags::C);
-        assert_eq!(ab.union(bc), Flags::ABC);
-
-        assert_eq!(ac, Flags::A | Flags::C);
-        assert_eq!(bc, Flags::B | Flags::C);
-
-        assert_eq!(ac.union(bc), ac | bc);
-        assert_eq!(ac.union(bc), Flags::ABC);
-        assert_eq!(bc.union(ac), Flags::ABC);
-
-        assert_eq!(ac.intersection(bc), ac & bc);
-        assert_eq!(ac.intersection(bc), Flags::C);
-        assert_eq!(bc.intersection(ac), Flags::C);
-
-        assert_eq!(ac.difference(bc), ac - bc);
-        assert_eq!(bc.difference(ac), bc - ac);
-        assert_eq!(ac.difference(bc), Flags::A);
-        assert_eq!(bc.difference(ac), Flags::B);
-
-        assert_eq!(bc.complement(), !bc);
-        assert_eq!(bc.complement(), Flags::A);
-        assert_eq!(ac.symmetric_difference(bc), Flags::A.union(Flags::B));
-        assert_eq!(bc.symmetric_difference(ac), Flags::A.union(Flags::B));
-    }
+# `impl` mode
 
-    #[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)
-        const INTERSECT: Flags = Flags::all().intersection(Flags::C);
-        const UNION: Flags = Flags::A.union(Flags::C);
-        const DIFFERENCE: Flags = Flags::all().difference(Flags::A);
-        const COMPLEMENT: Flags = Flags::C.complement();
-        const SYM_DIFFERENCE: Flags = UNION.symmetric_difference(DIFFERENCE);
-        assert_eq!(INTERSECT, Flags::C);
-        assert_eq!(UNION, Flags::A | Flags::C);
-        assert_eq!(DIFFERENCE, Flags::all() - Flags::A);
-        assert_eq!(COMPLEMENT, !Flags::C);
-        assert_eq!(SYM_DIFFERENCE, (Flags::A | Flags::C) ^ (Flags::all() - Flags::A));
-    }
+A declaration that begins with `impl` will only generate methods and trait implementations for the
+`struct` defined outside of the `bitflags` macro.
 
-    #[test]
-    fn test_set_ops_unchecked() {
-        let extra = unsafe { Flags::from_bits_unchecked(0b1000) };
-        let e1 = Flags::A.union(Flags::C).union(extra);
-        let e2 = Flags::B.union(Flags::C);
-        assert_eq!(e1.bits, 0b1101);
-        assert_eq!(e1.union(e2), (Flags::ABC | extra));
-        assert_eq!(e1.intersection(e2), Flags::C);
-        assert_eq!(e1.difference(e2), Flags::A | extra);
-        assert_eq!(e2.difference(e1), Flags::B);
-        assert_eq!(e2.complement(), Flags::A);
-        assert_eq!(e1.complement(), Flags::B);
-        assert_eq!(e1.symmetric_difference(e2), Flags::A | Flags::B | extra); // toggle
-    }
+The struct itself must be a newtype using the bits type as its field.
 
-    #[test]
-    fn test_set_ops_exhaustive() {
-        // Define a flag that contains gaps to help exercise edge-cases,
-        // especially around "unknown" flags (e.g. ones outside of `all()`
-        // `from_bits_unchecked`).
-        // - when lhs and rhs both have different sets of unknown flags.
-        // - unknown flags at both ends, and in the middle
-        // - cases with "gaps".
-        bitflags! {
-            struct Test: u16 {
-                // Intentionally no `A`
-                const B = 0b000000010;
-                // Intentionally no `C`
-                const D = 0b000001000;
-                const E = 0b000010000;
-                const F = 0b000100000;
-                const G = 0b001000000;
-                // Intentionally no `H`
-                const I = 0b100000000;
-            }
-        }
-        let iter_test_flags =
-            || (0..=0b111_1111_1111).map(|bits| unsafe { Test::from_bits_unchecked(bits) });
+The syntax for `impl` mode is identical to `struct` mode besides the starting token.
 
-        for a in iter_test_flags() {
-            assert_eq!(
-                a.complement(),
-                Test::from_bits_truncate(!a.bits),
-                "wrong result: !({:?})",
-                a,
-            );
-            assert_eq!(a.complement(), !a, "named != op: !({:?})", a);
-            for b in iter_test_flags() {
-                // Check that the named operations produce the expected bitwise
-                // values.
-                assert_eq!(
-                    a.union(b).bits,
-                    a.bits | b.bits,
-                    "wrong result: `{:?}` | `{:?}`",
-                    a,
-                    b,
-                );
-                assert_eq!(
-                    a.intersection(b).bits,
-                    a.bits & b.bits,
-                    "wrong result: `{:?}` & `{:?}`",
-                    a,
-                    b,
-                );
-                assert_eq!(
-                    a.symmetric_difference(b).bits,
-                    a.bits ^ b.bits,
-                    "wrong result: `{:?}` ^ `{:?}`",
-                    a,
-                    b,
-                );
-                assert_eq!(
-                    a.difference(b).bits,
-                    a.bits & !b.bits,
-                    "wrong result: `{:?}` - `{:?}`",
-                    a,
-                    b,
-                );
-                // Note: Difference is checked as both `a - b` and `b - a`
-                assert_eq!(
-                    b.difference(a).bits,
-                    b.bits & !a.bits,
-                    "wrong result: `{:?}` - `{:?}`",
-                    b,
-                    a,
-                );
-                // Check that the named set operations are equivalent to the
-                // bitwise equivalents
-                assert_eq!(a.union(b), a | b, "named != op: `{:?}` | `{:?}`", a, b,);
-                assert_eq!(
-                    a.intersection(b),
-                    a & b,
-                    "named != op: `{:?}` & `{:?}`",
-                    a,
-                    b,
-                );
-                assert_eq!(
-                    a.symmetric_difference(b),
-                    a ^ b,
-                    "named != op: `{:?}` ^ `{:?}`",
-                    a,
-                    b,
-                );
-                assert_eq!(a.difference(b), a - b, "named != op: `{:?}` - `{:?}`", a, b,);
-                // Note: Difference is checked as both `a - b` and `b - a`
-                assert_eq!(b.difference(a), b - a, "named != op: `{:?}` - `{:?}`", b, a,);
-                // Verify that the operations which should be symmetric are
-                // actually symmetric.
-                assert_eq!(a.union(b), b.union(a), "asymmetry: `{:?}` | `{:?}`", a, b,);
-                assert_eq!(
-                    a.intersection(b),
-                    b.intersection(a),
-                    "asymmetry: `{:?}` & `{:?}`",
-                    a,
-                    b,
-                );
-                assert_eq!(
-                    a.symmetric_difference(b),
-                    b.symmetric_difference(a),
-                    "asymmetry: `{:?}` ^ `{:?}`",
-                    a,
-                    b,
-                );
-            }
-        }
-    }
+## Examples
 
-    #[test]
-    fn test_set() {
-        let mut e1 = Flags::A | Flags::C;
-        e1.set(Flags::B, true);
-        e1.set(Flags::C, false);
+Implement flags methods and traits for a custom flags type using `u8` as its underlying bits type:
 
-        assert_eq!(e1, Flags::A | Flags::B);
-    }
+```
+# use bitflags::bitflags;
+struct Flags(u8);
 
-    #[test]
-    fn test_assignment_operators() {
-        let mut m1 = Flags::empty();
-        let e1 = Flags::A | Flags::C;
-        // union
-        m1 |= Flags::A;
-        assert_eq!(m1, Flags::A);
-        // intersection
-        m1 &= e1;
-        assert_eq!(m1, Flags::A);
-        // set difference
-        m1 -= m1;
-        assert_eq!(m1, Flags::empty());
-        // toggle
-        m1 ^= e1;
-        assert_eq!(m1, e1);
+bitflags! {
+    impl Flags: u8 {
+        const A = 1;
+        const B = 1 << 1;
+        const C = 0b0000_0100;
     }
+}
+```
 
-    #[test]
-    fn test_const_fn() {
-        const _M1: Flags = Flags::empty();
-
-        const M2: Flags = Flags::A;
-        assert_eq!(M2, Flags::A);
-
-        const M3: Flags = Flags::C;
-        assert_eq!(M3, Flags::C);
-    }
+# Named and unnamed flags
 
-    #[test]
-    fn test_extend() {
-        let mut flags;
-
-        flags = Flags::empty();
-        flags.extend([].iter().cloned());
-        assert_eq!(flags, Flags::empty());
-
-        flags = Flags::empty();
-        flags.extend([Flags::A, Flags::B].iter().cloned());
-        assert_eq!(flags, Flags::A | Flags::B);
-
-        flags = Flags::A;
-        flags.extend([Flags::A, Flags::B].iter().cloned());
-        assert_eq!(flags, Flags::A | Flags::B);
-
-        flags = Flags::B;
-        flags.extend([Flags::A, Flags::ABC].iter().cloned());
-        assert_eq!(flags, Flags::ABC);
-    }
+Constants in the body of a declaration are flags. The identifier of the constant is the name of
+the flag. If the identifier is `_`, then the flag is unnamed. Unnamed flags don't appear in the
+generated API, but affect how bits are truncated.
 
-    #[test]
-    fn test_from_iterator() {
-        assert_eq!([].iter().cloned().collect::<Flags>(), Flags::empty());
-        assert_eq!(
-            [Flags::A, Flags::B].iter().cloned().collect::<Flags>(),
-            Flags::A | Flags::B
-        );
-        assert_eq!(
-            [Flags::A, Flags::ABC].iter().cloned().collect::<Flags>(),
-            Flags::ABC
-        );
-    }
+## Examples
 
-    #[test]
-    fn test_lt() {
-        let mut a = Flags::empty();
-        let mut b = Flags::empty();
-
-        assert!(!(a < b) && !(b < a));
-        b = Flags::B;
-        assert!(a < b);
-        a = Flags::C;
-        assert!(!(a < b) && b < a);
-        b = Flags::C | Flags::B;
-        assert!(a < b);
-    }
+Adding an unnamed flag that makes all bits known:
 
-    #[test]
-    fn test_ord() {
-        let mut a = Flags::empty();
-        let mut b = Flags::empty();
-
-        assert!(a <= b && a >= b);
-        a = Flags::A;
-        assert!(a > b && a >= b);
-        assert!(b < a && b <= a);
-        b = Flags::B;
-        assert!(b > a && b >= a);
-        assert!(a < b && a <= b);
-    }
+```
+# use bitflags::bitflags;
+bitflags! {
+    struct Flags: u8 {
+        const A = 1;
+        const B = 1 << 1;
 
-    fn hash<T: Hash>(t: &T) -> u64 {
-        let mut s = DefaultHasher::new();
-        t.hash(&mut s);
-        s.finish()
+        const _ = !0;
     }
+}
+```
 
-    #[test]
-    fn test_hash() {
-        let mut x = Flags::empty();
-        let mut y = Flags::empty();
-        assert_eq!(hash(&x), hash(&y));
-        x = Flags::all();
-        y = Flags::ABC;
-        assert_eq!(hash(&x), hash(&y));
-    }
+Flags types may define multiple unnamed flags:
 
-    #[test]
-    fn test_default() {
-        assert_eq!(Flags::empty(), Flags::default());
+```
+# use bitflags::bitflags;
+bitflags! {
+    struct Flags: u8 {
+        const _ = 1;
+        const _ = 1 << 1;
     }
+}
+```
+*/
+#[macro_export(local_inner_macros)]
+macro_rules! bitflags {
+    (
+        $(#[$outer:meta])*
+        $vis:vis struct $BitFlags:ident: $T:ty {
+            $(
+                $(#[$inner:ident $($args:tt)*])*
+                const $Flag:tt = $value:expr;
+            )*
+        }
 
-    #[test]
-    fn test_debug() {
-        assert_eq!(format!("{:?}", Flags::A | Flags::B), "A | B");
-        assert_eq!(format!("{:?}", Flags::empty()), "(empty)");
-        assert_eq!(format!("{:?}", Flags::ABC), "A | B | C | ABC");
-        let extra = unsafe { Flags::from_bits_unchecked(0xb8) };
-        assert_eq!(format!("{:?}", extra), "0xb8");
-        assert_eq!(format!("{:?}", Flags::A | extra), "A | 0xb8");
-
-        assert_eq!(
-            format!("{:?}", Flags::ABC | extra),
-            "A | B | C | ABC | 0xb8"
-        );
+        $($t:tt)*
+    ) => {
+        // Declared in the scope of the `bitflags!` call
+        // This type appears in the end-user's API
+        __declare_public_bitflags! {
+            $(#[$outer])*
+            $vis struct $BitFlags
+        }
 
-        assert_eq!(format!("{:?}", EmptyFlags::empty()), "(empty)");
-    }
+        // Workaround for: https://github.com/bitflags/bitflags/issues/320
+        __impl_public_bitflags_consts! {
+            $BitFlags: $T {
+                $(
+                    $(#[$inner $($args)*])*
+                    const $Flag = $value;
+                )*
+            }
+        }
 
-    #[test]
-    fn test_binary() {
-        assert_eq!(format!("{:b}", Flags::ABC), "111");
-        assert_eq!(format!("{:#b}", Flags::ABC), "0b111");
-        let extra = unsafe { Flags::from_bits_unchecked(0b1010000) };
-        assert_eq!(format!("{:b}", Flags::ABC | extra), "1010111");
-        assert_eq!(format!("{:#b}", Flags::ABC | extra), "0b1010111");
-    }
+        #[allow(
+            dead_code,
+            deprecated,
+            unused_doc_comments,
+            unused_attributes,
+            unused_mut,
+            unused_imports,
+            non_upper_case_globals,
+            clippy::assign_op_pattern,
+            clippy::indexing_slicing,
+            clippy::same_name_method,
+            clippy::iter_without_into_iter,
+        )]
+        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! {
+                $vis struct InternalBitFlags: $T
+            }
 
-    #[test]
-    fn test_octal() {
-        assert_eq!(format!("{:o}", LongFlags::LONG_A), "177777");
-        assert_eq!(format!("{:#o}", LongFlags::LONG_A), "0o177777");
-        let extra = unsafe { LongFlags::from_bits_unchecked(0o5000000) };
-        assert_eq!(format!("{:o}", LongFlags::LONG_A | extra), "5177777");
-        assert_eq!(format!("{:#o}", LongFlags::LONG_A | extra), "0o5177777");
-    }
+            __impl_internal_bitflags! {
+                InternalBitFlags: $T, $BitFlags {
+                    $(
+                        $(#[$inner $($args)*])*
+                        const $Flag = $value;
+                    )*
+                }
+            }
 
-    #[test]
-    fn test_lowerhex() {
-        assert_eq!(format!("{:x}", LongFlags::LONG_A), "ffff");
-        assert_eq!(format!("{:#x}", LongFlags::LONG_A), "0xffff");
-        let extra = unsafe { LongFlags::from_bits_unchecked(0xe00000) };
-        assert_eq!(format!("{:x}", LongFlags::LONG_A | extra), "e0ffff");
-        assert_eq!(format!("{:#x}", LongFlags::LONG_A | extra), "0xe0ffff");
-    }
+            // This is where new library trait implementations can be added
+            __impl_external_bitflags! {
+                InternalBitFlags: $T, $BitFlags {
+                    $(
+                        $(#[$inner $($args)*])*
+                        const $Flag;
+                    )*
+                }
+            }
 
-    #[test]
-    fn test_upperhex() {
-        assert_eq!(format!("{:X}", LongFlags::LONG_A), "FFFF");
-        assert_eq!(format!("{:#X}", LongFlags::LONG_A), "0xFFFF");
-        let extra = unsafe { LongFlags::from_bits_unchecked(0xe00000) };
-        assert_eq!(format!("{:X}", LongFlags::LONG_A | extra), "E0FFFF");
-        assert_eq!(format!("{:#X}", LongFlags::LONG_A | extra), "0xE0FFFF");
-    }
+            __impl_public_bitflags_forward! {
+                $BitFlags: $T, InternalBitFlags
+            }
 
-    mod submodule {
-        bitflags! {
-            pub struct PublicFlags: i8 {
-                const X = 0;
+            __impl_public_bitflags_ops! {
+                $BitFlags
             }
 
-            struct PrivateFlags: i8 {
-                const Y = 0;
+            __impl_public_bitflags_iter! {
+                $BitFlags: $T, $BitFlags
             }
-        }
+        };
 
-        #[test]
-        fn test_private() {
-            let _ = PrivateFlags::Y;
+        bitflags! {
+            $($t)*
         }
-    }
-
-    #[test]
-    fn test_public() {
-        let _ = submodule::PublicFlags::X;
-    }
-
-    mod t1 {
-        mod foo {
-            pub type Bar = i32;
+    };
+    (
+        impl $BitFlags:ident: $T:ty {
+            $(
+                $(#[$inner:ident $($args:tt)*])*
+                const $Flag:tt = $value:expr;
+            )*
         }
 
-        bitflags! {
-            /// baz
-            struct Flags: foo::Bar {
-                const A = 0b00000001;
-                #[cfg(foo)]
-                const B = 0b00000010;
-                #[cfg(foo)]
-                const C = 0b00000010;
+        $($t:tt)*
+    ) => {
+        __impl_public_bitflags_consts! {
+            $BitFlags: $T {
+                $(
+                    $(#[$inner $($args)*])*
+                    const $Flag = $value;
+                )*
             }
         }
-    }
 
-    #[test]
-    fn test_in_function() {
-        bitflags! {
-           struct Flags: u8 {
-                const A = 1;
-                #[cfg(any())] // false
-                const B = 2;
+        #[allow(
+            dead_code,
+            deprecated,
+            unused_doc_comments,
+            unused_attributes,
+            unused_mut,
+            unused_imports,
+            non_upper_case_globals,
+            clippy::assign_op_pattern,
+            clippy::iter_without_into_iter,
+        )]
+        const _: () = {
+            __impl_public_bitflags! {
+                $BitFlags: $T, $BitFlags {
+                    $(
+                        $(#[$inner $($args)*])*
+                        const $Flag = $value;
+                    )*
+                }
             }
-        }
-        assert_eq!(Flags::all(), Flags::A);
-        assert_eq!(format!("{:?}", Flags::A), "A");
-    }
 
-    #[test]
-    fn test_deprecated() {
-        bitflags! {
-            pub struct TestFlags: u32 {
-                #[deprecated(note = "Use something else.")]
-                const ONE = 1;
+            __impl_public_bitflags_ops! {
+                $BitFlags
             }
-        }
-    }
 
-    #[test]
-    fn test_pub_crate() {
-        mod module {
-            bitflags! {
-                pub (crate) struct Test: u8 {
-                    const FOO = 1;
-                }
+            __impl_public_bitflags_iter! {
+                $BitFlags: $T, $BitFlags
             }
+        };
+
+        bitflags! {
+            $($t)*
         }
+    };
+    () => {};
+}
 
-        assert_eq!(module::Test::FOO.bits(), 1);
-    }
+/// Implement functions on bitflags types.
+///
+/// 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)]
+#[doc(hidden)]
+macro_rules! __impl_bitflags {
+    (
+        $PublicBitFlags:ident: $T:ty {
+            fn empty() $empty:block
+            fn all() $all:block
+            fn bits($bits0:ident) $bits:block
+            fn from_bits($from_bits0:ident) $from_bits:block
+            fn from_bits_truncate($from_bits_truncate0:ident) $from_bits_truncate:block
+            fn from_bits_retain($from_bits_retain0:ident) $from_bits_retain:block
+            fn from_name($from_name0:ident) $from_name:block
+            fn is_empty($is_empty0:ident) $is_empty:block
+            fn is_all($is_all0:ident) $is_all:block
+            fn intersects($intersects0:ident, $intersects1:ident) $intersects:block
+            fn contains($contains0:ident, $contains1:ident) $contains:block
+            fn insert($insert0:ident, $insert1:ident) $insert:block
+            fn remove($remove0:ident, $remove1:ident) $remove:block
+            fn toggle($toggle0:ident, $toggle1:ident) $toggle:block
+            fn set($set0:ident, $set1:ident, $set2:ident) $set:block
+            fn intersection($intersection0:ident, $intersection1:ident) $intersection:block
+            fn union($union0:ident, $union1:ident) $union:block
+            fn difference($difference0:ident, $difference1:ident) $difference:block
+            fn symmetric_difference($symmetric_difference0:ident, $symmetric_difference1:ident) $symmetric_difference:block
+            fn complement($complement0:ident) $complement:block
+        }
+    ) => {
+        #[allow(dead_code, deprecated, unused_attributes)]
+        impl $PublicBitFlags {
+            /// Get a flags value with all bits unset.
+            #[inline]
+            pub const fn empty() -> Self {
+                $empty
+            }
 
-    #[test]
-    fn test_pub_in_module() {
-        mod module {
-            mod submodule {
-                bitflags! {
-                    // `pub (in super)` means only the module `module` will
-                    // be able to access this.
-                    pub (in super) struct Test: u8 {
-                        const FOO = 1;
-                    }
-                }
+            /// Get a flags value with all known bits set.
+            #[inline]
+            pub const fn all() -> Self {
+                $all
             }
 
-            mod test {
-                // Note: due to `pub (in super)`,
-                // this cannot be accessed directly by the testing code.
-                pub(super) fn value() -> u8 {
-                    super::submodule::Test::FOO.bits()
-                }
+            /// Get the underlying bits value.
+            ///
+            /// The returned value is exactly the bits set in this flags value.
+            #[inline]
+            pub const fn bits(&self) -> $T {
+                let $bits0 = self;
+                $bits
             }
 
-            pub fn value() -> u8 {
-                test::value()
+            /// Convert from a bits value.
+            ///
+            /// This method will return `None` if any unknown bits are set.
+            #[inline]
+            pub const fn from_bits(bits: $T) -> $crate::__private::core::option::Option<Self> {
+                let $from_bits0 = bits;
+                $from_bits
             }
-        }
 
-        assert_eq!(module::value(), 1)
-    }
+            /// Convert from a bits value, unsetting any unknown bits.
+            #[inline]
+            pub const fn from_bits_truncate(bits: $T) -> Self {
+                let $from_bits_truncate0 = bits;
+                $from_bits_truncate
+            }
 
-    #[test]
-    fn test_zero_value_flags() {
-        bitflags! {
-            struct Flags: u32 {
-                const NONE = 0b0;
-                const SOME = 0b1;
+            /// Convert from a bits value exactly.
+            #[inline]
+            pub const fn from_bits_retain(bits: $T) -> Self {
+                let $from_bits_retain0 = bits;
+                $from_bits_retain
             }
-        }
 
-        assert!(Flags::empty().contains(Flags::NONE));
-        assert!(Flags::SOME.contains(Flags::NONE));
-        assert!(Flags::NONE.is_empty());
+            /// Get a flags value with the bits of a flag with the given name set.
+            ///
+            /// This method will return `None` if `name` is empty or doesn't
+            /// correspond to any named flag.
+            #[inline]
+            pub fn from_name(name: &str) -> $crate::__private::core::option::Option<Self> {
+                let $from_name0 = name;
+                $from_name
+            }
 
-        assert_eq!(format!("{:?}", Flags::empty()), "NONE");
-        assert_eq!(format!("{:?}", Flags::SOME), "SOME");
-    }
+            /// Whether all bits in this flags value are unset.
+            #[inline]
+            pub const fn is_empty(&self) -> bool {
+                let $is_empty0 = self;
+                $is_empty
+            }
 
-    #[test]
-    fn test_empty_bitflags() {
-        bitflags! {}
-    }
+            /// Whether all known bits in this flags value are set.
+            #[inline]
+            pub const fn is_all(&self) -> bool {
+                let $is_all0 = self;
+                $is_all
+            }
 
-    #[test]
-    fn test_u128_bitflags() {
-        bitflags! {
-            struct Flags128: u128 {
-                const A = 0x0000_0000_0000_0000_0000_0000_0000_0001;
-                const B = 0x0000_0000_0000_1000_0000_0000_0000_0000;
-                const C = 0x8000_0000_0000_0000_0000_0000_0000_0000;
-                const ABC = Self::A.bits | Self::B.bits | Self::C.bits;
+            /// Whether any set bits in a source flags value are also set in a target flags value.
+            #[inline]
+            pub const fn intersects(&self, other: Self) -> bool {
+                let $intersects0 = self;
+                let $intersects1 = other;
+                $intersects
             }
-        }
 
-        assert_eq!(Flags128::ABC, Flags128::A | Flags128::B | Flags128::C);
-        assert_eq!(Flags128::A.bits, 0x0000_0000_0000_0000_0000_0000_0000_0001);
-        assert_eq!(Flags128::B.bits, 0x0000_0000_0000_1000_0000_0000_0000_0000);
-        assert_eq!(Flags128::C.bits, 0x8000_0000_0000_0000_0000_0000_0000_0000);
-        assert_eq!(
-            Flags128::ABC.bits,
-            0x8000_0000_0000_1000_0000_0000_0000_0001
-        );
-        assert_eq!(format!("{:?}", Flags128::A), "A");
-        assert_eq!(format!("{:?}", Flags128::B), "B");
-        assert_eq!(format!("{:?}", Flags128::C), "C");
-        assert_eq!(format!("{:?}", Flags128::ABC), "A | B | C | ABC");
-    }
+            /// Whether all set bits in a source flags value are also set in a target flags value.
+            #[inline]
+            pub const fn contains(&self, other: Self) -> bool {
+                let $contains0 = self;
+                let $contains1 = other;
+                $contains
+            }
+
+            /// The bitwise or (`|`) of the bits in two flags values.
+            #[inline]
+            pub fn insert(&mut self, other: Self) {
+                let $insert0 = self;
+                let $insert1 = other;
+                $insert
+            }
 
-    #[test]
-    fn test_serde_bitflags_serialize() {
-        let flags = SerdeFlags::A | SerdeFlags::B;
+            /// The intersection of a source flags value with the complement of a target flags value (`&!`).
+            ///
+            /// This method is not equivalent to `self & !other` when `other` has unknown bits set.
+            /// `remove` won't truncate `other`, but the `!` operator will.
+            #[inline]
+            pub fn remove(&mut self, other: Self) {
+                let $remove0 = self;
+                let $remove1 = other;
+                $remove
+            }
 
-        let serialized = serde_json::to_string(&flags).unwrap();
+            /// The bitwise exclusive-or (`^`) of the bits in two flags values.
+            #[inline]
+            pub fn toggle(&mut self, other: Self) {
+                let $toggle0 = self;
+                let $toggle1 = other;
+                $toggle
+            }
 
-        assert_eq!(serialized, r#"{"bits":3}"#);
-    }
+            /// Call `insert` when `value` is `true` or `remove` when `value` is `false`.
+            #[inline]
+            pub fn set(&mut self, other: Self, value: bool) {
+                let $set0 = self;
+                let $set1 = other;
+                let $set2 = value;
+                $set
+            }
 
-    #[test]
-    fn test_serde_bitflags_deserialize() {
-        let deserialized: SerdeFlags = serde_json::from_str(r#"{"bits":12}"#).unwrap();
+            /// The bitwise and (`&`) of the bits in two flags values.
+            #[inline]
+            #[must_use]
+            pub const fn intersection(self, other: Self) -> Self {
+                let $intersection0 = self;
+                let $intersection1 = other;
+                $intersection
+            }
 
-        let expected = SerdeFlags::C | SerdeFlags::D;
+            /// The bitwise or (`|`) of the bits in two flags values.
+            #[inline]
+            #[must_use]
+            pub const fn union(self, other: Self) -> Self {
+                let $union0 = self;
+                let $union1 = other;
+                $union
+            }
 
-        assert_eq!(deserialized.bits, expected.bits);
-    }
+            /// The intersection of a source flags value with the complement of a target flags value (`&!`).
+            ///
+            /// This method is not equivalent to `self & !other` when `other` has unknown bits set.
+            /// `difference` won't truncate `other`, but the `!` operator will.
+            #[inline]
+            #[must_use]
+            pub const fn difference(self, other: Self) -> Self {
+                let $difference0 = self;
+                let $difference1 = other;
+                $difference
+            }
 
-    #[test]
-    fn test_serde_bitflags_roundtrip() {
-        let flags = SerdeFlags::A | SerdeFlags::B;
+            /// The bitwise exclusive-or (`^`) of the bits in two flags values.
+            #[inline]
+            #[must_use]
+            pub const fn symmetric_difference(self, other: Self) -> Self {
+                let $symmetric_difference0 = self;
+                let $symmetric_difference1 = other;
+                $symmetric_difference
+            }
 
-        let deserialized: SerdeFlags = serde_json::from_str(&serde_json::to_string(&flags).unwrap()).unwrap();
+            /// The bitwise negation (`!`) of the bits in a flags value, truncating the result.
+            #[inline]
+            #[must_use]
+            pub const fn complement(self) -> Self {
+                let $complement0 = self;
+                $complement
+            }
+        }
+    };
+}
 
-        assert_eq!(deserialized.bits, flags.bits);
+/// A macro that processed the input to `bitflags!` and shuffles attributes around
+/// based on whether or not they're "expression-safe".
+///
+/// This macro is a token-tree muncher that works on 2 levels:
+///
+/// For each attribute, we explicitly match on its identifier, like `cfg` to determine
+/// whether or not it should be considered expression-safe.
+///
+/// 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)]
+#[doc(hidden)]
+macro_rules! __bitflags_expr_safe_attrs {
+    // Entrypoint: Move all flags and all attributes into `unprocessed` lists
+    // where they'll be munched one-at-a-time
+    (
+        $(#[$inner:ident $($args:tt)*])*
+        { $e:expr }
+    ) => {
+        __bitflags_expr_safe_attrs! {
+            expr: { $e },
+            attrs: {
+                // All attributes start here
+                unprocessed: [$(#[$inner $($args)*])*],
+                // Attributes that are safe on expressions go here
+                processed: [],
+            },
+        }
+    };
+    // Process the next attribute on the current flag
+    // `cfg`: The next flag should be propagated to expressions
+    // NOTE: You can copy this rules block and replace `cfg` with
+    // your attribute name that should be considered expression-safe
+    (
+        expr: { $e:expr },
+            attrs: {
+            unprocessed: [
+                // cfg matched here
+                #[cfg $($args:tt)*]
+                $($attrs_rest:tt)*
+            ],
+            processed: [$($expr:tt)*],
+        },
+    ) => {
+        __bitflags_expr_safe_attrs! {
+            expr: { $e },
+            attrs: {
+                unprocessed: [
+                    $($attrs_rest)*
+                ],
+                processed: [
+                    $($expr)*
+                    // cfg added here
+                    #[cfg $($args)*]
+                ],
+            },
+        }
+    };
+    // Process the next attribute on the current flag
+    // `$other`: The next flag should not be propagated to expressions
+    (
+        expr: { $e:expr },
+            attrs: {
+            unprocessed: [
+                // $other matched here
+                #[$other:ident $($args:tt)*]
+                $($attrs_rest:tt)*
+            ],
+            processed: [$($expr:tt)*],
+        },
+    ) => {
+        __bitflags_expr_safe_attrs! {
+            expr: { $e },
+                attrs: {
+                unprocessed: [
+                    $($attrs_rest)*
+                ],
+                processed: [
+                    // $other not added here
+                    $($expr)*
+                ],
+            },
+        }
+    };
+    // Once all attributes on all flags are processed, generate the actual code
+    (
+        expr: { $e:expr },
+        attrs: {
+            unprocessed: [],
+            processed: [$(#[$expr:ident $($exprargs:tt)*])*],
+        },
+    ) => {
+        $(#[$expr $($exprargs)*])*
+        { $e }
     }
+}
 
-    bitflags! {
-        #[derive(serde::Serialize, serde::Deserialize)]
-        struct SerdeFlags: u32 {
-            const A = 1;
-            const B = 2;
-            const C = 4;
-            const D = 8;
+/// Implement a flag, which may be a wildcard `_`.
+#[macro_export(local_inner_macros)]
+#[doc(hidden)]
+macro_rules! __bitflags_flag {
+    (
+        {
+            name: _,
+            named: { $($named:tt)* },
+            unnamed: { $($unnamed:tt)* },
         }
-    }
+    ) => {
+        $($unnamed)*
+    };
+    (
+        {
+            name: $Flag:ident,
+            named: { $($named:tt)* },
+            unnamed: { $($unnamed:tt)* },
+        }
+    ) => {
+        $($named)*
+    };
 }
+
+#[macro_use]
+mod public;
+#[macro_use]
+mod internal;
+#[macro_use]
+mod external;
+
+#[cfg(feature = "example_generated")]
+pub mod example_generated;
+
+#[cfg(test)]
+mod tests;
diff -Naur vendor-41.0.5/bitflags/src/parser.rs vendor-41.0.7/bitflags/src/parser.rs
--- vendor-41.0.5/bitflags/src/parser.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags/src/parser.rs	1969-12-31 19:00:00.000000000 -0500
@@ -0,0 +1,247 @@
+/*!
+Parsing flags from text.
+
+Format and parse a flags value as text using the following grammar:
+
+- _Flags:_ (_Whitespace_ _Flag_ _Whitespace_)`|`*
+- _Flag:_ _Name_ | _Hex Number_
+- _Name:_ The name of any defined flag
+- _Hex Number_: `0x`([0-9a-fA-F])*
+- _Whitespace_: (\s)*
+
+As an example, this is how `Flags::A | Flags::B | 0x0c` can be represented as text:
+
+```text
+A | B | 0x0c
+```
+
+Alternatively, it could be represented without whitespace:
+
+```text
+A|B|0x0C
+```
+
+Note that identifiers are *case-sensitive*, so the following is *not equivalent*:
+
+```text
+a|b|0x0C
+```
+*/
+
+#![allow(clippy::let_unit_value)]
+
+use core::fmt::{self, Write};
+
+use crate::{Bits, Flags};
+
+/**
+Write a flags value as text.
+
+Any bits that aren't part of a contained flag will be formatted as a hex number.
+*/
+pub fn to_writer<B: Flags>(flags: &B, mut writer: impl Write) -> Result<(), fmt::Error>
+where
+    B::Bits: WriteHex,
+{
+    // A formatter for bitflags that produces text output like:
+    //
+    // A | B | 0xf6
+    //
+    // The names of set flags are written in a bar-separated-format,
+    // followed by a hex number of any remaining bits that are set
+    // but don't correspond to any flags.
+
+    // Iterate over known flag values
+    let mut first = true;
+    let mut iter = flags.iter_names();
+    for (name, _) in &mut iter {
+        if !first {
+            writer.write_str(" | ")?;
+        }
+
+        first = false;
+        writer.write_str(name)?;
+    }
+
+    // Append any extra bits that correspond to flags to the end of the format
+    let remaining = iter.remaining().bits();
+    if remaining != B::Bits::EMPTY {
+        if !first {
+            writer.write_str(" | ")?;
+        }
+
+        writer.write_str("0x")?;
+        remaining.write_hex(writer)?;
+    }
+
+    fmt::Result::Ok(())
+}
+
+pub(crate) struct AsDisplay<'a, B>(pub(crate) &'a B);
+
+impl<'a, B: Flags> fmt::Display for AsDisplay<'a, B>
+where
+    B::Bits: WriteHex,
+{
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        to_writer(self.0, f)
+    }
+}
+
+/**
+Parse a flags value from text.
+
+This function will fail on any names that don't correspond to defined flags.
+Unknown bits will be retained.
+*/
+pub fn from_str<B: Flags>(input: &str) -> Result<B, ParseError>
+where
+    B::Bits: ParseHex,
+{
+    let mut parsed_flags = B::empty();
+
+    // If the input is empty then return an empty set of flags
+    if input.trim().is_empty() {
+        return Ok(parsed_flags);
+    }
+
+    for flag in input.split('|') {
+        let flag = flag.trim();
+
+        // If the flag is empty then we've got missing input
+        if flag.is_empty() {
+            return Err(ParseError::empty_flag());
+        }
+
+        // If the flag starts with `0x` then it's a hex number
+        // Parse it directly to the underlying bits type
+        let parsed_flag = if let Some(flag) = flag.strip_prefix("0x") {
+            let bits =
+                <B::Bits>::parse_hex(flag).map_err(|_| ParseError::invalid_hex_flag(flag))?;
+
+            B::from_bits_retain(bits)
+        }
+        // Otherwise the flag is a name
+        // The generated flags type will determine whether
+        // or not it's a valid identifier
+        else {
+            B::from_name(flag).ok_or_else(|| ParseError::invalid_named_flag(flag))?
+        };
+
+        parsed_flags.insert(parsed_flag);
+    }
+
+    Ok(parsed_flags)
+}
+
+/**
+Encode a value as a hex string.
+
+Implementors of this trait should not write the `0x` prefix.
+*/
+pub trait WriteHex {
+    /// Write the value as hex.
+    fn write_hex<W: fmt::Write>(&self, writer: W) -> fmt::Result;
+}
+
+/**
+Parse a value from a hex string.
+*/
+pub trait ParseHex {
+    /// Parse the value from hex.
+    fn parse_hex(input: &str) -> Result<Self, ParseError>
+    where
+        Self: Sized;
+}
+
+/// An error encountered while parsing flags from text.
+#[derive(Debug)]
+pub struct ParseError(ParseErrorKind);
+
+#[derive(Debug)]
+#[allow(clippy::enum_variant_names)]
+enum ParseErrorKind {
+    EmptyFlag,
+    InvalidNamedFlag {
+        #[cfg(not(feature = "std"))]
+        got: (),
+        #[cfg(feature = "std")]
+        got: String,
+    },
+    InvalidHexFlag {
+        #[cfg(not(feature = "std"))]
+        got: (),
+        #[cfg(feature = "std")]
+        got: String,
+    },
+}
+
+impl ParseError {
+    /// An invalid hex flag was encountered.
+    pub fn invalid_hex_flag(flag: impl fmt::Display) -> Self {
+        let _flag = flag;
+
+        let got = {
+            #[cfg(feature = "std")]
+            {
+                _flag.to_string()
+            }
+        };
+
+        ParseError(ParseErrorKind::InvalidHexFlag { got })
+    }
+
+    /// A named flag that doesn't correspond to any on the flags type was encountered.
+    pub fn invalid_named_flag(flag: impl fmt::Display) -> Self {
+        let _flag = flag;
+
+        let got = {
+            #[cfg(feature = "std")]
+            {
+                _flag.to_string()
+            }
+        };
+
+        ParseError(ParseErrorKind::InvalidNamedFlag { got })
+    }
+
+    /// A hex or named flag wasn't found between separators.
+    pub const fn empty_flag() -> Self {
+        ParseError(ParseErrorKind::EmptyFlag)
+    }
+}
+
+impl fmt::Display for ParseError {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        match &self.0 {
+            ParseErrorKind::InvalidNamedFlag { got } => {
+                let _got = got;
+
+                write!(f, "unrecognized named flag")?;
+
+                #[cfg(feature = "std")]
+                {
+                    write!(f, " `{}`", _got)?;
+                }
+            }
+            ParseErrorKind::InvalidHexFlag { got } => {
+                let _got = got;
+
+                write!(f, "invalid hex flag")?;
+
+                #[cfg(feature = "std")]
+                {
+                    write!(f, " `{}`", _got)?;
+                }
+            }
+            ParseErrorKind::EmptyFlag => {
+                write!(f, "encountered empty flag")?;
+            }
+        }
+
+        Ok(())
+    }
+}
+
+#[cfg(feature = "std")]
+impl std::error::Error for ParseError {}
diff -Naur vendor-41.0.5/bitflags/src/public.rs vendor-41.0.7/bitflags/src/public.rs
--- vendor-41.0.5/bitflags/src/public.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags/src/public.rs	1969-12-31 19:00:00.000000000 -0500
@@ -0,0 +1,543 @@
+//! Generate the user-facing flags type.
+//!
+//! The code here belongs to the end-user, so new trait implementations and methods can't be
+//! added without potentially breaking users.
+
+/// Declare the user-facing bitflags struct.
+///
+/// This type is guaranteed to be a newtype with a `bitflags`-facing type as its single field.
+#[macro_export(local_inner_macros)]
+#[doc(hidden)]
+macro_rules! __declare_public_bitflags {
+    (
+        $(#[$outer:meta])*
+        $vis:vis struct $PublicBitFlags:ident
+    ) => {
+        $(#[$outer])*
+        $vis struct $PublicBitFlags(<$PublicBitFlags as $crate::__private::PublicFlags>::Internal);
+    };
+}
+
+/// Implement functions on the public (user-facing) bitflags type.
+///
+/// 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)]
+#[doc(hidden)]
+macro_rules! __impl_public_bitflags_forward {
+    (
+        $PublicBitFlags:ident: $T:ty, $InternalBitFlags:ident
+    ) => {
+        __impl_bitflags! {
+            $PublicBitFlags: $T {
+                fn empty() {
+                    Self($InternalBitFlags::empty())
+                }
+
+                fn all() {
+                    Self($InternalBitFlags::all())
+                }
+
+                fn bits(f) {
+                    f.0.bits()
+                }
+
+                fn from_bits(bits) {
+                    match $InternalBitFlags::from_bits(bits) {
+                        $crate::__private::core::option::Option::Some(bits) => $crate::__private::core::option::Option::Some(Self(bits)),
+                        $crate::__private::core::option::Option::None => $crate::__private::core::option::Option::None,
+                    }
+                }
+
+                fn from_bits_truncate(bits) {
+                    Self($InternalBitFlags::from_bits_truncate(bits))
+                }
+
+                fn from_bits_retain(bits) {
+                    Self($InternalBitFlags::from_bits_retain(bits))
+                }
+
+                fn from_name(name) {
+                    match $InternalBitFlags::from_name(name) {
+                        $crate::__private::core::option::Option::Some(bits) => $crate::__private::core::option::Option::Some(Self(bits)),
+                        $crate::__private::core::option::Option::None => $crate::__private::core::option::Option::None,
+                    }
+                }
+
+                fn is_empty(f) {
+                    f.0.is_empty()
+                }
+
+                fn is_all(f) {
+                    f.0.is_all()
+                }
+
+                fn intersects(f, other) {
+                    f.0.intersects(other.0)
+                }
+
+                fn contains(f, other) {
+                    f.0.contains(other.0)
+                }
+
+                fn insert(f, other) {
+                    f.0.insert(other.0)
+                }
+
+                fn remove(f, other) {
+                    f.0.remove(other.0)
+                }
+
+                fn toggle(f, other) {
+                    f.0.toggle(other.0)
+                }
+
+                fn set(f, other, value) {
+                    f.0.set(other.0, value)
+                }
+
+                fn intersection(f, other) {
+                    Self(f.0.intersection(other.0))
+                }
+
+                fn union(f, other) {
+                    Self(f.0.union(other.0))
+                }
+
+                fn difference(f, other) {
+                    Self(f.0.difference(other.0))
+                }
+
+                fn symmetric_difference(f, other) {
+                    Self(f.0.symmetric_difference(other.0))
+                }
+
+                fn complement(f) {
+                    Self(f.0.complement())
+                }
+            }
+        }
+    };
+}
+
+/// Implement functions on the public (user-facing) bitflags type.
+///
+/// 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)]
+#[doc(hidden)]
+macro_rules! __impl_public_bitflags {
+    (
+        $BitFlags:ident: $T:ty, $PublicBitFlags:ident {
+            $(
+                $(#[$inner:ident $($args:tt)*])*
+                const $Flag:tt = $value:expr;
+            )*
+        }
+    ) => {
+        __impl_bitflags! {
+            $BitFlags: $T {
+                fn empty() {
+                    Self(<$T as $crate::Bits>::EMPTY)
+                }
+
+                fn all() {
+                    let mut truncated = <$T as $crate::Bits>::EMPTY;
+                    let mut i = 0;
+
+                    $(
+                        __bitflags_expr_safe_attrs!(
+                            $(#[$inner $($args)*])*
+                            {{
+                                let flag = <$PublicBitFlags as $crate::Flags>::FLAGS[i].value().bits();
+
+                                truncated = truncated | flag;
+                                i += 1;
+                            }}
+                        );
+                    )*
+
+                    let _ = i;
+                    Self::from_bits_retain(truncated)
+                }
+
+                fn bits(f) {
+                    f.0
+                }
+
+                fn from_bits(bits) {
+                    let truncated = Self::from_bits_truncate(bits).0;
+
+                    if truncated == bits {
+                        $crate::__private::core::option::Option::Some(Self(bits))
+                    } else {
+                        $crate::__private::core::option::Option::None
+                    }
+                }
+
+                fn from_bits_truncate(bits) {
+                    Self(bits & Self::all().bits())
+                }
+
+                fn from_bits_retain(bits) {
+                    Self(bits)
+                }
+
+                fn from_name(name) {
+                    $(
+                        __bitflags_flag!({
+                            name: $Flag,
+                            named: {
+                                __bitflags_expr_safe_attrs!(
+                                    $(#[$inner $($args)*])*
+                                    {
+                                        if name == $crate::__private::core::stringify!($Flag) {
+                                            return $crate::__private::core::option::Option::Some(Self($PublicBitFlags::$Flag.bits()));
+                                        }
+                                    }
+                                );
+                            },
+                            unnamed: {},
+                        });
+                    )*
+
+                    let _ = name;
+                    $crate::__private::core::option::Option::None
+                }
+
+                fn is_empty(f) {
+                    f.bits() == <$T as $crate::Bits>::EMPTY
+                }
+
+                fn is_all(f) {
+                    // NOTE: We check against `Self::all` here, not `Self::Bits::ALL`
+                    // because the set of all flags may not use all bits
+                    Self::all().bits() | f.bits() == f.bits()
+                }
+
+                fn intersects(f, other) {
+                    f.bits() & other.bits() != <$T as $crate::Bits>::EMPTY
+                }
+
+                fn contains(f, other) {
+                    f.bits() & other.bits() == other.bits()
+                }
+
+                fn insert(f, other) {
+                    *f = Self::from_bits_retain(f.bits()).union(other);
+                }
+
+                fn remove(f, other) {
+                    *f = Self::from_bits_retain(f.bits()).difference(other);
+                }
+
+                fn toggle(f, other) {
+                    *f = Self::from_bits_retain(f.bits()).symmetric_difference(other);
+                }
+
+                fn set(f, other, value) {
+                    if value {
+                        f.insert(other);
+                    } else {
+                        f.remove(other);
+                    }
+                }
+
+                fn intersection(f, other) {
+                    Self::from_bits_retain(f.bits() & other.bits())
+                }
+
+                fn union(f, other) {
+                    Self::from_bits_retain(f.bits() | other.bits())
+                }
+
+                fn difference(f, other) {
+                    Self::from_bits_retain(f.bits() & !other.bits())
+                }
+
+                fn symmetric_difference(f, other) {
+                    Self::from_bits_retain(f.bits() ^ other.bits())
+                }
+
+                fn complement(f) {
+                    Self::from_bits_truncate(!f.bits())
+                }
+            }
+        }
+    };
+}
+
+/// Implement iterators on the public (user-facing) bitflags type.
+#[macro_export(local_inner_macros)]
+#[doc(hidden)]
+macro_rules! __impl_public_bitflags_iter {
+    ($BitFlags:ident: $T:ty, $PublicBitFlags:ident) => {
+        impl $BitFlags {
+            /// Yield a set of contained flags values.
+            ///
+            /// Each yielded flags value will correspond to a defined named flag. Any unknown bits
+            /// will be yielded together as a final flags value.
+            #[inline]
+            pub const fn iter(&self) -> $crate::iter::Iter<$PublicBitFlags> {
+                $crate::iter::Iter::__private_const_new(
+                    <$PublicBitFlags as $crate::Flags>::FLAGS,
+                    $PublicBitFlags::from_bits_retain(self.bits()),
+                    $PublicBitFlags::from_bits_retain(self.bits()),
+                )
+            }
+
+            /// Yield a set of contained named flags values.
+            ///
+            /// This method is like [`iter`](#method.iter), except only yields bits in contained named flags.
+            /// Any unknown bits, or bits not corresponding to a contained flag will not be yielded.
+            #[inline]
+            pub const fn iter_names(&self) -> $crate::iter::IterNames<$PublicBitFlags> {
+                $crate::iter::IterNames::__private_const_new(
+                    <$PublicBitFlags as $crate::Flags>::FLAGS,
+                    $PublicBitFlags::from_bits_retain(self.bits()),
+                    $PublicBitFlags::from_bits_retain(self.bits()),
+                )
+            }
+        }
+
+        impl $crate::__private::core::iter::IntoIterator for $BitFlags {
+            type Item = $PublicBitFlags;
+            type IntoIter = $crate::iter::Iter<$PublicBitFlags>;
+
+            fn into_iter(self) -> Self::IntoIter {
+                self.iter()
+            }
+        }
+    };
+}
+
+/// Implement traits on the public (user-facing) bitflags type.
+#[macro_export(local_inner_macros)]
+#[doc(hidden)]
+macro_rules! __impl_public_bitflags_ops {
+    ($PublicBitFlags:ident) => {
+        impl $crate::__private::core::fmt::Binary for $PublicBitFlags {
+            fn fmt(
+                &self,
+                f: &mut $crate::__private::core::fmt::Formatter,
+            ) -> $crate::__private::core::fmt::Result {
+                $crate::__private::core::fmt::Binary::fmt(&self.0, f)
+            }
+        }
+
+        impl $crate::__private::core::fmt::Octal for $PublicBitFlags {
+            fn fmt(
+                &self,
+                f: &mut $crate::__private::core::fmt::Formatter,
+            ) -> $crate::__private::core::fmt::Result {
+                $crate::__private::core::fmt::Octal::fmt(&self.0, f)
+            }
+        }
+
+        impl $crate::__private::core::fmt::LowerHex for $PublicBitFlags {
+            fn fmt(
+                &self,
+                f: &mut $crate::__private::core::fmt::Formatter,
+            ) -> $crate::__private::core::fmt::Result {
+                $crate::__private::core::fmt::LowerHex::fmt(&self.0, f)
+            }
+        }
+
+        impl $crate::__private::core::fmt::UpperHex for $PublicBitFlags {
+            fn fmt(
+                &self,
+                f: &mut $crate::__private::core::fmt::Formatter,
+            ) -> $crate::__private::core::fmt::Result {
+                $crate::__private::core::fmt::UpperHex::fmt(&self.0, f)
+            }
+        }
+
+        impl $crate::__private::core::ops::BitOr for $PublicBitFlags {
+            type Output = Self;
+
+            /// The bitwise or (`|`) of the bits in two flags values.
+            #[inline]
+            fn bitor(self, other: $PublicBitFlags) -> Self {
+                self.union(other)
+            }
+        }
+
+        impl $crate::__private::core::ops::BitOrAssign for $PublicBitFlags {
+            /// The bitwise or (`|`) of the bits in two flags values.
+            #[inline]
+            fn bitor_assign(&mut self, other: Self) {
+                self.insert(other);
+            }
+        }
+
+        impl $crate::__private::core::ops::BitXor for $PublicBitFlags {
+            type Output = Self;
+
+            /// The bitwise exclusive-or (`^`) of the bits in two flags values.
+            #[inline]
+            fn bitxor(self, other: Self) -> Self {
+                self.symmetric_difference(other)
+            }
+        }
+
+        impl $crate::__private::core::ops::BitXorAssign for $PublicBitFlags {
+            /// The bitwise exclusive-or (`^`) of the bits in two flags values.
+            #[inline]
+            fn bitxor_assign(&mut self, other: Self) {
+                self.toggle(other);
+            }
+        }
+
+        impl $crate::__private::core::ops::BitAnd for $PublicBitFlags {
+            type Output = Self;
+
+            /// The bitwise and (`&`) of the bits in two flags values.
+            #[inline]
+            fn bitand(self, other: Self) -> Self {
+                self.intersection(other)
+            }
+        }
+
+        impl $crate::__private::core::ops::BitAndAssign for $PublicBitFlags {
+            /// The bitwise and (`&`) of the bits in two flags values.
+            #[inline]
+            fn bitand_assign(&mut self, other: Self) {
+                *self = Self::from_bits_retain(self.bits()).intersection(other);
+            }
+        }
+
+        impl $crate::__private::core::ops::Sub for $PublicBitFlags {
+            type Output = Self;
+
+            /// The intersection of a source flags value with the complement of a target flags value (`&!`).
+            ///
+            /// This method is not equivalent to `self & !other` when `other` has unknown bits set.
+            /// `difference` won't truncate `other`, but the `!` operator will.
+            #[inline]
+            fn sub(self, other: Self) -> Self {
+                self.difference(other)
+            }
+        }
+
+        impl $crate::__private::core::ops::SubAssign for $PublicBitFlags {
+            /// The intersection of a source flags value with the complement of a target flags value (`&!`).
+            ///
+            /// This method is not equivalent to `self & !other` when `other` has unknown bits set.
+            /// `difference` won't truncate `other`, but the `!` operator will.
+            #[inline]
+            fn sub_assign(&mut self, other: Self) {
+                self.remove(other);
+            }
+        }
+
+        impl $crate::__private::core::ops::Not for $PublicBitFlags {
+            type Output = Self;
+
+            /// The bitwise negation (`!`) of the bits in a flags value, truncating the result.
+            #[inline]
+            fn not(self) -> Self {
+                self.complement()
+            }
+        }
+
+        impl $crate::__private::core::iter::Extend<$PublicBitFlags> for $PublicBitFlags {
+            /// The bitwise or (`|`) of the bits in each flags value.
+            fn extend<T: $crate::__private::core::iter::IntoIterator<Item = Self>>(
+                &mut self,
+                iterator: T,
+            ) {
+                for item in iterator {
+                    self.insert(item)
+                }
+            }
+        }
+
+        impl $crate::__private::core::iter::FromIterator<$PublicBitFlags> for $PublicBitFlags {
+            /// The bitwise or (`|`) of the bits in each flags value.
+            fn from_iter<T: $crate::__private::core::iter::IntoIterator<Item = Self>>(
+                iterator: T,
+            ) -> Self {
+                use $crate::__private::core::iter::Extend;
+
+                let mut result = Self::empty();
+                result.extend(iterator);
+                result
+            }
+        }
+    };
+}
+
+/// Implement constants on the public (user-facing) bitflags type.
+#[macro_export(local_inner_macros)]
+#[doc(hidden)]
+macro_rules! __impl_public_bitflags_consts {
+    (
+        $PublicBitFlags:ident: $T:ty {
+            $(
+                $(#[$inner:ident $($args:tt)*])*
+                const $Flag:tt = $value:expr;
+            )*
+        }
+    ) => {
+        impl $PublicBitFlags {
+            $(
+                __bitflags_flag!({
+                    name: $Flag,
+                    named: {
+                        $(#[$inner $($args)*])*
+                        #[allow(
+                            deprecated,
+                            non_upper_case_globals,
+                        )]
+                        pub const $Flag: Self = Self::from_bits_retain($value);
+                    },
+                    unnamed: {},
+                });
+            )*
+        }
+
+        impl $crate::Flags for $PublicBitFlags {
+            const FLAGS: &'static [$crate::Flag<$PublicBitFlags>] = &[
+                $(
+                    __bitflags_flag!({
+                        name: $Flag,
+                        named: {
+                            __bitflags_expr_safe_attrs!(
+                                $(#[$inner $($args)*])*
+                                {
+                                    #[allow(
+                                        deprecated,
+                                        non_upper_case_globals,
+                                    )]
+                                    $crate::Flag::new($crate::__private::core::stringify!($Flag), $PublicBitFlags::$Flag)
+                                }
+                            )
+                        },
+                        unnamed: {
+                            __bitflags_expr_safe_attrs!(
+                                $(#[$inner $($args)*])*
+                                {
+                                    #[allow(
+                                        deprecated,
+                                        non_upper_case_globals,
+                                    )]
+                                    $crate::Flag::new("", $PublicBitFlags::from_bits_retain($value))
+                                }
+                            )
+                        },
+                    }),
+                )*
+            ];
+
+            type Bits = $T;
+
+            fn bits(&self) -> $T {
+                $PublicBitFlags::bits(self)
+            }
+
+            fn from_bits_retain(bits: $T) -> $PublicBitFlags {
+                $PublicBitFlags::from_bits_retain(bits)
+            }
+        }
+    };
+}
diff -Naur vendor-41.0.5/bitflags/src/tests.rs vendor-41.0.7/bitflags/src/tests.rs
--- vendor-41.0.5/bitflags/src/tests.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags/src/tests.rs	1969-12-31 19:00:00.000000000 -0500
@@ -0,0 +1,131 @@
+mod all;
+mod bits;
+mod complement;
+mod contains;
+mod difference;
+mod empty;
+mod eq;
+mod extend;
+mod flags;
+mod fmt;
+mod from_bits;
+mod from_bits_retain;
+mod from_bits_truncate;
+mod from_name;
+mod insert;
+mod intersection;
+mod intersects;
+mod is_all;
+mod is_empty;
+mod iter;
+mod parser;
+mod remove;
+mod symmetric_difference;
+mod union;
+
+bitflags! {
+    #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy)]
+    pub struct TestFlags: u8 {
+        /// 1
+        const A = 1;
+
+        /// 1 << 1
+        const B = 1 << 1;
+
+        /// 1 << 2
+        const C = 1 << 2;
+
+        /// 1 | (1 << 1) | (1 << 2)
+        const ABC = Self::A.bits() | Self::B.bits() | Self::C.bits();
+    }
+
+    #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy)]
+    pub struct TestFlagsInvert: u8 {
+        /// 1 | (1 << 1) | (1 << 2)
+        const ABC = Self::A.bits() | Self::B.bits() | Self::C.bits();
+
+        /// 1
+        const A = 1;
+
+        /// 1 << 1
+        const B = 1 << 1;
+
+        /// 1 << 2
+        const C = 1 << 2;
+    }
+
+    #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy)]
+    pub struct TestZero: u8 {
+        /// 0
+        const ZERO = 0;
+    }
+
+    #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy)]
+    pub struct TestZeroOne: u8 {
+        /// 0
+        const ZERO = 0;
+
+        /// 1
+        const ONE = 1;
+    }
+
+    #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy)]
+    pub struct TestUnicode: u8 {
+        /// 1
+        const 一 = 1;
+
+        /// 2
+        const 二 = 1 << 1;
+    }
+
+    #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy)]
+    pub struct TestEmpty: u8 {}
+
+    #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy)]
+    pub struct TestOverlapping: u8 {
+        /// 1 | (1 << 1)
+        const AB = 1 | (1 << 1);
+
+        /// (1 << 1) | (1 << 2)
+        const BC = (1 << 1) | (1 << 2);
+    }
+
+    #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy)]
+    pub struct TestOverlappingFull: u8 {
+        /// 1
+        const A = 1;
+
+        /// 1
+        const B = 1;
+
+        /// 1
+        const C = 1;
+
+        /// 2
+        const D = 1 << 1;
+    }
+
+    #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy)]
+    pub struct TestExternal: u8 {
+        /// 1
+        const A = 1;
+
+        /// 1 << 1
+        const B = 1 << 1;
+
+        /// 1 << 2
+        const C = 1 << 2;
+
+        /// 1 | (1 << 1) | (1 << 2)
+        const ABC = Self::A.bits() | Self::B.bits() | Self::C.bits();
+
+        /// External
+        const _ = !0;
+    }
+
+    #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy)]
+    pub struct TestExternalFull: u8 {
+        /// External
+        const _ = !0;
+    }
+}
diff -Naur vendor-41.0.5/bitflags/src/traits.rs vendor-41.0.7/bitflags/src/traits.rs
--- vendor-41.0.5/bitflags/src/traits.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags/src/traits.rs	1969-12-31 19:00:00.000000000 -0500
@@ -0,0 +1,430 @@
+use core::{
+    fmt,
+    ops::{BitAnd, BitOr, BitXor, Not},
+};
+
+use crate::{
+    iter,
+    parser::{ParseError, ParseHex, WriteHex},
+};
+
+/**
+A defined flags value that may be named or unnamed.
+*/
+pub struct Flag<B> {
+    name: &'static str,
+    value: B,
+}
+
+impl<B> Flag<B> {
+    /**
+    Define a flag.
+
+    If `name` is non-empty then the flag is named, otherwise it's unnamed.
+    */
+    pub const fn new(name: &'static str, value: B) -> Self {
+        Flag { name, value }
+    }
+
+    /**
+    Get the name of this flag.
+
+    If the flag is unnamed then the returned string will be empty.
+    */
+    pub const fn name(&self) -> &'static str {
+        self.name
+    }
+
+    /**
+    Get the flags value of this flag.
+    */
+    pub const fn value(&self) -> &B {
+        &self.value
+    }
+
+    /**
+    Whether the flag is named.
+
+    If [`Flag::name`] returns a non-empty string then this method will return `true`.
+    */
+    pub const fn is_named(&self) -> bool {
+        !self.name.is_empty()
+    }
+
+    /**
+    Whether the flag is unnamed.
+
+    If [`Flag::name`] returns a non-empty string then this method will return `false`.
+    */
+    pub const fn is_unnamed(&self) -> bool {
+        self.name.is_empty()
+    }
+}
+
+/**
+A set of defined flags using a bits type as storage.
+
+## Implementing `Flags`
+
+This trait is implemented by the [`bitflags`](macro.bitflags.html) macro:
+
+```
+use bitflags::bitflags;
+
+bitflags! {
+    struct MyFlags: u8 {
+        const A = 1;
+        const B = 1 << 1;
+    }
+}
+```
+
+It can also be implemented manually:
+
+```
+use bitflags::{Flag, Flags};
+
+struct MyFlags(u8);
+
+impl Flags for MyFlags {
+    const FLAGS: &'static [Flag<Self>] = &[
+        Flag::new("A", MyFlags(1)),
+        Flag::new("B", MyFlags(1 << 1)),
+    ];
+
+    type Bits = u8;
+
+    fn from_bits_retain(bits: Self::Bits) -> Self {
+        MyFlags(bits)
+    }
+
+    fn bits(&self) -> Self::Bits {
+        self.0
+    }
+}
+```
+
+## Using `Flags`
+
+The `Flags` trait can be used generically to work with any flags types. In this example,
+we can count the number of defined named flags:
+
+```
+# use bitflags::{bitflags, Flags};
+fn defined_flags<F: Flags>() -> usize {
+    F::FLAGS.iter().filter(|f| f.is_named()).count()
+}
+
+bitflags! {
+    struct MyFlags: u8 {
+        const A = 1;
+        const B = 1 << 1;
+        const C = 1 << 2;
+
+        const _ = !0;
+    }
+}
+
+assert_eq!(3, defined_flags::<MyFlags>());
+```
+*/
+pub trait Flags: Sized + 'static {
+    /// The set of defined flags.
+    const FLAGS: &'static [Flag<Self>];
+
+    /// The underlying bits type.
+    type Bits: Bits;
+
+    /// Get a flags value with all bits unset.
+    fn empty() -> Self {
+        Self::from_bits_retain(Self::Bits::EMPTY)
+    }
+
+    /// Get a flags value with all known bits set.
+    fn all() -> Self {
+        let mut truncated = Self::Bits::EMPTY;
+
+        for flag in Self::FLAGS.iter() {
+            truncated = truncated | flag.value().bits();
+        }
+
+        Self::from_bits_retain(truncated)
+    }
+
+    /// Get the underlying bits value.
+    ///
+    /// The returned value is exactly the bits set in this flags value.
+    fn bits(&self) -> Self::Bits;
+
+    /// Convert from a bits value.
+    ///
+    /// This method will return `None` if any unknown bits are set.
+    fn from_bits(bits: Self::Bits) -> Option<Self> {
+        let truncated = Self::from_bits_truncate(bits);
+
+        if truncated.bits() == bits {
+            Some(truncated)
+        } else {
+            None
+        }
+    }
+
+    /// Convert from a bits value, unsetting any unknown bits.
+    fn from_bits_truncate(bits: Self::Bits) -> Self {
+        Self::from_bits_retain(bits & Self::all().bits())
+    }
+
+    /// Convert from a bits value exactly.
+    fn from_bits_retain(bits: Self::Bits) -> Self;
+
+    /// Get a flags value with the bits of a flag with the given name set.
+    ///
+    /// This method will return `None` if `name` is empty or doesn't
+    /// correspond to any named flag.
+    fn from_name(name: &str) -> Option<Self> {
+        // Don't parse empty names as empty flags
+        if name.is_empty() {
+            return None;
+        }
+
+        for flag in Self::FLAGS {
+            if flag.name() == name {
+                return Some(Self::from_bits_retain(flag.value().bits()));
+            }
+        }
+
+        None
+    }
+
+    /// Yield a set of contained flags values.
+    ///
+    /// Each yielded flags value will correspond to a defined named flag. Any unknown bits
+    /// will be yielded together as a final flags value.
+    fn iter(&self) -> iter::Iter<Self> {
+        iter::Iter::new(self)
+    }
+
+    /// Yield a set of contained named flags values.
+    ///
+    /// This method is like [`Flags::iter`], except only yields bits in contained named flags.
+    /// Any unknown bits, or bits not corresponding to a contained flag will not be yielded.
+    fn iter_names(&self) -> iter::IterNames<Self> {
+        iter::IterNames::new(self)
+    }
+
+    /// Whether all bits in this flags value are unset.
+    fn is_empty(&self) -> bool {
+        self.bits() == Self::Bits::EMPTY
+    }
+
+    /// Whether all known bits in this flags value are set.
+    fn is_all(&self) -> bool {
+        // NOTE: We check against `Self::all` here, not `Self::Bits::ALL`
+        // because the set of all flags may not use all bits
+        Self::all().bits() | self.bits() == self.bits()
+    }
+
+    /// Whether any set bits in a source flags value are also set in a target flags value.
+    fn intersects(&self, other: Self) -> bool
+    where
+        Self: Sized,
+    {
+        self.bits() & other.bits() != Self::Bits::EMPTY
+    }
+
+    /// Whether all set bits in a source flags value are also set in a target flags value.
+    fn contains(&self, other: Self) -> bool
+    where
+        Self: Sized,
+    {
+        self.bits() & other.bits() == other.bits()
+    }
+
+    /// The bitwise or (`|`) of the bits in two flags values.
+    fn insert(&mut self, other: Self)
+    where
+        Self: Sized,
+    {
+        *self = Self::from_bits_retain(self.bits()).union(other);
+    }
+
+    /// The intersection of a source flags value with the complement of a target flags value (`&!`).
+    ///
+    /// This method is not equivalent to `self & !other` when `other` has unknown bits set.
+    /// `remove` won't truncate `other`, but the `!` operator will.
+    fn remove(&mut self, other: Self)
+    where
+        Self: Sized,
+    {
+        *self = Self::from_bits_retain(self.bits()).difference(other);
+    }
+
+    /// The bitwise exclusive-or (`^`) of the bits in two flags values.
+    fn toggle(&mut self, other: Self)
+    where
+        Self: Sized,
+    {
+        *self = Self::from_bits_retain(self.bits()).symmetric_difference(other);
+    }
+
+    /// Call [`Flags::insert`] when `value` is `true` or [`Flags::remove`] when `value` is `false`.
+    fn set(&mut self, other: Self, value: bool)
+    where
+        Self: Sized,
+    {
+        if value {
+            self.insert(other);
+        } else {
+            self.remove(other);
+        }
+    }
+
+    /// The bitwise and (`&`) of the bits in two flags values.
+    #[must_use]
+    fn intersection(self, other: Self) -> Self {
+        Self::from_bits_retain(self.bits() & other.bits())
+    }
+
+    /// The bitwise or (`|`) of the bits in two flags values.
+    #[must_use]
+    fn union(self, other: Self) -> Self {
+        Self::from_bits_retain(self.bits() | other.bits())
+    }
+
+    /// The intersection of a source flags value with the complement of a target flags value (`&!`).
+    ///
+    /// This method is not equivalent to `self & !other` when `other` has unknown bits set.
+    /// `difference` won't truncate `other`, but the `!` operator will.
+    #[must_use]
+    fn difference(self, other: Self) -> Self {
+        Self::from_bits_retain(self.bits() & !other.bits())
+    }
+
+    /// The bitwise exclusive-or (`^`) of the bits in two flags values.
+    #[must_use]
+    fn symmetric_difference(self, other: Self) -> Self {
+        Self::from_bits_retain(self.bits() ^ other.bits())
+    }
+
+    /// The bitwise negation (`!`) of the bits in a flags value, truncating the result.
+    #[must_use]
+    fn complement(self) -> Self {
+        Self::from_bits_truncate(!self.bits())
+    }
+}
+
+/**
+A bits type that can be used as storage for a flags type.
+*/
+pub trait Bits:
+    Clone
+    + Copy
+    + PartialEq
+    + BitAnd<Output = Self>
+    + BitOr<Output = Self>
+    + BitXor<Output = Self>
+    + Not<Output = Self>
+    + Sized
+    + 'static
+{
+    /// A value with all bits unset.
+    const EMPTY: Self;
+
+    /// A value with all bits set.
+    const ALL: Self;
+}
+
+// Not re-exported: prevent custom `Bits` impls being used in the `bitflags!` macro,
+// or they may fail to compile based on crate features
+pub trait Primitive {}
+
+macro_rules! impl_bits {
+    ($($u:ty, $i:ty,)*) => {
+        $(
+            impl Bits for $u {
+                const EMPTY: $u = 0;
+                const ALL: $u = <$u>::MAX;
+            }
+
+            impl Bits for $i {
+                const EMPTY: $i = 0;
+                const ALL: $i = <$u>::MAX as $i;
+            }
+
+            impl ParseHex for $u {
+                fn parse_hex(input: &str) -> Result<Self, ParseError> {
+                    <$u>::from_str_radix(input, 16).map_err(|_| ParseError::invalid_hex_flag(input))
+                }
+            }
+
+            impl ParseHex for $i {
+                fn parse_hex(input: &str) -> Result<Self, ParseError> {
+                    <$i>::from_str_radix(input, 16).map_err(|_| ParseError::invalid_hex_flag(input))
+                }
+            }
+
+            impl WriteHex for $u {
+                fn write_hex<W: fmt::Write>(&self, mut writer: W) -> fmt::Result {
+                    write!(writer, "{:x}", self)
+                }
+            }
+
+            impl WriteHex for $i {
+                fn write_hex<W: fmt::Write>(&self, mut writer: W) -> fmt::Result {
+                    write!(writer, "{:x}", self)
+                }
+            }
+
+            impl Primitive for $i {}
+            impl Primitive for $u {}
+        )*
+    }
+}
+
+impl_bits! {
+    u8, i8,
+    u16, i16,
+    u32, i32,
+    u64, i64,
+    u128, i128,
+    usize, isize,
+}
+
+/// A trait for referencing the `bitflags`-owned internal type
+/// without exposing it publicly.
+pub trait PublicFlags {
+    /// The type of the underlying storage.
+    type Primitive: Primitive;
+
+    /// The type of the internal field on the generated flags type.
+    type Internal;
+}
+
+#[doc(hidden)]
+#[deprecated(note = "use the `Flags` trait instead")]
+pub trait BitFlags: ImplementedByBitFlagsMacro + Flags {
+    /// An iterator over enabled flags in an instance of the type.
+    type Iter: Iterator<Item = Self>;
+
+    /// An iterator over the raw names and bits for enabled flags in an instance of the type.
+    type IterNames: Iterator<Item = (&'static str, Self)>;
+}
+
+#[allow(deprecated)]
+impl<B: Flags> BitFlags for B {
+    type Iter = iter::Iter<Self>;
+    type IterNames = iter::IterNames<Self>;
+}
+
+impl<B: Flags> ImplementedByBitFlagsMacro for B {}
+
+/// A marker trait that signals that an implementation of `BitFlags` came from the `bitflags!` macro.
+///
+/// There's nothing stopping an end-user from implementing this trait, but we don't guarantee their
+/// manual implementations won't break between non-breaking releases.
+#[doc(hidden)]
+pub trait ImplementedByBitFlagsMacro {}
+
+pub(crate) mod __private {
+    pub use super::{ImplementedByBitFlagsMacro, PublicFlags};
+}
diff -Naur vendor-41.0.5/bitflags/tests/basic.rs vendor-41.0.7/bitflags/tests/basic.rs
--- vendor-41.0.5/bitflags/tests/basic.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags/tests/basic.rs	1969-12-31 19:00:00.000000000 -0500
@@ -1,20 +0,0 @@
-#![no_std]
-
-use bitflags::bitflags;
-
-bitflags! {
-    /// baz
-    struct Flags: u32 {
-        const A = 0b00000001;
-        #[doc = "bar"]
-        const B = 0b00000010;
-        const C = 0b00000100;
-        #[doc = "foo"]
-        const ABC = Flags::A.bits | Flags::B.bits | Flags::C.bits;
-    }
-}
-
-#[test]
-fn basic() {
-    assert_eq!(Flags::ABC, Flags::A | Flags::B | Flags::C);
-}
diff -Naur vendor-41.0.5/bitflags/tests/compile-fail/impls/copy.rs vendor-41.0.7/bitflags/tests/compile-fail/impls/copy.rs
--- vendor-41.0.5/bitflags/tests/compile-fail/impls/copy.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags/tests/compile-fail/impls/copy.rs	1969-12-31 19:00:00.000000000 -0500
@@ -1,10 +0,0 @@
-use bitflags::bitflags;
-
-bitflags! {
-    #[derive(Clone, Copy)]
-    struct Flags: u32 {
-        const A = 0b00000001;
-    }
-}
-
-fn main() {}
diff -Naur vendor-41.0.5/bitflags/tests/compile-fail/impls/copy.stderr.beta vendor-41.0.7/bitflags/tests/compile-fail/impls/copy.stderr.beta
--- vendor-41.0.5/bitflags/tests/compile-fail/impls/copy.stderr.beta	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags/tests/compile-fail/impls/copy.stderr.beta	1969-12-31 19:00:00.000000000 -0500
@@ -1,27 +0,0 @@
-error[E0119]: conflicting implementations of trait `std::clone::Clone` for type `Flags`
- --> $DIR/copy.rs:3:1
-  |
-3 | / bitflags! {
-4 | |     #[derive(Clone, Copy)]
-  | |              ----- first implementation here
-5 | |     struct Flags: u32 {
-6 | |         const A = 0b00000001;
-7 | |     }
-8 | | }
-  | |_^ conflicting implementation for `Flags`
-  |
-  = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error[E0119]: conflicting implementations of trait `std::marker::Copy` for type `Flags`
- --> $DIR/copy.rs:3:1
-  |
-3 | / bitflags! {
-4 | |     #[derive(Clone, Copy)]
-  | |                     ---- first implementation here
-5 | |     struct Flags: u32 {
-6 | |         const A = 0b00000001;
-7 | |     }
-8 | | }
-  | |_^ conflicting implementation for `Flags`
-  |
-  = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
diff -Naur vendor-41.0.5/bitflags/tests/compile-fail/impls/eq.rs vendor-41.0.7/bitflags/tests/compile-fail/impls/eq.rs
--- vendor-41.0.5/bitflags/tests/compile-fail/impls/eq.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags/tests/compile-fail/impls/eq.rs	1969-12-31 19:00:00.000000000 -0500
@@ -1,10 +0,0 @@
-use bitflags::bitflags;
-
-bitflags! {
-    #[derive(PartialEq, Eq)]
-    struct Flags: u32 {
-        const A = 0b00000001;
-    }
-}
-
-fn main() {}
diff -Naur vendor-41.0.5/bitflags/tests/compile-fail/impls/eq.stderr.beta vendor-41.0.7/bitflags/tests/compile-fail/impls/eq.stderr.beta
--- vendor-41.0.5/bitflags/tests/compile-fail/impls/eq.stderr.beta	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags/tests/compile-fail/impls/eq.stderr.beta	1969-12-31 19:00:00.000000000 -0500
@@ -1,55 +0,0 @@
-error[E0119]: conflicting implementations of trait `std::cmp::PartialEq` for type `Flags`
- --> $DIR/eq.rs:3:1
-  |
-3 | / bitflags! {
-4 | |     #[derive(PartialEq, Eq)]
-  | |              --------- first implementation here
-5 | |     struct Flags: u32 {
-6 | |         const A = 0b00000001;
-7 | |     }
-8 | | }
-  | |_^ conflicting implementation for `Flags`
-  |
-  = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error[E0119]: conflicting implementations of trait `std::cmp::Eq` for type `Flags`
- --> $DIR/eq.rs:3:1
-  |
-3 | / bitflags! {
-4 | |     #[derive(PartialEq, Eq)]
-  | |                         -- first implementation here
-5 | |     struct Flags: u32 {
-6 | |         const A = 0b00000001;
-7 | |     }
-8 | | }
-  | |_^ conflicting implementation for `Flags`
-  |
-  = note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error[E0119]: conflicting implementations of trait `std::marker::StructuralPartialEq` for type `Flags`
- --> $DIR/eq.rs:3:1
-  |
-3 | / bitflags! {
-4 | |     #[derive(PartialEq, Eq)]
-  | |              --------- first implementation here
-5 | |     struct Flags: u32 {
-6 | |         const A = 0b00000001;
-7 | |     }
-8 | | }
-  | |_^ conflicting implementation for `Flags`
-  |
-  = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error[E0119]: conflicting implementations of trait `std::marker::StructuralEq` for type `Flags`
- --> $DIR/eq.rs:3:1
-  |
-3 | / bitflags! {
-4 | |     #[derive(PartialEq, Eq)]
-  | |                         -- first implementation here
-5 | |     struct Flags: u32 {
-6 | |         const A = 0b00000001;
-7 | |     }
-8 | | }
-  | |_^ conflicting implementation for `Flags`
-  |
-  = note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info)
diff -Naur vendor-41.0.5/bitflags/tests/compile-fail/non_integer_base/all_defined.rs vendor-41.0.7/bitflags/tests/compile-fail/non_integer_base/all_defined.rs
--- vendor-41.0.5/bitflags/tests/compile-fail/non_integer_base/all_defined.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags/tests/compile-fail/non_integer_base/all_defined.rs	1969-12-31 19:00:00.000000000 -0500
@@ -1,123 +0,0 @@
-use std::{
-    fmt::{
-        self,
-        Debug,
-        Display,
-        LowerHex,
-        UpperHex,
-        Octal,
-        Binary,
-    },
-    ops::{
-        BitAnd,
-        BitOr,
-        BitXor,
-        BitAndAssign,
-        BitOrAssign,
-        BitXorAssign,
-        Not,
-    },
-};
-
-use bitflags::bitflags;
-
-// Ideally we'd actually want this to work, but currently need something like `num`'s `Zero`
-// With some design work it could be made possible
-#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
-struct MyInt(u8);
-
-impl BitAnd for MyInt {
-    type Output = Self;
-
-    fn bitand(self, other: Self) -> Self {
-        MyInt(self.0 & other.0)
-    }
-}
-
-impl BitOr for MyInt {
-    type Output = Self;
-
-    fn bitor(self, other: Self) -> Self {
-        MyInt(self.0 | other.0)
-    }
-}
-
-impl BitXor for MyInt {
-    type Output = Self;
-
-    fn bitxor(self, other: Self) -> Self {
-        MyInt(self.0 ^ other.0)
-    }
-}
-
-impl BitAndAssign for MyInt {
-    fn bitand_assign(&mut self, other: Self) {
-        self.0 &= other.0
-    }
-}
-
-impl BitOrAssign for MyInt {
-    fn bitor_assign(&mut self, other: Self) {
-        self.0 |= other.0
-    }
-}
-
-impl BitXorAssign for MyInt {
-    fn bitxor_assign(&mut self, other: Self) {
-        self.0 ^= other.0
-    }
-}
-
-impl Debug for MyInt {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        Debug::fmt(&self.0, f)
-    }
-}
-
-impl Display for MyInt {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        Display::fmt(&self.0, f)
-    }
-}
-
-impl LowerHex for MyInt {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        LowerHex::fmt(&self.0, f)
-    }
-}
-
-impl UpperHex for MyInt {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        UpperHex::fmt(&self.0, f)
-    }
-}
-
-impl Octal for MyInt {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        Octal::fmt(&self.0, f)
-    }
-}
-
-impl Binary for MyInt {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        Binary::fmt(&self.0, f)
-    }
-}
-
-impl Not for MyInt {
-    type Output = MyInt;
-
-    fn not(self) -> Self {
-        MyInt(!self.0)
-    }
-}
-
-bitflags! {
-    struct Flags128: MyInt {
-        const A = MyInt(0b0000_0001u8);
-        const B = MyInt(0b0000_0010u8);
-        const C = MyInt(0b0000_0100u8);
-    }
-}
-
-fn main() {}
diff -Naur vendor-41.0.5/bitflags/tests/compile-fail/non_integer_base/all_defined.stderr.beta vendor-41.0.7/bitflags/tests/compile-fail/non_integer_base/all_defined.stderr.beta
--- vendor-41.0.5/bitflags/tests/compile-fail/non_integer_base/all_defined.stderr.beta	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags/tests/compile-fail/non_integer_base/all_defined.stderr.beta	1969-12-31 19:00:00.000000000 -0500
@@ -1,27 +0,0 @@
-error[E0308]: mismatched types
-   --> $DIR/all_defined.rs:115:1
-    |
-115 | / bitflags! {
-116 | |     struct Flags128: MyInt {
-117 | |         const A = MyInt(0b0000_0001u8);
-118 | |         const B = MyInt(0b0000_0010u8);
-119 | |         const C = MyInt(0b0000_0100u8);
-120 | |     }
-121 | | }
-    | |_^ expected struct `MyInt`, found integer
-    |
-    = note: this error originates in the macro `__impl_all_bitflags` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error[E0308]: mismatched types
-   --> $DIR/all_defined.rs:115:1
-    |
-115 | / bitflags! {
-116 | |     struct Flags128: MyInt {
-117 | |         const A = MyInt(0b0000_0001u8);
-118 | |         const B = MyInt(0b0000_0010u8);
-119 | |         const C = MyInt(0b0000_0100u8);
-120 | |     }
-121 | | }
-    | |_^ expected struct `MyInt`, found integer
-    |
-    = note: this error originates in the macro `__impl_bitflags` (in Nightly builds, run with -Z macro-backtrace for more info)
diff -Naur vendor-41.0.5/bitflags/tests/compile-fail/non_integer_base/all_missing.rs vendor-41.0.7/bitflags/tests/compile-fail/non_integer_base/all_missing.rs
--- vendor-41.0.5/bitflags/tests/compile-fail/non_integer_base/all_missing.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags/tests/compile-fail/non_integer_base/all_missing.rs	1969-12-31 19:00:00.000000000 -0500
@@ -1,13 +0,0 @@
-use bitflags::bitflags;
-
-struct MyInt(u8);
-
-bitflags! {
-    struct Flags128: MyInt {
-        const A = MyInt(0b0000_0001);
-        const B = MyInt(0b0000_0010);
-        const C = MyInt(0b0000_0100);
-    }
-}
-
-fn main() {}
diff -Naur vendor-41.0.5/bitflags/tests/compile-fail/non_integer_base/all_missing.stderr.beta vendor-41.0.7/bitflags/tests/compile-fail/non_integer_base/all_missing.stderr.beta
--- vendor-41.0.5/bitflags/tests/compile-fail/non_integer_base/all_missing.stderr.beta	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags/tests/compile-fail/non_integer_base/all_missing.stderr.beta	1969-12-31 19:00:00.000000000 -0500
@@ -1,13 +0,0 @@
-error[E0204]: the trait `Copy` may not be implemented for this type
-  --> $DIR/all_missing.rs:5:1
-   |
-5  | / bitflags! {
-6  | |     struct Flags128: MyInt {
-7  | |         const A = MyInt(0b0000_0001);
-8  | |         const B = MyInt(0b0000_0010);
-9  | |         const C = MyInt(0b0000_0100);
-10 | |     }
-11 | | }
-   | |_^ this field does not implement `Copy`
-   |
-   = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
diff -Naur vendor-41.0.5/bitflags/tests/compile-fail/visibility/private_field.rs vendor-41.0.7/bitflags/tests/compile-fail/visibility/private_field.rs
--- vendor-41.0.5/bitflags/tests/compile-fail/visibility/private_field.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags/tests/compile-fail/visibility/private_field.rs	1969-12-31 19:00:00.000000000 -0500
@@ -1,13 +0,0 @@
-mod example {
-    use bitflags::bitflags;
-
-    bitflags! {
-        pub struct Flags1: u32 {
-            const FLAG_A = 0b00000001;
-        }
-    }
-}
-
-fn main() {
-    let flag1 = example::Flags1::FLAG_A.bits;
-}
diff -Naur vendor-41.0.5/bitflags/tests/compile-fail/visibility/private_field.stderr.beta vendor-41.0.7/bitflags/tests/compile-fail/visibility/private_field.stderr.beta
--- vendor-41.0.5/bitflags/tests/compile-fail/visibility/private_field.stderr.beta	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags/tests/compile-fail/visibility/private_field.stderr.beta	1969-12-31 19:00:00.000000000 -0500
@@ -1,10 +0,0 @@
-error[E0616]: field `bits` of struct `Flags1` is private
-  --> $DIR/private_field.rs:12:41
-   |
-12 |     let flag1 = example::Flags1::FLAG_A.bits;
-   |                                         ^^^^ private field
-   |
-help: a method `bits` also exists, call it with parentheses
-   |
-12 |     let flag1 = example::Flags1::FLAG_A.bits();
-   |                                             ^^
diff -Naur vendor-41.0.5/bitflags/tests/compile-fail/visibility/private_flags.rs vendor-41.0.7/bitflags/tests/compile-fail/visibility/private_flags.rs
--- vendor-41.0.5/bitflags/tests/compile-fail/visibility/private_flags.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags/tests/compile-fail/visibility/private_flags.rs	1969-12-31 19:00:00.000000000 -0500
@@ -1,18 +0,0 @@
-mod example {
-    use bitflags::bitflags;
-
-    bitflags! {
-        pub struct Flags1: u32 {
-            const FLAG_A = 0b00000001;
-        }
-
-        struct Flags2: u32 {
-            const FLAG_B = 0b00000010;
-        }
-    }
-}
-
-fn main() {
-    let flag1 = example::Flags1::FLAG_A;
-    let flag2 = example::Flags2::FLAG_B;
-}
diff -Naur vendor-41.0.5/bitflags/tests/compile-fail/visibility/private_flags.stderr.beta vendor-41.0.7/bitflags/tests/compile-fail/visibility/private_flags.stderr.beta
--- vendor-41.0.5/bitflags/tests/compile-fail/visibility/private_flags.stderr.beta	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags/tests/compile-fail/visibility/private_flags.stderr.beta	1969-12-31 19:00:00.000000000 -0500
@@ -1,18 +0,0 @@
-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)
diff -Naur vendor-41.0.5/bitflags/tests/compile-fail/visibility/pub_const.rs vendor-41.0.7/bitflags/tests/compile-fail/visibility/pub_const.rs
--- vendor-41.0.5/bitflags/tests/compile-fail/visibility/pub_const.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags/tests/compile-fail/visibility/pub_const.rs	1969-12-31 19:00:00.000000000 -0500
@@ -1,9 +0,0 @@
-use bitflags::bitflags;
-
-bitflags! {
-    pub struct Flags1: u32 {
-        pub const FLAG_A = 0b00000001;
-    }
-}
-
-fn main() {}
diff -Naur vendor-41.0.5/bitflags/tests/compile-fail/visibility/pub_const.stderr.beta vendor-41.0.7/bitflags/tests/compile-fail/visibility/pub_const.stderr.beta
--- vendor-41.0.5/bitflags/tests/compile-fail/visibility/pub_const.stderr.beta	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags/tests/compile-fail/visibility/pub_const.stderr.beta	1969-12-31 19:00:00.000000000 -0500
@@ -1,5 +0,0 @@
-error: no rules expected the token `pub`
- --> $DIR/pub_const.rs:5:9
-  |
-5 |         pub const FLAG_A = 0b00000001;
-  |         ^^^ no rules expected this token in macro call
diff -Naur vendor-41.0.5/bitflags/tests/compile-pass/impls/convert.rs vendor-41.0.7/bitflags/tests/compile-pass/impls/convert.rs
--- vendor-41.0.5/bitflags/tests/compile-pass/impls/convert.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags/tests/compile-pass/impls/convert.rs	1969-12-31 19:00:00.000000000 -0500
@@ -1,17 +0,0 @@
-use bitflags::bitflags;
-
-bitflags! {
-    struct Flags: u32 {
-        const A = 0b00000001;
-    }
-}
-
-impl From<u32> for Flags {
-    fn from(v: u32) -> Flags {
-        Flags::from_bits_truncate(v)
-    }
-}
-
-fn main() {
-
-}
diff -Naur vendor-41.0.5/bitflags/tests/compile-pass/impls/default.rs vendor-41.0.7/bitflags/tests/compile-pass/impls/default.rs
--- vendor-41.0.5/bitflags/tests/compile-pass/impls/default.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags/tests/compile-pass/impls/default.rs	1969-12-31 19:00:00.000000000 -0500
@@ -1,10 +0,0 @@
-use bitflags::bitflags;
-
-bitflags! {
-    #[derive(Default)]
-    struct Flags: u32 {
-        const A = 0b00000001;
-    }
-}
-
-fn main() {}
diff -Naur vendor-41.0.5/bitflags/tests/compile-pass/impls/inherent_methods.rs vendor-41.0.7/bitflags/tests/compile-pass/impls/inherent_methods.rs
--- vendor-41.0.5/bitflags/tests/compile-pass/impls/inherent_methods.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags/tests/compile-pass/impls/inherent_methods.rs	1969-12-31 19:00:00.000000000 -0500
@@ -1,15 +0,0 @@
-use bitflags::bitflags;
-
-bitflags! {
-    struct Flags: u32 {
-        const A = 0b00000001;
-    }
-}
-
-impl Flags {
-    pub fn new() -> Flags {
-        Flags::A
-    }
-}
-
-fn main() {}
diff -Naur vendor-41.0.5/bitflags/tests/compile-pass/redefinition/core.rs vendor-41.0.7/bitflags/tests/compile-pass/redefinition/core.rs
--- vendor-41.0.5/bitflags/tests/compile-pass/redefinition/core.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags/tests/compile-pass/redefinition/core.rs	1969-12-31 19:00:00.000000000 -0500
@@ -1,14 +0,0 @@
-use bitflags::bitflags;
-
-// Checks for possible errors caused by overriding names used by `bitflags!` internally.
-
-mod core {}
-mod _core {}
-
-bitflags! {
-    struct Test: u8 {
-        const A = 1;
-    }
-}
-
-fn main() {}
diff -Naur vendor-41.0.5/bitflags/tests/compile-pass/redefinition/stringify.rs vendor-41.0.7/bitflags/tests/compile-pass/redefinition/stringify.rs
--- vendor-41.0.5/bitflags/tests/compile-pass/redefinition/stringify.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags/tests/compile-pass/redefinition/stringify.rs	1969-12-31 19:00:00.000000000 -0500
@@ -1,19 +0,0 @@
-use bitflags::bitflags;
-
-// Checks for possible errors caused by overriding names used by `bitflags!` internally.
-
-#[allow(unused_macros)]
-macro_rules! stringify {
-    ($($t:tt)*) => { "..." };
-}
-
-bitflags! {
-    struct Test: u8 {
-        const A = 1;
-    }
-}
-
-fn main() {
-    // Just make sure we don't call the redefined `stringify` macro
-    assert_eq!(format!("{:?}", Test::A), "A");
-}
diff -Naur vendor-41.0.5/bitflags/tests/compile-pass/repr/c.rs vendor-41.0.7/bitflags/tests/compile-pass/repr/c.rs
--- vendor-41.0.5/bitflags/tests/compile-pass/repr/c.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags/tests/compile-pass/repr/c.rs	1969-12-31 19:00:00.000000000 -0500
@@ -1,10 +0,0 @@
-use bitflags::bitflags;
-
-bitflags! {
-    #[repr(C)]
-    struct Flags: u32 {
-        const A = 0b00000001;
-    }
-}
-
-fn main() {}
diff -Naur vendor-41.0.5/bitflags/tests/compile-pass/repr/transparent.rs vendor-41.0.7/bitflags/tests/compile-pass/repr/transparent.rs
--- vendor-41.0.5/bitflags/tests/compile-pass/repr/transparent.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags/tests/compile-pass/repr/transparent.rs	1969-12-31 19:00:00.000000000 -0500
@@ -1,10 +0,0 @@
-use bitflags::bitflags;
-
-bitflags! {
-    #[repr(transparent)]
-    struct Flags: u32 {
-        const A = 0b00000001;
-    }
-}
-
-fn main() {}
diff -Naur vendor-41.0.5/bitflags/tests/compile-pass/visibility/bits_field.rs vendor-41.0.7/bitflags/tests/compile-pass/visibility/bits_field.rs
--- vendor-41.0.5/bitflags/tests/compile-pass/visibility/bits_field.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags/tests/compile-pass/visibility/bits_field.rs	1969-12-31 19:00:00.000000000 -0500
@@ -1,11 +0,0 @@
-use bitflags::bitflags;
-
-bitflags! {
-    pub struct Flags1: u32 {
-        const FLAG_A = 0b00000001;
-    }
-}
-
-fn main() {
-    assert_eq!(0b00000001, Flags1::FLAG_A.bits);
-}
diff -Naur vendor-41.0.5/bitflags/tests/compile-pass/visibility/pub_in.rs vendor-41.0.7/bitflags/tests/compile-pass/visibility/pub_in.rs
--- vendor-41.0.5/bitflags/tests/compile-pass/visibility/pub_in.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags/tests/compile-pass/visibility/pub_in.rs	1969-12-31 19:00:00.000000000 -0500
@@ -1,19 +0,0 @@
-mod a {
-    mod b {
-        use bitflags::bitflags;
-
-        bitflags! {
-            pub(in crate::a) struct Flags: u32 {
-                const FLAG_A = 0b00000001;
-            }
-        }
-    }
-
-    pub fn flags() -> u32 {
-        b::Flags::FLAG_A.bits()
-    }
-}
-
-fn main() {
-    assert_eq!(0b00000001, a::flags());
-}
diff -Naur vendor-41.0.5/bitflags/tests/compile.rs vendor-41.0.7/bitflags/tests/compile.rs
--- vendor-41.0.5/bitflags/tests/compile.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags/tests/compile.rs	1969-12-31 19:00:00.000000000 -0500
@@ -1,63 +0,0 @@
-use std::{
-    fs,
-    ffi::OsStr,
-    io,
-    path::Path,
-};
-
-use walkdir::WalkDir;
-
-#[test]
-fn fail() {
-    prepare_stderr_files("tests/compile-fail").unwrap();
-
-    let t = trybuild::TestCases::new();
-    t.compile_fail("tests/compile-fail/**/*.rs");
-}
-
-#[test]
-fn pass() {
-    let t = trybuild::TestCases::new();
-    t.pass("tests/compile-pass/**/*.rs");
-}
-
-// Compiler messages may change between versions
-// We don't want to have to track these too closely for `bitflags`, but
-// having some message to check makes sure user-facing errors are sensical.
-// 
-// The approach we use is to run the test on all compilers, but only check stderr
-// output on beta (which is the next stable release). We do this by default ignoring
-// any `.stderr` files in the `compile-fail` directory, and copying `.stderr.beta` files
-// when we happen to be running on a beta compiler.
-fn prepare_stderr_files(path: impl AsRef<Path>) -> io::Result<()> {
-    for entry in WalkDir::new(path) {
-        let entry = entry?;
-
-        if entry.path().extension().and_then(OsStr::to_str) == Some("beta") {
-            let renamed = entry.path().with_extension("");
-
-            // Unconditionally remove a corresponding `.stderr` file for a `.stderr.beta`
-            // file if it exists. On `beta` compilers, we'll recreate it. On other compilers,
-            // we don't want to end up checking it anyways.
-            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(())
-}
diff -Naur vendor-41.0.5/bitflags-1.3.2/.cargo-checksum.json vendor-41.0.7/bitflags-1.3.2/.cargo-checksum.json
--- vendor-41.0.5/bitflags-1.3.2/.cargo-checksum.json	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags-1.3.2/.cargo-checksum.json	1969-12-31 19:00:00.000000000 -0500
@@ -0,0 +1 @@
+{"files":{"CHANGELOG.md":"d362fc1fccaaf4d421bcf0fe8b80ddb4f625dade0c1ee52d08bd0b95509a49d1","CODE_OF_CONDUCT.md":"42634d0f6d922f49857175af991802822f7f920487aefa2ee250a50d12251a66","Cargo.toml":"87aced7532a7974eb37ab5fe6037f0abafc36d6b2d74891ecd2bf2f14f50d11e","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"6485b8ed310d3f0340bf1ad1f47645069ce4069dcc6bb46c7d5c6faf41de1fdb","README.md":"baa8604f8afb34fd93b9c79729daafb884dedcaf34023e4af8ad037d916061fd","src/example_generated.rs":"e43eb59e90f317f38d436670a6067d2fd9eb35fb319fe716184e4a04e24ed1b2","src/lib.rs":"e6477688535ee326d27238aeedc9cb4320ac35b9d17a4deda09e0587b0ccdbd4","tests/basic.rs":"146f1cbf6279bc609242cd3349f29cb21b41294f5e4921875f5ec95bd83529a2","tests/compile-fail/impls/copy.rs":"b791371237ddc75a7c04d2130e03b462c9c00a80dca08bd45aa97433d9c0d13a","tests/compile-fail/impls/copy.stderr.beta":"77d83484ce221d4b6ff2f7de843929a452d779fcfff428122710dd8218c298e3","tests/compile-fail/impls/eq.rs":"0cee8b9e07d537890e0189710293b53972d0fab63c09366f33c391065afafa99","tests/compile-fail/impls/eq.stderr.beta":"381fc6143d45ce76d7cecc47aa59cb69fe5e79c0b60a4a85d5c6163b400b3cc7","tests/compile-fail/non_integer_base/all_defined.rs":"95e14cad9e94560262f2862c3c01865ac30369b69da1001b0e7285cb55e6cb75","tests/compile-fail/non_integer_base/all_defined.stderr.beta":"1760739a276690903bb03844025587d37939f5dfcbfab309db3c86f32bdbf748","tests/compile-fail/non_integer_base/all_missing.rs":"b3d9da619d23213731ba2581aa7999c796c3c79aaf4f0ee6b11ceec08a11537f","tests/compile-fail/non_integer_base/all_missing.stderr.beta":"37e102290d3867e175b21976be798939f294efb17580d5b51e7b17b590d55132","tests/compile-fail/visibility/private_field.rs":"38e4d3fe6471829360d12c8d09b097f6a21aa93fb51eac3b215d96bdae23316b","tests/compile-fail/visibility/private_field.stderr.beta":"5aa24a3ebb39326f31927721c5017b8beb66c3e501fb865a3fa814c9763bfa0f","tests/compile-fail/visibility/private_flags.rs":"2ce4235802aa4e9c96c4e77d9e31d8401ef58dcda4741325184f0764ab1fe393","tests/compile-fail/visibility/private_flags.stderr.beta":"f3eb9f7baf2689258f3519ff7ee5c6ec3c237264ebcfe63f40c40f2023e5022f","tests/compile-fail/visibility/pub_const.rs":"8f813a97ac518c5ea8ac65b184101912452384afaf7b8d6c5e62f8370eca3c0a","tests/compile-fail/visibility/pub_const.stderr.beta":"823976ae1794d7f5372e2ec9aabba497e7bb88004722904c38da342ed98e8962","tests/compile-pass/impls/convert.rs":"88fe80bfb9cd5779f0e1d92c9ec02a8b6bb67e334c07f2309e9c0ba5ef776eb0","tests/compile-pass/impls/default.rs":"c508f9a461691f44b45142fa5ad599f02326e1de4c0cbca6c0593f4652eba109","tests/compile-pass/impls/inherent_methods.rs":"ecc26388e9a394bfa7a5bb69a5d621ab3d4d1e53f28f657bb8e78fe79f437913","tests/compile-pass/redefinition/core.rs":"ff5b6e72f87acc6ebb12405d3c0f6e3fa62e669933656a454bb63b30ea44179c","tests/compile-pass/redefinition/stringify.rs":"1edbce42b900c14425d7ffa14e83e165ebe452d7dccd8c0a8a821bdec64f5c93","tests/compile-pass/repr/c.rs":"6fda17f7c2edfcd155314579e83d0fc8a16209e400f1f9a5ca77bd9a799041f2","tests/compile-pass/repr/transparent.rs":"6cdc87a2137d8a4e0c8ce9b6cba83c82255f8ea125951bf614418685600489ce","tests/compile-pass/visibility/bits_field.rs":"1f3e5ba5a047440066a9f6bf7b7af33f5b06f6b1da3dd9af6886168199a7ea0a","tests/compile-pass/visibility/pub_in.rs":"e95312ff60966d42ec4bc00225507895a9b8ec24056ce6a9edd9145be35d730f","tests/compile.rs":"f27c67a7dd183ca30efea1b6e0880e3469a6dd63b92b1fd711c082df182c9eec"},"package":"bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"}
\ No newline at end of file
diff -Naur vendor-41.0.5/bitflags-1.3.2/Cargo.toml vendor-41.0.7/bitflags-1.3.2/Cargo.toml
--- vendor-41.0.5/bitflags-1.3.2/Cargo.toml	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags-1.3.2/Cargo.toml	1969-12-31 19:00:00.000000000 -0500
@@ -0,0 +1,58 @@
+# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
+#
+# When uploading crates to the registry Cargo will automatically
+# "normalize" Cargo.toml files for maximal compatibility
+# with all versions of Cargo and also rewrite `path` dependencies
+# to registry (e.g., crates.io) dependencies
+#
+# If you believe there's an error in this file please file an
+# issue against the rust-lang/cargo repository. If you're
+# editing this file be aware that the upstream Cargo.toml
+# will likely look very different (and much more reasonable)
+
+[package]
+edition = "2018"
+name = "bitflags"
+version = "1.3.2"
+authors = ["The Rust Project Developers"]
+exclude = ["bors.toml"]
+description = "A macro to generate structures which behave like bitflags.\n"
+homepage = "https://github.com/bitflags/bitflags"
+documentation = "https://docs.rs/bitflags"
+readme = "README.md"
+keywords = ["bit", "bitmask", "bitflags", "flags"]
+categories = ["no-std"]
+license = "MIT/Apache-2.0"
+repository = "https://github.com/bitflags/bitflags"
+[package.metadata.docs.rs]
+features = ["example_generated"]
+[dependencies.compiler_builtins]
+version = "0.1.2"
+optional = true
+
+[dependencies.core]
+version = "1.0.0"
+optional = true
+package = "rustc-std-workspace-core"
+[dev-dependencies.rustversion]
+version = "1.0"
+
+[dev-dependencies.serde]
+version = "1.0"
+
+[dev-dependencies.serde_derive]
+version = "1.0"
+
+[dev-dependencies.serde_json]
+version = "1.0"
+
+[dev-dependencies.trybuild]
+version = "1.0"
+
+[dev-dependencies.walkdir]
+version = "2.3"
+
+[features]
+default = []
+example_generated = []
+rustc-dep-of-std = ["core", "compiler_builtins"]
diff -Naur vendor-41.0.5/bitflags-1.3.2/CHANGELOG.md vendor-41.0.7/bitflags-1.3.2/CHANGELOG.md
--- vendor-41.0.5/bitflags-1.3.2/CHANGELOG.md	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags-1.3.2/CHANGELOG.md	1969-12-31 19:00:00.000000000 -0500
@@ -0,0 +1,206 @@
+# 1.3.2
+
+- Allow `non_snake_case` in generated flags types ([#256])
+
+[#252]: https://github.com/bitflags/bitflags/pull/256
+
+# 1.3.1
+
+- Revert unconditional `#[repr(transparent)]` ([#252])
+
+[#252]: https://github.com/bitflags/bitflags/pull/252
+
+# 1.3.0 (yanked)
+
+- Add `#[repr(transparent)]` ([#187])
+
+- End `empty` doc comment with full stop ([#202])
+
+- Fix typo in crate root docs ([#206])
+
+- Document from_bits_unchecked unsafety ([#207])
+
+- Let `is_all` ignore extra bits ([#211])
+
+- 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])
+
+[#187]: https://github.com/bitflags/bitflags/pull/187
+[#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])
+
+[#194]: https://github.com/bitflags/bitflags/pull/194
+
+# 1.2.0
+
+- Fix typo: {Lower, Upper}Exp - {Lower, Upper}Hex ([#183])
+
+- Add support for "unknown" bits ([#188])
+
+[#183]: https://github.com/rust-lang-nursery/bitflags/pull/183
+[#188]: https://github.com/rust-lang-nursery/bitflags/pull/188
+
+# 1.1.0
+
+This is a re-release of `1.0.5`, which was yanked due to a bug in the RLS.
+
+# 1.0.5
+
+- Use compiletest_rs flags supported by stable toolchain ([#171])
+
+- Put the user provided attributes first ([#173])
+
+- Make bitflags methods `const` on newer compilers ([#175])
+
+[#171]: https://github.com/rust-lang-nursery/bitflags/pull/171
+[#173]: https://github.com/rust-lang-nursery/bitflags/pull/173
+[#175]: https://github.com/rust-lang-nursery/bitflags/pull/175
+
+# 1.0.4
+
+- Support Rust 2018 style macro imports ([#165])
+
+  ```rust
+  use bitflags::bitflags;
+  ```
+
+[#165]: https://github.com/rust-lang-nursery/bitflags/pull/165
+
+# 1.0.3
+
+- Improve zero value flag handling and documentation ([#157])
+
+[#157]: https://github.com/rust-lang-nursery/bitflags/pull/157
+
+# 1.0.2
+
+- 30% improvement in compile time of bitflags crate ([#156])
+
+- Documentation improvements ([#153])
+
+- Implementation cleanup ([#149])
+
+[#156]: https://github.com/rust-lang-nursery/bitflags/pull/156
+[#153]: https://github.com/rust-lang-nursery/bitflags/pull/153
+[#149]: https://github.com/rust-lang-nursery/bitflags/pull/149
+
+# 1.0.1
+- Add support for `pub(restricted)` specifier on the bitflags struct ([#135])
+- Optimize performance of `all()` when called from a separate crate ([#136])
+
+[#135]: https://github.com/rust-lang-nursery/bitflags/pull/135
+[#136]: https://github.com/rust-lang-nursery/bitflags/pull/136
+
+# 1.0.0
+- **[breaking change]** Macro now generates [associated constants](https://doc.rust-lang.org/reference/items.html#associated-constants) ([#24])
+
+- **[breaking change]** Minimum supported version is Rust **1.20**, due to usage of associated constants
+
+- After being broken in 0.9, the `#[deprecated]` attribute is now supported again ([#112])
+
+- Other improvements to unit tests and documentation ([#106] and [#115])
+
+[#24]: https://github.com/rust-lang-nursery/bitflags/pull/24
+[#106]: https://github.com/rust-lang-nursery/bitflags/pull/106
+[#112]: https://github.com/rust-lang-nursery/bitflags/pull/112
+[#115]: https://github.com/rust-lang-nursery/bitflags/pull/115
+
+## How to update your code to use associated constants
+Assuming the following structure definition:
+```rust
+bitflags! {
+  struct Something: u8 {
+     const FOO = 0b01,
+     const BAR = 0b10
+  }
+}
+```
+In 0.9 and older you could do:
+```rust
+let x = FOO.bits | BAR.bits;
+```
+Now you must use:
+```rust
+let x = Something::FOO.bits | Something::BAR.bits;
+```
+
+# 0.9.1
+- Fix the implementation of `Formatting` traits when other formatting traits were present in scope ([#105])
+
+[#105]: https://github.com/rust-lang-nursery/bitflags/pull/105
+
+# 0.9.0
+- **[breaking change]** Use struct keyword instead of flags to define bitflag types ([#84])
+
+- **[breaking change]** Terminate const items with semicolons instead of commas ([#87])
+
+- Implement the `Hex`, `Octal`, and `Binary` formatting traits ([#86])
+
+- Printing an empty flag value with the `Debug` trait now prints "(empty)" instead of nothing ([#85])
+
+- The `bitflags!` macro can now be used inside of a fn body, to define a type local to that function ([#74])
+
+[#74]: https://github.com/rust-lang-nursery/bitflags/pull/74
+[#84]: https://github.com/rust-lang-nursery/bitflags/pull/84
+[#85]: https://github.com/rust-lang-nursery/bitflags/pull/85
+[#86]: https://github.com/rust-lang-nursery/bitflags/pull/86
+[#87]: https://github.com/rust-lang-nursery/bitflags/pull/87
+
+# 0.8.2
+- Update feature flag used when building bitflags as a dependency of the Rust toolchain
+
+# 0.8.1
+- Allow bitflags to be used as a dependency of the Rust toolchain
+
+# 0.8.0
+- Add support for the experimental `i128` and `u128` integer types ([#57])
+- Add set method: `flags.set(SOME_FLAG, true)` or `flags.set(SOME_FLAG, false)` ([#55])
+  This may break code that defines its own set method
+
+[#55]: https://github.com/rust-lang-nursery/bitflags/pull/55
+[#57]: https://github.com/rust-lang-nursery/bitflags/pull/57
+
+# 0.7.1
+*(yanked)*
+
+# 0.7.0
+- Implement the Extend trait ([#49])
+- Allow definitions inside the `bitflags!` macro to refer to items imported from other modules ([#51])
+
+[#49]: https://github.com/rust-lang-nursery/bitflags/pull/49
+[#51]: https://github.com/rust-lang-nursery/bitflags/pull/51
+
+# 0.6.0
+- The `no_std` feature was removed as it is now the default
+- The `assignment_operators` feature was remove as it is now enabled by default
+- Some clippy suggestions have been applied
diff -Naur vendor-41.0.5/bitflags-1.3.2/CODE_OF_CONDUCT.md vendor-41.0.7/bitflags-1.3.2/CODE_OF_CONDUCT.md
--- vendor-41.0.5/bitflags-1.3.2/CODE_OF_CONDUCT.md	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags-1.3.2/CODE_OF_CONDUCT.md	1969-12-31 19:00:00.000000000 -0500
@@ -0,0 +1,73 @@
+# Contributor Covenant Code of Conduct
+
+## Our Pledge
+
+In the interest of fostering an open and welcoming environment, we as
+contributors and maintainers pledge to making participation in our project and
+our community a harassment-free experience for everyone, regardless of age, body
+size, disability, ethnicity, gender identity and expression, level of experience,
+education, socio-economic status, nationality, personal appearance, race,
+religion, or sexual identity and orientation.
+
+## Our Standards
+
+Examples of behavior that contributes to creating a positive environment
+include:
+
+* Using welcoming and inclusive language
+* Being respectful of differing viewpoints and experiences
+* Gracefully accepting constructive criticism
+* Focusing on what is best for the community
+* Showing empathy towards other community members
+
+Examples of unacceptable behavior by participants include:
+
+* The use of sexualized language or imagery and unwelcome sexual attention or
+  advances
+* Trolling, insulting/derogatory comments, and personal or political attacks
+* Public or private harassment
+* Publishing others' private information, such as a physical or electronic
+  address, without explicit permission
+* Other conduct which could reasonably be considered inappropriate in a
+  professional setting
+
+## Our Responsibilities
+
+Project maintainers are responsible for clarifying the standards of acceptable
+behavior and are expected to take appropriate and fair corrective action in
+response to any instances of unacceptable behavior.
+
+Project maintainers have the right and responsibility to remove, edit, or
+reject comments, commits, code, wiki edits, issues, and other contributions
+that are not aligned to this Code of Conduct, or to ban temporarily or
+permanently any contributor for other behaviors that they deem inappropriate,
+threatening, offensive, or harmful.
+
+## Scope
+
+This Code of Conduct applies both within project spaces and in public spaces
+when an individual is representing the project or its community. Examples of
+representing a project or community include using an official project e-mail
+address, posting via an official social media account, or acting as an appointed
+representative at an online or offline event. Representation of a project may be
+further defined and clarified by project maintainers.
+
+## Enforcement
+
+Instances of abusive, harassing, or otherwise unacceptable behavior may be
+reported by contacting the project team at coc@senaite.org. All
+complaints will be reviewed and investigated and will result in a response that
+is deemed necessary and appropriate to the circumstances. The project team is
+obligated to maintain confidentiality with regard to the reporter of an incident.
+Further details of specific enforcement policies may be posted separately.
+
+Project maintainers who do not follow or enforce the Code of Conduct in good
+faith may face temporary or permanent repercussions as determined by other
+members of the project's leadership.
+
+## Attribution
+
+This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
+available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
+
+[homepage]: https://www.contributor-covenant.org
\ No newline at end of file
diff -Naur vendor-41.0.5/bitflags-1.3.2/LICENSE-APACHE vendor-41.0.7/bitflags-1.3.2/LICENSE-APACHE
--- vendor-41.0.5/bitflags-1.3.2/LICENSE-APACHE	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags-1.3.2/LICENSE-APACHE	1969-12-31 19:00:00.000000000 -0500
@@ -0,0 +1,201 @@
+                              Apache License
+                        Version 2.0, January 2004
+                     http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+   "License" shall mean the terms and conditions for use, reproduction,
+   and distribution as defined by Sections 1 through 9 of this document.
+
+   "Licensor" shall mean the copyright owner or entity authorized by
+   the copyright owner that is granting the License.
+
+   "Legal Entity" shall mean the union of the acting entity and all
+   other entities that control, are controlled by, or are under common
+   control with that entity. For the purposes of this definition,
+   "control" means (i) the power, direct or indirect, to cause the
+   direction or management of such entity, whether by contract or
+   otherwise, or (ii) ownership of fifty percent (50%) or more of the
+   outstanding shares, or (iii) beneficial ownership of such entity.
+
+   "You" (or "Your") shall mean an individual or Legal Entity
+   exercising permissions granted by this License.
+
+   "Source" form shall mean the preferred form for making modifications,
+   including but not limited to software source code, documentation
+   source, and configuration files.
+
+   "Object" form shall mean any form resulting from mechanical
+   transformation or translation of a Source form, including but
+   not limited to compiled object code, generated documentation,
+   and conversions to other media types.
+
+   "Work" shall mean the work of authorship, whether in Source or
+   Object form, made available under the License, as indicated by a
+   copyright notice that is included in or attached to the work
+   (an example is provided in the Appendix below).
+
+   "Derivative Works" shall mean any work, whether in Source or Object
+   form, that is based on (or derived from) the Work and for which the
+   editorial revisions, annotations, elaborations, or other modifications
+   represent, as a whole, an original work of authorship. For the purposes
+   of this License, Derivative Works shall not include works that remain
+   separable from, or merely link (or bind by name) to the interfaces of,
+   the Work and Derivative Works thereof.
+
+   "Contribution" shall mean any work of authorship, including
+   the original version of the Work and any modifications or additions
+   to that Work or Derivative Works thereof, that is intentionally
+   submitted to Licensor for inclusion in the Work by the copyright owner
+   or by an individual or Legal Entity authorized to submit on behalf of
+   the copyright owner. For the purposes of this definition, "submitted"
+   means any form of electronic, verbal, or written communication sent
+   to the Licensor or its representatives, including but not limited to
+   communication on electronic mailing lists, source code control systems,
+   and issue tracking systems that are managed by, or on behalf of, the
+   Licensor for the purpose of discussing and improving the Work, but
+   excluding communication that is conspicuously marked or otherwise
+   designated in writing by the copyright owner as "Not a Contribution."
+
+   "Contributor" shall mean Licensor and any individual or Legal Entity
+   on behalf of whom a Contribution has been received by Licensor and
+   subsequently incorporated within the Work.
+
+2. Grant of Copyright License. Subject to the terms and conditions of
+   this License, each Contributor hereby grants to You a perpetual,
+   worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+   copyright license to reproduce, prepare Derivative Works of,
+   publicly display, publicly perform, sublicense, and distribute the
+   Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of
+   this License, each Contributor hereby grants to You a perpetual,
+   worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+   (except as stated in this section) patent license to make, have made,
+   use, offer to sell, sell, import, and otherwise transfer the Work,
+   where such license applies only to those patent claims licensable
+   by such Contributor that are necessarily infringed by their
+   Contribution(s) alone or by combination of their Contribution(s)
+   with the Work to which such Contribution(s) was submitted. If You
+   institute patent litigation against any entity (including a
+   cross-claim or counterclaim in a lawsuit) alleging that the Work
+   or a Contribution incorporated within the Work constitutes direct
+   or contributory patent infringement, then any patent licenses
+   granted to You under this License for that Work shall terminate
+   as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the
+   Work or Derivative Works thereof in any medium, with or without
+   modifications, and in Source or Object form, provided that You
+   meet the following conditions:
+
+   (a) You must give any other recipients of the Work or
+       Derivative Works a copy of this License; and
+
+   (b) You must cause any modified files to carry prominent notices
+       stating that You changed the files; and
+
+   (c) You must retain, in the Source form of any Derivative Works
+       that You distribute, all copyright, patent, trademark, and
+       attribution notices from the Source form of the Work,
+       excluding those notices that do not pertain to any part of
+       the Derivative Works; and
+
+   (d) If the Work includes a "NOTICE" text file as part of its
+       distribution, then any Derivative Works that You distribute must
+       include a readable copy of the attribution notices contained
+       within such NOTICE file, excluding those notices that do not
+       pertain to any part of the Derivative Works, in at least one
+       of the following places: within a NOTICE text file distributed
+       as part of the Derivative Works; within the Source form or
+       documentation, if provided along with the Derivative Works; or,
+       within a display generated by the Derivative Works, if and
+       wherever such third-party notices normally appear. The contents
+       of the NOTICE file are for informational purposes only and
+       do not modify the License. You may add Your own attribution
+       notices within Derivative Works that You distribute, alongside
+       or as an addendum to the NOTICE text from the Work, provided
+       that such additional attribution notices cannot be construed
+       as modifying the License.
+
+   You may add Your own copyright statement to Your modifications and
+   may provide additional or different license terms and conditions
+   for use, reproduction, or distribution of Your modifications, or
+   for any such Derivative Works as a whole, provided Your use,
+   reproduction, and distribution of the Work otherwise complies with
+   the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise,
+   any Contribution intentionally submitted for inclusion in the Work
+   by You to the Licensor shall be under the terms and conditions of
+   this License, without any additional terms or conditions.
+   Notwithstanding the above, nothing herein shall supersede or modify
+   the terms of any separate license agreement you may have executed
+   with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade
+   names, trademarks, service marks, or product names of the Licensor,
+   except as required for reasonable and customary use in describing the
+   origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or
+   agreed to in writing, Licensor provides the Work (and each
+   Contributor provides its Contributions) on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+   implied, including, without limitation, any warranties or conditions
+   of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+   PARTICULAR PURPOSE. You are solely responsible for determining the
+   appropriateness of using or redistributing the Work and assume any
+   risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory,
+   whether in tort (including negligence), contract, or otherwise,
+   unless required by applicable law (such as deliberate and grossly
+   negligent acts) or agreed to in writing, shall any Contributor be
+   liable to You for damages, including any direct, indirect, special,
+   incidental, or consequential damages of any character arising as a
+   result of this License or out of the use or inability to use the
+   Work (including but not limited to damages for loss of goodwill,
+   work stoppage, computer failure or malfunction, or any and all
+   other commercial damages or losses), even if such Contributor
+   has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing
+   the Work or Derivative Works thereof, You may choose to offer,
+   and charge a fee for, acceptance of support, warranty, indemnity,
+   or other liability obligations and/or rights consistent with this
+   License. However, in accepting such obligations, You may act only
+   on Your own behalf and on Your sole responsibility, not on behalf
+   of any other Contributor, and only if You agree to indemnify,
+   defend, and hold each Contributor harmless for any liability
+   incurred by, or claims asserted against, such Contributor by reason
+   of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
+APPENDIX: How to apply the Apache License to your work.
+
+   To apply the Apache License to your work, attach the following
+   boilerplate notice, with the fields enclosed by brackets "[]"
+   replaced with your own identifying information. (Don't include
+   the brackets!)  The text should be enclosed in the appropriate
+   comment syntax for the file format. We also recommend that a
+   file or class name and description of purpose be included on the
+   same "printed page" as the copyright notice for easier
+   identification within third-party archives.
+
+Copyright [yyyy] [name of copyright owner]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+	http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
diff -Naur vendor-41.0.5/bitflags-1.3.2/LICENSE-MIT vendor-41.0.7/bitflags-1.3.2/LICENSE-MIT
--- vendor-41.0.5/bitflags-1.3.2/LICENSE-MIT	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags-1.3.2/LICENSE-MIT	1969-12-31 19:00:00.000000000 -0500
@@ -0,0 +1,25 @@
+Copyright (c) 2014 The Rust Project Developers
+
+Permission is hereby granted, free of charge, to any
+person obtaining a copy of this software and associated
+documentation files (the "Software"), to deal in the
+Software without restriction, including without
+limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software
+is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice
+shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
+ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
+TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
+PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
+SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
diff -Naur vendor-41.0.5/bitflags-1.3.2/README.md vendor-41.0.7/bitflags-1.3.2/README.md
--- vendor-41.0.5/bitflags-1.3.2/README.md	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags-1.3.2/README.md	1969-12-31 19:00:00.000000000 -0500
@@ -0,0 +1,32 @@
+bitflags
+========
+
+[![Rust](https://github.com/bitflags/bitflags/workflows/Rust/badge.svg)](https://github.com/bitflags/bitflags/actions)
+[![Join the chat at https://gitter.im/bitflags/Lobby](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/bitflags/Lobby?utm_source=badge&utm_medium=badge&utm_content=badge)
+[![Latest version](https://img.shields.io/crates/v/bitflags.svg)](https://crates.io/crates/bitflags)
+[![Documentation](https://docs.rs/bitflags/badge.svg)](https://docs.rs/bitflags)
+![License](https://img.shields.io/crates/l/bitflags.svg)
+
+A Rust macro to generate structures which behave like a set of bitflags
+
+- [Documentation](https://docs.rs/bitflags)
+- [Release notes](https://github.com/bitflags/bitflags/releases)
+
+## Usage
+
+Add this to your `Cargo.toml`:
+
+```toml
+[dependencies]
+bitflags = "1.3"
+```
+
+and this to your source code:
+
+```rust
+use bitflags::bitflags;
+```
+
+## Rust Version Support
+
+The minimum supported Rust version is 1.46 due to use of associated constants and const functions.
diff -Naur vendor-41.0.5/bitflags-1.3.2/src/example_generated.rs vendor-41.0.7/bitflags-1.3.2/src/example_generated.rs
--- vendor-41.0.5/bitflags-1.3.2/src/example_generated.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags-1.3.2/src/example_generated.rs	1969-12-31 19:00:00.000000000 -0500
@@ -0,0 +1,14 @@
+//! This module shows an example of code generated by the macro. **IT MUST NOT BE USED OUTSIDE THIS
+//! CRATE**.
+
+bitflags! {
+    /// This is the same `Flags` struct defined in the [crate level example](../index.html#example).
+    /// Note that this struct is just for documentation purposes only, it must not be used outside
+    /// this crate.
+    pub struct Flags: u32 {
+        const A = 0b00000001;
+        const B = 0b00000010;
+        const C = 0b00000100;
+        const ABC = Self::A.bits | Self::B.bits | Self::C.bits;
+    }
+}
diff -Naur vendor-41.0.5/bitflags-1.3.2/src/lib.rs vendor-41.0.7/bitflags-1.3.2/src/lib.rs
--- vendor-41.0.5/bitflags-1.3.2/src/lib.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags-1.3.2/src/lib.rs	1969-12-31 19:00:00.000000000 -0500
@@ -0,0 +1,1729 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! A typesafe bitmask flag generator useful for sets of C-style bitmask flags.
+//! It can be used for creating typesafe wrappers around C APIs.
+//!
+//! The `bitflags!` macro generates `struct`s that manage a set of flags. The
+//! flags should only be defined for integer types, otherwise unexpected type
+//! errors may occur at compile time.
+//!
+//! # Example
+//!
+//! ```
+//! use bitflags::bitflags;
+//!
+//! bitflags! {
+//!     struct Flags: u32 {
+//!         const A = 0b00000001;
+//!         const B = 0b00000010;
+//!         const C = 0b00000100;
+//!         const ABC = Self::A.bits | Self::B.bits | Self::C.bits;
+//!     }
+//! }
+//!
+//! fn main() {
+//!     let e1 = Flags::A | Flags::C;
+//!     let e2 = Flags::B | Flags::C;
+//!     assert_eq!((e1 | e2), Flags::ABC);   // union
+//!     assert_eq!((e1 & e2), Flags::C);     // intersection
+//!     assert_eq!((e1 - e2), Flags::A);     // set difference
+//!     assert_eq!(!e2, Flags::A);           // set complement
+//! }
+//! ```
+//!
+//! See [`example_generated::Flags`](./example_generated/struct.Flags.html) for documentation of code
+//! generated by the above `bitflags!` expansion.
+//!
+//! The generated `struct`s can also be extended with type and trait
+//! implementations:
+//!
+//! ```
+//! use std::fmt;
+//!
+//! use bitflags::bitflags;
+//!
+//! bitflags! {
+//!     struct Flags: u32 {
+//!         const A = 0b00000001;
+//!         const B = 0b00000010;
+//!     }
+//! }
+//!
+//! impl Flags {
+//!     pub fn clear(&mut self) {
+//!         self.bits = 0;  // The `bits` field can be accessed from within the
+//!                         // same module where the `bitflags!` macro was invoked.
+//!     }
+//! }
+//!
+//! impl fmt::Display for Flags {
+//!     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+//!         write!(f, "hi!")
+//!     }
+//! }
+//!
+//! fn main() {
+//!     let mut flags = Flags::A | Flags::B;
+//!     flags.clear();
+//!     assert!(flags.is_empty());
+//!     assert_eq!(format!("{}", flags), "hi!");
+//!     assert_eq!(format!("{:?}", Flags::A | Flags::B), "A | B");
+//!     assert_eq!(format!("{:?}", Flags::B), "B");
+//! }
+//! ```
+//!
+//! # Visibility
+//!
+//! The generated structs and their associated flag constants are not exported
+//! out of the current module by default. A definition can be exported out of
+//! the current module by adding `pub` before `struct`:
+//!
+//! ```
+//! mod example {
+//!     use bitflags::bitflags;
+//!
+//!     bitflags! {
+//!         pub struct Flags1: u32 {
+//!             const A = 0b00000001;
+//!         }
+//!
+//! #       pub
+//!         struct Flags2: u32 {
+//!             const B = 0b00000010;
+//!         }
+//!     }
+//! }
+//!
+//! fn main() {
+//!     let flag1 = example::Flags1::A;
+//!     let flag2 = example::Flags2::B; // error: const `B` is private
+//! }
+//! ```
+//!
+//! # Attributes
+//!
+//! Attributes can be attached to the generated `struct`s by placing them
+//! before the `struct` keyword.
+//!
+//! ## Representations
+//!
+//! It's valid to add a `#[repr(C)]` or `#[repr(transparent)]` attribute to a type
+//! generated by `bitflags!`. In these cases, the type is guaranteed to be a newtype.
+//!
+//! ```
+//! use bitflags::bitflags;
+//!
+//! bitflags! {
+//!     #[repr(transparent)]
+//!     struct Flags: u32 {
+//!         const A = 0b00000001;
+//!         const B = 0b00000010;
+//!         const C = 0b00000100;
+//!     }
+//! }
+//! ```
+//!
+//! # Trait implementations
+//!
+//! The `Copy`, `Clone`, `PartialEq`, `Eq`, `PartialOrd`, `Ord` and `Hash`
+//! traits are automatically derived for the `struct`s using the `derive` attribute.
+//! Additional traits can be derived by providing an explicit `derive`
+//! attribute on `struct`.
+//!
+//! The `Extend` and `FromIterator` traits are implemented for the `struct`s,
+//! too: `Extend` adds the union of the instances of the `struct` iterated over,
+//! while `FromIterator` calculates the union.
+//!
+//! The `Binary`, `Debug`, `LowerHex`, `Octal` and `UpperHex` traits are also
+//! implemented by displaying the bits value of the internal struct.
+//!
+//! ## Operators
+//!
+//! The following operator traits are implemented for the generated `struct`s:
+//!
+//! - `BitOr` and `BitOrAssign`: union
+//! - `BitAnd` and `BitAndAssign`: intersection
+//! - `BitXor` and `BitXorAssign`: toggle
+//! - `Sub` and `SubAssign`: set difference
+//! - `Not`: set complement
+//!
+//! # Methods
+//!
+//! The following methods are defined for the generated `struct`s:
+//!
+//! - `empty`: an empty set of flags
+//! - `all`: the set of all defined flags
+//! - `bits`: the raw value of the flags currently stored
+//! - `from_bits`: convert from underlying bit representation, unless that
+//!                representation contains bits that do not correspond to a
+//!                defined flag
+//! - `from_bits_truncate`: convert from underlying bit representation, dropping
+//!                         any bits that do not correspond to defined flags
+//! - `from_bits_unchecked`: convert from underlying bit representation, keeping
+//!                          all bits (even those not corresponding to defined
+//!                          flags)
+//! - `is_empty`: `true` if no flags are currently stored
+//! - `is_all`: `true` if currently set flags exactly equal all defined flags
+//! - `intersects`: `true` if there are flags common to both `self` and `other`
+//! - `contains`: `true` if all of the flags in `other` are contained within `self`
+//! - `insert`: inserts the specified flags in-place
+//! - `remove`: removes the specified flags in-place
+//! - `toggle`: the specified flags will be inserted if not present, and removed
+//!             if they are.
+//! - `set`: inserts or removes the specified flags depending on the passed value
+//! - `intersection`: returns a new set of flags, containing only the flags present
+//!                   in both `self` and `other` (the argument to the function).
+//! - `union`: returns a new set of flags, containing any flags present in
+//!            either `self` or `other` (the argument to the function).
+//! - `difference`: returns a new set of flags, containing all flags present in
+//!                 `self` without any of the flags present in `other` (the
+//!                 argument to the function).
+//! - `symmetric_difference`: returns a new set of flags, containing all flags
+//!                           present in either `self` or `other` (the argument
+//!                           to the function), but not both.
+//! - `complement`: returns a new set of flags, containing all flags which are
+//!                 not set in `self`, but which are allowed for this type.
+//!
+//! ## Default
+//!
+//! The `Default` trait is not automatically implemented for the generated structs.
+//!
+//! If your default value is equal to `0` (which is the same value as calling `empty()`
+//! on the generated struct), you can simply derive `Default`:
+//!
+//! ```
+//! use bitflags::bitflags;
+//!
+//! bitflags! {
+//!     // Results in default value with bits: 0
+//!     #[derive(Default)]
+//!     struct Flags: u32 {
+//!         const A = 0b00000001;
+//!         const B = 0b00000010;
+//!         const C = 0b00000100;
+//!     }
+//! }
+//!
+//! fn main() {
+//!     let derived_default: Flags = Default::default();
+//!     assert_eq!(derived_default.bits(), 0);
+//! }
+//! ```
+//!
+//! If your default value is not equal to `0` you need to implement `Default` yourself:
+//!
+//! ```
+//! use bitflags::bitflags;
+//!
+//! bitflags! {
+//!     struct Flags: u32 {
+//!         const A = 0b00000001;
+//!         const B = 0b00000010;
+//!         const C = 0b00000100;
+//!     }
+//! }
+//!
+//! // explicit `Default` implementation
+//! impl Default for Flags {
+//!     fn default() -> Flags {
+//!         Flags::A | Flags::C
+//!     }
+//! }
+//!
+//! fn main() {
+//!     let implemented_default: Flags = Default::default();
+//!     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.
+//!
+//! ```
+//! use bitflags::bitflags;
+//!
+//! bitflags! {
+//!     struct Flags: u32 {
+//!         const NONE = 0b00000000;
+//!         const SOME = 0b00000001;
+//!     }
+//! }
+//!
+//! fn main() {
+//!     let empty = Flags::empty();
+//!     let none = Flags::NONE;
+//!     let some = Flags::SOME;
+//!
+//!     // Zero flags are treated as always present
+//!     assert!(empty.contains(Flags::NONE));
+//!     assert!(none.contains(Flags::NONE));
+//!     assert!(some.contains(Flags::NONE));
+//!
+//!     // Zero flags will be ignored when testing for emptiness
+//!     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.3.2")]
+
+#[doc(hidden)]
+pub extern crate core as _core;
+
+/// The macro used to generate the flag structures.
+///
+/// See the [crate level docs](../bitflags/index.html) for complete documentation.
+///
+/// # Example
+///
+/// ```
+/// use bitflags::bitflags;
+///
+/// bitflags! {
+///     struct Flags: u32 {
+///         const A = 0b00000001;
+///         const B = 0b00000010;
+///         const C = 0b00000100;
+///         const ABC = Self::A.bits | Self::B.bits | Self::C.bits;
+///     }
+/// }
+///
+/// fn main() {
+///     let e1 = Flags::A | Flags::C;
+///     let e2 = Flags::B | Flags::C;
+///     assert_eq!((e1 | e2), Flags::ABC);   // union
+///     assert_eq!((e1 & e2), Flags::C);     // intersection
+///     assert_eq!((e1 - e2), Flags::A);     // set difference
+///     assert_eq!(!e2, Flags::A);           // set complement
+/// }
+/// ```
+///
+/// The generated `struct`s can also be extended with type and trait
+/// implementations:
+///
+/// ```
+/// use std::fmt;
+///
+/// use bitflags::bitflags;
+///
+/// bitflags! {
+///     struct Flags: u32 {
+///         const A = 0b00000001;
+///         const B = 0b00000010;
+///     }
+/// }
+///
+/// impl Flags {
+///     pub fn clear(&mut self) {
+///         self.bits = 0;  // The `bits` field can be accessed from within the
+///                         // same module where the `bitflags!` macro was invoked.
+///     }
+/// }
+///
+/// impl fmt::Display for Flags {
+///     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+///         write!(f, "hi!")
+///     }
+/// }
+///
+/// fn main() {
+///     let mut flags = Flags::A | Flags::B;
+///     flags.clear();
+///     assert!(flags.is_empty());
+///     assert_eq!(format!("{}", flags), "hi!");
+///     assert_eq!(format!("{:?}", Flags::A | Flags::B), "A | B");
+///     assert_eq!(format!("{:?}", Flags::B), "B");
+/// }
+/// ```
+#[macro_export(local_inner_macros)]
+macro_rules! bitflags {
+    (
+        $(#[$outer:meta])*
+        $vis:vis struct $BitFlags:ident: $T:ty {
+            $(
+                $(#[$inner:ident $($args:tt)*])*
+                const $Flag:ident = $value:expr;
+            )*
+        }
+
+        $($t:tt)*
+    ) => {
+        $(#[$outer])*
+        #[derive(Copy, PartialEq, Eq, Clone, PartialOrd, Ord, Hash)]
+        $vis struct $BitFlags {
+            bits: $T,
+        }
+
+        __impl_bitflags! {
+            $BitFlags: $T {
+                $(
+                    $(#[$inner $($args)*])*
+                    $Flag = $value;
+                )*
+            }
+        }
+
+        bitflags! {
+            $($t)*
+        }
+    };
+    () => {};
+}
+
+// A helper macro to implement the `all` function.
+#[macro_export(local_inner_macros)]
+#[doc(hidden)]
+macro_rules! __impl_all_bitflags {
+    (
+        $BitFlags:ident: $T:ty {
+            $(
+                $(#[$attr:ident $($args:tt)*])*
+                $Flag:ident = $value:expr;
+            )+
+        }
+    ) => {
+        // See `Debug::fmt` for why this approach is taken.
+        #[allow(non_snake_case)]
+        trait __BitFlags {
+            $(
+                const $Flag: $T = 0;
+            )+
+        }
+        #[allow(non_snake_case)]
+        impl __BitFlags for $BitFlags {
+            $(
+                __impl_bitflags! {
+                    #[allow(deprecated)]
+                    $(? #[$attr $($args)*])*
+                    const $Flag: $T = Self::$Flag.bits;
+                }
+            )+
+        }
+        Self { bits: $(<Self as __BitFlags>::$Flag)|+ }
+    };
+    (
+        $BitFlags:ident: $T:ty { }
+    ) => {
+        Self { bits: 0 }
+    };
+}
+
+#[macro_export(local_inner_macros)]
+#[doc(hidden)]
+macro_rules! __impl_bitflags {
+    (
+        $BitFlags:ident: $T:ty {
+            $(
+                $(#[$attr:ident $($args:tt)*])*
+                $Flag:ident = $value:expr;
+            )*
+        }
+    ) => {
+        impl $crate::_core::fmt::Debug for $BitFlags {
+            fn fmt(&self, f: &mut $crate::_core::fmt::Formatter) -> $crate::_core::fmt::Result {
+                // This convoluted approach is to handle #[cfg]-based flag
+                // omission correctly. For example it needs to support:
+                //
+                //    #[cfg(unix)] const A: Flag = /* ... */;
+                //    #[cfg(windows)] const B: Flag = /* ... */;
+
+                // Unconditionally define a check for every flag, even disabled
+                // ones.
+                #[allow(non_snake_case)]
+                trait __BitFlags {
+                    $(
+                        #[inline]
+                        fn $Flag(&self) -> bool { false }
+                    )*
+                }
+
+                // Conditionally override the check for just those flags that
+                // are not #[cfg]ed away.
+                #[allow(non_snake_case)]
+                impl __BitFlags for $BitFlags {
+                    $(
+                        __impl_bitflags! {
+                            #[allow(deprecated)]
+                            #[inline]
+                            $(? #[$attr $($args)*])*
+                            fn $Flag(&self) -> bool {
+                                if Self::$Flag.bits == 0 && self.bits != 0 {
+                                    false
+                                } else {
+                                    self.bits & Self::$Flag.bits == Self::$Flag.bits
+                                }
+                            }
+                        }
+                    )*
+                }
+
+                let mut first = true;
+                $(
+                    if <Self as __BitFlags>::$Flag(self) {
+                        if !first {
+                            f.write_str(" | ")?;
+                        }
+                        first = false;
+                        f.write_str($crate::_core::stringify!($Flag))?;
+                    }
+                )*
+                let extra_bits = self.bits & !Self::all().bits();
+                if extra_bits != 0 {
+                    if !first {
+                        f.write_str(" | ")?;
+                    }
+                    first = false;
+                    f.write_str("0x")?;
+                    $crate::_core::fmt::LowerHex::fmt(&extra_bits, f)?;
+                }
+                if first {
+                    f.write_str("(empty)")?;
+                }
+                Ok(())
+            }
+        }
+        impl $crate::_core::fmt::Binary for $BitFlags {
+            fn fmt(&self, f: &mut $crate::_core::fmt::Formatter) -> $crate::_core::fmt::Result {
+                $crate::_core::fmt::Binary::fmt(&self.bits, f)
+            }
+        }
+        impl $crate::_core::fmt::Octal for $BitFlags {
+            fn fmt(&self, f: &mut $crate::_core::fmt::Formatter) -> $crate::_core::fmt::Result {
+                $crate::_core::fmt::Octal::fmt(&self.bits, f)
+            }
+        }
+        impl $crate::_core::fmt::LowerHex for $BitFlags {
+            fn fmt(&self, f: &mut $crate::_core::fmt::Formatter) -> $crate::_core::fmt::Result {
+                $crate::_core::fmt::LowerHex::fmt(&self.bits, f)
+            }
+        }
+        impl $crate::_core::fmt::UpperHex for $BitFlags {
+            fn fmt(&self, f: &mut $crate::_core::fmt::Formatter) -> $crate::_core::fmt::Result {
+                $crate::_core::fmt::UpperHex::fmt(&self.bits, f)
+            }
+        }
+
+        #[allow(dead_code)]
+        impl $BitFlags {
+            $(
+                $(#[$attr $($args)*])*
+                pub const $Flag: Self = Self { bits: $value };
+            )*
+
+            /// Returns an empty set of flags.
+            #[inline]
+            pub const fn empty() -> Self {
+                Self { bits: 0 }
+            }
+
+            /// Returns the set containing all flags.
+            #[inline]
+            pub const fn all() -> Self {
+                __impl_all_bitflags! {
+                    $BitFlags: $T {
+                        $(
+                            $(#[$attr $($args)*])*
+                            $Flag = $value;
+                        )*
+                    }
+                }
+            }
+
+            /// Returns the raw value of the flags currently stored.
+            #[inline]
+            pub const fn bits(&self) -> $T {
+                self.bits
+            }
+
+            /// Convert from underlying bit representation, unless that
+            /// representation contains bits that do not correspond to a flag.
+            #[inline]
+            pub const fn from_bits(bits: $T) -> $crate::_core::option::Option<Self> {
+                if (bits & !Self::all().bits()) == 0 {
+                    $crate::_core::option::Option::Some(Self { bits })
+                } else {
+                    $crate::_core::option::Option::None
+                }
+            }
+
+            /// Convert from underlying bit representation, dropping any bits
+            /// that do not correspond to flags.
+            #[inline]
+            pub const fn from_bits_truncate(bits: $T) -> Self {
+                Self { bits: bits & Self::all().bits }
+            }
+
+            /// Convert from underlying bit representation, preserving all
+            /// bits (even those not corresponding to a defined flag).
+            ///
+            /// # Safety
+            ///
+            /// The caller of the `bitflags!` macro can chose to allow or
+            /// disallow extra bits for their bitflags type.
+            ///
+            /// The caller of `from_bits_unchecked()` has to ensure that
+            /// all bits correspond to a defined flag or that extra bits
+            /// are valid for this bitflags type.
+            #[inline]
+            pub const unsafe fn from_bits_unchecked(bits: $T) -> Self {
+                Self { bits }
+            }
+
+            /// Returns `true` if no flags are currently stored.
+            #[inline]
+            pub const fn is_empty(&self) -> bool {
+                self.bits() == Self::empty().bits()
+            }
+
+            /// Returns `true` if all flags are currently set.
+            #[inline]
+            pub const fn is_all(&self) -> bool {
+                Self::all().bits | self.bits == self.bits
+            }
+
+            /// Returns `true` if there are flags common to both `self` and `other`.
+            #[inline]
+            pub const fn intersects(&self, other: Self) -> bool {
+                !(Self { bits: self.bits & other.bits}).is_empty()
+            }
+
+            /// Returns `true` if all of the flags in `other` are contained within `self`.
+            #[inline]
+            pub const fn contains(&self, other: Self) -> bool {
+                (self.bits & other.bits) == other.bits
+            }
+
+            /// Inserts the specified flags in-place.
+            #[inline]
+            pub fn insert(&mut self, other: Self) {
+                self.bits |= other.bits;
+            }
+
+            /// Removes the specified flags in-place.
+            #[inline]
+            pub fn remove(&mut self, other: Self) {
+                self.bits &= !other.bits;
+            }
+
+            /// Toggles the specified flags in-place.
+            #[inline]
+            pub fn toggle(&mut self, other: Self) {
+                self.bits ^= other.bits;
+            }
+
+            /// Inserts or removes the specified flags depending on the passed value.
+            #[inline]
+            pub fn set(&mut self, other: Self, value: bool) {
+                if value {
+                    self.insert(other);
+                } else {
+                    self.remove(other);
+                }
+            }
+
+            /// Returns the intersection between the flags in `self` and
+            /// `other`.
+            ///
+            /// Specifically, the returned set contains only the flags which are
+            /// present in *both* `self` *and* `other`.
+            ///
+            /// This is equivalent to using the `&` operator (e.g.
+            /// [`ops::BitAnd`]), as in `flags & other`.
+            ///
+            /// [`ops::BitAnd`]: https://doc.rust-lang.org/std/ops/trait.BitAnd.html
+            #[inline]
+            #[must_use]
+            pub const fn intersection(self, other: Self) -> Self {
+                Self { bits: self.bits & other.bits }
+            }
+
+            /// Returns the union of between the flags in `self` and `other`.
+            ///
+            /// Specifically, the returned set contains all flags which are
+            /// present in *either* `self` *or* `other`, including any which are
+            /// present in both (see [`Self::symmetric_difference`] if that
+            /// is undesirable).
+            ///
+            /// This is equivalent to using the `|` operator (e.g.
+            /// [`ops::BitOr`]), as in `flags | other`.
+            ///
+            /// [`ops::BitOr`]: https://doc.rust-lang.org/std/ops/trait.BitOr.html
+            #[inline]
+            #[must_use]
+            pub const fn union(self, other: Self) -> Self {
+                Self { bits: self.bits | other.bits }
+            }
+
+            /// Returns the difference between the flags in `self` and `other`.
+            ///
+            /// Specifically, the returned set contains all flags present in
+            /// `self`, except for the ones present in `other`.
+            ///
+            /// It is also conceptually equivalent to the "bit-clear" operation:
+            /// `flags & !other` (and this syntax is also supported).
+            ///
+            /// This is equivalent to using the `-` operator (e.g.
+            /// [`ops::Sub`]), as in `flags - other`.
+            ///
+            /// [`ops::Sub`]: https://doc.rust-lang.org/std/ops/trait.Sub.html
+            #[inline]
+            #[must_use]
+            pub const fn difference(self, other: Self) -> Self {
+                Self { bits: self.bits & !other.bits }
+            }
+
+            /// Returns the [symmetric difference][sym-diff] between the flags
+            /// in `self` and `other`.
+            ///
+            /// Specifically, the returned set contains the flags present which
+            /// are present in `self` or `other`, but that are not present in
+            /// both. Equivalently, it contains the flags present in *exactly
+            /// one* of the sets `self` and `other`.
+            ///
+            /// This is equivalent to using the `^` operator (e.g.
+            /// [`ops::BitXor`]), as in `flags ^ other`.
+            ///
+            /// [sym-diff]: https://en.wikipedia.org/wiki/Symmetric_difference
+            /// [`ops::BitXor`]: https://doc.rust-lang.org/std/ops/trait.BitXor.html
+            #[inline]
+            #[must_use]
+            pub const fn symmetric_difference(self, other: Self) -> Self {
+                Self { bits: self.bits ^ other.bits }
+            }
+
+            /// Returns the complement of this set of flags.
+            ///
+            /// Specifically, the returned set contains all the flags which are
+            /// not set in `self`, but which are allowed for this type.
+            ///
+            /// Alternatively, it can be thought of as the set difference
+            /// between [`Self::all()`] and `self` (e.g. `Self::all() - self`)
+            ///
+            /// This is equivalent to using the `!` operator (e.g.
+            /// [`ops::Not`]), as in `!flags`.
+            ///
+            /// [`Self::all()`]: Self::all
+            /// [`ops::Not`]: https://doc.rust-lang.org/std/ops/trait.Not.html
+            #[inline]
+            #[must_use]
+            pub const fn complement(self) -> Self {
+                Self::from_bits_truncate(!self.bits)
+            }
+
+        }
+
+        impl $crate::_core::ops::BitOr for $BitFlags {
+            type Output = Self;
+
+            /// Returns the union of the two sets of flags.
+            #[inline]
+            fn bitor(self, other: $BitFlags) -> Self {
+                Self { bits: self.bits | other.bits }
+            }
+        }
+
+        impl $crate::_core::ops::BitOrAssign for $BitFlags {
+            /// Adds the set of flags.
+            #[inline]
+            fn bitor_assign(&mut self, other: Self) {
+                self.bits |= other.bits;
+            }
+        }
+
+        impl $crate::_core::ops::BitXor for $BitFlags {
+            type Output = Self;
+
+            /// Returns the left flags, but with all the right flags toggled.
+            #[inline]
+            fn bitxor(self, other: Self) -> Self {
+                Self { bits: self.bits ^ other.bits }
+            }
+        }
+
+        impl $crate::_core::ops::BitXorAssign for $BitFlags {
+            /// Toggles the set of flags.
+            #[inline]
+            fn bitxor_assign(&mut self, other: Self) {
+                self.bits ^= other.bits;
+            }
+        }
+
+        impl $crate::_core::ops::BitAnd for $BitFlags {
+            type Output = Self;
+
+            /// Returns the intersection between the two sets of flags.
+            #[inline]
+            fn bitand(self, other: Self) -> Self {
+                Self { bits: self.bits & other.bits }
+            }
+        }
+
+        impl $crate::_core::ops::BitAndAssign for $BitFlags {
+            /// Disables all flags disabled in the set.
+            #[inline]
+            fn bitand_assign(&mut self, other: Self) {
+                self.bits &= other.bits;
+            }
+        }
+
+        impl $crate::_core::ops::Sub for $BitFlags {
+            type Output = Self;
+
+            /// Returns the set difference of the two sets of flags.
+            #[inline]
+            fn sub(self, other: Self) -> Self {
+                Self { bits: self.bits & !other.bits }
+            }
+        }
+
+        impl $crate::_core::ops::SubAssign for $BitFlags {
+            /// Disables all flags enabled in the set.
+            #[inline]
+            fn sub_assign(&mut self, other: Self) {
+                self.bits &= !other.bits;
+            }
+        }
+
+        impl $crate::_core::ops::Not for $BitFlags {
+            type Output = Self;
+
+            /// Returns the complement of this set of flags.
+            #[inline]
+            fn not(self) -> Self {
+                Self { bits: !self.bits } & Self::all()
+            }
+        }
+
+        impl $crate::_core::iter::Extend<$BitFlags> for $BitFlags {
+            fn extend<T: $crate::_core::iter::IntoIterator<Item=Self>>(&mut self, iterator: T) {
+                for item in iterator {
+                    self.insert(item)
+                }
+            }
+        }
+
+        impl $crate::_core::iter::FromIterator<$BitFlags> for $BitFlags {
+            fn from_iter<T: $crate::_core::iter::IntoIterator<Item=Self>>(iterator: T) -> Self {
+                let mut result = Self::empty();
+                result.extend(iterator);
+                result
+            }
+        }
+    };
+
+    // Every attribute that the user writes on a const is applied to the
+    // corresponding const that we generate, but within the implementation of
+    // Debug and all() we want to ignore everything but #[cfg] attributes. In
+    // particular, including a #[deprecated] attribute on those items would fail
+    // to compile.
+    // https://github.com/bitflags/bitflags/issues/109
+    //
+    // Input:
+    //
+    //     ? #[cfg(feature = "advanced")]
+    //     ? #[deprecated(note = "Use something else.")]
+    //     ? #[doc = r"High quality documentation."]
+    //     fn f() -> i32 { /* ... */ }
+    //
+    // Output:
+    //
+    //     #[cfg(feature = "advanced")]
+    //     fn f() -> i32 { /* ... */ }
+    (
+        $(#[$filtered:meta])*
+        ? #[cfg $($cfgargs:tt)*]
+        $(? #[$rest:ident $($restargs:tt)*])*
+        fn $($item:tt)*
+    ) => {
+        __impl_bitflags! {
+            $(#[$filtered])*
+            #[cfg $($cfgargs)*]
+            $(? #[$rest $($restargs)*])*
+            fn $($item)*
+        }
+    };
+    (
+        $(#[$filtered:meta])*
+        // $next != `cfg`
+        ? #[$next:ident $($nextargs:tt)*]
+        $(? #[$rest:ident $($restargs:tt)*])*
+        fn $($item:tt)*
+    ) => {
+        __impl_bitflags! {
+            $(#[$filtered])*
+            // $next filtered out
+            $(? #[$rest $($restargs)*])*
+            fn $($item)*
+        }
+    };
+    (
+        $(#[$filtered:meta])*
+        fn $($item:tt)*
+    ) => {
+        $(#[$filtered])*
+        fn $($item)*
+    };
+
+    // Every attribute that the user writes on a const is applied to the
+    // corresponding const that we generate, but within the implementation of
+    // Debug and all() we want to ignore everything but #[cfg] attributes. In
+    // particular, including a #[deprecated] attribute on those items would fail
+    // to compile.
+    // https://github.com/bitflags/bitflags/issues/109
+    //
+    // const version
+    //
+    // Input:
+    //
+    //     ? #[cfg(feature = "advanced")]
+    //     ? #[deprecated(note = "Use something else.")]
+    //     ? #[doc = r"High quality documentation."]
+    //     const f: i32 { /* ... */ }
+    //
+    // Output:
+    //
+    //     #[cfg(feature = "advanced")]
+    //     const f: i32 { /* ... */ }
+    (
+        $(#[$filtered:meta])*
+        ? #[cfg $($cfgargs:tt)*]
+        $(? #[$rest:ident $($restargs:tt)*])*
+        const $($item:tt)*
+    ) => {
+        __impl_bitflags! {
+            $(#[$filtered])*
+            #[cfg $($cfgargs)*]
+            $(? #[$rest $($restargs)*])*
+            const $($item)*
+        }
+    };
+    (
+        $(#[$filtered:meta])*
+        // $next != `cfg`
+        ? #[$next:ident $($nextargs:tt)*]
+        $(? #[$rest:ident $($restargs:tt)*])*
+        const $($item:tt)*
+    ) => {
+        __impl_bitflags! {
+            $(#[$filtered])*
+            // $next filtered out
+            $(? #[$rest $($restargs)*])*
+            const $($item)*
+        }
+    };
+    (
+        $(#[$filtered:meta])*
+        const $($item:tt)*
+    ) => {
+        $(#[$filtered])*
+        const $($item)*
+    };
+}
+
+#[cfg(feature = "example_generated")]
+pub mod example_generated;
+
+#[cfg(test)]
+mod tests {
+    use std::collections::hash_map::DefaultHasher;
+    use std::hash::{Hash, Hasher};
+
+    bitflags! {
+        #[doc = "> The first principle is that you must not fool yourself — and"]
+        #[doc = "> you are the easiest person to fool."]
+        #[doc = "> "]
+        #[doc = "> - Richard Feynman"]
+        #[derive(Default)]
+        struct Flags: u32 {
+            const A = 0b00000001;
+            #[doc = "<pcwalton> macros are way better at generating code than trans is"]
+            const B = 0b00000010;
+            const C = 0b00000100;
+            #[doc = "* cmr bed"]
+            #[doc = "* strcat table"]
+            #[doc = "<strcat> wait what?"]
+            const ABC = Self::A.bits | Self::B.bits | Self::C.bits;
+        }
+
+        struct _CfgFlags: u32 {
+            #[cfg(unix)]
+            const _CFG_A = 0b01;
+            #[cfg(windows)]
+            const _CFG_B = 0b01;
+            #[cfg(unix)]
+            const _CFG_C = Self::_CFG_A.bits | 0b10;
+        }
+
+        struct AnotherSetOfFlags: i8 {
+            const ANOTHER_FLAG = -1_i8;
+        }
+
+        struct LongFlags: u32 {
+            const LONG_A = 0b1111111111111111;
+        }
+    }
+
+    bitflags! {
+        struct EmptyFlags: u32 {
+        }
+    }
+
+    #[test]
+    fn test_bits() {
+        assert_eq!(Flags::empty().bits(), 0b00000000);
+        assert_eq!(Flags::A.bits(), 0b00000001);
+        assert_eq!(Flags::ABC.bits(), 0b00000111);
+
+        assert_eq!(AnotherSetOfFlags::empty().bits(), 0b00);
+        assert_eq!(AnotherSetOfFlags::ANOTHER_FLAG.bits(), !0_i8);
+
+        assert_eq!(EmptyFlags::empty().bits(), 0b00000000);
+    }
+
+    #[test]
+    fn test_from_bits() {
+        assert_eq!(Flags::from_bits(0), Some(Flags::empty()));
+        assert_eq!(Flags::from_bits(0b1), Some(Flags::A));
+        assert_eq!(Flags::from_bits(0b10), Some(Flags::B));
+        assert_eq!(Flags::from_bits(0b11), Some(Flags::A | Flags::B));
+        assert_eq!(Flags::from_bits(0b1000), None);
+
+        assert_eq!(
+            AnotherSetOfFlags::from_bits(!0_i8),
+            Some(AnotherSetOfFlags::ANOTHER_FLAG)
+        );
+
+        assert_eq!(EmptyFlags::from_bits(0), Some(EmptyFlags::empty()));
+        assert_eq!(EmptyFlags::from_bits(0b1), None);
+    }
+
+    #[test]
+    fn test_from_bits_truncate() {
+        assert_eq!(Flags::from_bits_truncate(0), Flags::empty());
+        assert_eq!(Flags::from_bits_truncate(0b1), Flags::A);
+        assert_eq!(Flags::from_bits_truncate(0b10), Flags::B);
+        assert_eq!(Flags::from_bits_truncate(0b11), (Flags::A | Flags::B));
+        assert_eq!(Flags::from_bits_truncate(0b1000), Flags::empty());
+        assert_eq!(Flags::from_bits_truncate(0b1001), Flags::A);
+
+        assert_eq!(
+            AnotherSetOfFlags::from_bits_truncate(0_i8),
+            AnotherSetOfFlags::empty()
+        );
+
+        assert_eq!(EmptyFlags::from_bits_truncate(0), EmptyFlags::empty());
+        assert_eq!(EmptyFlags::from_bits_truncate(0b1), EmptyFlags::empty());
+    }
+
+    #[test]
+    fn test_from_bits_unchecked() {
+        let extra = unsafe { Flags::from_bits_unchecked(0b1000) };
+        assert_eq!(unsafe { Flags::from_bits_unchecked(0) }, Flags::empty());
+        assert_eq!(unsafe { Flags::from_bits_unchecked(0b1) }, Flags::A);
+        assert_eq!(unsafe { Flags::from_bits_unchecked(0b10) }, Flags::B);
+
+        assert_eq!(
+            unsafe { Flags::from_bits_unchecked(0b11) },
+            (Flags::A | Flags::B)
+        );
+        assert_eq!(
+            unsafe { Flags::from_bits_unchecked(0b1000) },
+            (extra | Flags::empty())
+        );
+        assert_eq!(
+            unsafe { Flags::from_bits_unchecked(0b1001) },
+            (extra | Flags::A)
+        );
+
+        let extra = unsafe { EmptyFlags::from_bits_unchecked(0b1000) };
+        assert_eq!(
+            unsafe { EmptyFlags::from_bits_unchecked(0b1000) },
+            (extra | EmptyFlags::empty())
+        );
+    }
+
+    #[test]
+    fn test_is_empty() {
+        assert!(Flags::empty().is_empty());
+        assert!(!Flags::A.is_empty());
+        assert!(!Flags::ABC.is_empty());
+
+        assert!(!AnotherSetOfFlags::ANOTHER_FLAG.is_empty());
+
+        assert!(EmptyFlags::empty().is_empty());
+        assert!(EmptyFlags::all().is_empty());
+    }
+
+    #[test]
+    fn test_is_all() {
+        assert!(Flags::all().is_all());
+        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 | extra).is_all());
+        assert!((Flags::ABC | extra).is_all());
+
+        assert!(AnotherSetOfFlags::ANOTHER_FLAG.is_all());
+
+        assert!(EmptyFlags::all().is_all());
+        assert!(EmptyFlags::empty().is_all());
+    }
+
+    #[test]
+    fn test_two_empties_do_not_intersect() {
+        let e1 = Flags::empty();
+        let e2 = Flags::empty();
+        assert!(!e1.intersects(e2));
+
+        assert!(AnotherSetOfFlags::ANOTHER_FLAG.intersects(AnotherSetOfFlags::ANOTHER_FLAG));
+    }
+
+    #[test]
+    fn test_empty_does_not_intersect_with_full() {
+        let e1 = Flags::empty();
+        let e2 = Flags::ABC;
+        assert!(!e1.intersects(e2));
+    }
+
+    #[test]
+    fn test_disjoint_intersects() {
+        let e1 = Flags::A;
+        let e2 = Flags::B;
+        assert!(!e1.intersects(e2));
+    }
+
+    #[test]
+    fn test_overlapping_intersects() {
+        let e1 = Flags::A;
+        let e2 = Flags::A | Flags::B;
+        assert!(e1.intersects(e2));
+    }
+
+    #[test]
+    fn test_contains() {
+        let e1 = Flags::A;
+        let e2 = Flags::A | Flags::B;
+        assert!(!e1.contains(e2));
+        assert!(e2.contains(e1));
+        assert!(Flags::ABC.contains(e2));
+
+        assert!(AnotherSetOfFlags::ANOTHER_FLAG.contains(AnotherSetOfFlags::ANOTHER_FLAG));
+
+        assert!(EmptyFlags::empty().contains(EmptyFlags::empty()));
+    }
+
+    #[test]
+    fn test_insert() {
+        let mut e1 = Flags::A;
+        let e2 = Flags::A | Flags::B;
+        e1.insert(e2);
+        assert_eq!(e1, e2);
+
+        let mut e3 = AnotherSetOfFlags::empty();
+        e3.insert(AnotherSetOfFlags::ANOTHER_FLAG);
+        assert_eq!(e3, AnotherSetOfFlags::ANOTHER_FLAG);
+    }
+
+    #[test]
+    fn test_remove() {
+        let mut e1 = Flags::A | Flags::B;
+        let e2 = Flags::A | Flags::C;
+        e1.remove(e2);
+        assert_eq!(e1, Flags::B);
+
+        let mut e3 = AnotherSetOfFlags::ANOTHER_FLAG;
+        e3.remove(AnotherSetOfFlags::ANOTHER_FLAG);
+        assert_eq!(e3, AnotherSetOfFlags::empty());
+    }
+
+    #[test]
+    fn test_operators() {
+        let e1 = Flags::A | Flags::C;
+        let e2 = Flags::B | Flags::C;
+        assert_eq!((e1 | e2), Flags::ABC); // union
+        assert_eq!((e1 & e2), Flags::C); // intersection
+        assert_eq!((e1 - e2), Flags::A); // set difference
+        assert_eq!(!e2, Flags::A); // set complement
+        assert_eq!(e1 ^ e2, Flags::A | Flags::B); // toggle
+        let mut e3 = e1;
+        e3.toggle(e2);
+        assert_eq!(e3, Flags::A | Flags::B);
+
+        let mut m4 = AnotherSetOfFlags::empty();
+        m4.toggle(AnotherSetOfFlags::empty());
+        assert_eq!(m4, AnotherSetOfFlags::empty());
+    }
+
+    #[test]
+    fn test_operators_unchecked() {
+        let extra = unsafe { Flags::from_bits_unchecked(0b1000) };
+        let e1 = Flags::A | Flags::C | extra;
+        let e2 = Flags::B | Flags::C;
+        assert_eq!((e1 | e2), (Flags::ABC | extra)); // union
+        assert_eq!((e1 & e2), Flags::C); // intersection
+        assert_eq!((e1 - e2), (Flags::A | extra)); // set difference
+        assert_eq!(!e2, Flags::A); // set complement
+        assert_eq!(!e1, Flags::B); // set complement
+        assert_eq!(e1 ^ e2, Flags::A | Flags::B | extra); // toggle
+        let mut e3 = e1;
+        e3.toggle(e2);
+        assert_eq!(e3, Flags::A | Flags::B | extra);
+    }
+
+    #[test]
+    fn test_set_ops_basic() {
+        let ab = Flags::A.union(Flags::B);
+        let ac = Flags::A.union(Flags::C);
+        let bc = Flags::B.union(Flags::C);
+        assert_eq!(ab.bits, 0b011);
+        assert_eq!(bc.bits, 0b110);
+        assert_eq!(ac.bits, 0b101);
+
+        assert_eq!(ab, Flags::B.union(Flags::A));
+        assert_eq!(ac, Flags::C.union(Flags::A));
+        assert_eq!(bc, Flags::C.union(Flags::B));
+
+        assert_eq!(ac, Flags::A | Flags::C);
+        assert_eq!(bc, Flags::B | Flags::C);
+        assert_eq!(ab.union(bc), Flags::ABC);
+
+        assert_eq!(ac, Flags::A | Flags::C);
+        assert_eq!(bc, Flags::B | Flags::C);
+
+        assert_eq!(ac.union(bc), ac | bc);
+        assert_eq!(ac.union(bc), Flags::ABC);
+        assert_eq!(bc.union(ac), Flags::ABC);
+
+        assert_eq!(ac.intersection(bc), ac & bc);
+        assert_eq!(ac.intersection(bc), Flags::C);
+        assert_eq!(bc.intersection(ac), Flags::C);
+
+        assert_eq!(ac.difference(bc), ac - bc);
+        assert_eq!(bc.difference(ac), bc - ac);
+        assert_eq!(ac.difference(bc), Flags::A);
+        assert_eq!(bc.difference(ac), Flags::B);
+
+        assert_eq!(bc.complement(), !bc);
+        assert_eq!(bc.complement(), Flags::A);
+        assert_eq!(ac.symmetric_difference(bc), Flags::A.union(Flags::B));
+        assert_eq!(bc.symmetric_difference(ac), Flags::A.union(Flags::B));
+    }
+
+    #[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)
+        const INTERSECT: Flags = Flags::all().intersection(Flags::C);
+        const UNION: Flags = Flags::A.union(Flags::C);
+        const DIFFERENCE: Flags = Flags::all().difference(Flags::A);
+        const COMPLEMENT: Flags = Flags::C.complement();
+        const SYM_DIFFERENCE: Flags = UNION.symmetric_difference(DIFFERENCE);
+        assert_eq!(INTERSECT, Flags::C);
+        assert_eq!(UNION, Flags::A | Flags::C);
+        assert_eq!(DIFFERENCE, Flags::all() - Flags::A);
+        assert_eq!(COMPLEMENT, !Flags::C);
+        assert_eq!(SYM_DIFFERENCE, (Flags::A | Flags::C) ^ (Flags::all() - Flags::A));
+    }
+
+    #[test]
+    fn test_set_ops_unchecked() {
+        let extra = unsafe { Flags::from_bits_unchecked(0b1000) };
+        let e1 = Flags::A.union(Flags::C).union(extra);
+        let e2 = Flags::B.union(Flags::C);
+        assert_eq!(e1.bits, 0b1101);
+        assert_eq!(e1.union(e2), (Flags::ABC | extra));
+        assert_eq!(e1.intersection(e2), Flags::C);
+        assert_eq!(e1.difference(e2), Flags::A | extra);
+        assert_eq!(e2.difference(e1), Flags::B);
+        assert_eq!(e2.complement(), Flags::A);
+        assert_eq!(e1.complement(), Flags::B);
+        assert_eq!(e1.symmetric_difference(e2), Flags::A | Flags::B | extra); // toggle
+    }
+
+    #[test]
+    fn test_set_ops_exhaustive() {
+        // Define a flag that contains gaps to help exercise edge-cases,
+        // especially around "unknown" flags (e.g. ones outside of `all()`
+        // `from_bits_unchecked`).
+        // - when lhs and rhs both have different sets of unknown flags.
+        // - unknown flags at both ends, and in the middle
+        // - cases with "gaps".
+        bitflags! {
+            struct Test: u16 {
+                // Intentionally no `A`
+                const B = 0b000000010;
+                // Intentionally no `C`
+                const D = 0b000001000;
+                const E = 0b000010000;
+                const F = 0b000100000;
+                const G = 0b001000000;
+                // Intentionally no `H`
+                const I = 0b100000000;
+            }
+        }
+        let iter_test_flags =
+            || (0..=0b111_1111_1111).map(|bits| unsafe { Test::from_bits_unchecked(bits) });
+
+        for a in iter_test_flags() {
+            assert_eq!(
+                a.complement(),
+                Test::from_bits_truncate(!a.bits),
+                "wrong result: !({:?})",
+                a,
+            );
+            assert_eq!(a.complement(), !a, "named != op: !({:?})", a);
+            for b in iter_test_flags() {
+                // Check that the named operations produce the expected bitwise
+                // values.
+                assert_eq!(
+                    a.union(b).bits,
+                    a.bits | b.bits,
+                    "wrong result: `{:?}` | `{:?}`",
+                    a,
+                    b,
+                );
+                assert_eq!(
+                    a.intersection(b).bits,
+                    a.bits & b.bits,
+                    "wrong result: `{:?}` & `{:?}`",
+                    a,
+                    b,
+                );
+                assert_eq!(
+                    a.symmetric_difference(b).bits,
+                    a.bits ^ b.bits,
+                    "wrong result: `{:?}` ^ `{:?}`",
+                    a,
+                    b,
+                );
+                assert_eq!(
+                    a.difference(b).bits,
+                    a.bits & !b.bits,
+                    "wrong result: `{:?}` - `{:?}`",
+                    a,
+                    b,
+                );
+                // Note: Difference is checked as both `a - b` and `b - a`
+                assert_eq!(
+                    b.difference(a).bits,
+                    b.bits & !a.bits,
+                    "wrong result: `{:?}` - `{:?}`",
+                    b,
+                    a,
+                );
+                // Check that the named set operations are equivalent to the
+                // bitwise equivalents
+                assert_eq!(a.union(b), a | b, "named != op: `{:?}` | `{:?}`", a, b,);
+                assert_eq!(
+                    a.intersection(b),
+                    a & b,
+                    "named != op: `{:?}` & `{:?}`",
+                    a,
+                    b,
+                );
+                assert_eq!(
+                    a.symmetric_difference(b),
+                    a ^ b,
+                    "named != op: `{:?}` ^ `{:?}`",
+                    a,
+                    b,
+                );
+                assert_eq!(a.difference(b), a - b, "named != op: `{:?}` - `{:?}`", a, b,);
+                // Note: Difference is checked as both `a - b` and `b - a`
+                assert_eq!(b.difference(a), b - a, "named != op: `{:?}` - `{:?}`", b, a,);
+                // Verify that the operations which should be symmetric are
+                // actually symmetric.
+                assert_eq!(a.union(b), b.union(a), "asymmetry: `{:?}` | `{:?}`", a, b,);
+                assert_eq!(
+                    a.intersection(b),
+                    b.intersection(a),
+                    "asymmetry: `{:?}` & `{:?}`",
+                    a,
+                    b,
+                );
+                assert_eq!(
+                    a.symmetric_difference(b),
+                    b.symmetric_difference(a),
+                    "asymmetry: `{:?}` ^ `{:?}`",
+                    a,
+                    b,
+                );
+            }
+        }
+    }
+
+    #[test]
+    fn test_set() {
+        let mut e1 = Flags::A | Flags::C;
+        e1.set(Flags::B, true);
+        e1.set(Flags::C, false);
+
+        assert_eq!(e1, Flags::A | Flags::B);
+    }
+
+    #[test]
+    fn test_assignment_operators() {
+        let mut m1 = Flags::empty();
+        let e1 = Flags::A | Flags::C;
+        // union
+        m1 |= Flags::A;
+        assert_eq!(m1, Flags::A);
+        // intersection
+        m1 &= e1;
+        assert_eq!(m1, Flags::A);
+        // set difference
+        m1 -= m1;
+        assert_eq!(m1, Flags::empty());
+        // toggle
+        m1 ^= e1;
+        assert_eq!(m1, e1);
+    }
+
+    #[test]
+    fn test_const_fn() {
+        const _M1: Flags = Flags::empty();
+
+        const M2: Flags = Flags::A;
+        assert_eq!(M2, Flags::A);
+
+        const M3: Flags = Flags::C;
+        assert_eq!(M3, Flags::C);
+    }
+
+    #[test]
+    fn test_extend() {
+        let mut flags;
+
+        flags = Flags::empty();
+        flags.extend([].iter().cloned());
+        assert_eq!(flags, Flags::empty());
+
+        flags = Flags::empty();
+        flags.extend([Flags::A, Flags::B].iter().cloned());
+        assert_eq!(flags, Flags::A | Flags::B);
+
+        flags = Flags::A;
+        flags.extend([Flags::A, Flags::B].iter().cloned());
+        assert_eq!(flags, Flags::A | Flags::B);
+
+        flags = Flags::B;
+        flags.extend([Flags::A, Flags::ABC].iter().cloned());
+        assert_eq!(flags, Flags::ABC);
+    }
+
+    #[test]
+    fn test_from_iterator() {
+        assert_eq!([].iter().cloned().collect::<Flags>(), Flags::empty());
+        assert_eq!(
+            [Flags::A, Flags::B].iter().cloned().collect::<Flags>(),
+            Flags::A | Flags::B
+        );
+        assert_eq!(
+            [Flags::A, Flags::ABC].iter().cloned().collect::<Flags>(),
+            Flags::ABC
+        );
+    }
+
+    #[test]
+    fn test_lt() {
+        let mut a = Flags::empty();
+        let mut b = Flags::empty();
+
+        assert!(!(a < b) && !(b < a));
+        b = Flags::B;
+        assert!(a < b);
+        a = Flags::C;
+        assert!(!(a < b) && b < a);
+        b = Flags::C | Flags::B;
+        assert!(a < b);
+    }
+
+    #[test]
+    fn test_ord() {
+        let mut a = Flags::empty();
+        let mut b = Flags::empty();
+
+        assert!(a <= b && a >= b);
+        a = Flags::A;
+        assert!(a > b && a >= b);
+        assert!(b < a && b <= a);
+        b = Flags::B;
+        assert!(b > a && b >= a);
+        assert!(a < b && a <= b);
+    }
+
+    fn hash<T: Hash>(t: &T) -> u64 {
+        let mut s = DefaultHasher::new();
+        t.hash(&mut s);
+        s.finish()
+    }
+
+    #[test]
+    fn test_hash() {
+        let mut x = Flags::empty();
+        let mut y = Flags::empty();
+        assert_eq!(hash(&x), hash(&y));
+        x = Flags::all();
+        y = Flags::ABC;
+        assert_eq!(hash(&x), hash(&y));
+    }
+
+    #[test]
+    fn test_default() {
+        assert_eq!(Flags::empty(), Flags::default());
+    }
+
+    #[test]
+    fn test_debug() {
+        assert_eq!(format!("{:?}", Flags::A | Flags::B), "A | B");
+        assert_eq!(format!("{:?}", Flags::empty()), "(empty)");
+        assert_eq!(format!("{:?}", Flags::ABC), "A | B | C | ABC");
+        let extra = unsafe { Flags::from_bits_unchecked(0xb8) };
+        assert_eq!(format!("{:?}", extra), "0xb8");
+        assert_eq!(format!("{:?}", Flags::A | extra), "A | 0xb8");
+
+        assert_eq!(
+            format!("{:?}", Flags::ABC | extra),
+            "A | B | C | ABC | 0xb8"
+        );
+
+        assert_eq!(format!("{:?}", EmptyFlags::empty()), "(empty)");
+    }
+
+    #[test]
+    fn test_binary() {
+        assert_eq!(format!("{:b}", Flags::ABC), "111");
+        assert_eq!(format!("{:#b}", Flags::ABC), "0b111");
+        let extra = unsafe { Flags::from_bits_unchecked(0b1010000) };
+        assert_eq!(format!("{:b}", Flags::ABC | extra), "1010111");
+        assert_eq!(format!("{:#b}", Flags::ABC | extra), "0b1010111");
+    }
+
+    #[test]
+    fn test_octal() {
+        assert_eq!(format!("{:o}", LongFlags::LONG_A), "177777");
+        assert_eq!(format!("{:#o}", LongFlags::LONG_A), "0o177777");
+        let extra = unsafe { LongFlags::from_bits_unchecked(0o5000000) };
+        assert_eq!(format!("{:o}", LongFlags::LONG_A | extra), "5177777");
+        assert_eq!(format!("{:#o}", LongFlags::LONG_A | extra), "0o5177777");
+    }
+
+    #[test]
+    fn test_lowerhex() {
+        assert_eq!(format!("{:x}", LongFlags::LONG_A), "ffff");
+        assert_eq!(format!("{:#x}", LongFlags::LONG_A), "0xffff");
+        let extra = unsafe { LongFlags::from_bits_unchecked(0xe00000) };
+        assert_eq!(format!("{:x}", LongFlags::LONG_A | extra), "e0ffff");
+        assert_eq!(format!("{:#x}", LongFlags::LONG_A | extra), "0xe0ffff");
+    }
+
+    #[test]
+    fn test_upperhex() {
+        assert_eq!(format!("{:X}", LongFlags::LONG_A), "FFFF");
+        assert_eq!(format!("{:#X}", LongFlags::LONG_A), "0xFFFF");
+        let extra = unsafe { LongFlags::from_bits_unchecked(0xe00000) };
+        assert_eq!(format!("{:X}", LongFlags::LONG_A | extra), "E0FFFF");
+        assert_eq!(format!("{:#X}", LongFlags::LONG_A | extra), "0xE0FFFF");
+    }
+
+    mod submodule {
+        bitflags! {
+            pub struct PublicFlags: i8 {
+                const X = 0;
+            }
+
+            struct PrivateFlags: i8 {
+                const Y = 0;
+            }
+        }
+
+        #[test]
+        fn test_private() {
+            let _ = PrivateFlags::Y;
+        }
+    }
+
+    #[test]
+    fn test_public() {
+        let _ = submodule::PublicFlags::X;
+    }
+
+    mod t1 {
+        mod foo {
+            pub type Bar = i32;
+        }
+
+        bitflags! {
+            /// baz
+            struct Flags: foo::Bar {
+                const A = 0b00000001;
+                #[cfg(foo)]
+                const B = 0b00000010;
+                #[cfg(foo)]
+                const C = 0b00000010;
+            }
+        }
+    }
+
+    #[test]
+    fn test_in_function() {
+        bitflags! {
+           struct Flags: u8 {
+                const A = 1;
+                #[cfg(any())] // false
+                const B = 2;
+            }
+        }
+        assert_eq!(Flags::all(), Flags::A);
+        assert_eq!(format!("{:?}", Flags::A), "A");
+    }
+
+    #[test]
+    fn test_deprecated() {
+        bitflags! {
+            pub struct TestFlags: u32 {
+                #[deprecated(note = "Use something else.")]
+                const ONE = 1;
+            }
+        }
+    }
+
+    #[test]
+    fn test_pub_crate() {
+        mod module {
+            bitflags! {
+                pub (crate) struct Test: u8 {
+                    const FOO = 1;
+                }
+            }
+        }
+
+        assert_eq!(module::Test::FOO.bits(), 1);
+    }
+
+    #[test]
+    fn test_pub_in_module() {
+        mod module {
+            mod submodule {
+                bitflags! {
+                    // `pub (in super)` means only the module `module` will
+                    // be able to access this.
+                    pub (in super) struct Test: u8 {
+                        const FOO = 1;
+                    }
+                }
+            }
+
+            mod test {
+                // Note: due to `pub (in super)`,
+                // this cannot be accessed directly by the testing code.
+                pub(super) fn value() -> u8 {
+                    super::submodule::Test::FOO.bits()
+                }
+            }
+
+            pub fn value() -> u8 {
+                test::value()
+            }
+        }
+
+        assert_eq!(module::value(), 1)
+    }
+
+    #[test]
+    fn test_zero_value_flags() {
+        bitflags! {
+            struct Flags: u32 {
+                const NONE = 0b0;
+                const SOME = 0b1;
+            }
+        }
+
+        assert!(Flags::empty().contains(Flags::NONE));
+        assert!(Flags::SOME.contains(Flags::NONE));
+        assert!(Flags::NONE.is_empty());
+
+        assert_eq!(format!("{:?}", Flags::empty()), "NONE");
+        assert_eq!(format!("{:?}", Flags::SOME), "SOME");
+    }
+
+    #[test]
+    fn test_empty_bitflags() {
+        bitflags! {}
+    }
+
+    #[test]
+    fn test_u128_bitflags() {
+        bitflags! {
+            struct Flags128: u128 {
+                const A = 0x0000_0000_0000_0000_0000_0000_0000_0001;
+                const B = 0x0000_0000_0000_1000_0000_0000_0000_0000;
+                const C = 0x8000_0000_0000_0000_0000_0000_0000_0000;
+                const ABC = Self::A.bits | Self::B.bits | Self::C.bits;
+            }
+        }
+
+        assert_eq!(Flags128::ABC, Flags128::A | Flags128::B | Flags128::C);
+        assert_eq!(Flags128::A.bits, 0x0000_0000_0000_0000_0000_0000_0000_0001);
+        assert_eq!(Flags128::B.bits, 0x0000_0000_0000_1000_0000_0000_0000_0000);
+        assert_eq!(Flags128::C.bits, 0x8000_0000_0000_0000_0000_0000_0000_0000);
+        assert_eq!(
+            Flags128::ABC.bits,
+            0x8000_0000_0000_1000_0000_0000_0000_0001
+        );
+        assert_eq!(format!("{:?}", Flags128::A), "A");
+        assert_eq!(format!("{:?}", Flags128::B), "B");
+        assert_eq!(format!("{:?}", Flags128::C), "C");
+        assert_eq!(format!("{:?}", Flags128::ABC), "A | B | C | ABC");
+    }
+
+    #[test]
+    fn test_serde_bitflags_serialize() {
+        let flags = SerdeFlags::A | SerdeFlags::B;
+
+        let serialized = serde_json::to_string(&flags).unwrap();
+
+        assert_eq!(serialized, r#"{"bits":3}"#);
+    }
+
+    #[test]
+    fn test_serde_bitflags_deserialize() {
+        let deserialized: SerdeFlags = serde_json::from_str(r#"{"bits":12}"#).unwrap();
+
+        let expected = SerdeFlags::C | SerdeFlags::D;
+
+        assert_eq!(deserialized.bits, expected.bits);
+    }
+
+    #[test]
+    fn test_serde_bitflags_roundtrip() {
+        let flags = SerdeFlags::A | SerdeFlags::B;
+
+        let deserialized: SerdeFlags = serde_json::from_str(&serde_json::to_string(&flags).unwrap()).unwrap();
+
+        assert_eq!(deserialized.bits, flags.bits);
+    }
+
+    bitflags! {
+        #[derive(serde::Serialize, serde::Deserialize)]
+        struct SerdeFlags: u32 {
+            const A = 1;
+            const B = 2;
+            const C = 4;
+            const D = 8;
+        }
+    }
+}
diff -Naur vendor-41.0.5/bitflags-1.3.2/tests/basic.rs vendor-41.0.7/bitflags-1.3.2/tests/basic.rs
--- vendor-41.0.5/bitflags-1.3.2/tests/basic.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags-1.3.2/tests/basic.rs	1969-12-31 19:00:00.000000000 -0500
@@ -0,0 +1,20 @@
+#![no_std]
+
+use bitflags::bitflags;
+
+bitflags! {
+    /// baz
+    struct Flags: u32 {
+        const A = 0b00000001;
+        #[doc = "bar"]
+        const B = 0b00000010;
+        const C = 0b00000100;
+        #[doc = "foo"]
+        const ABC = Flags::A.bits | Flags::B.bits | Flags::C.bits;
+    }
+}
+
+#[test]
+fn basic() {
+    assert_eq!(Flags::ABC, Flags::A | Flags::B | Flags::C);
+}
diff -Naur vendor-41.0.5/bitflags-1.3.2/tests/compile-fail/impls/copy.rs vendor-41.0.7/bitflags-1.3.2/tests/compile-fail/impls/copy.rs
--- vendor-41.0.5/bitflags-1.3.2/tests/compile-fail/impls/copy.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags-1.3.2/tests/compile-fail/impls/copy.rs	1969-12-31 19:00:00.000000000 -0500
@@ -0,0 +1,10 @@
+use bitflags::bitflags;
+
+bitflags! {
+    #[derive(Clone, Copy)]
+    struct Flags: u32 {
+        const A = 0b00000001;
+    }
+}
+
+fn main() {}
diff -Naur vendor-41.0.5/bitflags-1.3.2/tests/compile-fail/impls/copy.stderr.beta vendor-41.0.7/bitflags-1.3.2/tests/compile-fail/impls/copy.stderr.beta
--- vendor-41.0.5/bitflags-1.3.2/tests/compile-fail/impls/copy.stderr.beta	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags-1.3.2/tests/compile-fail/impls/copy.stderr.beta	1969-12-31 19:00:00.000000000 -0500
@@ -0,0 +1,27 @@
+error[E0119]: conflicting implementations of trait `std::clone::Clone` for type `Flags`
+ --> $DIR/copy.rs:3:1
+  |
+3 | / bitflags! {
+4 | |     #[derive(Clone, Copy)]
+  | |              ----- first implementation here
+5 | |     struct Flags: u32 {
+6 | |         const A = 0b00000001;
+7 | |     }
+8 | | }
+  | |_^ conflicting implementation for `Flags`
+  |
+  = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0119]: conflicting implementations of trait `std::marker::Copy` for type `Flags`
+ --> $DIR/copy.rs:3:1
+  |
+3 | / bitflags! {
+4 | |     #[derive(Clone, Copy)]
+  | |                     ---- first implementation here
+5 | |     struct Flags: u32 {
+6 | |         const A = 0b00000001;
+7 | |     }
+8 | | }
+  | |_^ conflicting implementation for `Flags`
+  |
+  = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
diff -Naur vendor-41.0.5/bitflags-1.3.2/tests/compile-fail/impls/eq.rs vendor-41.0.7/bitflags-1.3.2/tests/compile-fail/impls/eq.rs
--- vendor-41.0.5/bitflags-1.3.2/tests/compile-fail/impls/eq.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags-1.3.2/tests/compile-fail/impls/eq.rs	1969-12-31 19:00:00.000000000 -0500
@@ -0,0 +1,10 @@
+use bitflags::bitflags;
+
+bitflags! {
+    #[derive(PartialEq, Eq)]
+    struct Flags: u32 {
+        const A = 0b00000001;
+    }
+}
+
+fn main() {}
diff -Naur vendor-41.0.5/bitflags-1.3.2/tests/compile-fail/impls/eq.stderr.beta vendor-41.0.7/bitflags-1.3.2/tests/compile-fail/impls/eq.stderr.beta
--- vendor-41.0.5/bitflags-1.3.2/tests/compile-fail/impls/eq.stderr.beta	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags-1.3.2/tests/compile-fail/impls/eq.stderr.beta	1969-12-31 19:00:00.000000000 -0500
@@ -0,0 +1,55 @@
+error[E0119]: conflicting implementations of trait `std::cmp::PartialEq` for type `Flags`
+ --> $DIR/eq.rs:3:1
+  |
+3 | / bitflags! {
+4 | |     #[derive(PartialEq, Eq)]
+  | |              --------- first implementation here
+5 | |     struct Flags: u32 {
+6 | |         const A = 0b00000001;
+7 | |     }
+8 | | }
+  | |_^ conflicting implementation for `Flags`
+  |
+  = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0119]: conflicting implementations of trait `std::cmp::Eq` for type `Flags`
+ --> $DIR/eq.rs:3:1
+  |
+3 | / bitflags! {
+4 | |     #[derive(PartialEq, Eq)]
+  | |                         -- first implementation here
+5 | |     struct Flags: u32 {
+6 | |         const A = 0b00000001;
+7 | |     }
+8 | | }
+  | |_^ conflicting implementation for `Flags`
+  |
+  = note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0119]: conflicting implementations of trait `std::marker::StructuralPartialEq` for type `Flags`
+ --> $DIR/eq.rs:3:1
+  |
+3 | / bitflags! {
+4 | |     #[derive(PartialEq, Eq)]
+  | |              --------- first implementation here
+5 | |     struct Flags: u32 {
+6 | |         const A = 0b00000001;
+7 | |     }
+8 | | }
+  | |_^ conflicting implementation for `Flags`
+  |
+  = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0119]: conflicting implementations of trait `std::marker::StructuralEq` for type `Flags`
+ --> $DIR/eq.rs:3:1
+  |
+3 | / bitflags! {
+4 | |     #[derive(PartialEq, Eq)]
+  | |                         -- first implementation here
+5 | |     struct Flags: u32 {
+6 | |         const A = 0b00000001;
+7 | |     }
+8 | | }
+  | |_^ conflicting implementation for `Flags`
+  |
+  = note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info)
diff -Naur vendor-41.0.5/bitflags-1.3.2/tests/compile-fail/non_integer_base/all_defined.rs vendor-41.0.7/bitflags-1.3.2/tests/compile-fail/non_integer_base/all_defined.rs
--- vendor-41.0.5/bitflags-1.3.2/tests/compile-fail/non_integer_base/all_defined.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags-1.3.2/tests/compile-fail/non_integer_base/all_defined.rs	1969-12-31 19:00:00.000000000 -0500
@@ -0,0 +1,123 @@
+use std::{
+    fmt::{
+        self,
+        Debug,
+        Display,
+        LowerHex,
+        UpperHex,
+        Octal,
+        Binary,
+    },
+    ops::{
+        BitAnd,
+        BitOr,
+        BitXor,
+        BitAndAssign,
+        BitOrAssign,
+        BitXorAssign,
+        Not,
+    },
+};
+
+use bitflags::bitflags;
+
+// Ideally we'd actually want this to work, but currently need something like `num`'s `Zero`
+// With some design work it could be made possible
+#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
+struct MyInt(u8);
+
+impl BitAnd for MyInt {
+    type Output = Self;
+
+    fn bitand(self, other: Self) -> Self {
+        MyInt(self.0 & other.0)
+    }
+}
+
+impl BitOr for MyInt {
+    type Output = Self;
+
+    fn bitor(self, other: Self) -> Self {
+        MyInt(self.0 | other.0)
+    }
+}
+
+impl BitXor for MyInt {
+    type Output = Self;
+
+    fn bitxor(self, other: Self) -> Self {
+        MyInt(self.0 ^ other.0)
+    }
+}
+
+impl BitAndAssign for MyInt {
+    fn bitand_assign(&mut self, other: Self) {
+        self.0 &= other.0
+    }
+}
+
+impl BitOrAssign for MyInt {
+    fn bitor_assign(&mut self, other: Self) {
+        self.0 |= other.0
+    }
+}
+
+impl BitXorAssign for MyInt {
+    fn bitxor_assign(&mut self, other: Self) {
+        self.0 ^= other.0
+    }
+}
+
+impl Debug for MyInt {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        Debug::fmt(&self.0, f)
+    }
+}
+
+impl Display for MyInt {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        Display::fmt(&self.0, f)
+    }
+}
+
+impl LowerHex for MyInt {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        LowerHex::fmt(&self.0, f)
+    }
+}
+
+impl UpperHex for MyInt {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        UpperHex::fmt(&self.0, f)
+    }
+}
+
+impl Octal for MyInt {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        Octal::fmt(&self.0, f)
+    }
+}
+
+impl Binary for MyInt {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        Binary::fmt(&self.0, f)
+    }
+}
+
+impl Not for MyInt {
+    type Output = MyInt;
+
+    fn not(self) -> Self {
+        MyInt(!self.0)
+    }
+}
+
+bitflags! {
+    struct Flags128: MyInt {
+        const A = MyInt(0b0000_0001u8);
+        const B = MyInt(0b0000_0010u8);
+        const C = MyInt(0b0000_0100u8);
+    }
+}
+
+fn main() {}
diff -Naur vendor-41.0.5/bitflags-1.3.2/tests/compile-fail/non_integer_base/all_defined.stderr.beta vendor-41.0.7/bitflags-1.3.2/tests/compile-fail/non_integer_base/all_defined.stderr.beta
--- vendor-41.0.5/bitflags-1.3.2/tests/compile-fail/non_integer_base/all_defined.stderr.beta	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags-1.3.2/tests/compile-fail/non_integer_base/all_defined.stderr.beta	1969-12-31 19:00:00.000000000 -0500
@@ -0,0 +1,27 @@
+error[E0308]: mismatched types
+   --> $DIR/all_defined.rs:115:1
+    |
+115 | / bitflags! {
+116 | |     struct Flags128: MyInt {
+117 | |         const A = MyInt(0b0000_0001u8);
+118 | |         const B = MyInt(0b0000_0010u8);
+119 | |         const C = MyInt(0b0000_0100u8);
+120 | |     }
+121 | | }
+    | |_^ expected struct `MyInt`, found integer
+    |
+    = note: this error originates in the macro `__impl_all_bitflags` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0308]: mismatched types
+   --> $DIR/all_defined.rs:115:1
+    |
+115 | / bitflags! {
+116 | |     struct Flags128: MyInt {
+117 | |         const A = MyInt(0b0000_0001u8);
+118 | |         const B = MyInt(0b0000_0010u8);
+119 | |         const C = MyInt(0b0000_0100u8);
+120 | |     }
+121 | | }
+    | |_^ expected struct `MyInt`, found integer
+    |
+    = note: this error originates in the macro `__impl_bitflags` (in Nightly builds, run with -Z macro-backtrace for more info)
diff -Naur vendor-41.0.5/bitflags-1.3.2/tests/compile-fail/non_integer_base/all_missing.rs vendor-41.0.7/bitflags-1.3.2/tests/compile-fail/non_integer_base/all_missing.rs
--- vendor-41.0.5/bitflags-1.3.2/tests/compile-fail/non_integer_base/all_missing.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags-1.3.2/tests/compile-fail/non_integer_base/all_missing.rs	1969-12-31 19:00:00.000000000 -0500
@@ -0,0 +1,13 @@
+use bitflags::bitflags;
+
+struct MyInt(u8);
+
+bitflags! {
+    struct Flags128: MyInt {
+        const A = MyInt(0b0000_0001);
+        const B = MyInt(0b0000_0010);
+        const C = MyInt(0b0000_0100);
+    }
+}
+
+fn main() {}
diff -Naur vendor-41.0.5/bitflags-1.3.2/tests/compile-fail/non_integer_base/all_missing.stderr.beta vendor-41.0.7/bitflags-1.3.2/tests/compile-fail/non_integer_base/all_missing.stderr.beta
--- vendor-41.0.5/bitflags-1.3.2/tests/compile-fail/non_integer_base/all_missing.stderr.beta	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags-1.3.2/tests/compile-fail/non_integer_base/all_missing.stderr.beta	1969-12-31 19:00:00.000000000 -0500
@@ -0,0 +1,13 @@
+error[E0204]: the trait `Copy` may not be implemented for this type
+  --> $DIR/all_missing.rs:5:1
+   |
+5  | / bitflags! {
+6  | |     struct Flags128: MyInt {
+7  | |         const A = MyInt(0b0000_0001);
+8  | |         const B = MyInt(0b0000_0010);
+9  | |         const C = MyInt(0b0000_0100);
+10 | |     }
+11 | | }
+   | |_^ this field does not implement `Copy`
+   |
+   = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
diff -Naur vendor-41.0.5/bitflags-1.3.2/tests/compile-fail/visibility/private_field.rs vendor-41.0.7/bitflags-1.3.2/tests/compile-fail/visibility/private_field.rs
--- vendor-41.0.5/bitflags-1.3.2/tests/compile-fail/visibility/private_field.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags-1.3.2/tests/compile-fail/visibility/private_field.rs	1969-12-31 19:00:00.000000000 -0500
@@ -0,0 +1,13 @@
+mod example {
+    use bitflags::bitflags;
+
+    bitflags! {
+        pub struct Flags1: u32 {
+            const FLAG_A = 0b00000001;
+        }
+    }
+}
+
+fn main() {
+    let flag1 = example::Flags1::FLAG_A.bits;
+}
diff -Naur vendor-41.0.5/bitflags-1.3.2/tests/compile-fail/visibility/private_field.stderr.beta vendor-41.0.7/bitflags-1.3.2/tests/compile-fail/visibility/private_field.stderr.beta
--- vendor-41.0.5/bitflags-1.3.2/tests/compile-fail/visibility/private_field.stderr.beta	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags-1.3.2/tests/compile-fail/visibility/private_field.stderr.beta	1969-12-31 19:00:00.000000000 -0500
@@ -0,0 +1,10 @@
+error[E0616]: field `bits` of struct `Flags1` is private
+  --> $DIR/private_field.rs:12:41
+   |
+12 |     let flag1 = example::Flags1::FLAG_A.bits;
+   |                                         ^^^^ private field
+   |
+help: a method `bits` also exists, call it with parentheses
+   |
+12 |     let flag1 = example::Flags1::FLAG_A.bits();
+   |                                             ^^
diff -Naur vendor-41.0.5/bitflags-1.3.2/tests/compile-fail/visibility/private_flags.rs vendor-41.0.7/bitflags-1.3.2/tests/compile-fail/visibility/private_flags.rs
--- vendor-41.0.5/bitflags-1.3.2/tests/compile-fail/visibility/private_flags.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags-1.3.2/tests/compile-fail/visibility/private_flags.rs	1969-12-31 19:00:00.000000000 -0500
@@ -0,0 +1,18 @@
+mod example {
+    use bitflags::bitflags;
+
+    bitflags! {
+        pub struct Flags1: u32 {
+            const FLAG_A = 0b00000001;
+        }
+
+        struct Flags2: u32 {
+            const FLAG_B = 0b00000010;
+        }
+    }
+}
+
+fn main() {
+    let flag1 = example::Flags1::FLAG_A;
+    let flag2 = example::Flags2::FLAG_B;
+}
diff -Naur vendor-41.0.5/bitflags-1.3.2/tests/compile-fail/visibility/private_flags.stderr.beta vendor-41.0.7/bitflags-1.3.2/tests/compile-fail/visibility/private_flags.stderr.beta
--- vendor-41.0.5/bitflags-1.3.2/tests/compile-fail/visibility/private_flags.stderr.beta	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags-1.3.2/tests/compile-fail/visibility/private_flags.stderr.beta	1969-12-31 19:00:00.000000000 -0500
@@ -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)
diff -Naur vendor-41.0.5/bitflags-1.3.2/tests/compile-fail/visibility/pub_const.rs vendor-41.0.7/bitflags-1.3.2/tests/compile-fail/visibility/pub_const.rs
--- vendor-41.0.5/bitflags-1.3.2/tests/compile-fail/visibility/pub_const.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags-1.3.2/tests/compile-fail/visibility/pub_const.rs	1969-12-31 19:00:00.000000000 -0500
@@ -0,0 +1,9 @@
+use bitflags::bitflags;
+
+bitflags! {
+    pub struct Flags1: u32 {
+        pub const FLAG_A = 0b00000001;
+    }
+}
+
+fn main() {}
diff -Naur vendor-41.0.5/bitflags-1.3.2/tests/compile-fail/visibility/pub_const.stderr.beta vendor-41.0.7/bitflags-1.3.2/tests/compile-fail/visibility/pub_const.stderr.beta
--- vendor-41.0.5/bitflags-1.3.2/tests/compile-fail/visibility/pub_const.stderr.beta	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags-1.3.2/tests/compile-fail/visibility/pub_const.stderr.beta	1969-12-31 19:00:00.000000000 -0500
@@ -0,0 +1,5 @@
+error: no rules expected the token `pub`
+ --> $DIR/pub_const.rs:5:9
+  |
+5 |         pub const FLAG_A = 0b00000001;
+  |         ^^^ no rules expected this token in macro call
diff -Naur vendor-41.0.5/bitflags-1.3.2/tests/compile-pass/impls/convert.rs vendor-41.0.7/bitflags-1.3.2/tests/compile-pass/impls/convert.rs
--- vendor-41.0.5/bitflags-1.3.2/tests/compile-pass/impls/convert.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags-1.3.2/tests/compile-pass/impls/convert.rs	1969-12-31 19:00:00.000000000 -0500
@@ -0,0 +1,17 @@
+use bitflags::bitflags;
+
+bitflags! {
+    struct Flags: u32 {
+        const A = 0b00000001;
+    }
+}
+
+impl From<u32> for Flags {
+    fn from(v: u32) -> Flags {
+        Flags::from_bits_truncate(v)
+    }
+}
+
+fn main() {
+
+}
diff -Naur vendor-41.0.5/bitflags-1.3.2/tests/compile-pass/impls/default.rs vendor-41.0.7/bitflags-1.3.2/tests/compile-pass/impls/default.rs
--- vendor-41.0.5/bitflags-1.3.2/tests/compile-pass/impls/default.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags-1.3.2/tests/compile-pass/impls/default.rs	1969-12-31 19:00:00.000000000 -0500
@@ -0,0 +1,10 @@
+use bitflags::bitflags;
+
+bitflags! {
+    #[derive(Default)]
+    struct Flags: u32 {
+        const A = 0b00000001;
+    }
+}
+
+fn main() {}
diff -Naur vendor-41.0.5/bitflags-1.3.2/tests/compile-pass/impls/inherent_methods.rs vendor-41.0.7/bitflags-1.3.2/tests/compile-pass/impls/inherent_methods.rs
--- vendor-41.0.5/bitflags-1.3.2/tests/compile-pass/impls/inherent_methods.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags-1.3.2/tests/compile-pass/impls/inherent_methods.rs	1969-12-31 19:00:00.000000000 -0500
@@ -0,0 +1,15 @@
+use bitflags::bitflags;
+
+bitflags! {
+    struct Flags: u32 {
+        const A = 0b00000001;
+    }
+}
+
+impl Flags {
+    pub fn new() -> Flags {
+        Flags::A
+    }
+}
+
+fn main() {}
diff -Naur vendor-41.0.5/bitflags-1.3.2/tests/compile-pass/redefinition/core.rs vendor-41.0.7/bitflags-1.3.2/tests/compile-pass/redefinition/core.rs
--- vendor-41.0.5/bitflags-1.3.2/tests/compile-pass/redefinition/core.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags-1.3.2/tests/compile-pass/redefinition/core.rs	1969-12-31 19:00:00.000000000 -0500
@@ -0,0 +1,14 @@
+use bitflags::bitflags;
+
+// Checks for possible errors caused by overriding names used by `bitflags!` internally.
+
+mod core {}
+mod _core {}
+
+bitflags! {
+    struct Test: u8 {
+        const A = 1;
+    }
+}
+
+fn main() {}
diff -Naur vendor-41.0.5/bitflags-1.3.2/tests/compile-pass/redefinition/stringify.rs vendor-41.0.7/bitflags-1.3.2/tests/compile-pass/redefinition/stringify.rs
--- vendor-41.0.5/bitflags-1.3.2/tests/compile-pass/redefinition/stringify.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags-1.3.2/tests/compile-pass/redefinition/stringify.rs	1969-12-31 19:00:00.000000000 -0500
@@ -0,0 +1,19 @@
+use bitflags::bitflags;
+
+// Checks for possible errors caused by overriding names used by `bitflags!` internally.
+
+#[allow(unused_macros)]
+macro_rules! stringify {
+    ($($t:tt)*) => { "..." };
+}
+
+bitflags! {
+    struct Test: u8 {
+        const A = 1;
+    }
+}
+
+fn main() {
+    // Just make sure we don't call the redefined `stringify` macro
+    assert_eq!(format!("{:?}", Test::A), "A");
+}
diff -Naur vendor-41.0.5/bitflags-1.3.2/tests/compile-pass/repr/c.rs vendor-41.0.7/bitflags-1.3.2/tests/compile-pass/repr/c.rs
--- vendor-41.0.5/bitflags-1.3.2/tests/compile-pass/repr/c.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags-1.3.2/tests/compile-pass/repr/c.rs	1969-12-31 19:00:00.000000000 -0500
@@ -0,0 +1,10 @@
+use bitflags::bitflags;
+
+bitflags! {
+    #[repr(C)]
+    struct Flags: u32 {
+        const A = 0b00000001;
+    }
+}
+
+fn main() {}
diff -Naur vendor-41.0.5/bitflags-1.3.2/tests/compile-pass/repr/transparent.rs vendor-41.0.7/bitflags-1.3.2/tests/compile-pass/repr/transparent.rs
--- vendor-41.0.5/bitflags-1.3.2/tests/compile-pass/repr/transparent.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags-1.3.2/tests/compile-pass/repr/transparent.rs	1969-12-31 19:00:00.000000000 -0500
@@ -0,0 +1,10 @@
+use bitflags::bitflags;
+
+bitflags! {
+    #[repr(transparent)]
+    struct Flags: u32 {
+        const A = 0b00000001;
+    }
+}
+
+fn main() {}
diff -Naur vendor-41.0.5/bitflags-1.3.2/tests/compile-pass/visibility/bits_field.rs vendor-41.0.7/bitflags-1.3.2/tests/compile-pass/visibility/bits_field.rs
--- vendor-41.0.5/bitflags-1.3.2/tests/compile-pass/visibility/bits_field.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags-1.3.2/tests/compile-pass/visibility/bits_field.rs	1969-12-31 19:00:00.000000000 -0500
@@ -0,0 +1,11 @@
+use bitflags::bitflags;
+
+bitflags! {
+    pub struct Flags1: u32 {
+        const FLAG_A = 0b00000001;
+    }
+}
+
+fn main() {
+    assert_eq!(0b00000001, Flags1::FLAG_A.bits);
+}
diff -Naur vendor-41.0.5/bitflags-1.3.2/tests/compile-pass/visibility/pub_in.rs vendor-41.0.7/bitflags-1.3.2/tests/compile-pass/visibility/pub_in.rs
--- vendor-41.0.5/bitflags-1.3.2/tests/compile-pass/visibility/pub_in.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags-1.3.2/tests/compile-pass/visibility/pub_in.rs	1969-12-31 19:00:00.000000000 -0500
@@ -0,0 +1,19 @@
+mod a {
+    mod b {
+        use bitflags::bitflags;
+
+        bitflags! {
+            pub(in crate::a) struct Flags: u32 {
+                const FLAG_A = 0b00000001;
+            }
+        }
+    }
+
+    pub fn flags() -> u32 {
+        b::Flags::FLAG_A.bits()
+    }
+}
+
+fn main() {
+    assert_eq!(0b00000001, a::flags());
+}
diff -Naur vendor-41.0.5/bitflags-1.3.2/tests/compile.rs vendor-41.0.7/bitflags-1.3.2/tests/compile.rs
--- vendor-41.0.5/bitflags-1.3.2/tests/compile.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/bitflags-1.3.2/tests/compile.rs	1969-12-31 19:00:00.000000000 -0500
@@ -0,0 +1,63 @@
+use std::{
+    fs,
+    ffi::OsStr,
+    io,
+    path::Path,
+};
+
+use walkdir::WalkDir;
+
+#[test]
+fn fail() {
+    prepare_stderr_files("tests/compile-fail").unwrap();
+
+    let t = trybuild::TestCases::new();
+    t.compile_fail("tests/compile-fail/**/*.rs");
+}
+
+#[test]
+fn pass() {
+    let t = trybuild::TestCases::new();
+    t.pass("tests/compile-pass/**/*.rs");
+}
+
+// Compiler messages may change between versions
+// We don't want to have to track these too closely for `bitflags`, but
+// having some message to check makes sure user-facing errors are sensical.
+// 
+// The approach we use is to run the test on all compilers, but only check stderr
+// output on beta (which is the next stable release). We do this by default ignoring
+// any `.stderr` files in the `compile-fail` directory, and copying `.stderr.beta` files
+// when we happen to be running on a beta compiler.
+fn prepare_stderr_files(path: impl AsRef<Path>) -> io::Result<()> {
+    for entry in WalkDir::new(path) {
+        let entry = entry?;
+
+        if entry.path().extension().and_then(OsStr::to_str) == Some("beta") {
+            let renamed = entry.path().with_extension("");
+
+            // Unconditionally remove a corresponding `.stderr` file for a `.stderr.beta`
+            // file if it exists. On `beta` compilers, we'll recreate it. On other compilers,
+            // we don't want to end up checking it anyways.
+            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(())
+}
diff -Naur vendor-41.0.5/openssl/build.rs vendor-41.0.7/openssl/build.rs
--- vendor-41.0.5/openssl/build.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/openssl/build.rs	1969-12-31 19:00:00.000000000 -0500
@@ -13,7 +13,6 @@
 
     if env::var("DEP_OPENSSL_BORINGSSL").is_ok() {
         println!("cargo:rustc-cfg=boringssl");
-        return;
     }
 
     if let Ok(v) = env::var("DEP_OPENSSL_LIBRESSL_VERSION_NUMBER") {
@@ -67,6 +66,12 @@
         if version >= 0x3_07_00_00_0 {
             println!("cargo:rustc-cfg=libressl370");
         }
+        if version >= 0x3_08_00_00_0 {
+            println!("cargo:rustc-cfg=libressl380");
+        }
+        if version >= 0x3_08_02_00_0 {
+            println!("cargo:rustc-cfg=libressl382");
+        }
     }
 
     if let Ok(vars) = env::var("DEP_OPENSSL_CONF") {
@@ -102,61 +107,8 @@
         if version >= 0x3_01_00_00_0 {
             println!("cargo:rustc-cfg=ossl310");
         }
-    }
-
-    if let Ok(version) = env::var("DEP_OPENSSL_LIBRESSL_VERSION_NUMBER") {
-        let version = u64::from_str_radix(&version, 16).unwrap();
-
-        if version >= 0x2_05_01_00_0 {
-            println!("cargo:rustc-cfg=libressl251");
-        }
-
-        if version >= 0x2_06_01_00_0 {
-            println!("cargo:rustc-cfg=libressl261");
-        }
-
-        if version >= 0x2_07_00_00_0 {
-            println!("cargo:rustc-cfg=libressl270");
-        }
-
-        if version >= 0x2_07_01_00_0 {
-            println!("cargo:rustc-cfg=libressl271");
-        }
-
-        if version >= 0x2_07_03_00_0 {
-            println!("cargo:rustc-cfg=libressl273");
-        }
-
-        if version >= 0x2_08_00_00_0 {
-            println!("cargo:rustc-cfg=libressl280");
-        }
-
-        if version >= 0x2_09_01_00_0 {
-            println!("cargo:rustc-cfg=libressl291");
-        }
-
-        if version >= 0x3_02_01_00_0 {
-            println!("cargo:rustc-cfg=libressl321");
-        }
-
-        if version >= 0x3_03_02_00_0 {
-            println!("cargo:rustc-cfg=libressl332");
-        }
-
-        if version >= 0x3_04_00_00_0 {
-            println!("cargo:rustc-cfg=libressl340");
-        }
-
-        if version >= 0x3_05_00_00_0 {
-            println!("cargo:rustc-cfg=libressl350");
-        }
-
-        if version >= 0x3_06_00_00_0 {
-            println!("cargo:rustc-cfg=libressl360");
-        }
-
-        if version >= 0x3_06_01_00_0 {
-            println!("cargo:rustc-cfg=libressl361");
+        if version >= 0x3_02_00_00_0 {
+            println!("cargo:rustc-cfg=ossl320");
         }
     }
 }
diff -Naur vendor-41.0.5/openssl/.cargo-checksum.json vendor-41.0.7/openssl/.cargo-checksum.json
--- vendor-41.0.5/openssl/.cargo-checksum.json	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/openssl/.cargo-checksum.json	1969-12-31 19:00:00.000000000 -0500
@@ -1 +1 @@
-{"files":{"CHANGELOG.md":"3ebdda02ba111dec484a46d11e50e81b823826bd0e8556d924299dc9f3822511","Cargo.lock":"1e64216ac33270969f53fa42c0335be766098a1dbed60eb9ba3fab971b9511e8","Cargo.toml":"fb08edc21511ae94921735732a458ece7e3c17183e649a8659745df351c9242b","LICENSE":"f3d4287b4a21c5176fea2f9bd4ae800696004e2fb8e05cbc818be513f188a941","README.md":"c5ddde25c2756a1115daaa671fb4297cdc83bf23009c8356ba65b5311d0dd30d","build.rs":"3433091bbfd54f4d66d5891b724e1c859d51e417665e31c285138fc92b28eaa4","examples/mk_certs.rs":"012569fc734c314c5d3c1c9dc8ae64a32db4cfa917e8fbc363c1eef118600d0a","src/aes.rs":"a428f06147e4b48219a789da0af12371d967d2eefcc55536df4d1547001dda8b","src/asn1.rs":"05d7a5fb1cc6c6bdf60af70db52e68ee458226998f1472806c41a4640b9d356e","src/base64.rs":"8be8ad4fe10055cdd55d0147d569e7669d3ac82927569bb917a76e447dfe90d1","src/bio.rs":"c19b865b79bb7ea3460083046f50757800f6c93fe9ec9f3dbb438980fe127aa4","src/bn.rs":"6d84c338369f3968ab6c751bc109dff8855049c07a05663af4f4dc5ddd233411","src/cipher.rs":"961cc845898243b9b4c77c2cac46b4904b25cf30ddc8691512f3334b7ec9e051","src/cipher_ctx.rs":"36e0b6f8cb1002aa0d99b4c290663f93cc6d378c6df990696b7b26949960867e","src/cms.rs":"9698b4cdd6b38a007c912783dad6c549c0a3618660719397feecebdf13c55a97","src/conf.rs":"c374003c606c331fedbe9075abfaf41eba38bfbbbefe9c9f2d2a1d445e4b1606","src/derive.rs":"4745c4ded509c1810d146fa4c641b015ee179d54123e845cf0559e7b84327d0a","src/dh.rs":"d1fd1f6bb0df4dd1d2248d6dbd3d25e0082e6b43cc15b1a17b9f1543fd7e5bac","src/dsa.rs":"148994de784a15e81c4df84069b07450bf223f98059a7bafae4cfc9b4463925c","src/ec.rs":"7fa2000ed5d7dd3d6abfc5955493da07d1ab66fa75412446367cd9ae49745716","src/ecdsa.rs":"c9ac3e7dae0721aff35344ffcb26412689f6eb663969160825c1c82f8db539a6","src/encrypt.rs":"bc1c824527e5fcb2044d3962b75c3807373f78474a29c0b75af8f8a9be273bf8","src/envelope.rs":"773551074ece307aff215686e6a43471edf0ef6f74c520e4611e70f96e928652","src/error.rs":"ede27beebf1594a9165f16aa8732816f28501a8454d3125b6eb5ce98756e0255","src/ex_data.rs":"0a58a3a274a4ef2251dadb64cbcd44b43710d252201b137ecfb91cf14373c04f","src/fips.rs":"761cd7cdfbc16af88fbfefd38e54cb77b4ba8e2f49221607e145bc541f089d7e","src/hash.rs":"671d5f2a5339a985b46b9b81fa6f5dc9ded9dd593d44d9f6d447f58514ab6596","src/lib.rs":"7a39605a9048db31b4064c385c59a997909c428282b465157731d403a18c31e0","src/lib_ctx.rs":"ec6431adad53f3a9621b011506678104bd4f62bdea38ef9d1b731334507ab068","src/macros.rs":"648054f2ee89a22314b942a882878d47121b97b47d9b1146e323b8c6c255a52c","src/md.rs":"32b197d29cb1c5faa9ea72fe148d1f6cdc8178f5bcd062a3338b6dd77174529f","src/md_ctx.rs":"74b1bb4cd8f4abd3b9272c2d685e9bbd4c21b082c200f54875d0a94630feafc6","src/memcmp.rs":"f48e0e29f372db2d0eb2239290abec8819300eb3e01e3bb1030783d6f6a8b2c9","src/nid.rs":"dfadf52d27906cf514ab6e71548380ead1bc07f066478f016f8b6e3bdc3d6947","src/ocsp.rs":"0b15fd57b73478f02813deb27a19f1e9004c5e5811ff71cf894ec2f924b17783","src/pkcs12.rs":"e5de1453b93e08b07fc10d90f85ee5dc29e435a1377b3db015aca8ed74495cfd","src/pkcs5.rs":"1f034690148a75749fa33d81c17750c7731caa02bd1832dc2b1aade8c61817c4","src/pkcs7.rs":"a2b344ceb37d608ea90d177597aaacac20e85680cf57c5cde4d7b6232a1fc1e4","src/pkey.rs":"ecb87814da2ab3adb8fb8511fcdea0eed9f6f5e0d508f0feed823fa98573a539","src/pkey_ctx.rs":"7465c06f63136c37c14bd5661196b1acec5b035f32b452a77a847ec84487fa5f","src/provider.rs":"c77886efcc4f962ebc4d8b693a69375aa58186cf1990c692a572723d3e46779b","src/rand.rs":"5025bc51effe6a2bad23787aaa457ae030065f6ec757aaba148a74b775a5a853","src/rsa.rs":"9f520c6af7addb585890ef0f5c834d95ca7b8214aac51ec8038e58d8363f4316","src/sha.rs":"c34f2f9df5fb52b578022568e195e011d0967f9f5ff57b559d7d2a235951a5b9","src/sign.rs":"37ca2942a9b1ed1cde5a5865e9e2c48f0605f822e7c3d77db47c88d4f7f97c0d","src/srtp.rs":"3defe1815cfc790e2407ff935f8ca7b0e8d504242886e8841715279e0d85f721","src/ssl/bio.rs":"f6c20da805b711d69f527e9df8897061f9d6f3ef22d2d0a8f9fd87f96dc3947e","src/ssl/callbacks.rs":"cab679d74b2364e0ab18dc8ccc49d5b1a21c0c69153646dc0f7529d03a17ade5","src/ssl/connector.rs":"32afe0925584b349b3595aaabd0dadbf6ab383b5879c49c68ad2d0fddf0b0e4a","src/ssl/error.rs":"f39ac3e1037a35ae5cccbf5cf5976044614a6368c9ffe3f1b96bead63c0c4231","src/ssl/mod.rs":"897e889ca8d81a13dc1c031d9a4deeff5f33ce5da1feeb48b4a95c71b1c9ec68","src/ssl/test/mod.rs":"13895c4b9782879405b770847e4a6b423ca127f906261642c99b0e39a54aa61c","src/ssl/test/server.rs":"4276ba970a0fac5c9cae21d7df7af36389c377472f3546ce597678ffc6ad5b38","src/stack.rs":"29aa6e467153b951cbf56ab62ac806941b4eb0e1dd22f22d4b1ab562cc037d55","src/string.rs":"8276d719b35cd74ee0efbecce9e58e754d50d8cc96111f2febd3c0d8849847a8","src/symm.rs":"bb3c065c49fdfc5d00e85aca1ba59c103c0d12ca8db546a7e52abb5e7a314f76","src/util.rs":"e6794bf0643d0c29e96325653f2bb4a00221de55bb5b3c6c96d5dbae3debe238","src/version.rs":"e3acbb0db2095ab616870055c7c7a902fb7b1439520574fd20b7c1164b1178b7","src/x509/extension.rs":"26a265248eb0e54c3b106708f8fce7d5fb5b91b7195f17a97e1b8b1d3b6fa119","src/x509/mod.rs":"381444c1ce36f693482b2bebe0c70ebcd8afceb6a7013e14ae34928382909029","src/x509/store.rs":"410b6dd6774360be20184af6395e9370728b26ccbefcad3e4b6225cba6b6f105","src/x509/tests.rs":"5c86a636076065884b02d20c8b83352078b0d85513d1eab5080809756ffc6e13","src/x509/verify.rs":"a93266a0a5882054a443402b855fceb7d22956a68824c987b9fcd3c786d6ad08","test/aia_test_cert.pem":"9eaf52b5d0023f3be7911938d937ed16fc75d43d14dbe41557a800b0a82f4b1b","test/alt_name_cert.pem":"f3cc0a1d21657164918dffab0dac8f1c499fc1cf5717805420a0134b3aee128c","test/authority_key_identifier.pem":"4644b83bbcd36a6e1917d1f7bd3b8ff913bf86cc74917c07dd78b6731b4d5bec","test/ca.crt":"70bcf52acc79191409801e72371db3a0cd8a27c0fc24eacb3fb8f8ab3e558f67","test/cert.pem":"53c8b338be254490c71a6b13da90dc5a59ba596587c548be5673657e04824afb","test/certs.pem":"106d5d22c86e26c3db619b9525567f22333d22de82e4d2850ed379150c638008","test/certv3.pem":"c230b76b6efb973816d0e3096ae95cdcf4941ec928c01c31b6537d01743fcd8a","test/certv3_extfile":"610fdc10edac2da398a582895e53d288d3e47a9d4f3868c2c7f7662c212b60bd","test/cms.p12":"d33fc5edd6b9caa672e7570b869135235bb2583580a273f6e88c6a6c68fd5a8a","test/cms_pubkey.der":"03682a732e1fd861f5fa687915a8e6f5c935d10273b0f6f73f3db52a8d71fc6d","test/crl-ca.crt":"911360ccdf700fd7d6091bd78c4138da0e9f027ca211f7ed80b394e570eb897c","test/csr.pem":"24423008144c43cf33f56ebcc245931b2d61bcd4eee17b476d7adb6f7416e24d","test/dhparams.pem":"14d9461949d9ae8ca50a393b008ee2168254f14342b0e17b56c0a62d2905b963","test/dsa.pem":"826d513234205fd3dee0bbbf844f0b6fea501145bdf05ea3b14e14df98cbe090","test/dsa.pem.pub":"721677bebf9ab28b8650f98a0cd27658de0c1acd867a4b6e985fe1df95a8bd37","test/dsaparam.pem":"94a1284bdd7d7566151cfde0c7f245e84f7b99ba840f202e3f27ea0160f82988","test/entry_extensions.crl":"fc41a73344f72c40a6c1733adc745f1e21c93821a497ba093680f8d9725b9e93","test/identity.p12":"aceeb3e5516471bd5af9a44bbeffc9559c4f228f67c677d29f36a4b368e2779f","test/intermediate-ca.key":"a5f3d331af87c1305843e235841e494a0669a95d3824a6c766d09371f62c3bab","test/intermediate-ca.pem":"5ff8055325d0cbb60586f4e20bd2df7718e4d94f5261f2ee05ba52a8fb9223f0","test/key.der":"e8842cd6674b5c77a83e0283cd876a91de404561dfc86d79ce525f6e55b28197","test/key.der.pub":"e559d56bb6ec57ad743dbf972bbcaf263a9fa7d320433baa71b04f849d987060","test/key.pem":"12d9105a92bf39b615ccb4820c5c1e38c61905483cd30be13f9ab99b98af64ed","test/key.pem.pub":"f5d030df843ddbaba5bf316ae18f1434de5a63a955be66442429dd4f16f161ef","test/keystore-empty-chain.p12":"bbea280f6fe10556d7470df7072ef0e4ee3997e2c0b3666197f423430c0e6b61","test/leaf.pem":"4f2c3fd02f73b3f49a1e05cf0622669ed014ba019876d89d3f21c788457c1e01","test/nid_test_cert.pem":"7047e8d317e284c6b698eee4a0f1a629d50cd4615ad7da85fe90a2ffb6c21611","test/nid_uid_test_cert.pem":"a735211f3b40edbde7084337138fb0aea06aea6c78369c52015253e4b7a17d83","test/pkcs1.pem.pub":"4d446864b63c4178ec2c7dc8df9b7121d9271851c1f4701231fccb8b07c94918","test/pkcs8-nocrypt.der":"5590d03cc0d037c6c27d78fafc937f48defb226e9a52cde84d54df68086d0575","test/pkcs8.der":"8719fc002d59313fb97e46e068ae40db4d9acc0e2debd308ac9eb46329bea487","test/root-ca.key":"b37cf88614980c38e43c4329cdf7162bae48cc8af1fafd54db2fe0d17e458e1d","test/root-ca.pem":"59b9200c35e818bf21be4aaa97ba87bb6a18fd780527a9f9c51cc74212c631a0","test/rsa-encrypted.pem":"ea41b0f1816056672de6abbab43d0e8089da047c329ceed14aace5a5bde713f1","test/rsa.pem":"f866a5506ea9a37ed2f73f62f503e1aff32f7e4145be62b023535f4da1c24416","test/rsa.pem.pub":"2c5eeea39708e90396f9f09d920f2af8b7e9f84ace963c1319072224dd3d302b","test/subca.crt":"70bcf52acc79191409801e72371db3a0cd8a27c0fc24eacb3fb8f8ab3e558f67","test/test.crl":"ac8443257214f9e82543871c3df48694ea39f2b16bd6c4ef5998a161edbb8fba"},"package":"69b3f656a17a6cbc115b5c7a40c616947d213ba182135b014d6051b73ab6f019"}
\ No newline at end of file
+{"files":{"CHANGELOG.md":"7d4bb60f0ed6f1e00aebd48b9cd88021db0db1713854eea6741546358aa340e7","Cargo.lock":"e9fe187a635e38c7d6aabc8ce3156179690bcb7acd664c9e2f38bbd63ac33a28","Cargo.toml":"000ac614fc4e3973684b3e964915c9c0c8b8f519b0b79477bb78b389c33440e4","LICENSE":"f3d4287b4a21c5176fea2f9bd4ae800696004e2fb8e05cbc818be513f188a941","README.md":"c5ddde25c2756a1115daaa671fb4297cdc83bf23009c8356ba65b5311d0dd30d","build.rs":"3dfd1bd2d4c66e1c833b33ca64abac0a216f3db43ad695f57c0c19aecde757f3","examples/mk_certs.rs":"012569fc734c314c5d3c1c9dc8ae64a32db4cfa917e8fbc363c1eef118600d0a","src/aes.rs":"a428f06147e4b48219a789da0af12371d967d2eefcc55536df4d1547001dda8b","src/asn1.rs":"ebdb0ba959b1756133c69432d86045b60f3e7b6a8581299d3f5e14f7c99ff439","src/base64.rs":"8be8ad4fe10055cdd55d0147d569e7669d3ac82927569bb917a76e447dfe90d1","src/bio.rs":"c19b865b79bb7ea3460083046f50757800f6c93fe9ec9f3dbb438980fe127aa4","src/bn.rs":"966356af877c59fbbf3d43d03ac643f6021933cbccab330b143e00fea7bfea5e","src/cipher.rs":"c1cba8c0d7ec2f6b08254900fb0ba64b243ff692cba663b9f14fb9446dd722fe","src/cipher_ctx.rs":"01ffd0005693695c41e5dd1d86b448bca4808e43d5778c5b9f707c1e867a75bb","src/cms.rs":"19e14cdf5ccdf9199df34a7d8f26374d4ce9277248f79b45cbd850a15ca104f6","src/conf.rs":"c374003c606c331fedbe9075abfaf41eba38bfbbbefe9c9f2d2a1d445e4b1606","src/derive.rs":"963694c3cf7b0b70802b5b2b3f93f857ed7b320d5db331b57c2ff11bcb0891ad","src/dh.rs":"61d7a4984db877d8360db8848e04d70758dc964a987fd1ce514696ba751f56fd","src/dsa.rs":"10b6aca140fe332cb35c78cb3b0e9f1aa7cf18971059ac93a9a458481de26f85","src/ec.rs":"43142ab898dd4dc25efd7cd5c081be4f1a65c39d48e715fa3a208c7a2c5cb534","src/ecdsa.rs":"b5bbfd49fafc9f08bd309a0046eca20016990cd266d442973498c6f2951aed37","src/encrypt.rs":"d1c6de4f5998f06d33de66005a1926eab895f0ecff01396b46dc697dc1593b26","src/envelope.rs":"773551074ece307aff215686e6a43471edf0ef6f74c520e4611e70f96e928652","src/error.rs":"ede27beebf1594a9165f16aa8732816f28501a8454d3125b6eb5ce98756e0255","src/ex_data.rs":"0a58a3a274a4ef2251dadb64cbcd44b43710d252201b137ecfb91cf14373c04f","src/fips.rs":"761cd7cdfbc16af88fbfefd38e54cb77b4ba8e2f49221607e145bc541f089d7e","src/hash.rs":"ee695fa92f63807c8689e8375e2616fd8798bbe655e7162f2fa1349d0b3ad8aa","src/lib.rs":"e9a6b41ea361b1e44d0bd79189371514deb63c056a0b41e81ed7f78332bbf985","src/lib_ctx.rs":"ec6431adad53f3a9621b011506678104bd4f62bdea38ef9d1b731334507ab068","src/macros.rs":"648054f2ee89a22314b942a882878d47121b97b47d9b1146e323b8c6c255a52c","src/md.rs":"038fb8c568634590d5beeb81e47d8bffa201b3ec0297b7b83a06af7abc3bf780","src/md_ctx.rs":"a00fbe465477fd1209fffd7b83eebb1e86af2bfd3acf2c1ca691f19da1a5b35f","src/memcmp.rs":"f48e0e29f372db2d0eb2239290abec8819300eb3e01e3bb1030783d6f6a8b2c9","src/nid.rs":"bd255663fc0a91050b51aca002ea585a110b950216c3e8da82e65d7eda229c63","src/ocsp.rs":"bfb378fa87945eee583521e350f427406888bbb8a804a90aeb06bdbf1b656ddf","src/pkcs12.rs":"e5de1453b93e08b07fc10d90f85ee5dc29e435a1377b3db015aca8ed74495cfd","src/pkcs5.rs":"b73bdd59ec857830a4fcc1e2e9b954e69f18df5302c5cc3366f11a877b0e655f","src/pkcs7.rs":"16e2312f8f5b83433ca29b48ee4b4ce7756fc5bfd5af681f95348281c974cf2f","src/pkey.rs":"48318aed4820d917956d89c9984ba0dd95cf024a06a50564c9e5e9b5f16653bf","src/pkey_ctx.rs":"70382b9d16112ec347c9114dc479ca703e7091fb224f3a6daf2ab59bb3f7d1d5","src/provider.rs":"c77886efcc4f962ebc4d8b693a69375aa58186cf1990c692a572723d3e46779b","src/rand.rs":"5025bc51effe6a2bad23787aaa457ae030065f6ec757aaba148a74b775a5a853","src/rsa.rs":"48e1d8c0100f87a69123daae20350c61e4ad6a256a535612c297bcb855aeada0","src/sha.rs":"c34f2f9df5fb52b578022568e195e011d0967f9f5ff57b559d7d2a235951a5b9","src/sign.rs":"9af5544b9c5d81c494ba055c247c8d152e5853a26efa60ff7c1788b569225fd9","src/srtp.rs":"3defe1815cfc790e2407ff935f8ca7b0e8d504242886e8841715279e0d85f721","src/ssl/bio.rs":"f6c20da805b711d69f527e9df8897061f9d6f3ef22d2d0a8f9fd87f96dc3947e","src/ssl/callbacks.rs":"07bacf44efc4977a7ad327bb026786585c78ebd991a0983c15669429f8d5d99b","src/ssl/connector.rs":"32afe0925584b349b3595aaabd0dadbf6ab383b5879c49c68ad2d0fddf0b0e4a","src/ssl/error.rs":"f39ac3e1037a35ae5cccbf5cf5976044614a6368c9ffe3f1b96bead63c0c4231","src/ssl/mod.rs":"2c5928c98ec958fb195a4a544ed44ffae550f8b6896455dbcb15a0e0e1aee255","src/ssl/test/mod.rs":"5054039dc032a9862f54dc140eaaaa38990053dc89ba914451783dddb8057540","src/ssl/test/server.rs":"4276ba970a0fac5c9cae21d7df7af36389c377472f3546ce597678ffc6ad5b38","src/stack.rs":"29aa6e467153b951cbf56ab62ac806941b4eb0e1dd22f22d4b1ab562cc037d55","src/string.rs":"8276d719b35cd74ee0efbecce9e58e754d50d8cc96111f2febd3c0d8849847a8","src/symm.rs":"3da30db9c0c67dff2e68a36b1497f542f08ee20f6fe1ca6bc0986bd7c88575ba","src/util.rs":"e6794bf0643d0c29e96325653f2bb4a00221de55bb5b3c6c96d5dbae3debe238","src/version.rs":"e3acbb0db2095ab616870055c7c7a902fb7b1439520574fd20b7c1164b1178b7","src/x509/extension.rs":"26a265248eb0e54c3b106708f8fce7d5fb5b91b7195f17a97e1b8b1d3b6fa119","src/x509/mod.rs":"fafd666515c0f2f11c9f84339ddb144cb46434cdb59eea78fbbb46b68a002d40","src/x509/store.rs":"964636ad1bf95cbc3964702e1b6636b83ef9a270a7380ee6ef790b6511acaa74","src/x509/tests.rs":"a64605f77fed97471fd3cb467a9b30ee249c7e2d1cfcf07be7ea25ec4c88e008","src/x509/verify.rs":"d7ec7421d0b9fe33755a031154487348beecccc87ef5fd8221dacce79278f48b","test/aia_test_cert.pem":"9eaf52b5d0023f3be7911938d937ed16fc75d43d14dbe41557a800b0a82f4b1b","test/alt_name_cert.pem":"f3cc0a1d21657164918dffab0dac8f1c499fc1cf5717805420a0134b3aee128c","test/authority_key_identifier.pem":"4644b83bbcd36a6e1917d1f7bd3b8ff913bf86cc74917c07dd78b6731b4d5bec","test/ca.crt":"70bcf52acc79191409801e72371db3a0cd8a27c0fc24eacb3fb8f8ab3e558f67","test/cert.pem":"53c8b338be254490c71a6b13da90dc5a59ba596587c548be5673657e04824afb","test/certs.pem":"106d5d22c86e26c3db619b9525567f22333d22de82e4d2850ed379150c638008","test/certv3.pem":"c230b76b6efb973816d0e3096ae95cdcf4941ec928c01c31b6537d01743fcd8a","test/certv3_extfile":"610fdc10edac2da398a582895e53d288d3e47a9d4f3868c2c7f7662c212b60bd","test/cms.p12":"d33fc5edd6b9caa672e7570b869135235bb2583580a273f6e88c6a6c68fd5a8a","test/cms_pubkey.der":"03682a732e1fd861f5fa687915a8e6f5c935d10273b0f6f73f3db52a8d71fc6d","test/crl-ca.crt":"911360ccdf700fd7d6091bd78c4138da0e9f027ca211f7ed80b394e570eb897c","test/csr.pem":"24423008144c43cf33f56ebcc245931b2d61bcd4eee17b476d7adb6f7416e24d","test/dhparams.pem":"14d9461949d9ae8ca50a393b008ee2168254f14342b0e17b56c0a62d2905b963","test/dsa.pem":"826d513234205fd3dee0bbbf844f0b6fea501145bdf05ea3b14e14df98cbe090","test/dsa.pem.pub":"721677bebf9ab28b8650f98a0cd27658de0c1acd867a4b6e985fe1df95a8bd37","test/dsaparam.pem":"94a1284bdd7d7566151cfde0c7f245e84f7b99ba840f202e3f27ea0160f82988","test/entry_extensions.crl":"bee73d33a326bde92d3c38f275b3f94943e46cf778d7043e1176e84413dc22e9","test/identity.p12":"aceeb3e5516471bd5af9a44bbeffc9559c4f228f67c677d29f36a4b368e2779f","test/intermediate-ca.key":"a5f3d331af87c1305843e235841e494a0669a95d3824a6c766d09371f62c3bab","test/intermediate-ca.pem":"5ff8055325d0cbb60586f4e20bd2df7718e4d94f5261f2ee05ba52a8fb9223f0","test/key.der":"e8842cd6674b5c77a83e0283cd876a91de404561dfc86d79ce525f6e55b28197","test/key.der.pub":"e559d56bb6ec57ad743dbf972bbcaf263a9fa7d320433baa71b04f849d987060","test/key.pem":"12d9105a92bf39b615ccb4820c5c1e38c61905483cd30be13f9ab99b98af64ed","test/key.pem.pub":"f5d030df843ddbaba5bf316ae18f1434de5a63a955be66442429dd4f16f161ef","test/keystore-empty-chain.p12":"bbea280f6fe10556d7470df7072ef0e4ee3997e2c0b3666197f423430c0e6b61","test/leaf.pem":"4f2c3fd02f73b3f49a1e05cf0622669ed014ba019876d89d3f21c788457c1e01","test/nid_test_cert.pem":"7047e8d317e284c6b698eee4a0f1a629d50cd4615ad7da85fe90a2ffb6c21611","test/nid_uid_test_cert.pem":"a735211f3b40edbde7084337138fb0aea06aea6c78369c52015253e4b7a17d83","test/pkcs1.pem.pub":"4d446864b63c4178ec2c7dc8df9b7121d9271851c1f4701231fccb8b07c94918","test/pkcs8-nocrypt.der":"5590d03cc0d037c6c27d78fafc937f48defb226e9a52cde84d54df68086d0575","test/pkcs8.der":"8719fc002d59313fb97e46e068ae40db4d9acc0e2debd308ac9eb46329bea487","test/root-ca.key":"b37cf88614980c38e43c4329cdf7162bae48cc8af1fafd54db2fe0d17e458e1d","test/root-ca.pem":"59b9200c35e818bf21be4aaa97ba87bb6a18fd780527a9f9c51cc74212c631a0","test/rsa-encrypted.pem":"ea41b0f1816056672de6abbab43d0e8089da047c329ceed14aace5a5bde713f1","test/rsa.pem":"f866a5506ea9a37ed2f73f62f503e1aff32f7e4145be62b023535f4da1c24416","test/rsa.pem.pub":"2c5eeea39708e90396f9f09d920f2af8b7e9f84ace963c1319072224dd3d302b","test/subca.crt":"70bcf52acc79191409801e72371db3a0cd8a27c0fc24eacb3fb8f8ab3e558f67","test/test.crl":"ac8443257214f9e82543871c3df48694ea39f2b16bd6c4ef5998a161edbb8fba"},"package":"79a4c6c3a2b158f7f8f2a2fc5a969fa3a068df6fc9dbb4a43845436e3af7c800"}
\ No newline at end of file
diff -Naur vendor-41.0.5/openssl/Cargo.lock vendor-41.0.7/openssl/Cargo.lock
--- vendor-41.0.5/openssl/Cargo.lock	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/openssl/Cargo.lock	1969-12-31 19:00:00.000000000 -0500
@@ -8,7 +8,7 @@
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "c4243e6031260db77ede97ad86c27e501d646a27ab57b59a574f725d98ab1fb4"
 dependencies = [
- "bitflags",
+ "bitflags 1.2.1",
  "cexpr",
  "clang-sys",
  "lazy_static",
@@ -20,15 +20,21 @@
  "regex",
  "rustc-hash",
  "shlex",
- "syn 1.0.107",
+ "syn 1.0.109",
  "which",
 ]
 
 [[package]]
 name = "bitflags"
-version = "1.3.2"
+version = "1.2.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
+checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
+
+[[package]]
+name = "bitflags"
+version = "2.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "24a6904aef64d73cf10ab17ebace7befb918b82164785cb89907993be7f83813"
 
 [[package]]
 name = "bssl-sys"
@@ -37,10 +43,16 @@
 checksum = "312d12393c060384f2e6ed14c7b4be37b3dd90249857485613c1a91b9a1abb5c"
 
 [[package]]
+name = "byteorder"
+version = "1.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "652805b7e73fada9d85e9a6682a4abd490cb52d96aeecc12e33a0de34dfd0d23"
+
+[[package]]
 name = "cc"
-version = "1.0.78"
+version = "1.0.79"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a20104e2335ce8a659d6dd92a51a767a0c062599c73b343fd152cb401e828c3d"
+checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f"
 
 [[package]]
 name = "cexpr"
@@ -59,9 +71,9 @@
 
 [[package]]
 name = "clang-sys"
-version = "1.4.0"
+version = "1.0.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fa2e27ae6ab525c3d369ded447057bca5438d86dc3a68f6faafb8269ba82ebf3"
+checksum = "9da1484c6a890e374ca5086062d4847e0a2c1e5eba9afa5d48c09e8eb39b2519"
 dependencies = [
  "glob",
  "libc",
@@ -70,107 +82,110 @@
 
 [[package]]
 name = "either"
-version = "1.8.1"
+version = "1.6.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91"
+checksum = "cd56b59865bce947ac5958779cfa508f6c3b9497cc762b7e24a12d11ccde2c4f"
 
 [[package]]
 name = "foreign-types"
-version = "0.3.2"
+version = "0.3.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1"
+checksum = "a21b40436003b2a1e22483c5ed6c3d25e755b6b3120f601cc22aa57e25dc9065"
 dependencies = [
  "foreign-types-shared",
 ]
 
 [[package]]
 name = "foreign-types-shared"
-version = "0.1.1"
+version = "0.1.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b"
+checksum = "baa1839fc3c5487b5e129ea4f774e3fd84e6c4607127315521bc014a722ebc9e"
 
 [[package]]
 name = "glob"
-version = "0.3.1"
+version = "0.3.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"
+checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"
 
 [[package]]
 name = "hex"
-version = "0.3.2"
+version = "0.3.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "805026a5d0141ffc30abb3be3173848ad46a1b1664fe632428479619a3644d77"
+checksum = "b66c2649564633dd569707d91459ac1d2deefd9fa2a1def6fffc55b4bfee0b1f"
 
 [[package]]
 name = "lazy_static"
-version = "1.4.0"
+version = "1.0.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
+checksum = "c8f31047daa365f19be14b47c29df4f7c3b581832407daabe6ae77397619237d"
 
 [[package]]
 name = "lazycell"
-version = "1.3.0"
+version = "1.0.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
+checksum = "d33a48d0365c96081958cc663eef834975cb1e8d8bea3378513fc72bdbf11e50"
 
 [[package]]
 name = "libc"
-version = "0.2.139"
+version = "0.2.65"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79"
+checksum = "1a31a0627fdf1f6a39ec0dd577e101440b7db22672c0901fe00a9a6fbb5c24e8"
 
 [[package]]
 name = "libloading"
-version = "0.7.4"
+version = "0.6.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f"
+checksum = "2c979a19ffb457f0273965c333053f3d586bf759bf7b683fbebc37f9a9ebedc4"
 dependencies = [
- "cfg-if",
  "winapi",
 ]
 
 [[package]]
 name = "log"
-version = "0.4.17"
+version = "0.4.14"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e"
+checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710"
 dependencies = [
  "cfg-if",
 ]
 
 [[package]]
 name = "memchr"
-version = "2.5.0"
+version = "2.0.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
+checksum = "e01e64d9017d18e7fc09d8e4fe0e28ff6931019e979fb8019319db7ca827f8a6"
+dependencies = [
+ "libc",
+]
 
 [[package]]
 name = "minimal-lexical"
-version = "0.2.1"
+version = "0.1.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
+checksum = "6595bb28ed34f43c3fe088e48f6cfb2e033cab45f25a5384d5fdf564fbc8c4b2"
 
 [[package]]
 name = "nom"
-version = "7.1.3"
+version = "7.0.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"
+checksum = "7ffd9d26838a953b4af82cbeb9f1592c6798916983959be223a7124e992742c1"
 dependencies = [
  "memchr",
  "minimal-lexical",
+ "version_check",
 ]
 
 [[package]]
 name = "once_cell"
-version = "1.14.0"
+version = "1.5.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2f7254b99e31cad77da24b08ebf628882739a608578bb1bcdfc1f9c21260d7c0"
+checksum = "13bd41f508810a131401606d54ac32a467c97172d74ba7662562ebba5ad07fa0"
 
 [[package]]
 name = "openssl"
-version = "0.10.54"
+version = "0.10.60"
 dependencies = [
- "bitflags",
+ "bitflags 2.2.1",
  "cfg-if",
  "foreign-types",
  "hex",
@@ -188,23 +203,23 @@
 dependencies = [
  "proc-macro2",
  "quote",
- "syn 2.0.11",
+ "syn 2.0.16",
 ]
 
 [[package]]
 name = "openssl-src"
-version = "111.24.0+1.1.1s"
+version = "300.1.2+3.1.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3498f259dab01178c6228c6b00dcef0ed2a2d5e20d648c017861227773ea4abd"
+checksum = "94773a6131a4d91f737a31debb0b3258964a47d923ef539c8be1d496dfb5145d"
 dependencies = [
  "cc",
 ]
 
 [[package]]
 name = "openssl-sys"
-version = "0.9.88"
+version = "0.9.96"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c2ce0f250f34a308dcfdbb351f511359857d4ed2134ba715a4eadd46e1ffd617"
+checksum = "3812c071ba60da8b5677cc12bcb1d42989a65553772897a7e0355545a819838f"
 dependencies = [
  "bindgen",
  "bssl-sys",
@@ -223,15 +238,15 @@
 
 [[package]]
 name = "pkg-config"
-version = "0.3.26"
+version = "0.3.9"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160"
+checksum = "3a8b4c6b8165cd1a1cd4b9b120978131389f64bdaf456435caa41e630edba903"
 
 [[package]]
 name = "proc-macro2"
-version = "1.0.54"
+version = "1.0.55"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e472a104799c74b514a57226160104aa483546de37e839ec50e3c2e41dd87534"
+checksum = "1d0dd4be24fcdcfeaa12a432d588dc59bbad6cad3510c67e74a2b6b2fc950564"
 dependencies = [
  "unicode-ident",
 ]
@@ -247,36 +262,39 @@
 
 [[package]]
 name = "regex"
-version = "1.7.1"
+version = "1.5.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "48aaa5748ba571fb95cd2c85c09f629215d3a6ece942baa100950af03a34f733"
+checksum = "a250501c60d8ee37c3c8cd93d95344a4653ce4999136cc9b3eb4c98770a4aea3"
 dependencies = [
  "regex-syntax",
 ]
 
 [[package]]
 name = "regex-syntax"
-version = "0.6.28"
+version = "0.6.24"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848"
+checksum = "00efb87459ba4f6fb2169d20f68565555688e1250ee6825cdf6254f8b48fafb2"
 
 [[package]]
 name = "rustc-hash"
-version = "1.1.0"
+version = "1.0.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
+checksum = "7540fc8b0c49f096ee9c961cda096467dce8084bec6bdca2fc83895fd9b28cb8"
+dependencies = [
+ "byteorder",
+]
 
 [[package]]
 name = "shlex"
-version = "1.1.0"
+version = "1.0.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3"
+checksum = "42a568c8f2cd051a4d283bd6eb0343ac214c1b0f1ac19f93e1175b2dee38c73d"
 
 [[package]]
 name = "syn"
-version = "1.0.107"
+version = "1.0.109"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5"
+checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
 dependencies = [
  "proc-macro2",
  "quote",
@@ -285,9 +303,9 @@
 
 [[package]]
 name = "syn"
-version = "2.0.11"
+version = "2.0.16"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "21e3787bb71465627110e7d87ed4faaa36c1f61042ee67badb9e2ef173accc40"
+checksum = "a6f671d4b5ffdb8eadec19c0ae67fe2639df8684bd7bc4b83d986b8db549cf01"
 dependencies = [
  "proc-macro2",
  "quote",
@@ -296,32 +314,38 @@
 
 [[package]]
 name = "unicode-ident"
-version = "1.0.6"
+version = "1.0.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc"
+checksum = "d22af068fba1eb5edcb4aea19d382b2a3deb4c8f9d475c589b6ada9e0fd493ee"
 
 [[package]]
 name = "vcpkg"
-version = "0.2.15"
+version = "0.2.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3fc439f2794e98976c88a2a2dafce96b930fe8010b0a256b3c2199a773933168"
+
+[[package]]
+name = "version_check"
+version = "0.9.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
+checksum = "45d3d553fd9413fffe7147a20171d640eda0ad4c070acd7d0c885a21bcd2e8b7"
 
 [[package]]
 name = "which"
-version = "4.4.0"
+version = "4.2.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2441c784c52b289a054b7201fc93253e288f094e2f4be9058343127c4226a269"
+checksum = "ea187a8ef279bc014ec368c27a920da2024d2a711109bfbe3440585d5cf27ad9"
 dependencies = [
  "either",
+ "lazy_static",
  "libc",
- "once_cell",
 ]
 
 [[package]]
 name = "winapi"
-version = "0.3.9"
+version = "0.3.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
+checksum = "04e3bd221fcbe8a271359c04f21a76db7d0c6028862d1bb5512d85e1e2eb5bb3"
 dependencies = [
  "winapi-i686-pc-windows-gnu",
  "winapi-x86_64-pc-windows-gnu",
diff -Naur vendor-41.0.5/openssl/Cargo.toml vendor-41.0.7/openssl/Cargo.toml
--- vendor-41.0.5/openssl/Cargo.toml	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/openssl/Cargo.toml	1969-12-31 19:00:00.000000000 -0500
@@ -12,7 +12,7 @@
 [package]
 edition = "2018"
 name = "openssl"
-version = "0.10.54"
+version = "0.10.60"
 authors = ["Steven Fackler <sfackler@gmail.com>"]
 description = "OpenSSL bindings"
 readme = "README.md"
@@ -30,13 +30,13 @@
 repository = "https://github.com/sfackler/rust-openssl"
 
 [dependencies.bitflags]
-version = "1.0"
+version = "2.2.1"
 
 [dependencies.cfg-if]
 version = "1.0"
 
 [dependencies.ffi]
-version = "0.9.88"
+version = "0.9.96"
 package = "openssl-sys"
 
 [dependencies.foreign-types]
diff -Naur vendor-41.0.5/openssl/CHANGELOG.md vendor-41.0.7/openssl/CHANGELOG.md
--- vendor-41.0.5/openssl/CHANGELOG.md	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/openssl/CHANGELOG.md	1969-12-31 19:00:00.000000000 -0500
@@ -2,6 +2,93 @@
 
 ## [Unreleased]
 
+## [v0.10.60] - 2023-11-22
+
+### Deprecated
+
+* Deprecated `X509StoreRef::objects`. It is unsound. All callers should migrate to using `X509StoreRef::all_certificates` instead.
+
+### Fixed
+
+* Fixed a memory leak when calling `SslContextBuilder::set_ex_data` and `SslRef::set_ex_data` multiple times with the same index.
+
+### Added
+
+* Added `X509StoreRef::all_certificates`
+* Added `cipher::Cipher::{camellia128_cbc,camellia192_cbc,camellia256_cbc,cast5_cbc,idea_cbc}`
+* Added `symm::Cipher::{des_ede3_ecb,des_ede3_cfb8,des_ede3_ofb,camellia_128_ecb,camellia_128_ofb,camellia_128_cfb128,camellia_192_ecb,camellia_192_ofb,camellia_192_cfb128,camellia_256_ecb,camellia_256_ofb,camellia_256_cfb128,cast5_ecb,cast5_ofb,cast5_cfb64,idea_ecb,idea_ofb,idea_cfb64}`
+* Added `Crypter::update_unchecked`
+* Added `SslRef::{peer_tmp_key,tmp_key}`
+
+### Changed
+
+* `cipher::Cipher::chacha20` is now available on LibreSSL
+* `symm::Cipher::chacha20` is now available on LibreSSL
+
+## [v0.10.59] - 2023-11-03
+
+### Added
+
+* Added `Nid::CHACHA20_POLY1305`
+
+### Changed
+
+* Fixed the availability of `Id::RSA_PSS` on OpenSSL
+
+## [v0.10.58] - 2023-11-01
+
+### Added
+
+* Added `Id::{RSA_PSS,DHX}` constants
+* Added `SslContextBuilder::set_security_level`
+* Added `SslContextRef::security_level`
+* Added `SslRef::set_security_level`, `SslRef::security_level`
+* Added `Cipher::{camellia_128_cbc, camellia_192_cbc, camellia_256_cbc, cast5_cbc, idea_cbc}`
+* Added `X509CrlRef::extension`
+* Added `X509PurposeId::CODE_SIGN`
+
+### Changed
+
+* `Pkey` HKDF functionality now works on LibreSSL
+* `BigNum::mod_sqrt` is now available on all OpenSSLs
+* `MessageDigest::sha3*` are now available on LibreSSL
+
+## [v0.10.57] - 2023-08-27
+
+### Added
+* Added `X509VerifyParam::set_email`
+* `Cipher::chacha20_poly1305` is now available on LibreSSL
+* Added `CipherCtx::copy`
+
+### Changed
+* Updated `bitflags` dependecy to the 2.x series
+
+## [v0.10.56] - 2023-08-06
+
+## Added
+
+* Added `BigNumRef::mod_sqrt`.
+* Added `PkeyCtxRef::set_signature_md` and `PkeyCtxRef::set_rsa_pss_saltlen`.
+* Added `PkeyCtxRef::verify_recover_init` and `PkeyCtxRef::verify_recover`.
+* Added `BigNumRef::is_even` and `BigNumRef::is_odd`.
+* Added `EcPointRef::to_hex_str` and `EcPoint::from_hex_str`.
+* Added support for AES key wrap and wrap pad.
+
+## [v0.10.55] - 2023-06-20
+
+### Fixed
+
+* Fixed compilation with the latest version of BoringSSL.
+* Fixed compilation when OpenSSL is compiled with `OPENSSL_NO_OCB`.
+* Fixed a segfault in `X509VerifyParamRef::set_host` when called with an empty string.
+
+### Added
+
+* Added `Deriver::set_peer_ex`.
+* Added `EcGroupRef::asn1_flag`.
+* Exposed `EcPointRef::affine_coordinates` on BoringSSL and LibreSSL.
+* Added `Nid::SM2` and `Id::SM2`
+
 ## [v0.10.54] - 2023-05-31
 
 ### Fixed
@@ -761,7 +848,13 @@
 
 Look at the [release tags] for information about older releases.
 
-[Unreleased]: https://github.com/sfackler/rust-openssl/compare/openssl-v0.10.54...master
+[Unreleased]: https://github.com/sfackler/rust-openssl/compare/openssl-v0.10.60...master
+[v0.10.60]: https://github.com/sfackler/rust-openssl/compare/openssl-v0.10.59...openssl-v0.10.60
+[v0.10.59]: https://github.com/sfackler/rust-openssl/compare/openssl-v0.10.58...openssl-v0.10.59
+[v0.10.58]: https://github.com/sfackler/rust-openssl/compare/openssl-v0.10.57...openssl-v0.10.58
+[v0.10.57]: https://github.com/sfackler/rust-openssl/compare/openssl-v0.10.56...openssl-v0.10.57
+[v0.10.56]: https://github.com/sfackler/rust-openssl/compare/openssl-v0.10.55...openssl-v0.10.56
+[v0.10.55]: https://github.com/sfackler/rust-openssl/compare/openssl-v0.10.54...openssl-v0.10.55
 [v0.10.54]: https://github.com/sfackler/rust-openssl/compare/openssl-v0.10.53...openssl-v0.10.54
 [v0.10.53]: https://github.com/sfackler/rust-openssl/compare/openssl-v0.10.52...openssl-v0.10.53
 [v0.10.52]: https://github.com/sfackler/rust-openssl/compare/openssl-v0.10.51...openssl-v0.10.52
diff -Naur vendor-41.0.5/openssl/src/asn1.rs vendor-41.0.7/openssl/src/asn1.rs
--- vendor-41.0.5/openssl/src/asn1.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/openssl/src/asn1.rs	1969-12-31 19:00:00.000000000 -0500
@@ -738,7 +738,7 @@
 }
 
 cfg_if! {
-    if #[cfg(any(ossl110, libressl273))] {
+    if #[cfg(any(ossl110, libressl273, boringssl))] {
         use ffi::ASN1_STRING_get0_data;
     } else {
         #[allow(bad_style)]
diff -Naur vendor-41.0.5/openssl/src/bn.rs vendor-41.0.7/openssl/src/bn.rs
--- vendor-41.0.5/openssl/src/bn.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/openssl/src/bn.rs	1969-12-31 19:00:00.000000000 -0500
@@ -335,6 +335,20 @@
         unsafe { BN_is_negative(self.as_ptr()) == 1 }
     }
 
+    /// Returns `true` is `self` is even.
+    #[corresponds(BN_is_even)]
+    #[cfg(any(ossl110, boringssl, libressl350))]
+    pub fn is_even(&self) -> bool {
+        !self.is_odd()
+    }
+
+    /// Returns `true` is `self` is odd.
+    #[corresponds(BN_is_odd)]
+    #[cfg(any(ossl110, boringssl, libressl350))]
+    pub fn is_odd(&self) -> bool {
+        unsafe { ffi::BN_is_odd(self.as_ptr()) == 1 }
+    }
+
     /// Returns the number of significant bits in `self`.
     #[corresponds(BN_num_bits)]
     #[allow(clippy::unnecessary_cast)]
@@ -639,6 +653,25 @@
         }
     }
 
+    /// Places into `self` the modular square root of `a` such that `self^2 = a (mod p)`
+    #[corresponds(BN_mod_sqrt)]
+    pub fn mod_sqrt(
+        &mut self,
+        a: &BigNumRef,
+        p: &BigNumRef,
+        ctx: &mut BigNumContextRef,
+    ) -> Result<(), ErrorStack> {
+        unsafe {
+            cvt_p(ffi::BN_mod_sqrt(
+                self.as_ptr(),
+                a.as_ptr(),
+                p.as_ptr(),
+                ctx.as_ptr(),
+            ))
+            .map(|_| ())
+        }
+    }
+
     /// Places the result of `a^p` in `self`.
     #[corresponds(BN_exp)]
     pub fn exp(
@@ -1195,7 +1228,7 @@
 
 impl PartialOrd for BigNum {
     fn partial_cmp(&self, oth: &BigNum) -> Option<Ordering> {
-        self.deref().partial_cmp(oth.deref())
+        Some(self.cmp(oth))
     }
 }
 
@@ -1455,4 +1488,36 @@
         b.set_const_time();
         assert!(b.is_const_time())
     }
+
+    #[test]
+    fn test_mod_sqrt() {
+        let mut ctx = BigNumContext::new().unwrap();
+
+        let s = BigNum::from_hex_str("2").unwrap();
+        let p = BigNum::from_hex_str("7DEB1").unwrap();
+        let mut sqrt = BigNum::new().unwrap();
+        let mut out = BigNum::new().unwrap();
+
+        // Square the root because OpenSSL randomly returns one of 2E42C or 4FA85
+        sqrt.mod_sqrt(&s, &p, &mut ctx).unwrap();
+        out.mod_sqr(&sqrt, &p, &mut ctx).unwrap();
+        assert!(out == s);
+
+        let s = BigNum::from_hex_str("3").unwrap();
+        let p = BigNum::from_hex_str("5").unwrap();
+        assert!(out.mod_sqrt(&s, &p, &mut ctx).is_err());
+    }
+
+    #[test]
+    #[cfg(any(ossl110, boringssl, libressl350))]
+    fn test_odd_even() {
+        let a = BigNum::from_u32(17).unwrap();
+        let b = BigNum::from_u32(18).unwrap();
+
+        assert!(a.is_odd());
+        assert!(!b.is_odd());
+
+        assert!(!a.is_even());
+        assert!(b.is_even());
+    }
 }
diff -Naur vendor-41.0.5/openssl/src/cipher_ctx.rs vendor-41.0.7/openssl/src/cipher_ctx.rs
--- vendor-41.0.5/openssl/src/cipher_ctx.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/openssl/src/cipher_ctx.rs	1969-12-31 19:00:00.000000000 -0500
@@ -55,6 +55,8 @@
 #[cfg(not(boringssl))]
 use crate::pkey::{HasPrivate, HasPublic, PKey, PKeyRef};
 use crate::{cvt, cvt_p};
+#[cfg(ossl102)]
+use bitflags::bitflags;
 use cfg_if::cfg_if;
 use foreign_types::{ForeignType, ForeignTypeRef};
 use libc::{c_int, c_uchar};
@@ -80,6 +82,15 @@
     pub struct CipherCtxRef;
 }
 
+#[cfg(ossl102)]
+bitflags! {
+    /// Flags for `EVP_CIPHER_CTX`.
+    pub struct CipherCtxFlags : c_int {
+        /// The flag used to opt into AES key wrap ciphers.
+        const FLAG_WRAP_ALLOW = ffi::EVP_CIPHER_CTX_FLAG_WRAP_ALLOW;
+    }
+}
+
 impl CipherCtx {
     /// Creates a new context.
     #[corresponds(EVP_CIPHER_CTX_new)]
@@ -94,6 +105,14 @@
 }
 
 impl CipherCtxRef {
+    #[corresponds(EVP_CIPHER_CTX_copy)]
+    pub fn copy(&mut self, src: &CipherCtxRef) -> Result<(), ErrorStack> {
+        unsafe {
+            cvt(ffi::EVP_CIPHER_CTX_copy(self.as_ptr(), src.as_ptr()))?;
+            Ok(())
+        }
+    }
+
     /// Initializes the context for encryption.
     ///
     /// Normally this is called once to set all of the cipher, key, and IV. However, this process can be split up
@@ -509,6 +528,17 @@
         Ok(())
     }
 
+    /// Set ctx flags.
+    ///
+    /// This function is currently used to enable AES key wrap feature supported by OpenSSL 1.0.2 or newer.
+    #[corresponds(EVP_CIPHER_CTX_set_flags)]
+    #[cfg(ossl102)]
+    pub fn set_flags(&mut self, flags: CipherCtxFlags) {
+        unsafe {
+            ffi::EVP_CIPHER_CTX_set_flags(self.as_ptr(), flags.bits());
+        }
+    }
+
     /// Writes data into the context.
     ///
     /// Providing no output buffer will cause the input to be considered additional authenticated data (AAD).
@@ -518,7 +548,7 @@
     /// # Panics
     ///
     /// Panics if `output` doesn't contain enough space for data to be
-    /// written as specified by [`Self::minimal_output_size`].
+    /// written.
     #[corresponds(EVP_CipherUpdate)]
     pub fn cipher_update(
         &mut self,
@@ -551,7 +581,9 @@
     /// output size check removed. It can be used when the exact
     /// buffer size control is maintained by the caller.
     ///
-    /// SAFETY: The caller is expected to provide `output` buffer
+    /// # Safety
+    ///
+    /// The caller is expected to provide `output` buffer
     /// large enough to contain correct number of bytes. For streaming
     /// ciphers the output buffer size should be at least as big as
     /// the input buffer. For block ciphers the size of the output
@@ -663,7 +695,9 @@
     /// This function is the same as [`Self::cipher_final`] but with
     /// the output buffer size check removed.
     ///
-    /// SAFETY: The caller is expected to provide `output` buffer
+    /// # Safety
+    ///
+    /// The caller is expected to provide `output` buffer
     /// large enough to contain correct number of bytes. For streaming
     /// ciphers the output buffer can be empty, for block ciphers the
     /// output buffer should be at least as big as the block.
@@ -915,4 +949,162 @@
         ctx.cipher_update(&vec![0; block_size + 1], Some(&mut vec![0; block_size - 1]))
             .unwrap();
     }
+
+    #[cfg(ossl102)]
+    fn cipher_wrap_test(cipher: &CipherRef, pt: &str, ct: &str, key: &str, iv: Option<&str>) {
+        let pt = hex::decode(pt).unwrap();
+        let key = hex::decode(key).unwrap();
+        let expected = hex::decode(ct).unwrap();
+        let iv = iv.map(|v| hex::decode(v).unwrap());
+        let padding = 8 - pt.len() % 8;
+        let mut computed = vec![0; pt.len() + padding + cipher.block_size() * 2];
+        let mut ctx = CipherCtx::new().unwrap();
+
+        ctx.set_flags(CipherCtxFlags::FLAG_WRAP_ALLOW);
+        ctx.encrypt_init(Some(cipher), Some(&key), iv.as_deref())
+            .unwrap();
+
+        let count = ctx.cipher_update(&pt, Some(&mut computed)).unwrap();
+        let rest = ctx.cipher_final(&mut computed[count..]).unwrap();
+        computed.truncate(count + rest);
+
+        if computed != expected {
+            println!("Computed: {}", hex::encode(&computed));
+            println!("Expected: {}", hex::encode(&expected));
+            if computed.len() != expected.len() {
+                println!(
+                    "Lengths differ: {} in computed vs {} expected",
+                    computed.len(),
+                    expected.len()
+                );
+            }
+            panic!("test failure");
+        }
+    }
+
+    #[test]
+    #[cfg(ossl102)]
+    fn test_aes128_wrap() {
+        let pt = "00112233445566778899aabbccddeeff";
+        let ct = "7940ff694448b5bb5139c959a4896832e55d69aa04daa27e";
+        let key = "2b7e151628aed2a6abf7158809cf4f3c";
+        let iv = "0001020304050607";
+
+        cipher_wrap_test(Cipher::aes_128_wrap(), pt, ct, key, Some(iv));
+    }
+
+    #[test]
+    #[cfg(ossl102)]
+    fn test_aes128_wrap_default_iv() {
+        let pt = "00112233445566778899aabbccddeeff";
+        let ct = "38f1215f0212526f8a70b51955b9fbdc9fe3041d9832306e";
+        let key = "2b7e151628aed2a6abf7158809cf4f3c";
+
+        cipher_wrap_test(Cipher::aes_128_wrap(), pt, ct, key, None);
+    }
+
+    #[test]
+    #[cfg(ossl110)]
+    fn test_aes128_wrap_pad() {
+        let pt = "00112233445566778899aabbccddee";
+        let ct = "f13998f5ab32ef82a1bdbcbe585e1d837385b529572a1e1b";
+        let key = "2b7e151628aed2a6abf7158809cf4f3c";
+        let iv = "00010203";
+
+        cipher_wrap_test(Cipher::aes_128_wrap_pad(), pt, ct, key, Some(iv));
+    }
+
+    #[test]
+    #[cfg(ossl110)]
+    fn test_aes128_wrap_pad_default_iv() {
+        let pt = "00112233445566778899aabbccddee";
+        let ct = "3a501085fb8cf66f4186b7df851914d471ed823411598add";
+        let key = "2b7e151628aed2a6abf7158809cf4f3c";
+
+        cipher_wrap_test(Cipher::aes_128_wrap_pad(), pt, ct, key, None);
+    }
+
+    #[test]
+    #[cfg(ossl102)]
+    fn test_aes192_wrap() {
+        let pt = "9f6dee187d35302116aecbfd059657efd9f7589c4b5e7f5b";
+        let ct = "83b89142dfeeb4871e078bfb81134d33e23fedc19b03a1cf689973d3831b6813";
+        let key = "8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b";
+        let iv = "0001020304050607";
+
+        cipher_wrap_test(Cipher::aes_192_wrap(), pt, ct, key, Some(iv));
+    }
+
+    #[test]
+    #[cfg(ossl102)]
+    fn test_aes192_wrap_default_iv() {
+        let pt = "9f6dee187d35302116aecbfd059657efd9f7589c4b5e7f5b";
+        let ct = "c02c2cf11505d3e4851030d5534cbf5a1d7eca7ba8839adbf239756daf1b43e6";
+        let key = "8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b";
+
+        cipher_wrap_test(Cipher::aes_192_wrap(), pt, ct, key, None);
+    }
+
+    #[test]
+    #[cfg(ossl110)]
+    fn test_aes192_wrap_pad() {
+        let pt = "00112233445566778899aabbccddee";
+        let ct = "b4f6bb167ef7caf061a74da82b36ad038ca057ab51e98d3a";
+        let key = "8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b";
+        let iv = "00010203";
+
+        cipher_wrap_test(Cipher::aes_192_wrap_pad(), pt, ct, key, Some(iv));
+    }
+
+    #[test]
+    #[cfg(ossl110)]
+    fn test_aes192_wrap_pad_default_iv() {
+        let pt = "00112233445566778899aabbccddee";
+        let ct = "b2c37a28cc602753a7c944a4c2555a2df9c98b2eded5312e";
+        let key = "8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b";
+
+        cipher_wrap_test(Cipher::aes_192_wrap_pad(), pt, ct, key, None);
+    }
+
+    #[test]
+    #[cfg(ossl102)]
+    fn test_aes256_wrap() {
+        let pt = "6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e51";
+        let ct = "cc05da2a7f56f7dd0c144231f90bce58648fa20a8278f5a6b7d13bba6aa57a33229d4333866b7fd6";
+        let key = "603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4";
+        let iv = "0001020304050607";
+
+        cipher_wrap_test(Cipher::aes_256_wrap(), pt, ct, key, Some(iv));
+    }
+
+    #[test]
+    #[cfg(ossl102)]
+    fn test_aes256_wrap_default_iv() {
+        let pt = "6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e51";
+        let ct = "0b24f068b50e52bc6987868411c36e1b03900866ed12af81eb87cef70a8d1911731c1d7abf789d88";
+        let key = "603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4";
+
+        cipher_wrap_test(Cipher::aes_256_wrap(), pt, ct, key, None);
+    }
+
+    #[test]
+    #[cfg(ossl110)]
+    fn test_aes256_wrap_pad() {
+        let pt = "00112233445566778899aabbccddee";
+        let ct = "91594e044ccc06130d60e6c84a996aa4f96a9faff8c5f6e7";
+        let key = "603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4";
+        let iv = "00010203";
+
+        cipher_wrap_test(Cipher::aes_256_wrap_pad(), pt, ct, key, Some(iv));
+    }
+
+    #[test]
+    #[cfg(ossl110)]
+    fn test_aes256_wrap_pad_default_iv() {
+        let pt = "00112233445566778899aabbccddee";
+        let ct = "dc3c166a854afd68aea624a4272693554bf2e4fcbae602cd";
+        let key = "603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4";
+
+        cipher_wrap_test(Cipher::aes_256_wrap_pad(), pt, ct, key, None);
+    }
 }
diff -Naur vendor-41.0.5/openssl/src/cipher.rs vendor-41.0.7/openssl/src/cipher.rs
--- vendor-41.0.5/openssl/src/cipher.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/openssl/src/cipher.rs	1969-12-31 19:00:00.000000000 -0500
@@ -12,6 +12,7 @@
 use openssl_macros::corresponds;
 #[cfg(ossl300)]
 use std::ffi::CString;
+use std::ops::{Deref, DerefMut};
 #[cfg(ossl300)]
 use std::ptr;
 
@@ -41,7 +42,6 @@
 cfg_if! {
     if #[cfg(ossl300)] {
         use foreign_types::ForeignType;
-        use std::ops::{Deref, DerefMut};
 
         type Inner = *mut ffi::EVP_CIPHER;
 
@@ -90,6 +90,22 @@
         }
     } else {
         enum Inner {}
+
+        impl Deref for Cipher {
+            type Target = CipherRef;
+
+            #[inline]
+            fn deref(&self) -> &Self::Target {
+                match self.0 {}
+            }
+        }
+
+        impl DerefMut for Cipher {
+            #[inline]
+            fn deref_mut(&mut self) -> &mut Self::Target {
+                match self.0 {}
+            }
+        }
     }
 }
 
@@ -170,7 +186,6 @@
         unsafe { CipherRef::from_ptr(ffi::EVP_aes_128_cfb8() as *mut _) }
     }
 
-    #[cfg(not(boringssl))]
     pub fn aes_128_gcm() -> &'static CipherRef {
         unsafe { CipherRef::from_ptr(ffi::EVP_aes_128_gcm() as *mut _) }
     }
@@ -186,11 +201,23 @@
     }
 
     /// Requires OpenSSL 1.1.0 or newer.
-    #[cfg(ossl110)]
+    #[cfg(all(ossl110, not(osslconf = "OPENSSL_NO_OCB")))]
     pub fn aes_128_ocb() -> &'static CipherRef {
         unsafe { CipherRef::from_ptr(ffi::EVP_aes_128_ocb() as *mut _) }
     }
 
+    /// Requires OpenSSL 1.0.2 or newer.
+    #[cfg(ossl102)]
+    pub fn aes_128_wrap() -> &'static CipherRef {
+        unsafe { CipherRef::from_ptr(ffi::EVP_aes_128_wrap() as *mut _) }
+    }
+
+    /// Requires OpenSSL 1.1.0 or newer.
+    #[cfg(ossl110)]
+    pub fn aes_128_wrap_pad() -> &'static CipherRef {
+        unsafe { CipherRef::from_ptr(ffi::EVP_aes_128_wrap_pad() as *mut _) }
+    }
+
     pub fn aes_192_ecb() -> &'static CipherRef {
         unsafe { CipherRef::from_ptr(ffi::EVP_aes_192_ecb() as *mut _) }
     }
@@ -231,11 +258,23 @@
     }
 
     /// Requires OpenSSL 1.1.0 or newer.
-    #[cfg(ossl110)]
+    #[cfg(all(ossl110, not(osslconf = "OPENSSL_NO_OCB")))]
     pub fn aes_192_ocb() -> &'static CipherRef {
         unsafe { CipherRef::from_ptr(ffi::EVP_aes_192_ocb() as *mut _) }
     }
 
+    /// Requires OpenSSL 1.0.2 or newer.
+    #[cfg(ossl102)]
+    pub fn aes_192_wrap() -> &'static CipherRef {
+        unsafe { CipherRef::from_ptr(ffi::EVP_aes_192_wrap() as *mut _) }
+    }
+
+    /// Requires OpenSSL 1.1.0 or newer.
+    #[cfg(ossl110)]
+    pub fn aes_192_wrap_pad() -> &'static CipherRef {
+        unsafe { CipherRef::from_ptr(ffi::EVP_aes_192_wrap_pad() as *mut _) }
+    }
+
     pub fn aes_256_ecb() -> &'static CipherRef {
         unsafe { CipherRef::from_ptr(ffi::EVP_aes_256_ecb() as *mut _) }
     }
@@ -276,11 +315,23 @@
     }
 
     /// Requires OpenSSL 1.1.0 or newer.
-    #[cfg(ossl110)]
+    #[cfg(all(ossl110, not(osslconf = "OPENSSL_NO_OCB")))]
     pub fn aes_256_ocb() -> &'static CipherRef {
         unsafe { CipherRef::from_ptr(ffi::EVP_aes_256_ocb() as *mut _) }
     }
 
+    /// Requires OpenSSL 1.0.2 or newer.
+    #[cfg(ossl102)]
+    pub fn aes_256_wrap() -> &'static CipherRef {
+        unsafe { CipherRef::from_ptr(ffi::EVP_aes_256_wrap() as *mut _) }
+    }
+
+    /// Requires OpenSSL 1.1.0 or newer.
+    #[cfg(ossl110)]
+    pub fn aes_256_wrap_pad() -> &'static CipherRef {
+        unsafe { CipherRef::from_ptr(ffi::EVP_aes_256_wrap_pad() as *mut _) }
+    }
+
     #[cfg(not(osslconf = "OPENSSL_NO_BF"))]
     pub fn bf_cbc() -> &'static CipherRef {
         unsafe { CipherRef::from_ptr(ffi::EVP_bf_cbc() as *mut _) }
@@ -292,13 +343,11 @@
     }
 
     #[cfg(not(osslconf = "OPENSSL_NO_BF"))]
-    #[cfg(not(boringssl))]
     pub fn bf_cfb64() -> &'static CipherRef {
         unsafe { CipherRef::from_ptr(ffi::EVP_bf_cfb64() as *mut _) }
     }
 
     #[cfg(not(osslconf = "OPENSSL_NO_BF"))]
-    #[cfg(not(boringssl))]
     pub fn bf_ofb() -> &'static CipherRef {
         unsafe { CipherRef::from_ptr(ffi::EVP_bf_ofb() as *mut _) }
     }
@@ -329,86 +378,107 @@
         unsafe { CipherRef::from_ptr(ffi::EVP_rc4() as *mut _) }
     }
 
-    #[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAMELLIA")))]
+    #[cfg(not(osslconf = "OPENSSL_NO_CAMELLIA"))]
     pub fn camellia128_cfb128() -> &'static CipherRef {
         unsafe { CipherRef::from_ptr(ffi::EVP_camellia_128_cfb128() as *mut _) }
     }
 
-    #[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAMELLIA")))]
+    #[cfg(not(osslconf = "OPENSSL_NO_CAMELLIA"))]
     pub fn camellia128_ecb() -> &'static CipherRef {
         unsafe { CipherRef::from_ptr(ffi::EVP_camellia_128_ecb() as *mut _) }
     }
 
-    #[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAMELLIA")))]
+    #[cfg(not(osslconf = "OPENSSL_NO_CAMELLIA"))]
+    pub fn camellia128_cbc() -> &'static CipherRef {
+        unsafe { CipherRef::from_ptr(ffi::EVP_camellia_128_cbc() as *mut _) }
+    }
+
+    #[cfg(not(osslconf = "OPENSSL_NO_CAMELLIA"))]
     pub fn camellia192_cfb128() -> &'static CipherRef {
         unsafe { CipherRef::from_ptr(ffi::EVP_camellia_192_cfb128() as *mut _) }
     }
 
-    #[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAMELLIA")))]
+    #[cfg(not(osslconf = "OPENSSL_NO_CAMELLIA"))]
     pub fn camellia192_ecb() -> &'static CipherRef {
         unsafe { CipherRef::from_ptr(ffi::EVP_camellia_192_ecb() as *mut _) }
     }
 
-    #[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAMELLIA")))]
+    #[cfg(not(osslconf = "OPENSSL_NO_CAMELLIA"))]
+    pub fn camellia192_cbc() -> &'static CipherRef {
+        unsafe { CipherRef::from_ptr(ffi::EVP_camellia_192_cbc() as *mut _) }
+    }
+
+    #[cfg(not(osslconf = "OPENSSL_NO_CAMELLIA"))]
     pub fn camellia256_cfb128() -> &'static CipherRef {
         unsafe { CipherRef::from_ptr(ffi::EVP_camellia_256_cfb128() as *mut _) }
     }
 
-    #[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAMELLIA")))]
+    #[cfg(not(osslconf = "OPENSSL_NO_CAMELLIA"))]
     pub fn camellia256_ecb() -> &'static CipherRef {
         unsafe { CipherRef::from_ptr(ffi::EVP_camellia_256_ecb() as *mut _) }
     }
 
-    #[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAST")))]
+    #[cfg(not(osslconf = "OPENSSL_NO_CAMELLIA"))]
+    pub fn camellia256_cbc() -> &'static CipherRef {
+        unsafe { CipherRef::from_ptr(ffi::EVP_camellia_256_cbc() as *mut _) }
+    }
+
+    #[cfg(not(osslconf = "OPENSSL_NO_CAST"))]
     pub fn cast5_cfb64() -> &'static CipherRef {
         unsafe { CipherRef::from_ptr(ffi::EVP_cast5_cfb64() as *mut _) }
     }
 
-    #[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAST")))]
+    #[cfg(not(osslconf = "OPENSSL_NO_CAST"))]
     pub fn cast5_ecb() -> &'static CipherRef {
         unsafe { CipherRef::from_ptr(ffi::EVP_cast5_ecb() as *mut _) }
     }
 
-    #[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_IDEA")))]
+    #[cfg(not(osslconf = "OPENSSL_NO_CAST"))]
+    pub fn cast5_cbc() -> &'static CipherRef {
+        unsafe { CipherRef::from_ptr(ffi::EVP_cast5_cbc() as *mut _) }
+    }
+
+    #[cfg(not(osslconf = "OPENSSL_NO_IDEA"))]
     pub fn idea_cfb64() -> &'static CipherRef {
         unsafe { CipherRef::from_ptr(ffi::EVP_idea_cfb64() as *mut _) }
     }
 
-    #[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_IDEA")))]
+    #[cfg(not(osslconf = "OPENSSL_NO_IDEA"))]
     pub fn idea_ecb() -> &'static CipherRef {
         unsafe { CipherRef::from_ptr(ffi::EVP_idea_ecb() as *mut _) }
     }
 
-    #[cfg(all(ossl110, not(osslconf = "OPENSSL_NO_CHACHA")))]
+    #[cfg(not(osslconf = "OPENSSL_NO_IDEA"))]
+    pub fn idea_cbc() -> &'static CipherRef {
+        unsafe { CipherRef::from_ptr(ffi::EVP_idea_cbc() as *mut _) }
+    }
+
+    #[cfg(all(any(ossl110, libressl310), not(osslconf = "OPENSSL_NO_CHACHA")))]
     pub fn chacha20() -> &'static CipherRef {
         unsafe { CipherRef::from_ptr(ffi::EVP_chacha20() as *mut _) }
     }
 
-    #[cfg(all(ossl110, not(osslconf = "OPENSSL_NO_CHACHA")))]
+    #[cfg(all(any(ossl110, libressl360), not(osslconf = "OPENSSL_NO_CHACHA")))]
     pub fn chacha20_poly1305() -> &'static CipherRef {
         unsafe { CipherRef::from_ptr(ffi::EVP_chacha20_poly1305() as *mut _) }
     }
 
     #[cfg(not(osslconf = "OPENSSL_NO_SEED"))]
-    #[cfg(not(boringssl))]
     pub fn seed_cbc() -> &'static CipherRef {
         unsafe { CipherRef::from_ptr(ffi::EVP_seed_cbc() as *mut _) }
     }
 
     #[cfg(not(osslconf = "OPENSSL_NO_SEED"))]
-    #[cfg(not(boringssl))]
     pub fn seed_cfb128() -> &'static CipherRef {
         unsafe { CipherRef::from_ptr(ffi::EVP_seed_cfb128() as *mut _) }
     }
 
     #[cfg(not(osslconf = "OPENSSL_NO_SEED"))]
-    #[cfg(not(boringssl))]
     pub fn seed_ecb() -> &'static CipherRef {
         unsafe { CipherRef::from_ptr(ffi::EVP_seed_ecb() as *mut _) }
     }
 
     #[cfg(not(osslconf = "OPENSSL_NO_SEED"))]
-    #[cfg(not(boringssl))]
     pub fn seed_ofb() -> &'static CipherRef {
         unsafe { CipherRef::from_ptr(ffi::EVP_seed_ofb() as *mut _) }
     }
diff -Naur vendor-41.0.5/openssl/src/cms.rs vendor-41.0.7/openssl/src/cms.rs
--- vendor-41.0.5/openssl/src/cms.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/openssl/src/cms.rs	1969-12-31 19:00:00.000000000 -0500
@@ -20,6 +20,8 @@
 use openssl_macros::corresponds;
 
 bitflags! {
+    #[derive(Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
+    #[repr(transparent)]
     pub struct CMSOptions : c_uint {
         const TEXT = ffi::CMS_TEXT;
         const CMS_NOCERTS = ffi::CMS_NOCERTS;
diff -Naur vendor-41.0.5/openssl/src/derive.rs vendor-41.0.7/openssl/src/derive.rs
--- vendor-41.0.5/openssl/src/derive.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/openssl/src/derive.rs	1969-12-31 19:00:00.000000000 -0500
@@ -56,6 +56,7 @@
 use crate::error::ErrorStack;
 use crate::pkey::{HasPrivate, HasPublic, PKeyRef};
 use crate::{cvt, cvt_p};
+use openssl_macros::corresponds;
 
 /// A type used to derive a shared secret between two keys.
 pub struct Deriver<'a>(*mut ffi::EVP_PKEY_CTX, PhantomData<&'a ()>);
@@ -82,10 +83,7 @@
     }
 
     /// Sets the peer key used for secret derivation.
-    ///
-    /// This corresponds to [`EVP_PKEY_derive_set_peer`]:
-    ///
-    /// [`EVP_PKEY_derive_set_peer`]: https://www.openssl.org/docs/manmaster/crypto/EVP_PKEY_derive_init.html
+    #[corresponds(EVP_PKEY_derive_set_peer)]
     pub fn set_peer<T>(&mut self, key: &'a PKeyRef<T>) -> Result<(), ErrorStack>
     where
         T: HasPublic,
@@ -93,6 +91,29 @@
         unsafe { cvt(ffi::EVP_PKEY_derive_set_peer(self.0, key.as_ptr())).map(|_| ()) }
     }
 
+    /// Sets the peer key used for secret derivation along with optionally validating the peer public key.
+    ///
+    /// Requires OpenSSL 3.0.0 or newer.
+    #[corresponds(EVP_PKEY_derive_set_peer_ex)]
+    #[cfg(ossl300)]
+    pub fn set_peer_ex<T>(
+        &mut self,
+        key: &'a PKeyRef<T>,
+        validate_peer: bool,
+    ) -> Result<(), ErrorStack>
+    where
+        T: HasPublic,
+    {
+        unsafe {
+            cvt(ffi::EVP_PKEY_derive_set_peer_ex(
+                self.0,
+                key.as_ptr(),
+                validate_peer as i32,
+            ))
+            .map(|_| ())
+        }
+    }
+
     /// Returns the size of the shared secret.
     ///
     /// It can be used to size the buffer passed to [`Deriver::derive`].
@@ -179,4 +200,18 @@
         let shared = deriver.derive_to_vec().unwrap();
         assert!(!shared.is_empty());
     }
+
+    #[test]
+    #[cfg(ossl300)]
+    fn test_ec_key_derive_ex() {
+        let group = EcGroup::from_curve_name(Nid::X9_62_PRIME256V1).unwrap();
+        let ec_key = EcKey::generate(&group).unwrap();
+        let ec_key2 = EcKey::generate(&group).unwrap();
+        let pkey = PKey::from_ec_key(ec_key).unwrap();
+        let pkey2 = PKey::from_ec_key(ec_key2).unwrap();
+        let mut deriver = Deriver::new(&pkey).unwrap();
+        deriver.set_peer_ex(&pkey2, true).unwrap();
+        let shared = deriver.derive_to_vec().unwrap();
+        assert!(!shared.is_empty());
+    }
 }
diff -Naur vendor-41.0.5/openssl/src/dh.rs vendor-41.0.7/openssl/src/dh.rs
--- vendor-41.0.5/openssl/src/dh.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/openssl/src/dh.rs	1969-12-31 19:00:00.000000000 -0500
@@ -475,6 +475,6 @@
         let g = BigNum::from_hex_str("02").unwrap();
         let dh2 = Dh::from_pqg(p, None, g).unwrap();
         assert!(dh1.check_key().unwrap());
-        assert!(!dh2.check_key().unwrap());
+        assert!(matches!(dh2.check_key(), Ok(false) | Err(_)));
     }
 }
diff -Naur vendor-41.0.5/openssl/src/dsa.rs vendor-41.0.7/openssl/src/dsa.rs
--- vendor-41.0.5/openssl/src/dsa.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/openssl/src/dsa.rs	1969-12-31 19:00:00.000000000 -0500
@@ -7,6 +7,7 @@
 
 use cfg_if::cfg_if;
 use foreign_types::{ForeignType, ForeignTypeRef};
+#[cfg(not(boringssl))]
 use libc::c_int;
 use std::fmt;
 use std::mem;
@@ -314,7 +315,7 @@
 }
 
 cfg_if! {
-    if #[cfg(any(ossl110, libressl273))] {
+    if #[cfg(any(ossl110, libressl273, boringssl))] {
         use ffi::{DSA_get0_key, DSA_get0_pqg, DSA_set0_key, DSA_set0_pqg};
     } else {
         #[allow(bad_style)]
@@ -493,7 +494,7 @@
 }
 
 cfg_if! {
-    if #[cfg(any(ossl110, libressl273))] {
+    if #[cfg(any(ossl110, libressl273, boringssl))] {
         use ffi::{DSA_SIG_set0, DSA_SIG_get0};
     } else {
         #[allow(bad_style)]
diff -Naur vendor-41.0.5/openssl/src/ecdsa.rs vendor-41.0.7/openssl/src/ecdsa.rs
--- vendor-41.0.5/openssl/src/ecdsa.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/openssl/src/ecdsa.rs	1969-12-31 19:00:00.000000000 -0500
@@ -110,7 +110,7 @@
 }
 
 cfg_if! {
-    if #[cfg(any(ossl110, libressl273))] {
+    if #[cfg(any(ossl110, libressl273, boringssl))] {
         use ffi::{ECDSA_SIG_set0, ECDSA_SIG_get0};
     } else {
         #[allow(bad_style)]
@@ -158,7 +158,7 @@
     }
 
     #[test]
-    #[cfg_attr(osslconf = "OPENSSL_NO_EC2M", ignore)]
+    #[cfg_attr(osslconf = "OPENSSL_NO_EC", ignore)]
     fn sign_and_verify() {
         let group = EcGroup::from_curve_name(Nid::X9_62_PRIME256V1).unwrap();
         let private_key = EcKey::generate(&group).unwrap();
@@ -186,7 +186,7 @@
     }
 
     #[test]
-    #[cfg_attr(osslconf = "OPENSSL_NO_EC2M", ignore)]
+    #[cfg_attr(osslconf = "OPENSSL_NO_EC", ignore)]
     fn check_private_components() {
         let group = EcGroup::from_curve_name(Nid::X9_62_PRIME256V1).unwrap();
         let private_key = EcKey::generate(&group).unwrap();
@@ -206,7 +206,7 @@
     }
 
     #[test]
-    #[cfg_attr(osslconf = "OPENSSL_NO_EC2M", ignore)]
+    #[cfg_attr(osslconf = "OPENSSL_NO_EC", ignore)]
     fn serialize_deserialize() {
         let group = EcGroup::from_curve_name(Nid::X9_62_PRIME256V1).unwrap();
         let private_key = EcKey::generate(&group).unwrap();
diff -Naur vendor-41.0.5/openssl/src/ec.rs vendor-41.0.7/openssl/src/ec.rs
--- vendor-41.0.5/openssl/src/ec.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/openssl/src/ec.rs	1969-12-31 19:00:00.000000000 -0500
@@ -15,6 +15,7 @@
 //! [`EcGroup`]: struct.EcGroup.html
 //! [`Nid`]: ../nid/struct.Nid.html
 //! [Elliptic Curve Cryptography]: https://wiki.openssl.org/index.php/Elliptic_Curve_Cryptography
+use cfg_if::cfg_if;
 use foreign_types::{ForeignType, ForeignTypeRef};
 use libc::c_int;
 use std::fmt;
@@ -28,6 +29,13 @@
 use crate::{cvt, cvt_n, cvt_p, init};
 use openssl_macros::corresponds;
 
+cfg_if! {
+    if #[cfg(not(boringssl))] {
+        use std::ffi::CString;
+        use crate::string::OpensslString;
+    }
+}
+
 /// Compressed or Uncompressed conversion
 ///
 /// Conversion from the binary value of the point on the curve is performed in one of
@@ -57,7 +65,7 @@
 /// Named Curve or Explicit
 ///
 /// This type acts as a boolean as to whether the `EcGroup` is named or explicit.
-#[derive(Copy, Clone)]
+#[derive(Copy, Clone, Debug, PartialEq)]
 pub struct Asn1Flag(c_int);
 
 impl Asn1Flag {
@@ -187,7 +195,7 @@
     /// a term in the polynomial.  It will be set to 3 `1`s or 5 `1`s depending on
     /// using a trinomial or pentanomial.
     #[corresponds(EC_GROUP_get_curve_GF2m)]
-    #[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_EC2M")))]
+    #[cfg(not(osslconf = "OPENSSL_NO_EC2M"))]
     pub fn components_gf2m(
         &self,
         p: &mut BigNumRef,
@@ -294,6 +302,12 @@
         }
     }
 
+    /// Gets the flag determining if the group corresponds to a named curve.
+    #[corresponds(EC_GROUP_get_asn1_flag)]
+    pub fn asn1_flag(&self) -> Asn1Flag {
+        unsafe { Asn1Flag(ffi::EC_GROUP_get_asn1_flag(self.as_ptr())) }
+    }
+
     /// Returns the name of the curve, if a name is associated.
     #[corresponds(EC_GROUP_get_curve_name)]
     pub fn curve_name(&self) -> Option<Nid> {
@@ -457,6 +471,26 @@
         }
     }
 
+    /// Serializes the point to a hexadecimal string representation.
+    #[corresponds(EC_POINT_point2hex)]
+    #[cfg(not(boringssl))]
+    pub fn to_hex_str(
+        &self,
+        group: &EcGroupRef,
+        form: PointConversionForm,
+        ctx: &mut BigNumContextRef,
+    ) -> Result<OpensslString, ErrorStack> {
+        unsafe {
+            let buf = cvt_p(ffi::EC_POINT_point2hex(
+                group.as_ptr(),
+                self.as_ptr(),
+                form.0,
+                ctx.as_ptr(),
+            ))?;
+            Ok(OpensslString::from_ptr(buf))
+        }
+    }
+
     /// Creates a new point on the specified curve with the same value.
     #[corresponds(EC_POINT_dup)]
     pub fn to_owned(&self, group: &EcGroupRef) -> Result<EcPoint, ErrorStack> {
@@ -485,7 +519,7 @@
     /// Places affine coordinates of a curve over a prime field in the provided
     /// `x` and `y` `BigNum`s.
     #[corresponds(EC_POINT_get_affine_coordinates)]
-    #[cfg(ossl111)]
+    #[cfg(any(ossl111, boringssl, libressl350))]
     pub fn affine_coordinates(
         &self,
         group: &EcGroupRef,
@@ -552,7 +586,7 @@
     /// Places affine coordinates of a curve over a binary field in the provided
     /// `x` and `y` `BigNum`s
     #[corresponds(EC_POINT_get_affine_coordinates_GF2m)]
-    #[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_EC2M")))]
+    #[cfg(not(osslconf = "OPENSSL_NO_EC2M"))]
     pub fn affine_coordinates_gf2m(
         &self,
         group: &EcGroupRef,
@@ -625,6 +659,27 @@
         }
         Ok(point)
     }
+
+    /// Creates point from a hexadecimal string representation
+    #[corresponds(EC_POINT_hex2point)]
+    #[cfg(not(boringssl))]
+    pub fn from_hex_str(
+        group: &EcGroupRef,
+        s: &str,
+        ctx: &mut BigNumContextRef,
+    ) -> Result<EcPoint, ErrorStack> {
+        let point = EcPoint::new(group)?;
+        unsafe {
+            let c_str = CString::new(s.as_bytes()).unwrap();
+            cvt_p(ffi::EC_POINT_hex2point(
+                group.as_ptr(),
+                c_str.as_ptr() as *const _,
+                point.as_ptr(),
+                ctx.as_ptr(),
+            ))?;
+        }
+        Ok(point)
+    }
 }
 
 generic_foreign_type_and_impl_send_sync! {
@@ -1116,6 +1171,20 @@
     }
 
     #[test]
+    #[cfg(not(boringssl))]
+    fn point_hex_str() {
+        let group = EcGroup::from_curve_name(Nid::X9_62_PRIME256V1).unwrap();
+        let key = EcKey::generate(&group).unwrap();
+        let point = key.public_key();
+        let mut ctx = BigNumContext::new().unwrap();
+        let hex = point
+            .to_hex_str(&group, PointConversionForm::COMPRESSED, &mut ctx)
+            .unwrap();
+        let point2 = EcPoint::from_hex_str(&group, &hex, &mut ctx).unwrap();
+        assert!(point.eq(&group, &point2, &mut ctx).unwrap());
+    }
+
+    #[test]
     fn point_owned() {
         let group = EcGroup::from_curve_name(Nid::X9_62_PRIME256V1).unwrap();
         let key = EcKey::generate(&group).unwrap();
@@ -1191,7 +1260,7 @@
         assert!(ec_key.check_key().is_ok());
     }
 
-    #[cfg(ossl111)]
+    #[cfg(any(ossl111, boringssl, libressl350))]
     #[test]
     fn get_affine_coordinates() {
         let group = EcGroup::from_curve_name(Nid::X9_62_PRIME256V1).unwrap();
@@ -1255,7 +1324,7 @@
     }
 
     #[test]
-    #[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_EC2M")))]
+    #[cfg(not(osslconf = "OPENSSL_NO_EC2M"))]
     fn is_on_curve() {
         let group = EcGroup::from_curve_name(Nid::X9_62_PRIME256V1).unwrap();
         let mut ctx = BigNumContext::new().unwrap();
@@ -1265,4 +1334,12 @@
         let group2 = EcGroup::from_curve_name(Nid::X9_62_PRIME239V3).unwrap();
         assert!(!g.is_on_curve(&group2, &mut ctx).unwrap());
     }
+
+    #[test]
+    #[cfg(any(boringssl, ossl111, libressl350))]
+    fn asn1_flag() {
+        let group = EcGroup::from_curve_name(Nid::X9_62_PRIME256V1).unwrap();
+        let flag = group.asn1_flag();
+        assert_eq!(flag, Asn1Flag::NAMED_CURVE);
+    }
 }
diff -Naur vendor-41.0.5/openssl/src/encrypt.rs vendor-41.0.7/openssl/src/encrypt.rs
--- vendor-41.0.5/openssl/src/encrypt.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/openssl/src/encrypt.rs	1969-12-31 19:00:00.000000000 -0500
@@ -40,7 +40,7 @@
 //! assert_eq!(&*decrypted, data);
 //! ```
 #[cfg(any(ossl102, libressl310))]
-use libc::{c_int, c_void};
+use libc::c_int;
 use std::{marker::PhantomData, ptr};
 
 use crate::error::ErrorStack;
@@ -174,7 +174,7 @@
 
             cvt(ffi::EVP_PKEY_CTX_set0_rsa_oaep_label(
                 self.pctx,
-                p as *mut c_void,
+                p,
                 label.len() as c_int,
             ))
             .map(|_| ())
@@ -378,7 +378,7 @@
 
             cvt(ffi::EVP_PKEY_CTX_set0_rsa_oaep_label(
                 self.pctx,
-                p as *mut c_void,
+                p,
                 label.len() as c_int,
             ))
             .map(|_| ())
diff -Naur vendor-41.0.5/openssl/src/hash.rs vendor-41.0.7/openssl/src/hash.rs
--- vendor-41.0.5/openssl/src/hash.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/openssl/src/hash.rs	1969-12-31 19:00:00.000000000 -0500
@@ -43,7 +43,7 @@
 use crate::{cvt, cvt_p};
 
 cfg_if! {
-    if #[cfg(ossl110)] {
+    if #[cfg(any(ossl110, boringssl, libressl382))] {
         use ffi::{EVP_MD_CTX_free, EVP_MD_CTX_new};
     } else {
         use ffi::{EVP_MD_CTX_create as EVP_MD_CTX_new, EVP_MD_CTX_destroy as EVP_MD_CTX_free};
@@ -127,22 +127,22 @@
         unsafe { MessageDigest(ffi::EVP_sha512()) }
     }
 
-    #[cfg(ossl111)]
+    #[cfg(any(ossl111, libressl380))]
     pub fn sha3_224() -> MessageDigest {
         unsafe { MessageDigest(ffi::EVP_sha3_224()) }
     }
 
-    #[cfg(ossl111)]
+    #[cfg(any(ossl111, libressl380))]
     pub fn sha3_256() -> MessageDigest {
         unsafe { MessageDigest(ffi::EVP_sha3_256()) }
     }
 
-    #[cfg(ossl111)]
+    #[cfg(any(ossl111, libressl380))]
     pub fn sha3_384() -> MessageDigest {
         unsafe { MessageDigest(ffi::EVP_sha3_384()) }
     }
 
-    #[cfg(ossl111)]
+    #[cfg(any(ossl111, libressl380))]
     pub fn sha3_512() -> MessageDigest {
         unsafe { MessageDigest(ffi::EVP_sha3_512()) }
     }
@@ -157,7 +157,7 @@
         unsafe { MessageDigest(ffi::EVP_shake256()) }
     }
 
-    #[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_RMD160")))]
+    #[cfg(not(osslconf = "OPENSSL_NO_RMD160"))]
     pub fn ripemd160() -> MessageDigest {
         unsafe { MessageDigest(ffi::EVP_ripemd160()) }
     }
@@ -624,7 +624,7 @@
         );
     }
 
-    #[cfg(ossl111)]
+    #[cfg(any(ossl111, libressl380))]
     #[test]
     fn test_sha3_224() {
         let tests = [(
@@ -644,7 +644,7 @@
         );
     }
 
-    #[cfg(ossl111)]
+    #[cfg(any(ossl111, libressl380))]
     #[test]
     fn test_sha3_256() {
         let tests = [(
@@ -664,7 +664,7 @@
         );
     }
 
-    #[cfg(ossl111)]
+    #[cfg(any(ossl111, libressl380))]
     #[test]
     fn test_sha3_384() {
         let tests = [("416c6c20796f75722062617365206172652062656c6f6e6720746f207573",
@@ -684,7 +684,7 @@
         );
     }
 
-    #[cfg(ossl111)]
+    #[cfg(any(ossl111, libressl380))]
     #[test]
     fn test_sha3_512() {
         let tests = [("416c6c20796f75722062617365206172652062656c6f6e6720746f207573",
@@ -745,7 +745,7 @@
     }
 
     #[test]
-    #[cfg(not(boringssl))]
+    #[cfg(not(osslconf = "OPENSSL_NO_RMD160"))]
     #[cfg_attr(ossl300, ignore)]
     fn test_ripemd160() {
         #[cfg(ossl300)]
diff -Naur vendor-41.0.5/openssl/src/lib.rs vendor-41.0.7/openssl/src/lib.rs
--- vendor-41.0.5/openssl/src/lib.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/openssl/src/lib.rs	1969-12-31 19:00:00.000000000 -0500
@@ -44,7 +44,7 @@
 //! $ sudo apt-get install pkg-config libssl-dev
 //!
 //! # Fedora
-//! $ sudo dnf install pkg-config openssl-devel
+//! $ sudo dnf install pkg-config perl-FindBin openssl-devel
 //!
 //! # Alpine Linux
 //! $ apk add pkgconfig openssl-dev
@@ -119,12 +119,14 @@
 //! ```
 #![doc(html_root_url = "https://docs.rs/openssl/0.10")]
 #![warn(rust_2018_idioms)]
-#![allow(clippy::uninlined_format_args)]
+#![allow(clippy::uninlined_format_args, clippy::needless_doctest_main)]
 
 #[doc(inline)]
 pub use ffi::init;
 
 use libc::c_int;
+#[cfg(ossl300)]
+use libc::c_long;
 
 use crate::error::ErrorStack;
 
@@ -140,7 +142,7 @@
 pub mod bn;
 pub mod cipher;
 pub mod cipher_ctx;
-#[cfg(all(not(boringssl), not(libressl), not(osslconf = "OPENSSL_NO_CMS")))]
+#[cfg(all(not(libressl), not(osslconf = "OPENSSL_NO_CMS")))]
 pub mod cms;
 pub mod conf;
 pub mod derive;
@@ -162,7 +164,7 @@
 pub mod md_ctx;
 pub mod memcmp;
 pub mod nid;
-#[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_OCSP")))]
+#[cfg(not(osslconf = "OPENSSL_NO_OCSP"))]
 pub mod ocsp;
 pub mod pkcs12;
 pub mod pkcs5;
@@ -208,6 +210,19 @@
     if r <= 0 {
         Err(ErrorStack::get())
     } else {
+        Ok(r)
+    }
+}
+
+// cvt_long is currently only used in functions that require openssl >= 3.0.0,
+// so this cfg statement is used to avoid "unused function" errors when
+// compiling with openssl < 3.0.0
+#[inline]
+#[cfg(ossl300)]
+fn cvt_long(r: c_long) -> Result<c_long, ErrorStack> {
+    if r <= 0 {
+        Err(ErrorStack::get())
+    } else {
         Ok(r)
     }
 }
diff -Naur vendor-41.0.5/openssl/src/md_ctx.rs vendor-41.0.7/openssl/src/md_ctx.rs
--- vendor-41.0.5/openssl/src/md_ctx.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/openssl/src/md_ctx.rs	1969-12-31 19:00:00.000000000 -0500
@@ -93,7 +93,7 @@
 use std::ptr;
 
 cfg_if! {
-    if #[cfg(ossl110)] {
+    if #[cfg(any(ossl110, boringssl, libressl382))] {
         use ffi::{EVP_MD_CTX_free, EVP_MD_CTX_new};
     } else {
         use ffi::{EVP_MD_CTX_create as EVP_MD_CTX_new, EVP_MD_CTX_destroy as EVP_MD_CTX_free};
diff -Naur vendor-41.0.5/openssl/src/md.rs vendor-41.0.7/openssl/src/md.rs
--- vendor-41.0.5/openssl/src/md.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/openssl/src/md.rs	1969-12-31 19:00:00.000000000 -0500
@@ -150,25 +150,25 @@
         unsafe { MdRef::from_ptr(ffi::EVP_sha512() as *mut _) }
     }
 
-    #[cfg(ossl111)]
+    #[cfg(any(ossl111, libressl380))]
     #[inline]
     pub fn sha3_224() -> &'static MdRef {
         unsafe { MdRef::from_ptr(ffi::EVP_sha3_224() as *mut _) }
     }
 
-    #[cfg(ossl111)]
+    #[cfg(any(ossl111, libressl380))]
     #[inline]
     pub fn sha3_256() -> &'static MdRef {
         unsafe { MdRef::from_ptr(ffi::EVP_sha3_256() as *mut _) }
     }
 
-    #[cfg(ossl111)]
+    #[cfg(any(ossl111, libressl380))]
     #[inline]
     pub fn sha3_384() -> &'static MdRef {
         unsafe { MdRef::from_ptr(ffi::EVP_sha3_384() as *mut _) }
     }
 
-    #[cfg(ossl111)]
+    #[cfg(any(ossl111, libressl380))]
     #[inline]
     pub fn sha3_512() -> &'static MdRef {
         unsafe { MdRef::from_ptr(ffi::EVP_sha3_512() as *mut _) }
@@ -188,14 +188,12 @@
 
     #[cfg(not(osslconf = "OPENSSL_NO_RMD160"))]
     #[inline]
-    #[cfg(not(boringssl))]
     pub fn ripemd160() -> &'static MdRef {
         unsafe { MdRef::from_ptr(ffi::EVP_ripemd160() as *mut _) }
     }
 
     #[cfg(all(any(ossl111, libressl291), not(osslconf = "OPENSSL_NO_SM3")))]
     #[inline]
-    #[cfg(not(boringssl))]
     pub fn sm3() -> &'static MdRef {
         unsafe { MdRef::from_ptr(ffi::EVP_sm3() as *mut _) }
     }
diff -Naur vendor-41.0.5/openssl/src/nid.rs vendor-41.0.7/openssl/src/nid.rs
--- vendor-41.0.5/openssl/src/nid.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/openssl/src/nid.rs	1969-12-31 19:00:00.000000000 -0500
@@ -1074,20 +1074,24 @@
     pub const AES_128_CBC_HMAC_SHA1: Nid = Nid(ffi::NID_aes_128_cbc_hmac_sha1);
     pub const AES_192_CBC_HMAC_SHA1: Nid = Nid(ffi::NID_aes_192_cbc_hmac_sha1);
     pub const AES_256_CBC_HMAC_SHA1: Nid = Nid(ffi::NID_aes_256_cbc_hmac_sha1);
+    #[cfg(ossl111)]
+    pub const SM2: Nid = Nid(ffi::NID_sm2);
     #[cfg(any(ossl111, libressl291))]
     pub const SM3: Nid = Nid(ffi::NID_sm3);
-    #[cfg(ossl111)]
+    #[cfg(any(ossl111, libressl380))]
     pub const SHA3_224: Nid = Nid(ffi::NID_sha3_224);
-    #[cfg(ossl111)]
+    #[cfg(any(ossl111, libressl380))]
     pub const SHA3_256: Nid = Nid(ffi::NID_sha3_256);
-    #[cfg(ossl111)]
+    #[cfg(any(ossl111, libressl380))]
     pub const SHA3_384: Nid = Nid(ffi::NID_sha3_384);
-    #[cfg(ossl111)]
+    #[cfg(any(ossl111, libressl380))]
     pub const SHA3_512: Nid = Nid(ffi::NID_sha3_512);
     #[cfg(ossl111)]
     pub const SHAKE128: Nid = Nid(ffi::NID_shake128);
     #[cfg(ossl111)]
     pub const SHAKE256: Nid = Nid(ffi::NID_shake256);
+    #[cfg(any(ossl110, libressl271))]
+    pub const CHACHA20_POLY1305: Nid = Nid(ffi::NID_chacha20_poly1305);
 }
 
 #[cfg(test)]
diff -Naur vendor-41.0.5/openssl/src/ocsp.rs vendor-41.0.7/openssl/src/ocsp.rs
--- vendor-41.0.5/openssl/src/ocsp.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/openssl/src/ocsp.rs	1969-12-31 19:00:00.000000000 -0500
@@ -15,6 +15,8 @@
 use openssl_macros::corresponds;
 
 bitflags! {
+    #[derive(Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
+    #[repr(transparent)]
     pub struct OcspFlag: c_ulong {
         const NO_CERTS = ffi::OCSP_NOCERTS;
         const NO_INTERN = ffi::OCSP_NOINTERN;
diff -Naur vendor-41.0.5/openssl/src/pkcs5.rs vendor-41.0.7/openssl/src/pkcs5.rs
--- vendor-41.0.5/openssl/src/pkcs5.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/openssl/src/pkcs5.rs	1969-12-31 19:00:00.000000000 -0500
@@ -115,7 +115,7 @@
 ///
 /// Requires OpenSSL 1.1.0 or newer.
 #[corresponds(EVP_PBE_scrypt)]
-#[cfg(any(ossl110, boringssl))]
+#[cfg(all(any(ossl110, boringssl), not(osslconf = "OPENSSL_NO_SCRYPT")))]
 #[allow(clippy::useless_conversion)]
 pub fn scrypt(
     pass: &[u8],
diff -Naur vendor-41.0.5/openssl/src/pkcs7.rs vendor-41.0.7/openssl/src/pkcs7.rs
--- vendor-41.0.5/openssl/src/pkcs7.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/openssl/src/pkcs7.rs	1969-12-31 19:00:00.000000000 -0500
@@ -28,6 +28,8 @@
 }
 
 bitflags! {
+    #[derive(Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
+    #[repr(transparent)]
     pub struct Pkcs7Flags: c_int {
         const TEXT = ffi::PKCS7_TEXT;
         const NOCERTS = ffi::PKCS7_NOCERTS;
@@ -111,7 +113,7 @@
                 certs.as_ptr(),
                 input_bio.as_ptr(),
                 cipher.as_ptr(),
-                flags.bits,
+                flags.bits(),
             ))
             .map(Pkcs7)
         }
@@ -141,7 +143,7 @@
                 pkey.as_ptr(),
                 certs.as_ptr(),
                 input_bio.as_ptr(),
-                flags.bits,
+                flags.bits(),
             ))
             .map(Pkcs7)
         }
@@ -159,7 +161,7 @@
                 output.as_ptr(),
                 self.as_ptr(),
                 input_bio.as_ptr(),
-                flags.bits,
+                flags.bits(),
             ))
             .map(|_| output.get_buf().to_owned())
         }
@@ -205,7 +207,7 @@
                 pkey.as_ptr(),
                 cert.as_ptr(),
                 output.as_ptr(),
-                flags.bits,
+                flags.bits(),
             ))
             .map(|_| output.get_buf().to_owned())
         }
@@ -241,7 +243,7 @@
                 store.as_ptr(),
                 indata_bio_ptr,
                 out_bio.as_ptr(),
-                flags.bits,
+                flags.bits(),
             ))
             .map(|_| ())?
         }
@@ -265,7 +267,7 @@
             let ptr = cvt_p(ffi::PKCS7_get0_signers(
                 self.as_ptr(),
                 certs.as_ptr(),
-                flags.bits,
+                flags.bits(),
             ))?;
 
             // The returned stack is owned by the caller, but the certs inside are not! Our stack interface can't deal
diff -Naur vendor-41.0.5/openssl/src/pkey_ctx.rs vendor-41.0.7/openssl/src/pkey_ctx.rs
--- vendor-41.0.5/openssl/src/pkey_ctx.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/openssl/src/pkey_ctx.rs	1969-12-31 19:00:00.000000000 -0500
@@ -70,7 +70,8 @@
 use crate::md::MdRef;
 use crate::pkey::{HasPrivate, HasPublic, Id, PKey, PKeyRef, Private};
 use crate::rsa::Padding;
-use crate::{cvt, cvt_n, cvt_p};
+use crate::sign::RsaPssSaltlen;
+use crate::{cvt, cvt_p};
 use foreign_types::{ForeignType, ForeignTypeRef};
 #[cfg(not(boringssl))]
 use libc::c_int;
@@ -79,10 +80,10 @@
 use std::ptr;
 
 /// HKDF modes of operation.
-#[cfg(ossl111)]
+#[cfg(any(ossl111, libressl360))]
 pub struct HkdfMode(c_int);
 
-#[cfg(ossl111)]
+#[cfg(any(ossl111, libressl360))]
 impl HkdfMode {
     /// This is the default mode. Calling [`derive`][PkeyCtxRef::derive] on a [`PkeyCtxRef`] set up
     /// for HKDF will perform an extract followed by an expand operation in one go. The derived key
@@ -164,6 +165,17 @@
         Ok(())
     }
 
+    /// Prepares the context for signature recovery using the public key.
+    #[corresponds(EVP_PKEY_verify_recover_init)]
+    #[inline]
+    pub fn verify_recover_init(&mut self) -> Result<(), ErrorStack> {
+        unsafe {
+            cvt(ffi::EVP_PKEY_verify_recover_init(self.as_ptr()))?;
+        }
+
+        Ok(())
+    }
+
     /// Encrypts data using the public key.
     ///
     /// If `to` is set to `None`, an upper bound on the number of bytes required for the output buffer will be
@@ -209,16 +221,54 @@
     #[inline]
     pub fn verify(&mut self, data: &[u8], sig: &[u8]) -> Result<bool, ErrorStack> {
         unsafe {
-            let r = cvt_n(ffi::EVP_PKEY_verify(
+            let r = ffi::EVP_PKEY_verify(
                 self.as_ptr(),
                 sig.as_ptr(),
                 sig.len(),
                 data.as_ptr(),
                 data.len(),
-            ))?;
+            );
+            // `EVP_PKEY_verify` is not terribly consistent about how it,
+            // reports errors. It does not clearly distinguish between 0 and
+            // -1, and may put errors on the stack in both cases. If there's
+            // errors on the stack, we return `Err()`, else we return
+            // `Ok(false)`.
+            if r <= 0 {
+                let errors = ErrorStack::get();
+                if !errors.errors().is_empty() {
+                    return Err(errors);
+                }
+            }
+
             Ok(r == 1)
         }
     }
+
+    /// Recovers the original data signed by the private key. You almost
+    /// always want `verify` instead.
+    ///
+    /// Returns the number of bytes written to `to`, or the number of bytes
+    /// that would be written, if `to` is `None.
+    #[corresponds(EVP_PKEY_verify_recover)]
+    #[inline]
+    pub fn verify_recover(
+        &mut self,
+        sig: &[u8],
+        to: Option<&mut [u8]>,
+    ) -> Result<usize, ErrorStack> {
+        let mut written = to.as_ref().map_or(0, |b| b.len());
+        unsafe {
+            cvt(ffi::EVP_PKEY_verify_recover(
+                self.as_ptr(),
+                to.map_or(ptr::null_mut(), |b| b.as_mut_ptr()),
+                &mut written,
+                sig.as_ptr(),
+                sig.len(),
+            ))?;
+        }
+
+        Ok(written)
+    }
 }
 
 impl<T> PkeyCtxRef<T>
@@ -351,6 +401,22 @@
         Ok(())
     }
 
+    /// Sets which algorithm was used to compute the digest used in a
+    /// signature. With RSA signatures this causes the signature to be wrapped
+    /// in a `DigestInfo` structure. This is almost always what you want with
+    /// RSA signatures.
+    #[corresponds(EVP_PKEY_CTX_set_signature_md)]
+    #[inline]
+    pub fn set_signature_md(&self, md: &MdRef) -> Result<(), ErrorStack> {
+        unsafe {
+            cvt(ffi::EVP_PKEY_CTX_set_signature_md(
+                self.as_ptr(),
+                md.as_ptr(),
+            ))?;
+        }
+        Ok(())
+    }
+
     /// Returns the RSA padding mode in use.
     ///
     /// This is only useful for RSA keys.
@@ -381,6 +447,21 @@
         Ok(())
     }
 
+    /// Sets the RSA PSS salt length.
+    ///
+    /// This is only useful for RSA keys.
+    #[corresponds(EVP_PKEY_CTX_set_rsa_pss_saltlen)]
+    #[inline]
+    pub fn set_rsa_pss_saltlen(&mut self, len: RsaPssSaltlen) -> Result<(), ErrorStack> {
+        unsafe {
+            cvt(ffi::EVP_PKEY_CTX_set_rsa_pss_saltlen(
+                self.as_ptr(),
+                len.as_raw(),
+            ))
+            .map(|_| ())
+        }
+    }
+
     /// Sets the RSA MGF1 algorithm.
     ///
     /// This is only useful for RSA keys.
@@ -401,7 +482,7 @@
     ///
     /// This is only useful for RSA keys.
     #[corresponds(EVP_PKEY_CTX_set_rsa_oaep_md)]
-    #[cfg(any(ossl102, libressl310))]
+    #[cfg(any(ossl102, libressl310, boringssl))]
     #[inline]
     pub fn set_rsa_oaep_md(&mut self, md: &MdRef) -> Result<(), ErrorStack> {
         unsafe {
@@ -485,7 +566,7 @@
     ///
     /// Requires OpenSSL 1.1.0 or newer.
     #[corresponds(EVP_PKEY_CTX_set_hkdf_md)]
-    #[cfg(any(ossl110, boringssl))]
+    #[cfg(any(ossl110, boringssl, libressl360))]
     #[inline]
     pub fn set_hkdf_md(&mut self, digest: &MdRef) -> Result<(), ErrorStack> {
         unsafe {
@@ -508,7 +589,7 @@
     ///
     /// Requires OpenSSL 1.1.1 or newer.
     #[corresponds(EVP_PKEY_CTX_set_hkdf_mode)]
-    #[cfg(ossl111)]
+    #[cfg(any(ossl111, libressl360))]
     #[inline]
     pub fn set_hkdf_mode(&mut self, mode: HkdfMode) -> Result<(), ErrorStack> {
         unsafe {
@@ -527,7 +608,7 @@
     ///
     /// Requires OpenSSL 1.1.0 or newer.
     #[corresponds(EVP_PKEY_CTX_set1_hkdf_key)]
-    #[cfg(any(ossl110, boringssl))]
+    #[cfg(any(ossl110, boringssl, libressl360))]
     #[inline]
     pub fn set_hkdf_key(&mut self, key: &[u8]) -> Result<(), ErrorStack> {
         #[cfg(not(boringssl))]
@@ -552,7 +633,7 @@
     ///
     /// Requires OpenSSL 1.1.0 or newer.
     #[corresponds(EVP_PKEY_CTX_set1_hkdf_salt)]
-    #[cfg(any(ossl110, boringssl))]
+    #[cfg(any(ossl110, boringssl, libressl360))]
     #[inline]
     pub fn set_hkdf_salt(&mut self, salt: &[u8]) -> Result<(), ErrorStack> {
         #[cfg(not(boringssl))]
@@ -577,7 +658,7 @@
     ///
     /// Requires OpenSSL 1.1.0 or newer.
     #[corresponds(EVP_PKEY_CTX_add1_hkdf_info)]
-    #[cfg(any(ossl110, boringssl))]
+    #[cfg(any(ossl110, boringssl, libressl360))]
     #[inline]
     pub fn add_hkdf_info(&mut self, info: &[u8]) -> Result<(), ErrorStack> {
         #[cfg(not(boringssl))]
@@ -641,11 +722,12 @@
     #[cfg(not(boringssl))]
     use crate::cipher::Cipher;
     use crate::ec::{EcGroup, EcKey};
-    #[cfg(any(ossl102, libressl310, boringssl))]
+    use crate::hash::{hash, MessageDigest};
     use crate::md::Md;
     use crate::nid::Nid;
     use crate::pkey::PKey;
     use crate::rsa::Rsa;
+    use crate::sign::Verifier;
 
     #[test]
     fn rsa() {
@@ -671,7 +753,7 @@
     }
 
     #[test]
-    #[cfg(any(ossl102, libressl310))]
+    #[cfg(any(ossl102, libressl310, boringssl))]
     fn rsa_oaep() {
         let key = include_bytes!("../test/rsa.pem");
         let rsa = Rsa::private_key_from_pem(key).unwrap();
@@ -699,6 +781,53 @@
     }
 
     #[test]
+    fn rsa_sign() {
+        let key = include_bytes!("../test/rsa.pem");
+        let rsa = Rsa::private_key_from_pem(key).unwrap();
+        let pkey = PKey::from_rsa(rsa).unwrap();
+
+        let mut ctx = PkeyCtx::new(&pkey).unwrap();
+        ctx.sign_init().unwrap();
+        ctx.set_rsa_padding(Padding::PKCS1).unwrap();
+        ctx.set_signature_md(Md::sha384()).unwrap();
+
+        let msg = b"hello world";
+        let digest = hash(MessageDigest::sha384(), msg).unwrap();
+        let mut signature = vec![];
+        ctx.sign_to_vec(&digest, &mut signature).unwrap();
+
+        let mut verifier = Verifier::new(MessageDigest::sha384(), &pkey).unwrap();
+        verifier.update(msg).unwrap();
+        assert!(matches!(verifier.verify(&signature), Ok(true)));
+    }
+
+    #[test]
+    fn rsa_sign_pss() {
+        let key = include_bytes!("../test/rsa.pem");
+        let rsa = Rsa::private_key_from_pem(key).unwrap();
+        let pkey = PKey::from_rsa(rsa).unwrap();
+
+        let mut ctx = PkeyCtx::new(&pkey).unwrap();
+        ctx.sign_init().unwrap();
+        ctx.set_rsa_padding(Padding::PKCS1_PSS).unwrap();
+        ctx.set_signature_md(Md::sha384()).unwrap();
+        ctx.set_rsa_pss_saltlen(RsaPssSaltlen::custom(14)).unwrap();
+
+        let msg = b"hello world";
+        let digest = hash(MessageDigest::sha384(), msg).unwrap();
+        let mut signature = vec![];
+        ctx.sign_to_vec(&digest, &mut signature).unwrap();
+
+        let mut verifier = Verifier::new(MessageDigest::sha384(), &pkey).unwrap();
+        verifier.set_rsa_padding(Padding::PKCS1_PSS).unwrap();
+        verifier
+            .set_rsa_pss_saltlen(RsaPssSaltlen::custom(14))
+            .unwrap();
+        verifier.update(msg).unwrap();
+        assert!(matches!(verifier.verify(&signature), Ok(true)));
+    }
+
+    #[test]
     fn derive() {
         let group = EcGroup::from_curve_name(Nid::X9_62_PRIME256V1).unwrap();
         let key1 = EcKey::generate(&group).unwrap();
@@ -726,7 +855,7 @@
     }
 
     #[test]
-    #[cfg(any(ossl110, boringssl))]
+    #[cfg(any(ossl110, boringssl, libressl360))]
     fn hkdf() {
         let mut ctx = PkeyCtx::new_id(Id::HKDF).unwrap();
         ctx.derive_init().unwrap();
@@ -748,7 +877,7 @@
     }
 
     #[test]
-    #[cfg(ossl111)]
+    #[cfg(any(ossl111, libressl360))]
     fn hkdf_expand() {
         let mut ctx = PkeyCtx::new_id(Id::HKDF).unwrap();
         ctx.derive_init().unwrap();
@@ -772,7 +901,7 @@
     }
 
     #[test]
-    #[cfg(ossl111)]
+    #[cfg(any(ossl111, libressl360))]
     fn hkdf_extract() {
         let mut ctx = PkeyCtx::new_id(Id::HKDF).unwrap();
         ctx.derive_init().unwrap();
@@ -807,7 +936,67 @@
         let bad_data = b"Some Crypto text";
 
         ctx.verify_init().unwrap();
-        let valid = ctx.verify(bad_data, &signature).unwrap();
-        assert!(!valid);
+        let valid = ctx.verify(bad_data, &signature);
+        assert!(matches!(valid, Ok(false) | Err(_)));
+        assert!(ErrorStack::get().errors().is_empty());
+    }
+
+    #[test]
+    fn verify_fail_ec() {
+        let key1 =
+            EcKey::generate(&EcGroup::from_curve_name(Nid::X9_62_PRIME256V1).unwrap()).unwrap();
+        let key1 = PKey::from_ec_key(key1).unwrap();
+
+        let data = b"Some Crypto Text";
+        let mut ctx = PkeyCtx::new(&key1).unwrap();
+        ctx.verify_init().unwrap();
+        assert!(matches!(ctx.verify(data, &[0; 64]), Ok(false) | Err(_)));
+        assert!(ErrorStack::get().errors().is_empty());
+    }
+
+    #[test]
+    fn test_verify_recover() {
+        let key = Rsa::generate(2048).unwrap();
+        let key = PKey::from_rsa(key).unwrap();
+
+        let digest = [
+            0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
+            24, 25, 26, 27, 28, 29, 30, 31,
+        ];
+
+        let mut ctx = PkeyCtx::new(&key).unwrap();
+        ctx.sign_init().unwrap();
+        ctx.set_rsa_padding(Padding::PKCS1).unwrap();
+        ctx.set_signature_md(Md::sha256()).unwrap();
+        let mut signature = vec![];
+        ctx.sign_to_vec(&digest, &mut signature).unwrap();
+
+        // Attempt recovery of just the digest.
+        let mut ctx = PkeyCtx::new(&key).unwrap();
+        ctx.verify_recover_init().unwrap();
+        ctx.set_rsa_padding(Padding::PKCS1).unwrap();
+        ctx.set_signature_md(Md::sha256()).unwrap();
+        let length = ctx.verify_recover(&signature, None).unwrap();
+        let mut result_buf = vec![0; length];
+        let length = ctx
+            .verify_recover(&signature, Some(&mut result_buf))
+            .unwrap();
+        assert_eq!(length, digest.len());
+        // result_buf contains the digest
+        assert_eq!(result_buf[..length], digest);
+
+        // Attempt recovery of teh entire DigestInfo
+        let mut ctx = PkeyCtx::new(&key).unwrap();
+        ctx.verify_recover_init().unwrap();
+        ctx.set_rsa_padding(Padding::PKCS1).unwrap();
+        let length = ctx.verify_recover(&signature, None).unwrap();
+        let mut result_buf = vec![0; length];
+        let length = ctx
+            .verify_recover(&signature, Some(&mut result_buf))
+            .unwrap();
+        // 32-bytes of SHA256 digest + the ASN.1 DigestInfo structure == 51 bytes
+        assert_eq!(length, 51);
+        // The digest is the end of the DigestInfo structure.
+        assert_eq!(result_buf[length - digest.len()..length], digest);
     }
 }
diff -Naur vendor-41.0.5/openssl/src/pkey.rs vendor-41.0.7/openssl/src/pkey.rs
--- vendor-41.0.5/openssl/src/pkey.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/openssl/src/pkey.rs	1969-12-31 19:00:00.000000000 -0500
@@ -78,15 +78,21 @@
 
 impl Id {
     pub const RSA: Id = Id(ffi::EVP_PKEY_RSA);
+    #[cfg(any(ossl111, libressl310, boringssl))]
+    pub const RSA_PSS: Id = Id(ffi::EVP_PKEY_RSA_PSS);
     #[cfg(not(boringssl))]
     pub const HMAC: Id = Id(ffi::EVP_PKEY_HMAC);
     #[cfg(not(boringssl))]
     pub const CMAC: Id = Id(ffi::EVP_PKEY_CMAC);
     pub const DSA: Id = Id(ffi::EVP_PKEY_DSA);
     pub const DH: Id = Id(ffi::EVP_PKEY_DH);
+    #[cfg(ossl110)]
+    pub const DHX: Id = Id(ffi::EVP_PKEY_DHX);
     pub const EC: Id = Id(ffi::EVP_PKEY_EC);
+    #[cfg(ossl111)]
+    pub const SM2: Id = Id(ffi::EVP_PKEY_SM2);
 
-    #[cfg(any(ossl110, boringssl))]
+    #[cfg(any(ossl110, boringssl, libressl360))]
     pub const HKDF: Id = Id(ffi::EVP_PKEY_HKDF);
 
     #[cfg(any(ossl111, boringssl, libressl370))]
@@ -406,11 +412,7 @@
         unsafe {
             let evp = cvt_p(ffi::EVP_PKEY_new())?;
             let pkey = PKey::from_ptr(evp);
-            cvt(ffi::EVP_PKEY_assign(
-                pkey.0,
-                ffi::EVP_PKEY_RSA,
-                rsa.as_ptr() as *mut _,
-            ))?;
+            cvt(ffi::EVP_PKEY_assign_RSA(pkey.0, rsa.as_ptr()))?;
             mem::forget(rsa);
             Ok(pkey)
         }
@@ -422,11 +424,7 @@
         unsafe {
             let evp = cvt_p(ffi::EVP_PKEY_new())?;
             let pkey = PKey::from_ptr(evp);
-            cvt(ffi::EVP_PKEY_assign(
-                pkey.0,
-                ffi::EVP_PKEY_DSA,
-                dsa.as_ptr() as *mut _,
-            ))?;
+            cvt(ffi::EVP_PKEY_assign_DSA(pkey.0, dsa.as_ptr()))?;
             mem::forget(dsa);
             Ok(pkey)
         }
@@ -434,15 +432,12 @@
 
     /// Creates a new `PKey` containing a Diffie-Hellman key.
     #[corresponds(EVP_PKEY_assign_DH)]
+    #[cfg(not(boringssl))]
     pub fn from_dh(dh: Dh<T>) -> Result<PKey<T>, ErrorStack> {
         unsafe {
             let evp = cvt_p(ffi::EVP_PKEY_new())?;
             let pkey = PKey::from_ptr(evp);
-            cvt(ffi::EVP_PKEY_assign(
-                pkey.0,
-                ffi::EVP_PKEY_DH,
-                dh.as_ptr() as *mut _,
-            ))?;
+            cvt(ffi::EVP_PKEY_assign_DH(pkey.0, dh.as_ptr()))?;
             mem::forget(dh);
             Ok(pkey)
         }
@@ -454,11 +449,7 @@
         unsafe {
             let evp = cvt_p(ffi::EVP_PKEY_new())?;
             let pkey = PKey::from_ptr(evp);
-            cvt(ffi::EVP_PKEY_assign(
-                pkey.0,
-                ffi::EVP_PKEY_EC,
-                ec_key.as_ptr() as *mut _,
-            ))?;
+            cvt(ffi::EVP_PKEY_assign_EC_KEY(pkey.0, ec_key.as_ptr()))?;
             mem::forget(ec_key);
             Ok(pkey)
         }
@@ -861,6 +852,7 @@
     }
 }
 
+#[cfg(not(boringssl))]
 impl<T> TryFrom<Dh<T>> for PKey<T> {
     type Error = ErrorStack;
 
diff -Naur vendor-41.0.5/openssl/src/rsa.rs vendor-41.0.7/openssl/src/rsa.rs
--- vendor-41.0.5/openssl/src/rsa.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/openssl/src/rsa.rs	1969-12-31 19:00:00.000000000 -0500
@@ -581,7 +581,7 @@
 }
 
 cfg_if! {
-    if #[cfg(any(ossl110, libressl273))] {
+    if #[cfg(any(ossl110, libressl273, boringssl))] {
         use ffi::{
             RSA_get0_key, RSA_get0_factors, RSA_get0_crt_params, RSA_set0_key, RSA_set0_factors,
             RSA_set0_crt_params,
diff -Naur vendor-41.0.5/openssl/src/sign.rs vendor-41.0.7/openssl/src/sign.rs
--- vendor-41.0.5/openssl/src/sign.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/openssl/src/sign.rs	1969-12-31 19:00:00.000000000 -0500
@@ -81,7 +81,7 @@
 use crate::{cvt, cvt_p};
 
 cfg_if! {
-    if #[cfg(ossl110)] {
+    if #[cfg(any(ossl110, libressl382))] {
         use ffi::{EVP_MD_CTX_free, EVP_MD_CTX_new};
     } else {
         use ffi::{EVP_MD_CTX_create as EVP_MD_CTX_new, EVP_MD_CTX_destroy as EVP_MD_CTX_free};
@@ -93,7 +93,7 @@
 
 impl RsaPssSaltlen {
     /// Returns the integer representation of `RsaPssSaltlen`.
-    fn as_raw(&self) -> c_int {
+    pub(crate) fn as_raw(&self) -> c_int {
         self.0
     }
 
diff -Naur vendor-41.0.5/openssl/src/ssl/callbacks.rs vendor-41.0.7/openssl/src/ssl/callbacks.rs
--- vendor-41.0.5/openssl/src/ssl/callbacks.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/openssl/src/ssl/callbacks.rs	1969-12-31 19:00:00.000000000 -0500
@@ -86,6 +86,7 @@
         };
         // Give the callback mutable slices into which it can write the identity and psk.
         let identity_sl = slice::from_raw_parts_mut(identity as *mut u8, max_identity_len as usize);
+        #[allow(clippy::unnecessary_cast)]
         let psk_sl = slice::from_raw_parts_mut(psk as *mut u8, max_psk_len as usize);
         match (*callback)(ssl, hint, identity_sl, psk_sl) {
             Ok(psk_len) => psk_len as u32,
@@ -124,6 +125,7 @@
             Some(CStr::from_ptr(identity).to_bytes())
         };
         // Give the callback mutable slices into which it can write the psk.
+        #[allow(clippy::unnecessary_cast)]
         let psk_sl = slice::from_raw_parts_mut(psk as *mut u8, max_psk_len as usize);
         match (*callback)(ssl, identity, psk_sl) {
             Ok(psk_len) => psk_len as u32,
@@ -194,6 +196,7 @@
             .ssl_context()
             .ex_data(SslContext::cached_ex_index::<F>())
             .expect("BUG: alpn callback missing") as *const F;
+        #[allow(clippy::unnecessary_cast)]
         let protos = slice::from_raw_parts(inbuf as *const u8, inlen as usize);
 
         match (*callback)(ssl, protos) {
@@ -412,6 +415,7 @@
         .expect("BUG: session context missing")
         .ex_data(SslContext::cached_ex_index::<F>())
         .expect("BUG: get session callback missing") as *const F;
+    #[allow(clippy::unnecessary_cast)]
     let data = slice::from_raw_parts(data as *const u8, len as usize);
 
     match (*callback)(ssl, data) {
@@ -455,6 +459,7 @@
         .ssl_context()
         .ex_data(SslContext::cached_ex_index::<F>())
         .expect("BUG: stateless cookie generate callback missing") as *const F;
+    #[allow(clippy::unnecessary_cast)]
     let slice = slice::from_raw_parts_mut(cookie as *mut u8, ffi::SSL_COOKIE_LENGTH as usize);
     match (*callback)(ssl, slice) {
         Ok(len) => {
@@ -482,6 +487,7 @@
         .ssl_context()
         .ex_data(SslContext::cached_ex_index::<F>())
         .expect("BUG: stateless cookie verify callback missing") as *const F;
+    #[allow(clippy::unnecessary_cast)]
     let slice = slice::from_raw_parts(cookie as *const c_uchar as *const u8, cookie_len);
     (*callback)(ssl, slice) as c_int
 }
@@ -503,6 +509,7 @@
             .expect("BUG: cookie generate callback missing") as *const F;
         // We subtract 1 from DTLS1_COOKIE_LENGTH as the ostensible value, 256, is erroneous but retained for
         // compatibility. See comments in dtls1.h.
+        #[allow(clippy::unnecessary_cast)]
         let slice =
             slice::from_raw_parts_mut(cookie as *mut u8, ffi::DTLS1_COOKIE_LENGTH as usize - 1);
         match (*callback)(ssl, slice) {
@@ -542,6 +549,7 @@
             .ssl_context()
             .ex_data(SslContext::cached_ex_index::<F>())
             .expect("BUG: cookie verify callback missing") as *const F;
+        #[allow(clippy::unnecessary_cast)]
         let slice =
             slice::from_raw_parts(cookie as *const c_uchar as *const u8, cookie_len as usize);
         (*callback)(ssl, slice) as c_int
@@ -654,6 +662,7 @@
             .ex_data(SslContext::cached_ex_index::<F>())
             .expect("BUG: custom ext parse callback missing") as *const F;
         let ectx = ExtensionContext::from_bits_truncate(context);
+        #[allow(clippy::unnecessary_cast)]
         let slice = slice::from_raw_parts(input as *const u8, inlen);
         let cert = if ectx.contains(ExtensionContext::TLS1_3_CERTIFICATE) {
             Some((chainidx, X509Ref::from_ptr(x)))
diff -Naur vendor-41.0.5/openssl/src/ssl/mod.rs vendor-41.0.7/openssl/src/ssl/mod.rs
--- vendor-41.0.5/openssl/src/ssl/mod.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/openssl/src/ssl/mod.rs	1969-12-31 19:00:00.000000000 -0500
@@ -57,6 +57,8 @@
 //!     }
 //! }
 //! ```
+#[cfg(ossl300)]
+use crate::cvt_long;
 use crate::dh::{Dh, DhRef};
 #[cfg(all(ossl101, not(ossl110)))]
 use crate::ec::EcKey;
@@ -68,6 +70,8 @@
 #[cfg(any(ossl110, libressl270))]
 use crate::nid::Nid;
 use crate::pkey::{HasPrivate, PKeyRef, Params, Private};
+#[cfg(ossl300)]
+use crate::pkey::{PKey, Public};
 use crate::srtp::{SrtpProtectionProfile, SrtpProtectionProfileRef};
 use crate::ssl::bio::BioMethod;
 use crate::ssl::callbacks::*;
@@ -143,6 +147,8 @@
 
 bitflags! {
     /// Options controlling the behavior of an `SslContext`.
+    #[derive(Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
+    #[repr(transparent)]
     pub struct SslOptions: SslOptionsRepr {
         /// Disables a countermeasure against an SSLv3/TLSv1.0 vulnerability affecting CBC ciphers.
         const DONT_INSERT_EMPTY_FRAGMENTS = ffi::SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS as SslOptionsRepr;
@@ -281,6 +287,8 @@
 
 bitflags! {
     /// Options controlling the behavior of an `SslContext`.
+    #[derive(Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
+    #[repr(transparent)]
     pub struct SslMode: SslBitType {
         /// Enables "short writes".
         ///
@@ -378,6 +386,8 @@
 
 bitflags! {
     /// Options controlling the behavior of certificate verification.
+    #[derive(Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
+    #[repr(transparent)]
     pub struct SslVerifyMode: i32 {
         /// Verifies that the peer's certificate is trusted.
         ///
@@ -410,6 +420,8 @@
 
 bitflags! {
     /// Options controlling the behavior of session caching.
+    #[derive(Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
+    #[repr(transparent)]
     pub struct SslSessionCacheMode: SslBitType {
         /// No session caching for the client or server takes place.
         const OFF = ffi::SSL_SESS_CACHE_OFF;
@@ -447,6 +459,8 @@
 #[cfg(ossl111)]
 bitflags! {
     /// Which messages and under which conditions an extension should be added or expected.
+    #[derive(Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
+    #[repr(transparent)]
     pub struct ExtensionContext: c_uint {
         /// This extension is only allowed in TLS
         const TLS_ONLY = ffi::SSL_EXT_TLS_ONLY;
@@ -599,7 +613,7 @@
     /// Terminate the handshake with a fatal alert.
     ///
     /// Requires OpenSSL 1.1.0 or newer.
-    #[cfg(any(ossl110))]
+    #[cfg(ossl110)]
     pub const ALERT_FATAL: AlpnError = AlpnError(ffi::SSL_TLSEXT_ERR_ALERT_FATAL);
 
     /// Do not select a protocol, but continue the handshake.
@@ -735,7 +749,7 @@
     #[corresponds(SSL_CTX_set_verify)]
     pub fn set_verify(&mut self, mode: SslVerifyMode) {
         unsafe {
-            ffi::SSL_CTX_set_verify(self.as_ptr(), mode.bits as c_int, None);
+            ffi::SSL_CTX_set_verify(self.as_ptr(), mode.bits() as c_int, None);
         }
     }
 
@@ -752,7 +766,7 @@
     {
         unsafe {
             self.set_ex_data(SslContext::cached_ex_index::<F>(), verify);
-            ffi::SSL_CTX_set_verify(self.as_ptr(), mode.bits as c_int, Some(raw_verify::<F>));
+            ffi::SSL_CTX_set_verify(self.as_ptr(), mode.bits() as c_int, Some(raw_verify::<F>));
         }
     }
 
@@ -839,7 +853,7 @@
     pub fn set_mode(&mut self, mode: SslMode) -> SslMode {
         unsafe {
             let bits = ffi::SSL_CTX_set_mode(self.as_ptr(), mode.bits() as MtuTy) as SslBitType;
-            SslMode { bits }
+            SslMode::from_bits_retain(bits)
         }
     }
 
@@ -1111,14 +1125,14 @@
     pub fn set_options(&mut self, option: SslOptions) -> SslOptions {
         let bits =
             unsafe { ffi::SSL_CTX_set_options(self.as_ptr(), option.bits()) } as SslOptionsRepr;
-        SslOptions { bits }
+        SslOptions::from_bits_retain(bits)
     }
 
     /// Returns the options used by the context.
     #[corresponds(SSL_CTX_get_options)]
     pub fn options(&self) -> SslOptions {
         let bits = unsafe { ffi::SSL_CTX_get_options(self.as_ptr()) } as SslOptionsRepr;
-        SslOptions { bits }
+        SslOptions::from_bits_retain(bits)
     }
 
     /// Clears the options used by the context, returning the old set.
@@ -1126,7 +1140,7 @@
     pub fn clear_options(&mut self, option: SslOptions) -> SslOptions {
         let bits =
             unsafe { ffi::SSL_CTX_clear_options(self.as_ptr(), option.bits()) } as SslOptionsRepr;
-        SslOptions { bits }
+        SslOptions::from_bits_retain(bits)
     }
 
     /// Sets the minimum supported protocol version.
@@ -1475,7 +1489,7 @@
     pub fn set_session_cache_mode(&mut self, mode: SslSessionCacheMode) -> SslSessionCacheMode {
         unsafe {
             let bits = ffi::SSL_CTX_set_session_cache_mode(self.as_ptr(), mode.bits());
-            SslSessionCacheMode { bits }
+            SslSessionCacheMode::from_bits_retain(bits)
         }
     }
 
@@ -1558,16 +1572,34 @@
     ///
     /// This can be used to provide data to callbacks registered with the context. Use the
     /// `SslContext::new_ex_index` method to create an `Index`.
+    // FIXME should return a result
     #[corresponds(SSL_CTX_set_ex_data)]
     pub fn set_ex_data<T>(&mut self, index: Index<SslContext, T>, data: T) {
         self.set_ex_data_inner(index, data);
     }
 
     fn set_ex_data_inner<T>(&mut self, index: Index<SslContext, T>, data: T) -> *mut c_void {
+        match self.ex_data_mut(index) {
+            Some(v) => {
+                *v = data;
+                (v as *mut T).cast()
+            }
+            _ => unsafe {
+                let data = Box::into_raw(Box::new(data)) as *mut c_void;
+                ffi::SSL_CTX_set_ex_data(self.as_ptr(), index.as_raw(), data);
+                data
+            },
+        }
+    }
+
+    fn ex_data_mut<T>(&mut self, index: Index<SslContext, T>) -> Option<&mut T> {
         unsafe {
-            let data = Box::into_raw(Box::new(data)) as *mut c_void;
-            ffi::SSL_CTX_set_ex_data(self.as_ptr(), index.as_raw(), data);
-            data
+            let data = ffi::SSL_CTX_get_ex_data(self.as_ptr(), index.as_raw());
+            if data.is_null() {
+                None
+            } else {
+                Some(&mut *data.cast())
+            }
         }
     }
 
@@ -1708,6 +1740,16 @@
         unsafe { cvt(ffi::SSL_CTX_set_num_tickets(self.as_ptr(), num_tickets)).map(|_| ()) }
     }
 
+    /// Set the context's security level to a value between 0 and 5, inclusive.
+    /// A security value of 0 allows allows all parameters and algorithms.
+    ///
+    /// Requires OpenSSL 1.1.0 or newer.
+    #[corresponds(SSL_CTX_set_security_level)]
+    #[cfg(any(ossl110, libressl360))]
+    pub fn set_security_level(&mut self, level: u32) {
+        unsafe { ffi::SSL_CTX_set_security_level(self.as_ptr(), level as c_int) }
+    }
+
     /// Consumes the builder, returning a new `SslContext`.
     pub fn build(self) -> SslContext {
         self.0
@@ -1911,6 +1953,16 @@
     pub fn num_tickets(&self) -> usize {
         unsafe { ffi::SSL_CTX_get_num_tickets(self.as_ptr()) }
     }
+
+    /// Get the context's security level, which controls the allowed parameters
+    /// and algorithms.
+    ///
+    /// Requires OpenSSL 1.1.0 or newer.
+    #[corresponds(SSL_CTX_get_security_level)]
+    #[cfg(any(ossl110, libressl360))]
+    pub fn security_level(&self) -> u32 {
+        unsafe { ffi::SSL_CTX_get_security_level(self.as_ptr()) as u32 }
+    }
 }
 
 /// Information about the state of a cipher.
@@ -2122,6 +2174,7 @@
         unsafe {
             let mut len = 0;
             let p = ffi::SSL_SESSION_get_id(self.as_ptr(), &mut len);
+            #[allow(clippy::unnecessary_cast)]
             slice::from_raw_parts(p as *const u8, len as usize)
         }
     }
@@ -2350,7 +2403,7 @@
     /// [`SslContextBuilder::set_verify`]: struct.SslContextBuilder.html#method.set_verify
     #[corresponds(SSL_set_verify)]
     pub fn set_verify(&mut self, mode: SslVerifyMode) {
-        unsafe { ffi::SSL_set_verify(self.as_ptr(), mode.bits as c_int, None) }
+        unsafe { ffi::SSL_set_verify(self.as_ptr(), mode.bits() as c_int, None) }
     }
 
     /// Returns the verify mode that was set using `set_verify`.
@@ -2371,7 +2424,11 @@
         unsafe {
             // this needs to be in an Arc since the callback can register a new callback!
             self.set_ex_data(Ssl::cached_ex_index(), Arc::new(verify));
-            ffi::SSL_set_verify(self.as_ptr(), mode.bits as c_int, Some(ssl_raw_verify::<F>));
+            ffi::SSL_set_verify(
+                self.as_ptr(),
+                mode.bits() as c_int,
+                Some(ssl_raw_verify::<F>),
+            );
         }
     }
 
@@ -2413,7 +2470,7 @@
     ///
     /// Requires OpenSSL 1.0.1 or 1.0.2.
     #[corresponds(SSL_set_tmp_ecdh_callback)]
-    #[cfg(any(all(ossl101, not(ossl110))))]
+    #[cfg(all(ossl101, not(ossl110)))]
     #[deprecated(note = "this function leaks memory and does not exist on newer OpenSSL versions")]
     pub fn set_tmp_ecdh_callback<F>(&mut self, callback: F)
     where
@@ -2926,15 +2983,19 @@
     ///
     /// This can be used to provide data to callbacks registered with the context. Use the
     /// `Ssl::new_ex_index` method to create an `Index`.
+    // FIXME should return a result
     #[corresponds(SSL_set_ex_data)]
     pub fn set_ex_data<T>(&mut self, index: Index<Ssl, T>, data: T) {
-        unsafe {
-            let data = Box::new(data);
-            ffi::SSL_set_ex_data(
-                self.as_ptr(),
-                index.as_raw(),
-                Box::into_raw(data) as *mut c_void,
-            );
+        match self.ex_data_mut(index) {
+            Some(v) => *v = data,
+            None => unsafe {
+                let data = Box::new(data);
+                ffi::SSL_set_ex_data(
+                    self.as_ptr(),
+                    index.as_raw(),
+                    Box::into_raw(data) as *mut c_void,
+                );
+            },
         }
     }
 
@@ -3390,6 +3451,58 @@
     pub fn num_tickets(&self) -> usize {
         unsafe { ffi::SSL_get_num_tickets(self.as_ptr()) }
     }
+
+    /// Set the context's security level to a value between 0 and 5, inclusive.
+    /// A security value of 0 allows allows all parameters and algorithms.
+    ///
+    /// Requires OpenSSL 1.1.0 or newer.
+    #[corresponds(SSL_set_security_level)]
+    #[cfg(any(ossl110, libressl360))]
+    pub fn set_security_level(&mut self, level: u32) {
+        unsafe { ffi::SSL_set_security_level(self.as_ptr(), level as c_int) }
+    }
+
+    /// Get the connection's security level, which controls the allowed parameters
+    /// and algorithms.
+    ///
+    /// Requires OpenSSL 1.1.0 or newer.
+    #[corresponds(SSL_get_security_level)]
+    #[cfg(any(ossl110, libressl360))]
+    pub fn security_level(&self) -> u32 {
+        unsafe { ffi::SSL_get_security_level(self.as_ptr()) as u32 }
+    }
+
+    /// Get the temporary key provided by the peer that is used during key
+    /// exchange.
+    // We use an owned value because EVP_KEY free need to be called when it is
+    // dropped
+    #[corresponds(SSL_get_peer_tmp_key)]
+    #[cfg(ossl300)]
+    pub fn peer_tmp_key(&self) -> Result<PKey<Public>, ErrorStack> {
+        unsafe {
+            let mut key = ptr::null_mut();
+            match cvt_long(ffi::SSL_get_peer_tmp_key(self.as_ptr(), &mut key)) {
+                Ok(_) => Ok(PKey::<Public>::from_ptr(key)),
+                Err(e) => Err(e),
+            }
+        }
+    }
+
+    /// Returns the temporary key from the local end of the connection that is
+    /// used during key exchange.
+    // We use an owned value because EVP_KEY free need to be called when it is
+    // dropped
+    #[corresponds(SSL_get_tmp_key)]
+    #[cfg(ossl300)]
+    pub fn tmp_key(&self) -> Result<PKey<Private>, ErrorStack> {
+        unsafe {
+            let mut key = ptr::null_mut();
+            match cvt_long(ffi::SSL_get_tmp_key(self.as_ptr(), &mut key)) {
+                Ok(_) => Ok(PKey::<Private>::from_ptr(key)),
+                Err(e) => Err(e),
+            }
+        }
+    }
 }
 
 /// An SSL stream midway through the handshake process.
@@ -3718,7 +3831,7 @@
     pub fn get_shutdown(&mut self) -> ShutdownState {
         unsafe {
             let bits = ffi::SSL_get_shutdown(self.ssl.as_ptr());
-            ShutdownState { bits }
+            ShutdownState::from_bits_retain(bits)
         }
     }
 
@@ -4051,6 +4164,8 @@
 
 bitflags! {
     /// The shutdown state of a session.
+    #[derive(Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
+    #[repr(transparent)]
     pub struct ShutdownState: c_int {
         /// A close notify message has been sent to the peer.
         const SENT = ffi::SSL_SENT_SHUTDOWN;
diff -Naur vendor-41.0.5/openssl/src/ssl/test/mod.rs vendor-41.0.7/openssl/src/ssl/test/mod.rs
--- vendor-41.0.5/openssl/src/ssl/test/mod.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/openssl/src/ssl/test/mod.rs	1969-12-31 19:00:00.000000000 -0500
@@ -10,7 +10,7 @@
 use std::net::{SocketAddr, TcpListener, TcpStream};
 use std::path::Path;
 use std::process::{Child, ChildStdin, Command, Stdio};
-use std::sync::atomic::{AtomicBool, Ordering};
+use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering};
 use std::thread;
 use std::time::Duration;
 
@@ -19,7 +19,7 @@
 use crate::hash::MessageDigest;
 #[cfg(not(boringssl))]
 use crate::ocsp::{OcspResponse, OcspResponseStatus};
-use crate::pkey::PKey;
+use crate::pkey::{Id, PKey};
 use crate::srtp::SrtpProfileId;
 use crate::ssl::test::server::Server;
 #[cfg(any(ossl110, ossl111, libressl261))]
@@ -322,6 +322,56 @@
     );
 }
 
+// when a connection uses ECDHE P-384 key exchange, then the temp key APIs
+// return P-384 keys, and the peer and local keys are different.
+#[test]
+#[cfg(ossl300)]
+fn peer_tmp_key_p384() {
+    let mut server = Server::builder();
+    server.ctx().set_groups_list("P-384").unwrap();
+    let server = server.build();
+    let s = server.client().connect();
+    let peer_temp = s.ssl().peer_tmp_key().unwrap();
+    assert_eq!(peer_temp.id(), Id::EC);
+    assert_eq!(peer_temp.bits(), 384);
+
+    let local_temp = s.ssl().tmp_key().unwrap();
+    assert_eq!(local_temp.id(), Id::EC);
+    assert_eq!(local_temp.bits(), 384);
+
+    assert_ne!(
+        peer_temp.ec_key().unwrap().public_key_to_der().unwrap(),
+        local_temp.ec_key().unwrap().public_key_to_der().unwrap(),
+    );
+}
+
+// when a connection uses RSA key exchange, then the peer (server) temp key is
+// an Error because there is no temp key, and the local (client) temp key is the
+// temp key sent in the initial key share.
+#[test]
+#[cfg(ossl300)]
+fn peer_tmp_key_rsa() {
+    let mut server = Server::builder();
+    server.ctx().set_cipher_list("RSA").unwrap();
+    // RSA key exchange is not allowed in TLS 1.3, so force the connection
+    // to negotiate TLS 1.2
+    server
+        .ctx()
+        .set_max_proto_version(Some(SslVersion::TLS1_2))
+        .unwrap();
+    let server = server.build();
+    let mut client = server.client();
+    client.ctx().set_groups_list("P-521").unwrap();
+    let s = client.connect();
+    let peer_temp = s.ssl().peer_tmp_key();
+    assert!(peer_temp.is_err());
+
+    // this is the temp key that the client sent in the initial key share
+    let local_temp = s.ssl().tmp_key().unwrap();
+    assert_eq!(local_temp.id(), Id::EC);
+    assert_eq!(local_temp.bits(), 521);
+}
+
 /// Tests that when both the client as well as the server use SRTP and their
 /// lists of supported protocols have an overlap -- with only ONE protocol
 /// being valid for both.
@@ -467,7 +517,7 @@
 }
 
 #[test]
-#[cfg(any(ossl110))]
+#[cfg(ossl110)]
 fn test_alpn_server_select_none_fatal() {
     let mut server = Server::builder();
     server.ctx().set_alpn_select_callback(|_, client| {
@@ -1023,7 +1073,9 @@
     assert!(ssl.session().is_none());
 }
 
-/// possible LibreSSL bug since 3.2.1
+/// LibreSSL 3.2.1 enabled TLSv1.3 by default for clients and sessions do
+/// not work due to lack of PSK support. The test passes with NO_TLSV1_3,
+/// but let's ignore it until LibreSSL supports it out of the box.
 #[test]
 #[cfg_attr(libressl321, ignore)]
 fn active_session() {
@@ -1081,7 +1133,9 @@
     assert!(CALLED_BACK_CLIENT.load(Ordering::SeqCst));
 }
 
-/// possible LibreSSL bug since 3.2.1
+/// LibreSSL 3.2.1 enabled TLSv1.3 by default for clients and sessions do
+/// not work due to lack of PSK support. The test passes with NO_TLSV1_3,
+/// but let's ignore it until LibreSSL supports it out of the box.
 #[test]
 #[cfg_attr(libressl321, ignore)]
 fn new_session_callback() {
@@ -1106,7 +1160,9 @@
     assert!(CALLED_BACK.load(Ordering::SeqCst));
 }
 
-/// possible LibreSSL bug since 3.2.1
+/// LibreSSL 3.2.1 enabled TLSv1.3 by default for clients and sessions do
+/// not work due to lack of PSK support. The test passes with NO_TLSV1_3,
+/// but let's ignore it until LibreSSL supports it out of the box.
 #[test]
 #[cfg_attr(libressl321, ignore)]
 fn new_session_callback_swapped_ctx() {
@@ -1568,3 +1624,64 @@
     let ssl = ssl;
     assert_eq!(5, ssl.num_tickets());
 }
+
+#[test]
+#[cfg(ossl110)]
+fn set_security_level() {
+    let mut ctx = SslContext::builder(SslMethod::tls_server()).unwrap();
+    ctx.set_security_level(3);
+    let ctx = ctx.build();
+    assert_eq!(3, ctx.security_level());
+
+    let mut ssl = Ssl::new(&ctx).unwrap();
+    ssl.set_security_level(4);
+    let ssl = ssl;
+    assert_eq!(4, ssl.security_level());
+}
+
+#[test]
+fn ssl_ctx_ex_data_leak() {
+    static DROPS: AtomicUsize = AtomicUsize::new(0);
+
+    struct DropTest;
+
+    impl Drop for DropTest {
+        fn drop(&mut self) {
+            DROPS.fetch_add(1, Ordering::Relaxed);
+        }
+    }
+
+    let idx = SslContext::new_ex_index().unwrap();
+
+    let mut ctx = SslContext::builder(SslMethod::tls()).unwrap();
+    ctx.set_ex_data(idx, DropTest);
+    ctx.set_ex_data(idx, DropTest);
+    assert_eq!(DROPS.load(Ordering::Relaxed), 1);
+
+    drop(ctx);
+    assert_eq!(DROPS.load(Ordering::Relaxed), 2);
+}
+
+#[test]
+fn ssl_ex_data_leak() {
+    static DROPS: AtomicUsize = AtomicUsize::new(0);
+
+    struct DropTest;
+
+    impl Drop for DropTest {
+        fn drop(&mut self) {
+            DROPS.fetch_add(1, Ordering::Relaxed);
+        }
+    }
+
+    let idx = Ssl::new_ex_index().unwrap();
+
+    let ctx = SslContext::builder(SslMethod::tls()).unwrap().build();
+    let mut ssl = Ssl::new(&ctx).unwrap();
+    ssl.set_ex_data(idx, DropTest);
+    ssl.set_ex_data(idx, DropTest);
+    assert_eq!(DROPS.load(Ordering::Relaxed), 1);
+
+    drop(ssl);
+    assert_eq!(DROPS.load(Ordering::Relaxed), 2);
+}
diff -Naur vendor-41.0.5/openssl/src/symm.rs vendor-41.0.7/openssl/src/symm.rs
--- vendor-41.0.5/openssl/src/symm.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/openssl/src/symm.rs	1969-12-31 19:00:00.000000000 -0500
@@ -142,7 +142,7 @@
     }
 
     /// Requires OpenSSL 1.1.0 or newer.
-    #[cfg(ossl110)]
+    #[cfg(all(ossl110, not(osslconf = "OPENSSL_NO_OCB")))]
     pub fn aes_128_ocb() -> Cipher {
         unsafe { Cipher(ffi::EVP_aes_128_ocb()) }
     }
@@ -187,7 +187,7 @@
     }
 
     /// Requires OpenSSL 1.1.0 or newer.
-    #[cfg(ossl110)]
+    #[cfg(all(ossl110, not(osslconf = "OPENSSL_NO_OCB")))]
     pub fn aes_192_ocb() -> Cipher {
         unsafe { Cipher(ffi::EVP_aes_192_ocb()) }
     }
@@ -237,7 +237,7 @@
     }
 
     /// Requires OpenSSL 1.1.0 or newer.
-    #[cfg(ossl110)]
+    #[cfg(all(ossl110, not(osslconf = "OPENSSL_NO_OCB")))]
     pub fn aes_256_ocb() -> Cipher {
         unsafe { Cipher(ffi::EVP_aes_256_ocb()) }
     }
@@ -252,12 +252,12 @@
         unsafe { Cipher(ffi::EVP_bf_ecb()) }
     }
 
-    #[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_BF")))]
+    #[cfg(not(osslconf = "OPENSSL_NO_BF"))]
     pub fn bf_cfb64() -> Cipher {
         unsafe { Cipher(ffi::EVP_bf_cfb64()) }
     }
 
-    #[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_BF")))]
+    #[cfg(not(osslconf = "OPENSSL_NO_BF"))]
     pub fn bf_ofb() -> Cipher {
         unsafe { Cipher(ffi::EVP_bf_ofb()) }
     }
@@ -278,44 +278,158 @@
         unsafe { Cipher(ffi::EVP_des_ede3_cbc()) }
     }
 
+    pub fn des_ede3_ecb() -> Cipher {
+        unsafe { Cipher(ffi::EVP_des_ede3_ecb()) }
+    }
+
     #[cfg(not(boringssl))]
     pub fn des_ede3_cfb64() -> Cipher {
         unsafe { Cipher(ffi::EVP_des_ede3_cfb64()) }
     }
 
+    #[cfg(not(boringssl))]
+    pub fn des_ede3_cfb8() -> Cipher {
+        unsafe { Cipher(ffi::EVP_des_ede3_cfb8()) }
+    }
+
+    #[cfg(not(boringssl))]
+    pub fn des_ede3_ofb() -> Cipher {
+        unsafe { Cipher(ffi::EVP_des_ede3_ofb()) }
+    }
+
     #[cfg(not(osslconf = "OPENSSL_NO_RC4"))]
     pub fn rc4() -> Cipher {
         unsafe { Cipher(ffi::EVP_rc4()) }
     }
 
+    #[cfg(not(osslconf = "OPENSSL_NO_CAMELLIA"))]
+    pub fn camellia_128_cbc() -> Cipher {
+        unsafe { Cipher(ffi::EVP_camellia_128_cbc()) }
+    }
+
+    #[cfg(not(osslconf = "OPENSSL_NO_CAMELLIA"))]
+    pub fn camellia_128_ecb() -> Cipher {
+        unsafe { Cipher(ffi::EVP_camellia_128_ecb()) }
+    }
+
+    #[cfg(not(osslconf = "OPENSSL_NO_CAMELLIA"))]
+    pub fn camellia_128_ofb() -> Cipher {
+        unsafe { Cipher(ffi::EVP_camellia_128_ofb()) }
+    }
+
+    #[cfg(not(osslconf = "OPENSSL_NO_CAMELLIA"))]
+    pub fn camellia_128_cfb128() -> Cipher {
+        unsafe { Cipher(ffi::EVP_camellia_128_cfb128()) }
+    }
+
+    #[cfg(not(osslconf = "OPENSSL_NO_CAMELLIA"))]
+    pub fn camellia_192_cbc() -> Cipher {
+        unsafe { Cipher(ffi::EVP_camellia_192_cbc()) }
+    }
+
+    #[cfg(not(osslconf = "OPENSSL_NO_CAMELLIA"))]
+    pub fn camellia_192_ecb() -> Cipher {
+        unsafe { Cipher(ffi::EVP_camellia_192_ecb()) }
+    }
+
+    #[cfg(not(osslconf = "OPENSSL_NO_CAMELLIA"))]
+    pub fn camellia_192_ofb() -> Cipher {
+        unsafe { Cipher(ffi::EVP_camellia_192_ofb()) }
+    }
+
+    #[cfg(not(osslconf = "OPENSSL_NO_CAMELLIA"))]
+    pub fn camellia_192_cfb128() -> Cipher {
+        unsafe { Cipher(ffi::EVP_camellia_192_cfb128()) }
+    }
+
+    #[cfg(not(osslconf = "OPENSSL_NO_CAMELLIA"))]
+    pub fn camellia_256_cbc() -> Cipher {
+        unsafe { Cipher(ffi::EVP_camellia_256_cbc()) }
+    }
+
+    #[cfg(not(osslconf = "OPENSSL_NO_CAMELLIA"))]
+    pub fn camellia_256_ecb() -> Cipher {
+        unsafe { Cipher(ffi::EVP_camellia_256_ecb()) }
+    }
+
+    #[cfg(not(osslconf = "OPENSSL_NO_CAMELLIA"))]
+    pub fn camellia_256_ofb() -> Cipher {
+        unsafe { Cipher(ffi::EVP_camellia_256_ofb()) }
+    }
+
+    #[cfg(not(osslconf = "OPENSSL_NO_CAMELLIA"))]
+    pub fn camellia_256_cfb128() -> Cipher {
+        unsafe { Cipher(ffi::EVP_camellia_256_cfb128()) }
+    }
+
+    #[cfg(not(osslconf = "OPENSSL_NO_CAST"))]
+    pub fn cast5_cbc() -> Cipher {
+        unsafe { Cipher(ffi::EVP_cast5_cbc()) }
+    }
+
+    #[cfg(not(osslconf = "OPENSSL_NO_CAST"))]
+    pub fn cast5_ecb() -> Cipher {
+        unsafe { Cipher(ffi::EVP_cast5_ecb()) }
+    }
+
+    #[cfg(not(osslconf = "OPENSSL_NO_CAST"))]
+    pub fn cast5_ofb() -> Cipher {
+        unsafe { Cipher(ffi::EVP_cast5_ofb()) }
+    }
+
+    #[cfg(not(osslconf = "OPENSSL_NO_CAST"))]
+    pub fn cast5_cfb64() -> Cipher {
+        unsafe { Cipher(ffi::EVP_cast5_cfb64()) }
+    }
+
     /// Requires OpenSSL 1.1.0 or newer.
-    #[cfg(all(ossl110, not(osslconf = "OPENSSL_NO_CHACHA")))]
+    #[cfg(all(any(ossl110, libressl310), not(osslconf = "OPENSSL_NO_CHACHA")))]
     pub fn chacha20() -> Cipher {
         unsafe { Cipher(ffi::EVP_chacha20()) }
     }
 
     /// Requires OpenSSL 1.1.0 or newer.
-    #[cfg(all(ossl110, not(osslconf = "OPENSSL_NO_CHACHA")))]
+    #[cfg(all(any(ossl110, libressl360), not(osslconf = "OPENSSL_NO_CHACHA")))]
     pub fn chacha20_poly1305() -> Cipher {
         unsafe { Cipher(ffi::EVP_chacha20_poly1305()) }
     }
 
-    #[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_SEED")))]
+    #[cfg(not(osslconf = "OPENSSL_NO_IDEA"))]
+    pub fn idea_cbc() -> Cipher {
+        unsafe { Cipher(ffi::EVP_idea_cbc()) }
+    }
+
+    #[cfg(not(osslconf = "OPENSSL_NO_IDEA"))]
+    pub fn idea_ecb() -> Cipher {
+        unsafe { Cipher(ffi::EVP_idea_ecb()) }
+    }
+
+    #[cfg(not(osslconf = "OPENSSL_NO_IDEA"))]
+    pub fn idea_ofb() -> Cipher {
+        unsafe { Cipher(ffi::EVP_idea_ofb()) }
+    }
+
+    #[cfg(not(osslconf = "OPENSSL_NO_IDEA"))]
+    pub fn idea_cfb64() -> Cipher {
+        unsafe { Cipher(ffi::EVP_idea_cfb64()) }
+    }
+
+    #[cfg(not(osslconf = "OPENSSL_NO_SEED"))]
     pub fn seed_cbc() -> Cipher {
         unsafe { Cipher(ffi::EVP_seed_cbc()) }
     }
 
-    #[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_SEED")))]
+    #[cfg(not(osslconf = "OPENSSL_NO_SEED"))]
     pub fn seed_cfb128() -> Cipher {
         unsafe { Cipher(ffi::EVP_seed_cfb128()) }
     }
 
-    #[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_SEED")))]
+    #[cfg(not(osslconf = "OPENSSL_NO_SEED"))]
     pub fn seed_ecb() -> Cipher {
         unsafe { Cipher(ffi::EVP_seed_ecb()) }
     }
 
-    #[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_SEED")))]
+    #[cfg(not(osslconf = "OPENSSL_NO_SEED"))]
     pub fn seed_ofb() -> Cipher {
         unsafe { Cipher(ffi::EVP_seed_ofb()) }
     }
@@ -402,14 +516,14 @@
     }
 
     /// Determines whether the cipher is using OCB mode
-    #[cfg(ossl110)]
+    #[cfg(all(ossl110, not(osslconf = "OPENSSL_NO_OCB")))]
     fn is_ocb(self) -> bool {
         self == Cipher::aes_128_ocb()
             || self == Cipher::aes_192_ocb()
             || self == Cipher::aes_256_ocb()
     }
 
-    #[cfg(not(ossl110))]
+    #[cfg(any(not(ossl110), osslconf = "OPENSSL_NO_OCB"))]
     const fn is_ocb(self) -> bool {
         false
     }
@@ -582,6 +696,27 @@
         self.ctx.cipher_update(input, Some(output))
     }
 
+    /// Feeds data from `input` through the cipher, writing encrypted/decrypted
+    /// bytes into `output`.
+    ///
+    /// The number of bytes written to `output` is returned. Note that this may
+    /// not be equal to the length of `input`.
+    ///
+    /// # Safety
+    ///
+    /// The caller must provide an `output` buffer large enough to contain
+    /// correct number of bytes. For streaming ciphers the output buffer size
+    /// should be at least as big as the input buffer. For block ciphers the
+    /// size of the output buffer depends on the state of partially updated
+    /// blocks.
+    pub unsafe fn update_unchecked(
+        &mut self,
+        input: &[u8],
+        output: &mut [u8],
+    ) -> Result<usize, ErrorStack> {
+        self.ctx.cipher_update_unchecked(input, Some(output))
+    }
+
     /// Finishes the encryption/decryption process, writing any remaining data
     /// to `output`.
     ///
@@ -1422,7 +1557,7 @@
     }
 
     #[test]
-    #[cfg(ossl110)]
+    #[cfg(all(ossl110, not(osslconf = "OPENSSL_NO_OCB")))]
     fn test_aes_128_ocb() {
         let key = "000102030405060708090a0b0c0d0e0f";
         let aad = "0001020304050607";
@@ -1458,7 +1593,7 @@
     }
 
     #[test]
-    #[cfg(ossl110)]
+    #[cfg(all(ossl110, not(osslconf = "OPENSSL_NO_OCB")))]
     fn test_aes_128_ocb_fail() {
         let key = "000102030405060708090a0b0c0d0e0f";
         let aad = "0001020304050607";
@@ -1478,7 +1613,7 @@
     }
 
     #[test]
-    #[cfg(any(ossl110))]
+    #[cfg(any(ossl110, libressl310))]
     fn test_chacha20() {
         let key = "0000000000000000000000000000000000000000000000000000000000000000";
         let iv = "00000000000000000000000000000000";
@@ -1493,7 +1628,7 @@
     }
 
     #[test]
-    #[cfg(any(ossl110))]
+    #[cfg(any(ossl110, libressl360))]
     fn test_chacha20_poly1305() {
         let key = "808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f";
         let iv = "070000004041424344454647";
@@ -1534,7 +1669,7 @@
     }
 
     #[test]
-    #[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_SEED", ossl300)))]
+    #[cfg(not(any(osslconf = "OPENSSL_NO_SEED", ossl300)))]
     fn test_seed_cbc() {
         #[cfg(ossl300)]
         let _provider = crate::provider::Provider::try_load(None, "legacy", true).unwrap();
@@ -1548,7 +1683,7 @@
     }
 
     #[test]
-    #[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_SEED", ossl300)))]
+    #[cfg(not(any(osslconf = "OPENSSL_NO_SEED", ossl300)))]
     fn test_seed_cfb128() {
         #[cfg(ossl300)]
         let _provider = crate::provider::Provider::try_load(None, "legacy", true).unwrap();
@@ -1562,7 +1697,7 @@
     }
 
     #[test]
-    #[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_SEED", ossl300)))]
+    #[cfg(not(any(osslconf = "OPENSSL_NO_SEED", ossl300)))]
     fn test_seed_ecb() {
         #[cfg(ossl300)]
         let _provider = crate::provider::Provider::try_load(None, "legacy", true).unwrap();
@@ -1576,7 +1711,7 @@
     }
 
     #[test]
-    #[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_SEED", ossl300)))]
+    #[cfg(not(any(osslconf = "OPENSSL_NO_SEED", ossl300)))]
     fn test_seed_ofb() {
         #[cfg(ossl300)]
         let _provider = crate::provider::Provider::try_load(None, "legacy", true).unwrap();
diff -Naur vendor-41.0.5/openssl/src/x509/mod.rs vendor-41.0.7/openssl/src/x509/mod.rs
--- vendor-41.0.5/openssl/src/x509/mod.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/openssl/src/x509/mod.rs	1969-12-31 19:00:00.000000000 -0500
@@ -832,7 +832,7 @@
 
 impl PartialOrd for X509 {
     fn partial_cmp(&self, other: &Self) -> Option<cmp::Ordering> {
-        X509Ref::partial_cmp(self, other)
+        Some(self.cmp(other))
     }
 }
 
@@ -1746,6 +1746,17 @@
     type Output = Stack<GeneralName>;
 }
 
+/// The CRL extension identifying how to access information and services for the issuer of the CRL
+pub enum AuthorityInformationAccess {}
+
+// SAFETY: AuthorityInformationAccess is defined to be a stack of AccessDescription in the RFC
+// and in OpenSSL.
+unsafe impl ExtensionType for AuthorityInformationAccess {
+    const NID: Nid = Nid::from_raw(ffi::NID_info_access);
+
+    type Output = Stack<AccessDescription>;
+}
+
 foreign_type_and_impl_send_sync! {
     type CType = ffi::X509_CRL;
     fn drop = ffi::X509_CRL_free;
@@ -1915,6 +1926,36 @@
     {
         unsafe { cvt_n(ffi::X509_CRL_verify(self.as_ptr(), key.as_ptr())).map(|n| n != 0) }
     }
+
+    /// Get the criticality and value of an extension.
+    ///
+    /// This returns None if the extension is not present or occurs multiple times.
+    #[corresponds(X509_CRL_get_ext_d2i)]
+    pub fn extension<T: ExtensionType>(&self) -> Result<Option<(bool, T::Output)>, ErrorStack> {
+        let mut critical = -1;
+        let out = unsafe {
+            // SAFETY: self.as_ptr() is a valid pointer to an X509_CRL.
+            let ext = ffi::X509_CRL_get_ext_d2i(
+                self.as_ptr(),
+                T::NID.as_raw(),
+                &mut critical as *mut _,
+                ptr::null_mut(),
+            );
+            // SAFETY: Extensions's contract promises that the type returned by
+            // OpenSSL here is T::Output.
+            T::Output::from_ptr_opt(ext as *mut _)
+        };
+        match (critical, out) {
+            (0, Some(out)) => Ok(Some((false, out))),
+            (1, Some(out)) => Ok(Some((true, out))),
+            // -1 means the extension wasn't found, -2 means multiple were found.
+            (-1 | -2, _) => Ok(None),
+            // A critical value of 0 or 1 suggests success, but a null pointer
+            // was returned so something went wrong.
+            (0 | 1, None) => Err(ErrorStack::get()),
+            (c_int::MIN..=-2 | 2.., _) => panic!("OpenSSL should only return -2, -1, 0, or 1 for an extension's criticality but it returned {}", critical),
+        }
+    }
 }
 
 /// The result of peer certificate verification.
@@ -2102,6 +2143,7 @@
             let ptr = ASN1_STRING_get0_data(d as *mut _);
             let len = ffi::ASN1_STRING_length(d as *mut _);
 
+            #[allow(clippy::unnecessary_cast)]
             let slice = slice::from_raw_parts(ptr as *const u8, len as usize);
             // IA5Strings are stated to be ASCII (specifically IA5). Hopefully
             // OpenSSL checks that when loading a certificate but if not we'll
@@ -2155,6 +2197,7 @@
             let ptr = ASN1_STRING_get0_data(d as *mut _);
             let len = ffi::ASN1_STRING_length(d as *mut _);
 
+            #[allow(clippy::unnecessary_cast)]
             Some(slice::from_raw_parts(ptr as *const u8, len as usize))
         }
     }
@@ -2457,6 +2500,8 @@
     pub const ANY: X509PurposeId = X509PurposeId(ffi::X509_PURPOSE_ANY);
     pub const OCSP_HELPER: X509PurposeId = X509PurposeId(ffi::X509_PURPOSE_OCSP_HELPER);
     pub const TIMESTAMP_SIGN: X509PurposeId = X509PurposeId(ffi::X509_PURPOSE_TIMESTAMP_SIGN);
+    #[cfg(ossl320)]
+    pub const CODE_SIGN: X509PurposeId = X509PurposeId(ffi::X509_PURPOSE_CODE_SIGN);
 
     /// Constructs an `X509PurposeId` from a raw OpenSSL value.
     pub fn from_raw(id: c_int) -> Self {
diff -Naur vendor-41.0.5/openssl/src/x509/store.rs vendor-41.0.7/openssl/src/x509/store.rs
--- vendor-41.0.5/openssl/src/x509/store.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/openssl/src/x509/store.rs	1969-12-31 19:00:00.000000000 -0500
@@ -42,12 +42,14 @@
 //! ```
 
 use cfg_if::cfg_if;
-use foreign_types::ForeignTypeRef;
+use foreign_types::{ForeignType, ForeignTypeRef};
 use std::mem;
 
 use crate::error::ErrorStack;
 #[cfg(not(boringssl))]
 use crate::ssl::SslFiletype;
+#[cfg(ossl300)]
+use crate::stack::Stack;
 use crate::stack::StackRef;
 #[cfg(any(ossl102, libressl261))]
 use crate::x509::verify::{X509VerifyFlags, X509VerifyParamRef};
@@ -260,10 +262,24 @@
 
 impl X509StoreRef {
     /// Get a reference to the cache of certificates in this store.
+    ///
+    /// This method is deprecated. It is **unsound** and will be removed in a
+    /// future version of rust-openssl. `X509StoreRef::all_certificates`
+    /// should be used instead.
+    #[deprecated(
+        note = "This method is unsound, and will be removed in a future version of rust-openssl. X509StoreRef::all_certificates should be used instead."
+    )]
     #[corresponds(X509_STORE_get0_objects)]
     pub fn objects(&self) -> &StackRef<X509Object> {
         unsafe { StackRef::from_ptr(X509_STORE_get0_objects(self.as_ptr())) }
     }
+
+    /// Returns a stack of all the certificates in this store.
+    #[corresponds(X509_STORE_get1_all_certs)]
+    #[cfg(ossl300)]
+    pub fn all_certificates(&self) -> Stack<X509> {
+        unsafe { Stack::from_ptr(ffi::X509_STORE_get1_all_certs(self.as_ptr())) }
+    }
 }
 
 cfg_if! {
diff -Naur vendor-41.0.5/openssl/src/x509/tests.rs vendor-41.0.7/openssl/src/x509/tests.rs
--- vendor-41.0.5/openssl/src/x509/tests.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/openssl/src/x509/tests.rs	1969-12-31 19:00:00.000000000 -0500
@@ -34,7 +34,7 @@
 #[cfg(any(ossl102, libressl261))]
 use libc::time_t;
 
-use super::{CertificateIssuer, ReasonCode};
+use super::{AuthorityInformationAccess, CertificateIssuer, ReasonCode};
 
 fn pkey() -> PKey<Private> {
     let rsa = Rsa::generate(2048).unwrap();
@@ -701,6 +701,24 @@
     let crl = include_bytes!("../../test/entry_extensions.crl");
     let crl = X509Crl::from_pem(crl).unwrap();
 
+    let (critical, access_info) = crl
+        .extension::<AuthorityInformationAccess>()
+        .unwrap()
+        .expect("Authority Information Access extension should be present");
+    assert!(
+        !critical,
+        "Authority Information Access extension is not critical"
+    );
+    assert_eq!(
+        access_info.len(),
+        1,
+        "Authority Information Access should have one entry"
+    );
+    assert_eq!(access_info[0].method().to_string(), "CA Issuers");
+    assert_eq!(
+        access_info[0].location().uri(),
+        Some("http://www.example.com/ca.crt")
+    );
     let revoked_certs = crl.get_revoked().unwrap();
     let entry = &revoked_certs[0];
 
@@ -1159,3 +1177,18 @@
     let cert = X509::from_pem(cert).unwrap();
     assert!(cert.crl_distribution_points().is_none());
 }
+
+#[test]
+#[cfg(ossl300)]
+fn test_store_all_certificates() {
+    let cert = include_bytes!("../../test/cert.pem");
+    let cert = X509::from_pem(cert).unwrap();
+
+    let store = {
+        let mut b = X509StoreBuilder::new().unwrap();
+        b.add_cert(cert).unwrap();
+        b.build()
+    };
+
+    assert_eq!(store.all_certificates().len(), 1);
+}
diff -Naur vendor-41.0.5/openssl/src/x509/verify.rs vendor-41.0.7/openssl/src/x509/verify.rs
--- vendor-41.0.5/openssl/src/x509/verify.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/openssl/src/x509/verify.rs	1969-12-31 19:00:00.000000000 -0500
@@ -11,6 +11,8 @@
 
 bitflags! {
     /// Flags used to check an `X509` certificate.
+    #[derive(Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
+    #[repr(transparent)]
     pub struct X509CheckFlags: c_uint {
         const ALWAYS_CHECK_SUBJECT = ffi::X509_CHECK_FLAG_ALWAYS_CHECK_SUBJECT;
         const NO_WILDCARDS = ffi::X509_CHECK_FLAG_NO_WILDCARDS;
@@ -28,6 +30,8 @@
 
 bitflags! {
     /// Flags used to verify an `X509` certificate chain.
+    #[derive(Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
+    #[repr(transparent)]
     pub struct X509VerifyFlags: c_ulong {
         const CB_ISSUER_CHECK = ffi::X509_V_FLAG_CB_ISSUER_CHECK;
         const USE_CHECK_TIME = ffi::X509_V_FLAG_USE_CHECK_TIME;
@@ -87,14 +91,20 @@
     #[corresponds(X509_VERIFY_PARAM_set_hostflags)]
     pub fn set_hostflags(&mut self, hostflags: X509CheckFlags) {
         unsafe {
-            ffi::X509_VERIFY_PARAM_set_hostflags(self.as_ptr(), hostflags.bits);
+            ffi::X509_VERIFY_PARAM_set_hostflags(self.as_ptr(), hostflags.bits());
         }
     }
 
     /// Set verification flags.
     #[corresponds(X509_VERIFY_PARAM_set_flags)]
     pub fn set_flags(&mut self, flags: X509VerifyFlags) -> Result<(), ErrorStack> {
-        unsafe { cvt(ffi::X509_VERIFY_PARAM_set_flags(self.as_ptr(), flags.bits)).map(|_| ()) }
+        unsafe {
+            cvt(ffi::X509_VERIFY_PARAM_set_flags(
+                self.as_ptr(),
+                flags.bits(),
+            ))
+            .map(|_| ())
+        }
     }
 
     /// Clear verification flags.
@@ -103,7 +113,7 @@
         unsafe {
             cvt(ffi::X509_VERIFY_PARAM_clear_flags(
                 self.as_ptr(),
-                flags.bits,
+                flags.bits(),
             ))
             .map(|_| ())
         }
@@ -113,20 +123,37 @@
     #[corresponds(X509_VERIFY_PARAM_get_flags)]
     pub fn flags(&mut self) -> X509VerifyFlags {
         let bits = unsafe { ffi::X509_VERIFY_PARAM_get_flags(self.as_ptr()) };
-        X509VerifyFlags { bits }
+        X509VerifyFlags::from_bits_retain(bits)
     }
 
     /// Set the expected DNS hostname.
     #[corresponds(X509_VERIFY_PARAM_set1_host)]
     pub fn set_host(&mut self, host: &str) -> Result<(), ErrorStack> {
         unsafe {
+            // len == 0 means "run strlen" :(
+            let raw_host = if host.is_empty() { "\0" } else { host };
             cvt(ffi::X509_VERIFY_PARAM_set1_host(
                 self.as_ptr(),
-                host.as_ptr() as *const _,
+                raw_host.as_ptr() as *const _,
                 host.len(),
             ))
             .map(|_| ())
         }
+    }
+
+    /// Set the expected email address.
+    #[corresponds(X509_VERIFY_PARAM_set1_email)]
+    pub fn set_email(&mut self, email: &str) -> Result<(), ErrorStack> {
+        unsafe {
+            // len == 0 means "run strlen" :(
+            let raw_email = if email.is_empty() { "\0" } else { email };
+            cvt(ffi::X509_VERIFY_PARAM_set1_email(
+                self.as_ptr(),
+                raw_email.as_ptr() as *const _,
+                email.len(),
+            ))
+            .map(|_| ())
+        }
     }
 
     /// Set the expected IPv4 or IPv6 address.
diff -Naur vendor-41.0.5/openssl/test/entry_extensions.crl vendor-41.0.7/openssl/test/entry_extensions.crl
--- vendor-41.0.5/openssl/test/entry_extensions.crl	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/openssl/test/entry_extensions.crl	1969-12-31 19:00:00.000000000 -0500
@@ -1,10 +1,11 @@
 -----BEGIN X509 CRL-----
-MIIBXDCCAQICAQEwCgYIKoZIzj0EAwIwETEPMA0GA1UEAwwGQ1JMIENBFw0yMzAz
-MjgwOTQ5MThaFw0yMzA0MDQwOTUwMDdaMIGAMH4CFE+Y95/1pOqa6c9fUEJ8c04k
-xu2PFw0yMzAzMjgwOTQ3MzNaMFcwLwYDVR0dAQH/BCUwI6QhMB8xCzAJBgNVBAYT
-AkdCMRAwDgYDVQQDDAdUZXN0IENBMAoGA1UdFQQDCgEBMBgGA1UdGAQRGA8yMDIz
-MDMyODA5NDQ0MFqgPTA7MB8GA1UdIwQYMBaAFNX1GZ0RWuC+4gz1wuy5H32T2W+R
-MAoGA1UdFAQDAgEUMAwGA1UdHAQFMAOEAf8wCgYIKoZIzj0EAwIDSAAwRQIgbl7x
-W+WVAb+zlvKcJLmHVuC+gbqR4jqwGIHHgQl2J8kCIQCo/sAF5sDqy/cL+fbzBeUe
-YoY2h6lIkj9ENwU8ZCt03w==
+MIIBojCCAUkCAQEwCgYIKoZIzj0EAwIwHTEbMBkGA1UEAwwSY3J5cHRvZ3JhcGh5
+LmlvIENBFw0yMzA3MjUxNDA1MzlaFw0yMzA4MDExNDA1MzlaMIGAMH4CFE+Y95/1
+pOqa6c9fUEJ8c04kxu2PFw0yMzA3MjUxNDA1MzlaMFcwLwYDVR0dAQH/BCUwI6Qh
+MB8xCzAJBgNVBAYTAkdCMRAwDgYDVQQDDAdUZXN0IENBMAoGA1UdFQQDCgEBMBgG
+A1UdGAQRGA8yMDIzMDcyNTE0MDUzOVqgeDB2MB8GA1UdIwQYMBaAFK6qKNgsGefh
+XexO9WsIwiQ/73R8MAoGA1UdFAQDAgEUMAwGA1UdHAQFMAOEAf8wOQYIKwYBBQUH
+AQEELTArMCkGCCsGAQUFBzAChh1odHRwOi8vd3d3LmV4YW1wbGUuY29tL2NhLmNy
+dDAKBggqhkjOPQQDAgNHADBEAiB22SXxFnQUB41uxfyCvg2dAs2nFiR0r8jft/cd
+G8zcKAIgeYkNOzRn4lyopK6J94rhm8jIIuJRj3Ns9XcH+91N370=
 -----END X509 CRL-----
diff -Naur vendor-41.0.5/openssl-sys/build/cfgs.rs vendor-41.0.7/openssl-sys/build/cfgs.rs
--- vendor-41.0.5/openssl-sys/build/cfgs.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/openssl-sys/build/cfgs.rs	1969-12-31 19:00:00.000000000 -0500
@@ -1,3 +1,4 @@
+#[allow(clippy::unusual_byte_groupings)]
 pub fn get(openssl_version: Option<u64>, libressl_version: Option<u64>) -> Vec<&'static str> {
     let mut cfgs = vec![];
 
@@ -52,9 +53,21 @@
         if libressl_version >= 0x3_07_00_00_0 {
             cfgs.push("libressl370");
         }
+        if libressl_version >= 0x3_08_00_00_0 {
+            cfgs.push("libressl380");
+        }
+        if libressl_version >= 0x3_08_01_00_0 {
+            cfgs.push("libressl381");
+        }
+        if libressl_version >= 0x3_08_02_00_0 {
+            cfgs.push("libressl382");
+        }
     } else {
         let openssl_version = openssl_version.unwrap();
 
+        if openssl_version >= 0x3_02_00_00_0 {
+            cfgs.push("ossl320");
+        }
         if openssl_version >= 0x3_00_00_00_0 {
             cfgs.push("ossl300");
         }
diff -Naur vendor-41.0.5/openssl-sys/build/expando.c vendor-41.0.7/openssl-sys/build/expando.c
--- vendor-41.0.5/openssl-sys/build/expando.c	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/openssl-sys/build/expando.c	1969-12-31 19:00:00.000000000 -0500
@@ -75,6 +75,10 @@
 RUST_CONF_OPENSSL_NO_OCSP
 #endif
 
+#ifdef OPENSSL_NO_OCB
+RUST_CONF_OPENSSL_NO_OCB
+#endif
+
 #ifdef OPENSSL_NO_PSK
 RUST_CONF_OPENSSL_NO_PSK
 #endif
@@ -107,6 +111,10 @@
 RUST_CONF_OPENSSL_NO_TLSEXT
 #endif
 
+#ifdef OPENSSL_NO_SOCK
+RUST_CONF_OPENSSL_NO_SOCK
+#endif
+
 #ifdef OPENSSL_NO_STDIO
 RUST_CONF_OPENSSL_NO_STDIO
 #endif
@@ -126,3 +134,7 @@
 #ifdef OPENSSL_NO_SEED
 RUST_CONF_OPENSSL_NO_SEED
 #endif
+
+#ifdef OPENSSL_NO_SCRYPT
+RUST_CONF_OPENSSL_NO_SCRYPT
+#endif
diff -Naur vendor-41.0.5/openssl-sys/build/find_normal.rs vendor-41.0.7/openssl-sys/build/find_normal.rs
--- vendor-41.0.5/openssl-sys/build/find_normal.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/openssl-sys/build/find_normal.rs	1969-12-31 19:00:00.000000000 -0500
@@ -92,8 +92,8 @@
     try_pkg_config();
     try_vcpkg();
 
-    // FreeBSD ships with OpenSSL but doesn't include a pkg-config file :(
-    if host == target && target.contains("freebsd") {
+    // FreeBSD and OpenBSD ship with Libre|OpenSSL but don't include a pkg-config file
+    if host == target && (target.contains("freebsd") || target.contains("openbsd")) {
         return OsString::from("/usr");
     }
 
@@ -198,13 +198,11 @@
     let target = env::var("TARGET").unwrap();
     let host = env::var("HOST").unwrap();
 
-    // If we're going to windows-gnu we can use pkg-config, but only so long as
-    // we're coming from a windows host.
-    //
-    // Otherwise if we're going to windows we probably can't use pkg-config.
+    // FIXME we really shouldn't be automatically enabling this
     if target.contains("windows-gnu") && host.contains("windows") {
         env::set_var("PKG_CONFIG_ALLOW_CROSS", "1");
-    } else if target.contains("windows") {
+    } else if target.contains("windows-msvc") {
+        // MSVC targets use vcpkg instead.
         return;
     }
 
@@ -232,8 +230,12 @@
 ///
 /// Note that if this succeeds then the function does not return as vcpkg
 /// should emit all of the cargo metadata that we need.
-#[cfg(target_env = "msvc")]
 fn try_vcpkg() {
+    let target = env::var("TARGET").unwrap();
+    if !target.contains("windows") {
+        return;
+    }
+
     // vcpkg will not emit any metadata if it can not find libraries
     // appropriate for the target triple with the desired linkage.
 
@@ -257,9 +259,6 @@
     process::exit(0);
 }
 
-#[cfg(not(target_env = "msvc"))]
-fn try_vcpkg() {}
-
 fn execute_command_and_get_output(cmd: &str, args: &[&str]) -> Option<String> {
     let out = Command::new(cmd).args(args).output();
     if let Ok(ref r1) = out {
diff -Naur vendor-41.0.5/openssl-sys/build/main.rs vendor-41.0.7/openssl-sys/build/main.rs
--- vendor-41.0.5/openssl-sys/build/main.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/openssl-sys/build/main.rs	1969-12-31 19:00:00.000000000 -0500
@@ -1,16 +1,9 @@
-#![allow(
-    clippy::inconsistent_digit_grouping,
-    clippy::uninlined_format_args,
-    clippy::unusual_byte_groupings
-)]
-
 #[cfg(feature = "bindgen")]
 extern crate bindgen;
 extern crate cc;
 #[cfg(feature = "vendored")]
 extern crate openssl_src;
 extern crate pkg_config;
-#[cfg(target_env = "msvc")]
 extern crate vcpkg;
 
 use std::collections::HashSet;
@@ -67,6 +60,14 @@
     if cfg!(feature = "unstable_boringssl") {
         println!("cargo:rustc-cfg=boringssl");
         println!("cargo:boringssl=true");
+
+        if let Ok(vars) = env::var("DEP_BSSL_CONF") {
+            for var in vars.split(',') {
+                println!("cargo:rustc-cfg=osslconf=\"{}\"", var);
+            }
+            println!("cargo:conf={}", vars);
+        }
+
         // BoringSSL does not have any build logic, exit early
         std::process::exit(0);
     }
@@ -122,6 +123,16 @@
         println!("cargo:rustc-link-lib={}={}", kind, lib);
     }
 
+    // https://github.com/openssl/openssl/pull/15086
+    if version == Version::Openssl3xx
+        && kind == "static"
+        && (env::var("CARGO_CFG_TARGET_OS").unwrap() == "linux"
+            || env::var("CARGO_CFG_TARGET_OS").unwrap() == "android")
+        && env::var("CARGO_CFG_TARGET_POINTER_WIDTH").unwrap() == "32"
+    {
+        println!("cargo:rustc-link-lib=dylib=atomic");
+    }
+
     if kind == "static" && target.contains("windows") {
         println!("cargo:rustc-link-lib=dylib=gdi32");
         println!("cargo:rustc-link-lib=dylib=user32");
@@ -131,7 +142,6 @@
     }
 }
 
-#[allow(clippy::let_and_return)]
 fn postprocess(include_dirs: &[PathBuf]) -> Version {
     let version = validate_headers(include_dirs);
 
@@ -146,7 +156,7 @@
 
 /// Validates the header files found in `include_dir` and then returns the
 /// version string of OpenSSL.
-#[allow(clippy::manual_strip)] // we need to support pre-1.45.0
+#[allow(clippy::unusual_byte_groupings)]
 fn validate_headers(include_dirs: &[PathBuf]) -> Version {
     // This `*-sys` crate only works with OpenSSL 1.0.1, 1.0.2, 1.1.0, 1.1.1 and 3.0.0.
     // To correctly expose the right API from this crate, take a look at
@@ -162,9 +172,7 @@
     // account for compile differences and such.
     println!("cargo:rerun-if-changed=build/expando.c");
     let mut gcc = cc::Build::new();
-    for include_dir in include_dirs {
-        gcc.include(include_dir);
-    }
+    gcc.includes(include_dirs);
     let expanded = match gcc.file("build/expando.c").try_expand() {
         Ok(expanded) => expanded,
         Err(e) => {
@@ -210,22 +218,24 @@
         let libressl_prefix = "RUST_VERSION_LIBRESSL_";
         let boringsl_prefix = "RUST_OPENSSL_IS_BORINGSSL";
         let conf_prefix = "RUST_CONF_";
-        if line.starts_with(openssl_prefix) {
-            let version = &line[openssl_prefix.len()..];
+        if let Some(version) = line.strip_prefix(openssl_prefix) {
             openssl_version = Some(parse_version(version));
-        } else if line.starts_with(new_openssl_prefix) {
-            let version = &line[new_openssl_prefix.len()..];
+        } else if let Some(version) = line.strip_prefix(new_openssl_prefix) {
             openssl_version = Some(parse_new_version(version));
-        } else if line.starts_with(libressl_prefix) {
-            let version = &line[libressl_prefix.len()..];
+        } else if let Some(version) = line.strip_prefix(libressl_prefix) {
             libressl_version = Some(parse_version(version));
-        } else if line.starts_with(conf_prefix) {
-            enabled.push(&line[conf_prefix.len()..]);
+        } else if let Some(conf) = line.strip_prefix(conf_prefix) {
+            enabled.push(conf);
         } else if line.starts_with(boringsl_prefix) {
             is_boringssl = true;
         }
     }
 
+    for enabled in &enabled {
+        println!("cargo:rustc-cfg=osslconf=\"{}\"", enabled);
+    }
+    println!("cargo:conf={}", enabled.join(","));
+
     if is_boringssl {
         println!("cargo:rustc-cfg=boringssl");
         println!("cargo:boringssl=true");
@@ -236,11 +246,6 @@
     // We set this for any non-BoringSSL lib.
     println!("cargo:rustc-cfg=openssl");
 
-    for enabled in &enabled {
-        println!("cargo:rustc-cfg=osslconf=\"{}\"", enabled);
-    }
-    println!("cargo:conf={}", enabled.join(","));
-
     for cfg in cfgs::get(openssl_version, libressl_version) {
         println!("cargo:rustc-cfg={}", cfg);
     }
@@ -286,6 +291,8 @@
             (3, 7, 1) => ('3', '7', '1'),
             (3, 7, _) => ('3', '7', 'x'),
             (3, 8, 0) => ('3', '8', '0'),
+            (3, 8, 1) => ('3', '8', '1'),
+            (3, 8, _) => ('3', '8', 'x'),
             _ => version_error(),
         };
 
@@ -327,8 +334,8 @@
     panic!(
         "
 
-This crate is only compatible with OpenSSL (version 1.0.1 through 1.1.1, or 3.0.0), or LibreSSL 2.5
-through 3.8.0, but a different version of OpenSSL was found. The build is now aborting
+This crate is only compatible with OpenSSL (version 1.0.1 through 1.1.1, or 3), or LibreSSL 2.5
+through 3.8.1, but a different version of OpenSSL was found. The build is now aborting
 due to this version mismatch.
 
 "
@@ -336,18 +343,13 @@
 }
 
 // parses a string that looks like "0x100020cfL"
-#[allow(deprecated)] // trim_right_matches is now trim_end_matches
-#[allow(clippy::match_like_matches_macro)] // matches macro requires rust 1.42.0
 fn parse_version(version: &str) -> u64 {
     // cut off the 0x prefix
     assert!(version.starts_with("0x"));
     let version = &version[2..];
 
     // and the type specifier suffix
-    let version = version.trim_right_matches(|c: char| match c {
-        '0'..='9' | 'a'..='f' | 'A'..='F' => false,
-        _ => true,
-    });
+    let version = version.trim_end_matches(|c: char| !c.is_ascii_hexdigit());
 
     u64::from_str_radix(version, 16).unwrap()
 }
diff -Naur vendor-41.0.5/openssl-sys/build/run_bindgen.rs vendor-41.0.7/openssl-sys/build/run_bindgen.rs
--- vendor-41.0.5/openssl-sys/build/run_bindgen.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/openssl-sys/build/run_bindgen.rs	1969-12-31 19:00:00.000000000 -0500
@@ -55,6 +55,10 @@
 #if OPENSSL_VERSION_NUMBER >= 0x30000000
 #include <openssl/provider.h>
 #endif
+
+#if defined(LIBRESSL_VERSION_NUMBER) || defined(OPENSSL_IS_BORINGSSL)
+#include <openssl/poly1305.h>
+#endif
 ";
 
 #[cfg(feature = "bindgen")]
@@ -110,11 +114,15 @@
     let mut builder = bindgen::builder()
         .rust_target(RustTarget::Stable_1_47)
         .ctypes_prefix("::libc")
+        .raw_line("use libc::*;")
         .derive_default(false)
         .enable_function_attribute_detection()
         .default_macro_constant_type(MacroTypeVariation::Signed)
         .rustified_enum("point_conversion_form_t")
         .allowlist_file(".*/openssl/[^/]+\\.h")
+        .allowlist_recursively(false)
+        .blocklist_function("BIO_vsnprintf")
+        .blocklist_function("OPENSSL_vasprintf")
         .wrap_static_fns(true)
         .wrap_static_fns_path(out_dir.join("boring_static_wrapper").display().to_string())
         .layout_tests(false)
@@ -163,13 +171,19 @@
     bindgen_cmd
         .arg("-o")
         .arg(out_dir.join("bindgen.rs"))
+        // Must be a valid version from
+        // https://docs.rs/bindgen/latest/bindgen/enum.RustTarget.html
         .arg("--rust-target=1.47")
         .arg("--ctypes-prefix=::libc")
+        .arg("--raw-line=use libc::*;")
         .arg("--no-derive-default")
         .arg("--enable-function-attribute-detection")
         .arg("--default-macro-constant-type=signed")
         .arg("--rustified-enum=point_conversion_form_t")
         .arg("--allowlist-file=.*/openssl/[^/]+\\.h")
+        .arg("--no-recursive-allowlist")
+        .arg("--blocklist-function=BIO_vsnprintf")
+        .arg("--blocklist-function=OPENSSL_vasprintf")
         .arg("--experimental")
         .arg("--wrap-static-fns")
         .arg("--wrap-static-fns-path")
diff -Naur vendor-41.0.5/openssl-sys/.cargo-checksum.json vendor-41.0.7/openssl-sys/.cargo-checksum.json
--- vendor-41.0.5/openssl-sys/.cargo-checksum.json	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/openssl-sys/.cargo-checksum.json	1969-12-31 19:00:00.000000000 -0500
@@ -1 +1 @@
-{"files":{"CHANGELOG.md":"033ce31a3dd7e5b90c09ee0f57860824b3e273d5d345618a8180e430ae848631","Cargo.toml":"d2775f2f1a98a1ef68feb5307a7a8e1d6784affe0a28089a5d81b909144a9b99","LICENSE-MIT":"378f5840b258e2779c39418f3f2d7b2ba96f1c7917dd6be0713f88305dbda397","README.md":"c5ddde25c2756a1115daaa671fb4297cdc83bf23009c8356ba65b5311d0dd30d","build/cfgs.rs":"0aab581ec2744ec709069a1c513e629067d082dcae3b54a3f695551f86ff5142","build/expando.c":"2d9ca60c44dd23004803d0b01893062e37308fc3719df147d173849ff10ea19e","build/find_normal.rs":"1f9233e5993c3537767d39b66fa5a43f5268a9bf89b70884886652cfa7e869c6","build/find_vendored.rs":"4907761e6bc1115f5081dd4c42aa1df6ec7db3cc8b6e2a46071631c23125fe15","build/main.rs":"c79393c31b6e0d9a9bafec2875dde2e4274ef8afc8d926a3e3addde4eb7e11c0","build/run_bindgen.rs":"403035f425f3fb5d0de49f3b4ed1a2761b54770d4fe765e0023fcd9395ee99ae","src/aes.rs":"e744b2d608216fb98d365dced84e044951939b6e1868ab52226bf0eeaac3c0f5","src/asn1.rs":"88ce843ffd803b9c6768869d179ddc38b8c1225b092272fdfddd9bd1bdcb3c44","src/bio.rs":"35a5bfd4f38302f3ea47a70d80889280f4f0ae2e3e119082d21322a27c4bb48e","src/bn.rs":"d1b7578c0ec448e3f8ebe68d5048f2761e46715619d81173a5aa89205b9ba8b2","src/cms.rs":"6dbd69d39da588ece53fabdb3a1e2136602eb24ed26106f59c8b852bce0d1a84","src/crypto.rs":"7aee1518a591e4d8b4049c0d5dadf28987dded69cccc17a9cf5a8808c6261d0c","src/dtls1.rs":"0477022d5bcf2b7a620c70ece4da08a2958be3eca5a57127c89d79525c692ebd","src/ec.rs":"2fa5d9a495bc80bf583064c2a0671e13051da2e11bfd725accf2f32e1dabfb0b","src/err.rs":"2eb2bba43e6fc607d7e9cc99c26dfb006a425e647e9bdd1a0b28c014e1363b67","src/evp.rs":"65d06efce8e3d65f3253635f8da3725649117beb22ef280e2c47fef7d462c9f8","src/handwritten/aes.rs":"31d07045f63d7ea88d1d182487f6cbd42a613119bed32f12affef37bcba26879","src/handwritten/asn1.rs":"218fd7b3f14a374f7585ed665a68a240a4e3f2422b809255770bc0412c5c9924","src/handwritten/bio.rs":"137b2cc9f618bd47b96411e0a46e317f8b9aa7b1a37a8b9fb7fe5fd0392c3ebe","src/handwritten/bn.rs":"6be05ce72fa9b27a48443cab46690ffe7f91be6781c1c451615dc3ad44ce5a07","src/handwritten/cmac.rs":"0ec98c75d6f3d5b097a435a651af101f0e6bde003d0913f62009aff1f51c1f0c","src/handwritten/cms.rs":"2aeff50ca7061f8cba7d0cf9d5da7e17e38909aff0295e5b6301aaa7655c5bfd","src/handwritten/conf.rs":"56835aece385e1093665684fa65b7ade778e3f244e1cc9254d75aa6258eef6b2","src/handwritten/crypto.rs":"910fcf6df345e6bdc43e79088f2eb18bd9b8461a786eee38c7799b9d6ecf9fd4","src/handwritten/dh.rs":"496e92aa7a2843b8c0279ea9bab2f7d9a1e5b73c057f77da6af88c902b7af47b","src/handwritten/dsa.rs":"69da4a548c4bcde09cf1b7ca9d0fb20185fd95d1728638a3efcaf7e4c25fc0e4","src/handwritten/ec.rs":"edc3259e9b3530b5b6f3f3e744dc3497d3287f3493b9b59a8f010cfbb6d16f2c","src/handwritten/err.rs":"391a867241db4656411b3da5cc8b30ab23dcc9e928a290f6f215caeeb498403d","src/handwritten/evp.rs":"9966968d7654593e99bd5c309832387a849b8f90ebbdf549acc0a84b3ff1325a","src/handwritten/hmac.rs":"f31cb39769625adb3bcaf5689a0666801ebea4bf5383077b1e76747451a4d07b","src/handwritten/kdf.rs":"bf4ed9a10d8cbeacbdb7a738c76b1a26885e4aa87758879f217a273a5172607a","src/handwritten/mod.rs":"1d2e226965588f2d992d55fe42e63772ee0c117605cd503b287792465f891530","src/handwritten/object.rs":"3a91e4b03fa4f84b5211cddd5a02cc908ccf9ea5f4413d8ef2c503884592f368","src/handwritten/ocsp.rs":"27979cc0439dff61f4c21c68e3d585c0221bd025425ff9bc181c8e870d44f1a7","src/handwritten/pem.rs":"1d04f7b600f7422a24e81705d8f9467fdf63a5fa4c61468178da4b71c85ea429","src/handwritten/pkcs12.rs":"65534ca2844850576e08113990be3a3241ac54c486c48ceae77b382a657facc0","src/handwritten/pkcs7.rs":"9614eb04fdaa430f219cb13df116d6874cb8ca7d6a88ff66d0f6f649670221c2","src/handwritten/provider.rs":"86d1dbfd1147fcd3bb7ecde52c5b694e7beb599cd5a26754c5af1b179b170f5d","src/handwritten/rand.rs":"c771057f37c64406aa750f36397fa877caf330a8c725e49356c7081c2b2fdd67","src/handwritten/rsa.rs":"64c34e9d207bb562514e6b7fa9892777b2fb1df32a49d4672bf4eb33345a6e30","src/handwritten/safestack.rs":"6c39e28565d34efad707d77561d4caa99e3f028fcac3a2ef6fd403a78de1190c","src/handwritten/sha.rs":"7107e2e7e09e9f8b10433b0005a3f4aafead896d7d35949b607dc42b76e24d44","src/handwritten/srtp.rs":"0e9693c840c696cb31774c35c5af55f197de675a6c7e3326a19d7c79958f1e78","src/handwritten/ssl.rs":"4a6cf88e588484bc2d00aece0c090368e3d09bba9242718831ef92fb2970e8cf","src/handwritten/stack.rs":"1a509907283e5a2bf88cf193ce607f49ce7d2d95547c2ce2abc0fd4567aad334","src/handwritten/tls1.rs":"eccb78cf777389a975ec79d5efa634a44802fc963a6a392888640c1cfb00da11","src/handwritten/types.rs":"e6cf9d5b025e88f35c42b53fe037a52270a6e67da3b9eb0c55783410c0f4ed71","src/handwritten/x509.rs":"a0585f54dacd4ba9abc971ad99dab30979e16d4baa23aeac0c6c6b58d7ce487f","src/handwritten/x509_vfy.rs":"4da8c57787ecc69fd73719c22c48d0e9493a8a0903aca9f6b4c9f9ad290a9ac7","src/handwritten/x509v3.rs":"1c9093371a096b6dd639d092a8bf3f5d7a64b9af7206272d8ca796d61a6b9031","src/lib.rs":"589aca0d79ae9b447019938f61ce0f55124e435bf606399768e3bf8f238f5893","src/macros.rs":"270fa673eba5497b52bd62159e604773dc767cd4536a2377b24ce35cabf680a6","src/obj_mac.rs":"66efc299822c0ea18b38caa7de2ea02b1eb7374f240d5a34e0f4877a5146eeb8","src/ocsp.rs":"63c9ce598f67eb0bb162d4c8d78cb5049c53c4baa41988328b42f7b1bd982ac8","src/pem.rs":"3a0197173331d8b6143d8036a6b121e6b59cac260107d8f42f9b1a1a3426d6fe","src/pkcs7.rs":"f77db0a26e5546d752001701ea43cd55a0c1f7c317425e1f7529ff92590c5076","src/rsa.rs":"a255b57723b8c3dcd125eb5d7fd69e897687f3de6d95833f73cd909e82b35e75","src/sha.rs":"a5c50aee5fe7a9ba6287129836fce23b9cb35b18de331778d4edbf500b1163b7","src/srtp.rs":"2829d69f64a7c64635340b5e8db48af1d32678b42e7c3b8266c29e26f5b83838","src/ssl.rs":"d938dcf47286ba4b9c814d1415a8823e89e0f814645123348a04683462412ff0","src/ssl3.rs":"9336c816e00847d552dea22587d4ac72ff3cbd469fa5ff750423a19ea11e68eb","src/tls1.rs":"a60a545a4bc60aaa976cf4304cc892e7b2060e120748670ef14e89a50c6a771b","src/types.rs":"e201d386731c7d20ee827acab33d10d0fe8aa65559f3e61efbf465e468fb34eb","src/x509.rs":"3193e9e0de000571468ec7467887ed931fede88de54584f8823a789fdb1edd58","src/x509_vfy.rs":"eb4a8f36623bafc40ccba26ba3eada5c57fd1f4e780bfc0e6210e4d772ce09fc","src/x509v3.rs":"3c8f029433724a31d10c7b55e0940f10f4aaeb7b5b63232f19bc04808f3312d1"},"package":"c2ce0f250f34a308dcfdbb351f511359857d4ed2134ba715a4eadd46e1ffd617"}
\ No newline at end of file
+{"files":{"CHANGELOG.md":"b6ad5835dd7622263e75408a03db3f7191ab23e4ba3cb07cc879a836bf09d235","Cargo.toml":"67875b23ef6065c7de91d3747f225a1051269ade6f1fda4849fe6d67611f352b","LICENSE-MIT":"378f5840b258e2779c39418f3f2d7b2ba96f1c7917dd6be0713f88305dbda397","README.md":"c5ddde25c2756a1115daaa671fb4297cdc83bf23009c8356ba65b5311d0dd30d","build/cfgs.rs":"5f93ab4f03d3d1463f15984769988f4ce8f0a76ad84f2650ec1d1126598d63fb","build/expando.c":"70183c7062c6bf4808376e9e9ef81ee76eface58616bbeea2abf7cd1bbda50ba","build/find_normal.rs":"b2cbaa5bfac5e7d5550aa0eb8e5c65a9f7e86a3692b759fb13330ef6e3b26b30","build/find_vendored.rs":"4907761e6bc1115f5081dd4c42aa1df6ec7db3cc8b6e2a46071631c23125fe15","build/main.rs":"3a9d3ba268fe346f5a3406f8ad1a28e65a774f0dfb84c52ebcad7fe3a8b77989","build/run_bindgen.rs":"cf484c616eb768185a6155c91c81b7e3243e7e3df7222a62eab90981b7664438","src/aes.rs":"e744b2d608216fb98d365dced84e044951939b6e1868ab52226bf0eeaac3c0f5","src/asn1.rs":"88ce843ffd803b9c6768869d179ddc38b8c1225b092272fdfddd9bd1bdcb3c44","src/bio.rs":"35a5bfd4f38302f3ea47a70d80889280f4f0ae2e3e119082d21322a27c4bb48e","src/bn.rs":"d1b7578c0ec448e3f8ebe68d5048f2761e46715619d81173a5aa89205b9ba8b2","src/cms.rs":"6dbd69d39da588ece53fabdb3a1e2136602eb24ed26106f59c8b852bce0d1a84","src/crypto.rs":"10b73c19f9a8b7383f5337397e00723090de01b20478011df8421d901f653e42","src/dtls1.rs":"0477022d5bcf2b7a620c70ece4da08a2958be3eca5a57127c89d79525c692ebd","src/ec.rs":"2fa5d9a495bc80bf583064c2a0671e13051da2e11bfd725accf2f32e1dabfb0b","src/err.rs":"2eb2bba43e6fc607d7e9cc99c26dfb006a425e647e9bdd1a0b28c014e1363b67","src/evp.rs":"4b23453d673e7d347c0e4ec093380a90ce115a17ec4d960cead0fd263ad7876d","src/handwritten/aes.rs":"31d07045f63d7ea88d1d182487f6cbd42a613119bed32f12affef37bcba26879","src/handwritten/asn1.rs":"218fd7b3f14a374f7585ed665a68a240a4e3f2422b809255770bc0412c5c9924","src/handwritten/bio.rs":"5c969104d8211533f356d058310e7e7e69243343e93b508ccb1419ecd4d28a85","src/handwritten/bn.rs":"ee4370b17e313996f63e0d525caab3271cb6c489ac055b54feb73a207a19f7c2","src/handwritten/cmac.rs":"0ec98c75d6f3d5b097a435a651af101f0e6bde003d0913f62009aff1f51c1f0c","src/handwritten/cms.rs":"2aeff50ca7061f8cba7d0cf9d5da7e17e38909aff0295e5b6301aaa7655c5bfd","src/handwritten/conf.rs":"56835aece385e1093665684fa65b7ade778e3f244e1cc9254d75aa6258eef6b2","src/handwritten/crypto.rs":"910fcf6df345e6bdc43e79088f2eb18bd9b8461a786eee38c7799b9d6ecf9fd4","src/handwritten/dh.rs":"d062c91151f3687186c642d709957a2dca6440f95200b8b9e4e4a91c8d425008","src/handwritten/dsa.rs":"69da4a548c4bcde09cf1b7ca9d0fb20185fd95d1728638a3efcaf7e4c25fc0e4","src/handwritten/ec.rs":"46ce0880b27ce5d1f7df28ab464cdef144028c9b32477d95d499f1e54ebc44fc","src/handwritten/err.rs":"391a867241db4656411b3da5cc8b30ab23dcc9e928a290f6f215caeeb498403d","src/handwritten/evp.rs":"4e5231760631a7feed49940085d0c4a46fa3ee6b4febe8a218ae06283e3de99e","src/handwritten/hmac.rs":"f31cb39769625adb3bcaf5689a0666801ebea4bf5383077b1e76747451a4d07b","src/handwritten/kdf.rs":"bf4ed9a10d8cbeacbdb7a738c76b1a26885e4aa87758879f217a273a5172607a","src/handwritten/mod.rs":"c8a231ff482a427b0d988f04420ba4d57467d13eb17fc23986e1e5b70052ce91","src/handwritten/object.rs":"3a91e4b03fa4f84b5211cddd5a02cc908ccf9ea5f4413d8ef2c503884592f368","src/handwritten/ocsp.rs":"27979cc0439dff61f4c21c68e3d585c0221bd025425ff9bc181c8e870d44f1a7","src/handwritten/pem.rs":"1d04f7b600f7422a24e81705d8f9467fdf63a5fa4c61468178da4b71c85ea429","src/handwritten/pkcs12.rs":"65534ca2844850576e08113990be3a3241ac54c486c48ceae77b382a657facc0","src/handwritten/pkcs7.rs":"9614eb04fdaa430f219cb13df116d6874cb8ca7d6a88ff66d0f6f649670221c2","src/handwritten/poly1305.rs":"3c96081a77ea69441d572a4845d2fccb0bb17dc31006bc936f96e8531e6caa4c","src/handwritten/provider.rs":"86d1dbfd1147fcd3bb7ecde52c5b694e7beb599cd5a26754c5af1b179b170f5d","src/handwritten/rand.rs":"c771057f37c64406aa750f36397fa877caf330a8c725e49356c7081c2b2fdd67","src/handwritten/rsa.rs":"64c34e9d207bb562514e6b7fa9892777b2fb1df32a49d4672bf4eb33345a6e30","src/handwritten/safestack.rs":"6c39e28565d34efad707d77561d4caa99e3f028fcac3a2ef6fd403a78de1190c","src/handwritten/sha.rs":"7107e2e7e09e9f8b10433b0005a3f4aafead896d7d35949b607dc42b76e24d44","src/handwritten/srtp.rs":"0e9693c840c696cb31774c35c5af55f197de675a6c7e3326a19d7c79958f1e78","src/handwritten/ssl.rs":"9fe0318be8c780fda95e01d9012125f8d190f6765e6bada7b82880d982618a08","src/handwritten/stack.rs":"1a509907283e5a2bf88cf193ce607f49ce7d2d95547c2ce2abc0fd4567aad334","src/handwritten/tls1.rs":"eccb78cf777389a975ec79d5efa634a44802fc963a6a392888640c1cfb00da11","src/handwritten/types.rs":"d4836cd6e2523f97ccd383db5261924fe6d01d1ac3ac67b83a981c5199d1be06","src/handwritten/x509.rs":"9dd08b3125c48e0a287d8743e3ed830c11cac34c2755ef685916617e25ef5a90","src/handwritten/x509_vfy.rs":"f97861f4ce0a20942eae43b852fe73fd0f3a279035c7884eb5853b9e2d890c82","src/handwritten/x509v3.rs":"94270dab5ab0b792e4f712a238bb9004a60c48e269ccf170045e6d762bdc3c6d","src/lib.rs":"b9ba62ea8fd44f47a38b02f952f02b415450f6491363201f871ce6b590f50345","src/macros.rs":"270fa673eba5497b52bd62159e604773dc767cd4536a2377b24ce35cabf680a6","src/obj_mac.rs":"2a02eb89e6eae62c5313173130359d736a5567cc76efec8114d98e1d7f137587","src/ocsp.rs":"63c9ce598f67eb0bb162d4c8d78cb5049c53c4baa41988328b42f7b1bd982ac8","src/pem.rs":"3a0197173331d8b6143d8036a6b121e6b59cac260107d8f42f9b1a1a3426d6fe","src/pkcs7.rs":"f77db0a26e5546d752001701ea43cd55a0c1f7c317425e1f7529ff92590c5076","src/rsa.rs":"8ac9c7a88687ecc8035d56e57c69ba400b3779fd434993c9f53b3e26acd928f0","src/sha.rs":"a5c50aee5fe7a9ba6287129836fce23b9cb35b18de331778d4edbf500b1163b7","src/srtp.rs":"2829d69f64a7c64635340b5e8db48af1d32678b42e7c3b8266c29e26f5b83838","src/ssl.rs":"618ee2f5ce58583d7f4b645701da2748ca41e3b1b624137cd8cf5584c6486dbd","src/ssl3.rs":"9336c816e00847d552dea22587d4ac72ff3cbd469fa5ff750423a19ea11e68eb","src/tls1.rs":"a60a545a4bc60aaa976cf4304cc892e7b2060e120748670ef14e89a50c6a771b","src/types.rs":"e201d386731c7d20ee827acab33d10d0fe8aa65559f3e61efbf465e468fb34eb","src/x509.rs":"3193e9e0de000571468ec7467887ed931fede88de54584f8823a789fdb1edd58","src/x509_vfy.rs":"eb4a8f36623bafc40ccba26ba3eada5c57fd1f4e780bfc0e6210e4d772ce09fc","src/x509v3.rs":"bbaca7754f6a5f587f2213204eeaa10ea1afddc3c837b3cf7a6da915d2413742"},"package":"3812c071ba60da8b5677cc12bcb1d42989a65553772897a7e0355545a819838f"}
\ No newline at end of file
diff -Naur vendor-41.0.5/openssl-sys/Cargo.toml vendor-41.0.7/openssl-sys/Cargo.toml
--- vendor-41.0.5/openssl-sys/Cargo.toml	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/openssl-sys/Cargo.toml	1969-12-31 19:00:00.000000000 -0500
@@ -12,7 +12,7 @@
 [package]
 edition = "2018"
 name = "openssl-sys"
-version = "0.9.88"
+version = "0.9.96"
 authors = [
     "Alex Crichton <alex@alexcrichton.com>",
     "Steven Fackler <sfackler@gmail.com>",
@@ -47,15 +47,16 @@
 version = "1.0.61"
 
 [build-dependencies.openssl-src]
-version = "111"
+version = "300.1.2"
+features = ["legacy"]
 optional = true
 
 [build-dependencies.pkg-config]
 version = "0.3.9"
 
+[build-dependencies.vcpkg]
+version = "0.2.8"
+
 [features]
 unstable_boringssl = ["bssl-sys"]
 vendored = ["openssl-src"]
-
-[target."cfg(target_env = \"msvc\")".build-dependencies.vcpkg]
-version = "0.2.8"
diff -Naur vendor-41.0.5/openssl-sys/CHANGELOG.md vendor-41.0.7/openssl-sys/CHANGELOG.md
--- vendor-41.0.5/openssl-sys/CHANGELOG.md	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/openssl-sys/CHANGELOG.md	1969-12-31 19:00:00.000000000 -0500
@@ -2,6 +2,93 @@
 
 ## [Unreleased]
 
+## [v0.9.96] - 2023-11-22
+
+### Changed
+
+* `EVP_chacha20` is now available on LibreSSL
+
+### Added
+
+* Added `EVP_des_ede3_ecb`, `EVP_des_ede3_cfb8`, `EVP_des_ede3_ofb`, `EVP_camellia_128_ofb`, `EVP_camellia_192_ofb`, `EVP_camellia_256_ofb`, `EVP_cast5_ofb`, `EVP_idea_ofb`
+* Added `X509_STORE_get1_all_certs`
+* Added `SSL_CTRL_GET_PEER_TMP_KEY`, `SSL_CTRL_GET_TMP_KEY`, `SSL_get_peer_tmp_key`, `SSL_get_tmp_key`
+
+## [v0.9.95] - 2023-11-03
+
+### Changed
+
+* Fixed the availability of `EVP_PKEY_RSA_PSS` on OpenSSL
+
+### Added
+
+* Added support for LibreSSL 3.8.x.
+* Added `NID_chacha20_poly1305`
+
+## [v0.9.94] - 2023-11-01
+
+### Changed
+
+* `X509_ALGOR` is now opaque on new LibreSSL releases
+
+### Added
+
+* Added support for building with `OPENSSL_NO_SCRYPT`
+* Added `EVP_PKEY_RSA_PSS` and `EVP_PKEY_DHX`
+* Functions and constants for using HKDF `EVP_PKEY` are now available on LibreSSL.
+* Added `SSL_CTX_set_security_level`, `SSL_set_security_level`, `SSL_CTX_get_security_level`, `SSL_get_security_level`
+* Added `X509_check_host`, `X509_check_email`, `X509_check_ip`, `X509_check_ip_asc`
+
+## [v0.9.93] - 2023-09-04
+
+### Changed
+
+* The `vendored` Cargo feature now builds OpenSSL 3.1, as 1.1.1 is reaching its EOL.
+
+### Added
+
+* Added support for LibreSSL 3.8.1.
+
+## [v0.9.92] - 2023-08-27
+
+### Added
+
+* Added `EVP_CIPHER_CTX_copy`
+* Expose `EVP_chacha20_poly1305` on LibreSSL
+* Added `X509_VERIFY_PARAM_set1_email`
+
+## [v0.9.91] - 2023-08-06
+
+### Added
+
+* Expose `poly1305_state`, `CRYPTO_poly1305_init`, `CRYPTO_poly1305_update`, and `CRYPTO_poly1305_finish` on BoringSSL and LibreSSL.
+* Fix detection of libraries on OpenBSD.
+* Added `EC_POINT_point2hex` and `EC_POINT_hex2point`.
+* Added `EVP_PKEY_verify_recover_init`, `EVP_PKEY_verify_recover`, and `EVP_PKEY_CTX_set_signature_md`.
+* Added `EVP_CIPHER_CTX_FLAG_WRAP_ALLOW` and `EVP_CTX_set_flags`.
+* Added `BN_mod_sqrt`.
+
+## [v0.9.90] - 2023-06-20
+
+### Fixed
+
+* Fixed compilation with BoringSSL when building with the bindgen CLI.
+
+## [v0.9.89] - 2023-06-20
+
+### Fixed
+
+* Fixed compilation with recent versions of BoringSSL.
+
+### Added
+
+* Added support for detecting OpenSSL compiled with `OPENSSL_NO_OCB`.
+* Added `EVP_PKEY_SM2` and `NID_sm2`.
+* Added `EVP_PKEY_assign_RSA`, `EVP_PKEY_assign_DSA`, `EVP_PKEY_assign_DH`, and `EVP_PKEY_assign_EC_KEY`.
+* Added `EC_GROUP_get_asn1_flag`.
+* Expose `EC_POINT_get_affine_coordinates` on BoringSSL and LibreSSL.
+* Added `EVP_PKEY_derive_set_peer_ex`.
+
 ## [v0.9.88] - 2023-05-30
 
 ### Added
@@ -458,7 +545,15 @@
 * Added `X509_verify` and `X509_REQ_verify`.
 * Added `EVP_MD_type` and `EVP_GROUP_get_curve_name`.
 
-[Unreleased]: https://github.com/sfackler/rust-openssl/compare/openssl-sys-v0.9.88..master
+[Unreleased]: https://github.com/sfackler/rust-openssl/compare/openssl-sys-v0.9.96..master
+[v0.9.96]: https://github.com/sfackler/rust-openssl/compare/openssl-sys-v0.9.95...openssl-sys-v0.9.96
+[v0.9.95]: https://github.com/sfackler/rust-openssl/compare/openssl-sys-v0.9.94...openssl-sys-v0.9.95
+[v0.9.94]: https://github.com/sfackler/rust-openssl/compare/openssl-sys-v0.9.93...openssl-sys-v0.9.94
+[v0.9.93]: https://github.com/sfackler/rust-openssl/compare/openssl-sys-v0.9.92...openssl-sys-v0.9.93
+[v0.9.92]: https://github.com/sfackler/rust-openssl/compare/openssl-sys-v0.9.91...openssl-sys-v0.9.92
+[v0.9.91]: https://github.com/sfackler/rust-openssl/compare/openssl-sys-v0.9.90...openssl-sys-v0.9.91
+[v0.9.90]: https://github.com/sfackler/rust-openssl/compare/openssl-sys-v0.9.89...openssl-sys-v0.9.90
+[v0.9.89]: https://github.com/sfackler/rust-openssl/compare/openssl-sys-v0.9.88...openssl-sys-v0.9.89
 [v0.9.88]: https://github.com/sfackler/rust-openssl/compare/openssl-sys-v0.9.87...openssl-sys-v0.9.88
 [v0.9.87]: https://github.com/sfackler/rust-openssl/compare/openssl-sys-v0.9.86...openssl-sys-v0.9.87
 [v0.9.86]: https://github.com/sfackler/rust-openssl/compare/openssl-sys-v0.9.85...openssl-sys-v0.9.86
diff -Naur vendor-41.0.5/openssl-sys/src/crypto.rs vendor-41.0.7/openssl-sys/src/crypto.rs
--- vendor-41.0.5/openssl-sys/src/crypto.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/openssl-sys/src/crypto.rs	1969-12-31 19:00:00.000000000 -0500
@@ -106,7 +106,7 @@
 pub const CRYPTO_LOCK_SSL_SESSION: c_int = 14;
 
 cfg_if! {
-    if #[cfg(ossl110)] {
+    if #[cfg(any(ossl110, libressl381))] {
         pub const CRYPTO_EX_INDEX_SSL: c_int = 0;
         pub const CRYPTO_EX_INDEX_SSL_CTX: c_int = 1;
     } else if #[cfg(libressl)] {
diff -Naur vendor-41.0.5/openssl-sys/src/evp.rs vendor-41.0.7/openssl-sys/src/evp.rs
--- vendor-41.0.5/openssl-sys/src/evp.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/openssl-sys/src/evp.rs	1969-12-31 19:00:00.000000000 -0500
@@ -7,9 +7,15 @@
 pub const PKCS12_DEFAULT_ITER: c_int = 2048;
 
 pub const EVP_PKEY_RSA: c_int = NID_rsaEncryption;
+#[cfg(any(ossl111, libressl310, boringssl))]
+pub const EVP_PKEY_RSA_PSS: c_int = NID_rsassaPss;
 pub const EVP_PKEY_DSA: c_int = NID_dsa;
 pub const EVP_PKEY_DH: c_int = NID_dhKeyAgreement;
+#[cfg(ossl110)]
+pub const EVP_PKEY_DHX: c_int = NID_dhpublicnumber;
 pub const EVP_PKEY_EC: c_int = NID_X9_62_id_ecPublicKey;
+#[cfg(ossl111)]
+pub const EVP_PKEY_SM2: c_int = NID_sm2;
 #[cfg(any(ossl111, libressl370))]
 pub const EVP_PKEY_X25519: c_int = NID_X25519;
 #[cfg(any(ossl111, libressl370))]
@@ -22,9 +28,12 @@
 pub const EVP_PKEY_CMAC: c_int = NID_cmac;
 #[cfg(ossl111)]
 pub const EVP_PKEY_POLY1305: c_int = NID_poly1305;
-#[cfg(ossl110)]
+#[cfg(any(ossl110, libressl360))]
 pub const EVP_PKEY_HKDF: c_int = NID_hkdf;
 
+#[cfg(ossl102)]
+pub const EVP_CIPHER_CTX_FLAG_WRAP_ALLOW: c_int = 0x1;
+
 pub const EVP_CTRL_GCM_SET_IVLEN: c_int = 0x9;
 pub const EVP_CTRL_GCM_GET_TAG: c_int = 0x10;
 pub const EVP_CTRL_GCM_SET_TAG: c_int = 0x11;
@@ -184,37 +193,39 @@
 
 pub const EVP_PKEY_OP_TYPE_CRYPT: c_int = EVP_PKEY_OP_ENCRYPT | EVP_PKEY_OP_DECRYPT;
 
+pub const EVP_PKEY_CTRL_MD: c_int = 1;
+
 pub const EVP_PKEY_CTRL_SET_MAC_KEY: c_int = 6;
 
 pub const EVP_PKEY_CTRL_CIPHER: c_int = 12;
 
 pub const EVP_PKEY_ALG_CTRL: c_int = 0x1000;
 
-#[cfg(ossl111)]
+#[cfg(any(ossl111, libressl360))]
 pub const EVP_PKEY_HKDEF_MODE_EXTRACT_AND_EXPAND: c_int = 0;
 
-#[cfg(ossl111)]
+#[cfg(any(ossl111, libressl360))]
 pub const EVP_PKEY_HKDEF_MODE_EXTRACT_ONLY: c_int = 1;
 
-#[cfg(ossl111)]
+#[cfg(any(ossl111, libressl360))]
 pub const EVP_PKEY_HKDEF_MODE_EXPAND_ONLY: c_int = 2;
 
-#[cfg(ossl110)]
+#[cfg(any(ossl110, libressl360))]
 pub const EVP_PKEY_CTRL_HKDF_MD: c_int = EVP_PKEY_ALG_CTRL + 3;
 
-#[cfg(ossl110)]
+#[cfg(any(ossl110, libressl360))]
 pub const EVP_PKEY_CTRL_HKDF_SALT: c_int = EVP_PKEY_ALG_CTRL + 4;
 
-#[cfg(ossl110)]
+#[cfg(any(ossl110, libressl360))]
 pub const EVP_PKEY_CTRL_HKDF_KEY: c_int = EVP_PKEY_ALG_CTRL + 5;
 
-#[cfg(ossl110)]
+#[cfg(any(ossl110, libressl360))]
 pub const EVP_PKEY_CTRL_HKDF_INFO: c_int = EVP_PKEY_ALG_CTRL + 6;
 
-#[cfg(ossl111)]
+#[cfg(any(ossl111, libressl360))]
 pub const EVP_PKEY_CTRL_HKDF_MODE: c_int = EVP_PKEY_ALG_CTRL + 7;
 
-#[cfg(all(ossl111, not(ossl300)))]
+#[cfg(any(all(ossl111, not(ossl300)), libressl360))]
 pub unsafe fn EVP_PKEY_CTX_set_hkdf_mode(ctx: *mut EVP_PKEY_CTX, mode: c_int) -> c_int {
     EVP_PKEY_CTX_ctrl(
         ctx,
@@ -226,7 +237,7 @@
     )
 }
 
-#[cfg(all(ossl110, not(ossl300)))]
+#[cfg(any(all(ossl110, not(ossl300)), libressl360))]
 pub unsafe fn EVP_PKEY_CTX_set_hkdf_md(ctx: *mut EVP_PKEY_CTX, md: *const EVP_MD) -> c_int {
     EVP_PKEY_CTX_ctrl(
         ctx,
@@ -238,7 +249,7 @@
     )
 }
 
-#[cfg(all(ossl110, not(ossl300)))]
+#[cfg(any(all(ossl110, not(ossl300)), libressl360))]
 pub unsafe fn EVP_PKEY_CTX_set1_hkdf_salt(
     ctx: *mut EVP_PKEY_CTX,
     salt: *const u8,
@@ -254,7 +265,7 @@
     )
 }
 
-#[cfg(all(ossl110, not(ossl300)))]
+#[cfg(any(all(ossl110, not(ossl300)), libressl360))]
 pub unsafe fn EVP_PKEY_CTX_set1_hkdf_key(
     ctx: *mut EVP_PKEY_CTX,
     key: *const u8,
@@ -270,7 +281,7 @@
     )
 }
 
-#[cfg(all(ossl110, not(ossl300)))]
+#[cfg(any(all(ossl110, not(ossl300)), libressl360))]
 pub unsafe fn EVP_PKEY_CTX_add1_hkdf_info(
     ctx: *mut EVP_PKEY_CTX,
     info: *const u8,
@@ -285,3 +296,31 @@
         info as *mut c_void,
     )
 }
+
+#[cfg(all(not(ossl300), not(boringssl)))]
+pub unsafe fn EVP_PKEY_CTX_set_signature_md(cxt: *mut EVP_PKEY_CTX, md: *mut EVP_MD) -> c_int {
+    EVP_PKEY_CTX_ctrl(
+        cxt,
+        -1,
+        EVP_PKEY_OP_TYPE_SIG,
+        EVP_PKEY_CTRL_MD,
+        0,
+        md as *mut c_void,
+    )
+}
+
+pub unsafe fn EVP_PKEY_assign_RSA(pkey: *mut EVP_PKEY, rsa: *mut RSA) -> c_int {
+    EVP_PKEY_assign(pkey, EVP_PKEY_RSA, rsa as *mut c_void)
+}
+
+pub unsafe fn EVP_PKEY_assign_DSA(pkey: *mut EVP_PKEY, dsa: *mut DSA) -> c_int {
+    EVP_PKEY_assign(pkey, EVP_PKEY_DSA, dsa as *mut c_void)
+}
+
+pub unsafe fn EVP_PKEY_assign_DH(pkey: *mut EVP_PKEY, dh: *mut DH) -> c_int {
+    EVP_PKEY_assign(pkey, EVP_PKEY_DH, dh as *mut c_void)
+}
+
+pub unsafe fn EVP_PKEY_assign_EC_KEY(pkey: *mut EVP_PKEY, ec_key: *mut EC_KEY) -> c_int {
+    EVP_PKEY_assign(pkey, EVP_PKEY_EC, ec_key as *mut c_void)
+}
diff -Naur vendor-41.0.5/openssl-sys/src/handwritten/bio.rs vendor-41.0.7/openssl-sys/src/handwritten/bio.rs
--- vendor-41.0.5/openssl-sys/src/handwritten/bio.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/openssl-sys/src/handwritten/bio.rs	1969-12-31 19:00:00.000000000 -0500
@@ -58,6 +58,7 @@
 }
 
 extern "C" {
+    #[cfg(not(osslconf = "OPENSSL_NO_SOCK"))]
     pub fn BIO_new_socket(sock: c_int, close_flag: c_int) -> *mut BIO;
 
     #[cfg(any(ossl110, libressl273))]
diff -Naur vendor-41.0.5/openssl-sys/src/handwritten/bn.rs vendor-41.0.7/openssl-sys/src/handwritten/bn.rs
--- vendor-41.0.5/openssl-sys/src/handwritten/bn.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/openssl-sys/src/handwritten/bn.rs	1969-12-31 19:00:00.000000000 -0500
@@ -32,6 +32,8 @@
     pub fn BN_set_negative(bn: *mut BIGNUM, n: c_int);
     #[cfg(any(ossl110, libressl350))]
     pub fn BN_is_negative(b: *const BIGNUM) -> c_int;
+    #[cfg(any(ossl110, libressl350))]
+    pub fn BN_is_odd(b: *const BIGNUM) -> c_int;
 
     pub fn BN_div(
         dv: *mut BIGNUM,
@@ -73,6 +75,12 @@
         m: *const BIGNUM,
         ctx: *mut BN_CTX,
     ) -> c_int;
+    pub fn BN_mod_sqrt(
+        ret: *mut BIGNUM,
+        a: *const BIGNUM,
+        p: *const BIGNUM,
+        ctx: *mut BN_CTX,
+    ) -> *mut BIGNUM;
 
     pub fn BN_mod_word(r: *const BIGNUM, w: BN_ULONG) -> BN_ULONG;
     pub fn BN_div_word(r: *mut BIGNUM, w: BN_ULONG) -> BN_ULONG;
diff -Naur vendor-41.0.5/openssl-sys/src/handwritten/dh.rs vendor-41.0.7/openssl-sys/src/handwritten/dh.rs
--- vendor-41.0.5/openssl-sys/src/handwritten/dh.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/openssl-sys/src/handwritten/dh.rs	1969-12-31 19:00:00.000000000 -0500
@@ -5,6 +5,7 @@
     pub fn DH_free(dh: *mut DH);
     pub fn DH_check(dh: *const DH, codes: *mut c_int) -> c_int;
 
+    #[cfg(not(libressl382))]
     pub fn DH_generate_parameters(
         prime_len: c_int,
         generator: c_int,
diff -Naur vendor-41.0.5/openssl-sys/src/handwritten/ec.rs vendor-41.0.7/openssl-sys/src/handwritten/ec.rs
--- vendor-41.0.5/openssl-sys/src/handwritten/ec.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/openssl-sys/src/handwritten/ec.rs	1969-12-31 19:00:00.000000000 -0500
@@ -46,6 +46,8 @@
 
     pub fn EC_GROUP_set_asn1_flag(key: *mut EC_GROUP, flag: c_int);
 
+    pub fn EC_GROUP_get_asn1_flag(group: *const EC_GROUP) -> c_int;
+
     pub fn EC_GROUP_get_curve_GFp(
         group: *const EC_GROUP,
         p: *mut BIGNUM,
@@ -99,7 +101,7 @@
 
     pub fn EC_POINT_dup(p: *const EC_POINT, group: *const EC_GROUP) -> *mut EC_POINT;
 
-    #[cfg(ossl111)]
+    #[cfg(any(ossl111, boringssl, libressl350))]
     pub fn EC_POINT_get_affine_coordinates(
         group: *const EC_GROUP,
         p: *const EC_POINT,
@@ -150,6 +152,20 @@
         ctx: *mut BN_CTX,
     ) -> c_int;
 
+    pub fn EC_POINT_point2hex(
+        group: *const EC_GROUP,
+        p: *const EC_POINT,
+        form: point_conversion_form_t,
+        ctx: *mut BN_CTX,
+    ) -> *mut c_char;
+
+    pub fn EC_POINT_hex2point(
+        group: *const EC_GROUP,
+        s: *const c_char,
+        p: *mut EC_POINT,
+        ctx: *mut BN_CTX,
+    ) -> *mut EC_POINT;
+
     pub fn EC_POINT_add(
         group: *const EC_GROUP,
         r: *mut EC_POINT,
diff -Naur vendor-41.0.5/openssl-sys/src/handwritten/evp.rs vendor-41.0.7/openssl-sys/src/handwritten/evp.rs
--- vendor-41.0.5/openssl-sys/src/handwritten/evp.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/openssl-sys/src/handwritten/evp.rs	1969-12-31 19:00:00.000000000 -0500
@@ -52,7 +52,7 @@
 }
 
 cfg_if! {
-    if #[cfg(ossl110)] {
+    if #[cfg(any(ossl110, libressl382))] {
         extern "C" {
             pub fn EVP_MD_CTX_new() -> *mut EVP_MD_CTX;
             pub fn EVP_MD_CTX_free(ctx: *mut EVP_MD_CTX);
@@ -271,6 +271,8 @@
 extern "C" {
     pub fn EVP_CIPHER_CTX_new() -> *mut EVP_CIPHER_CTX;
     pub fn EVP_CIPHER_CTX_free(ctx: *mut EVP_CIPHER_CTX);
+    pub fn EVP_CIPHER_CTX_copy(dst: *mut EVP_CIPHER_CTX, src: *const EVP_CIPHER_CTX) -> c_int;
+
     pub fn EVP_MD_CTX_copy_ex(dst: *mut EVP_MD_CTX, src: *const EVP_MD_CTX) -> c_int;
     #[cfg(ossl111)]
     pub fn EVP_MD_CTX_reset(ctx: *mut EVP_MD_CTX) -> c_int;
@@ -283,6 +285,7 @@
         ptr: *mut c_void,
     ) -> c_int;
     pub fn EVP_CIPHER_CTX_rand_key(ctx: *mut EVP_CIPHER_CTX, key: *mut c_uchar) -> c_int;
+    pub fn EVP_CIPHER_CTX_set_flags(ctx: *mut EVP_CIPHER_CTX, flags: c_int);
 
     pub fn EVP_md_null() -> *const EVP_MD;
     pub fn EVP_md5() -> *const EVP_MD;
@@ -291,13 +294,13 @@
     pub fn EVP_sha256() -> *const EVP_MD;
     pub fn EVP_sha384() -> *const EVP_MD;
     pub fn EVP_sha512() -> *const EVP_MD;
-    #[cfg(ossl111)]
+    #[cfg(any(ossl111, libressl380))]
     pub fn EVP_sha3_224() -> *const EVP_MD;
-    #[cfg(ossl111)]
+    #[cfg(any(ossl111, libressl380))]
     pub fn EVP_sha3_256() -> *const EVP_MD;
-    #[cfg(ossl111)]
+    #[cfg(any(ossl111, libressl380))]
     pub fn EVP_sha3_384() -> *const EVP_MD;
-    #[cfg(ossl111)]
+    #[cfg(any(ossl111, libressl380))]
     pub fn EVP_sha3_512() -> *const EVP_MD;
     #[cfg(ossl111)]
     pub fn EVP_shake128() -> *const EVP_MD;
@@ -309,7 +312,10 @@
     pub fn EVP_des_ecb() -> *const EVP_CIPHER;
     pub fn EVP_des_ede3() -> *const EVP_CIPHER;
     pub fn EVP_des_ede3_cbc() -> *const EVP_CIPHER;
+    pub fn EVP_des_ede3_ecb() -> *const EVP_CIPHER;
     pub fn EVP_des_ede3_cfb64() -> *const EVP_CIPHER;
+    pub fn EVP_des_ede3_cfb8() -> *const EVP_CIPHER;
+    pub fn EVP_des_ede3_ofb() -> *const EVP_CIPHER;
     pub fn EVP_des_cbc() -> *const EVP_CIPHER;
     #[cfg(not(osslconf = "OPENSSL_NO_RC4"))]
     pub fn EVP_rc4() -> *const EVP_CIPHER;
@@ -329,6 +335,10 @@
     pub fn EVP_aes_128_ofb() -> *const EVP_CIPHER;
     #[cfg(ossl110)]
     pub fn EVP_aes_128_ocb() -> *const EVP_CIPHER;
+    #[cfg(ossl102)]
+    pub fn EVP_aes_128_wrap() -> *const EVP_CIPHER;
+    #[cfg(ossl110)]
+    pub fn EVP_aes_128_wrap_pad() -> *const EVP_CIPHER;
     pub fn EVP_aes_192_ecb() -> *const EVP_CIPHER;
     pub fn EVP_aes_192_cbc() -> *const EVP_CIPHER;
     pub fn EVP_aes_192_cfb1() -> *const EVP_CIPHER;
@@ -340,6 +350,10 @@
     pub fn EVP_aes_192_ofb() -> *const EVP_CIPHER;
     #[cfg(ossl110)]
     pub fn EVP_aes_192_ocb() -> *const EVP_CIPHER;
+    #[cfg(ossl102)]
+    pub fn EVP_aes_192_wrap() -> *const EVP_CIPHER;
+    #[cfg(ossl110)]
+    pub fn EVP_aes_192_wrap_pad() -> *const EVP_CIPHER;
     pub fn EVP_aes_256_ecb() -> *const EVP_CIPHER;
     pub fn EVP_aes_256_cbc() -> *const EVP_CIPHER;
     pub fn EVP_aes_256_cfb1() -> *const EVP_CIPHER;
@@ -352,9 +366,13 @@
     pub fn EVP_aes_256_ofb() -> *const EVP_CIPHER;
     #[cfg(ossl110)]
     pub fn EVP_aes_256_ocb() -> *const EVP_CIPHER;
-    #[cfg(all(ossl110, not(osslconf = "OPENSSL_NO_CHACHA")))]
+    #[cfg(ossl102)]
+    pub fn EVP_aes_256_wrap() -> *const EVP_CIPHER;
+    #[cfg(ossl110)]
+    pub fn EVP_aes_256_wrap_pad() -> *const EVP_CIPHER;
+    #[cfg(all(any(ossl110, libressl310), not(osslconf = "OPENSSL_NO_CHACHA")))]
     pub fn EVP_chacha20() -> *const EVP_CIPHER;
-    #[cfg(all(ossl110, not(osslconf = "OPENSSL_NO_CHACHA")))]
+    #[cfg(all(any(ossl110, libressl360), not(osslconf = "OPENSSL_NO_CHACHA")))]
     pub fn EVP_chacha20_poly1305() -> *const EVP_CIPHER;
     #[cfg(not(osslconf = "OPENSSL_NO_SEED"))]
     pub fn EVP_seed_cbc() -> *const EVP_CIPHER;
@@ -376,28 +394,48 @@
     #[cfg(all(any(ossl111, libressl291), not(osslconf = "OPENSSL_NO_SM4")))]
     pub fn EVP_sm4_ctr() -> *const EVP_CIPHER;
 
-    #[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAMELLIA")))]
+    #[cfg(not(osslconf = "OPENSSL_NO_CAMELLIA"))]
     pub fn EVP_camellia_128_cfb128() -> *const EVP_CIPHER;
-    #[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAMELLIA")))]
+    #[cfg(not(osslconf = "OPENSSL_NO_CAMELLIA"))]
     pub fn EVP_camellia_128_ecb() -> *const EVP_CIPHER;
-    #[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAMELLIA")))]
+    #[cfg(not(osslconf = "OPENSSL_NO_CAMELLIA"))]
+    pub fn EVP_camellia_128_cbc() -> *const EVP_CIPHER;
+    #[cfg(not(osslconf = "OPENSSL_NO_CAMELLIA"))]
+    pub fn EVP_camellia_128_ofb() -> *const EVP_CIPHER;
+    #[cfg(not(osslconf = "OPENSSL_NO_CAMELLIA"))]
     pub fn EVP_camellia_192_cfb128() -> *const EVP_CIPHER;
-    #[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAMELLIA")))]
+    #[cfg(not(osslconf = "OPENSSL_NO_CAMELLIA"))]
     pub fn EVP_camellia_192_ecb() -> *const EVP_CIPHER;
-    #[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAMELLIA")))]
+    #[cfg(not(osslconf = "OPENSSL_NO_CAMELLIA"))]
+    pub fn EVP_camellia_192_cbc() -> *const EVP_CIPHER;
+    #[cfg(not(osslconf = "OPENSSL_NO_CAMELLIA"))]
+    pub fn EVP_camellia_192_ofb() -> *const EVP_CIPHER;
+    #[cfg(not(osslconf = "OPENSSL_NO_CAMELLIA"))]
     pub fn EVP_camellia_256_cfb128() -> *const EVP_CIPHER;
-    #[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAMELLIA")))]
+    #[cfg(not(osslconf = "OPENSSL_NO_CAMELLIA"))]
     pub fn EVP_camellia_256_ecb() -> *const EVP_CIPHER;
+    #[cfg(not(osslconf = "OPENSSL_NO_CAMELLIA"))]
+    pub fn EVP_camellia_256_cbc() -> *const EVP_CIPHER;
+    #[cfg(not(osslconf = "OPENSSL_NO_CAMELLIA"))]
+    pub fn EVP_camellia_256_ofb() -> *const EVP_CIPHER;
 
-    #[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAST")))]
+    #[cfg(not(osslconf = "OPENSSL_NO_CAST"))]
     pub fn EVP_cast5_cfb64() -> *const EVP_CIPHER;
-    #[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAST")))]
+    #[cfg(not(osslconf = "OPENSSL_NO_CAST"))]
     pub fn EVP_cast5_ecb() -> *const EVP_CIPHER;
+    #[cfg(not(osslconf = "OPENSSL_NO_CAST"))]
+    pub fn EVP_cast5_cbc() -> *const EVP_CIPHER;
+    #[cfg(not(osslconf = "OPENSSL_NO_CAST"))]
+    pub fn EVP_cast5_ofb() -> *const EVP_CIPHER;
 
-    #[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_IDEA")))]
+    #[cfg(not(osslconf = "OPENSSL_NO_IDEA"))]
     pub fn EVP_idea_cfb64() -> *const EVP_CIPHER;
-    #[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_IDEA")))]
+    #[cfg(not(osslconf = "OPENSSL_NO_IDEA"))]
     pub fn EVP_idea_ecb() -> *const EVP_CIPHER;
+    #[cfg(not(osslconf = "OPENSSL_NO_IDEA"))]
+    pub fn EVP_idea_cbc() -> *const EVP_CIPHER;
+    #[cfg(not(osslconf = "OPENSSL_NO_IDEA"))]
+    pub fn EVP_idea_ofb() -> *const EVP_CIPHER;
 
     #[cfg(not(ossl110))]
     pub fn OPENSSL_add_all_algorithms_noconf();
@@ -413,22 +451,6 @@
             pub fn EVP_PKEY_get_bits(key: *const EVP_PKEY) -> c_int;
             pub fn EVP_PKEY_get_security_bits(key: *const EVP_PKEY) -> c_int;
         }
-
-        #[inline]
-        pub unsafe fn EVP_PKEY_id(pkey: *const EVP_PKEY) -> c_int {
-            EVP_PKEY_get_id(pkey)
-        }
-
-        #[inline]
-        pub unsafe fn EVP_PKEY_bits(pkey: *const EVP_PKEY) -> c_int {
-            EVP_PKEY_get_bits(pkey)
-        }
-
-        #[inline]
-        pub unsafe fn EVP_PKEY_security_bits(pkey: *const EVP_PKEY) -> c_int {
-            EVP_PKEY_get_security_bits(pkey)
-        }
-
     } else {
         extern "C" {
             pub fn EVP_PKEY_id(pkey: *const EVP_PKEY) -> c_int;
@@ -513,6 +535,9 @@
         p2: *mut c_void,
     ) -> c_int;
 
+    #[cfg(ossl300)]
+    pub fn EVP_PKEY_CTX_set_signature_md(ctx: *mut EVP_PKEY_CTX, md: *const EVP_MD) -> c_int;
+
     pub fn EVP_PKEY_new_mac_key(
         type_: c_int,
         e: *mut ENGINE,
@@ -522,6 +547,12 @@
 
     pub fn EVP_PKEY_derive_init(ctx: *mut EVP_PKEY_CTX) -> c_int;
     pub fn EVP_PKEY_derive_set_peer(ctx: *mut EVP_PKEY_CTX, peer: *mut EVP_PKEY) -> c_int;
+    #[cfg(ossl300)]
+    pub fn EVP_PKEY_derive_set_peer_ex(
+        ctx: *mut EVP_PKEY_CTX,
+        peer: *mut EVP_PKEY,
+        validate_peer: c_int,
+    ) -> c_int;
     pub fn EVP_PKEY_derive(ctx: *mut EVP_PKEY_CTX, key: *mut c_uchar, size: *mut size_t) -> c_int;
 
     #[cfg(ossl300)]
@@ -566,6 +597,14 @@
         pin: *const c_uchar,
         pinlen: size_t,
     ) -> c_int;
+    pub fn EVP_PKEY_verify_recover_init(ctx: *mut EVP_PKEY_CTX) -> c_int;
+    pub fn EVP_PKEY_verify_recover(
+        ctx: *mut EVP_PKEY_CTX,
+        rout: *mut c_uchar,
+        routlen: *mut size_t,
+        sig: *const c_uchar,
+        siglen: size_t,
+    ) -> c_int;
 }
 
 const_ptr_api! {
diff -Naur vendor-41.0.5/openssl-sys/src/handwritten/mod.rs vendor-41.0.7/openssl-sys/src/handwritten/mod.rs
--- vendor-41.0.5/openssl-sys/src/handwritten/mod.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/openssl-sys/src/handwritten/mod.rs	1969-12-31 19:00:00.000000000 -0500
@@ -18,6 +18,8 @@
 pub use self::pem::*;
 pub use self::pkcs12::*;
 pub use self::pkcs7::*;
+#[cfg(libressl)]
+pub use self::poly1305::*;
 pub use self::provider::*;
 pub use self::rand::*;
 pub use self::rsa::*;
@@ -52,6 +54,8 @@
 mod pem;
 mod pkcs12;
 mod pkcs7;
+#[cfg(libressl)]
+mod poly1305;
 mod provider;
 mod rand;
 mod rsa;
diff -Naur vendor-41.0.5/openssl-sys/src/handwritten/poly1305.rs vendor-41.0.7/openssl-sys/src/handwritten/poly1305.rs
--- vendor-41.0.5/openssl-sys/src/handwritten/poly1305.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/openssl-sys/src/handwritten/poly1305.rs	1969-12-31 19:00:00.000000000 -0500
@@ -0,0 +1,23 @@
+use super::super::*;
+use libc::*;
+
+cfg_if! {
+    if #[cfg(libressl)] {
+        #[repr(C)]
+        #[derive(Debug, Copy, Clone)]
+        pub struct poly1305_context {
+            pub aligner: usize,
+            pub opaque: [::libc::c_uchar; 136usize],
+        }
+        pub type poly1305_state = poly1305_context;
+        extern "C" {
+            pub fn CRYPTO_poly1305_init(ctx: *mut poly1305_context, key: *const ::libc::c_uchar);
+            pub fn CRYPTO_poly1305_update(
+                ctx: *mut poly1305_context,
+                in_: *const ::libc::c_uchar,
+                len: usize,
+            );
+            pub fn CRYPTO_poly1305_finish(ctx: *mut poly1305_context, mac: *mut ::libc::c_uchar);
+        }
+    }
+}
diff -Naur vendor-41.0.5/openssl-sys/src/handwritten/ssl.rs vendor-41.0.7/openssl-sys/src/handwritten/ssl.rs
--- vendor-41.0.5/openssl-sys/src/handwritten/ssl.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/openssl-sys/src/handwritten/ssl.rs	1969-12-31 19:00:00.000000000 -0500
@@ -924,3 +924,17 @@
     #[cfg(all(ossl111, not(ossl111b)))]
     pub fn SSL_get_num_tickets(s: *mut SSL) -> size_t;
 }
+
+extern "C" {
+    #[cfg(any(ossl110, libressl360))]
+    pub fn SSL_CTX_set_security_level(ctx: *mut SSL_CTX, level: c_int);
+
+    #[cfg(any(ossl110, libressl360))]
+    pub fn SSL_set_security_level(s: *mut SSL, level: c_int);
+
+    #[cfg(any(ossl110, libressl360))]
+    pub fn SSL_CTX_get_security_level(ctx: *const SSL_CTX) -> c_int;
+
+    #[cfg(any(ossl110, libressl360))]
+    pub fn SSL_get_security_level(s: *const SSL) -> c_int;
+}
diff -Naur vendor-41.0.5/openssl-sys/src/handwritten/types.rs vendor-41.0.7/openssl-sys/src/handwritten/types.rs
--- vendor-41.0.5/openssl-sys/src/handwritten/types.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/openssl-sys/src/handwritten/types.rs	1969-12-31 19:00:00.000000000 -0500
@@ -329,7 +329,7 @@
     }
 }
 cfg_if! {
-    if #[cfg(ossl110)] {
+    if #[cfg(any(ossl110, libressl382))] {
         pub enum X509_ALGOR {}
     } else {
         #[repr(C)]
diff -Naur vendor-41.0.5/openssl-sys/src/handwritten/x509.rs vendor-41.0.7/openssl-sys/src/handwritten/x509.rs
--- vendor-41.0.5/openssl-sys/src/handwritten/x509.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/openssl-sys/src/handwritten/x509.rs	1969-12-31 19:00:00.000000000 -0500
@@ -644,6 +644,8 @@
     extern "C" {
         #[cfg(any(ossl110, libressl270))]
         pub fn X509_STORE_get0_objects(ctx: #[const_ptr_if(ossl300)] X509_STORE) -> *mut stack_st_X509_OBJECT;
+        #[cfg(ossl300)]
+        pub fn X509_STORE_get1_all_certs(ctx: *mut X509_STORE) -> *mut stack_st_X509;
     }
 }
 
diff -Naur vendor-41.0.5/openssl-sys/src/handwritten/x509v3.rs vendor-41.0.7/openssl-sys/src/handwritten/x509v3.rs
--- vendor-41.0.5/openssl-sys/src/handwritten/x509v3.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/openssl-sys/src/handwritten/x509v3.rs	1969-12-31 19:00:00.000000000 -0500
@@ -145,3 +145,22 @@
     pub fn DIST_POINT_free(dist_point: *mut DIST_POINT);
     pub fn DIST_POINT_NAME_free(dist_point: *mut DIST_POINT_NAME);
 }
+
+#[cfg(ossl102)]
+extern "C" {
+    pub fn X509_check_host(
+        x: *mut X509,
+        chk: *const c_char,
+        chklen: usize,
+        flags: c_uint,
+        peername: *mut *mut c_char,
+    ) -> c_int;
+    pub fn X509_check_email(
+        x: *mut X509,
+        chk: *const c_char,
+        chklen: usize,
+        flags: c_uint,
+    ) -> c_int;
+    pub fn X509_check_ip(x: *mut X509, chk: *const c_uchar, chklen: usize, flags: c_uint) -> c_int;
+    pub fn X509_check_ip_asc(x: *mut X509, ipasc: *const c_char, flags: c_uint) -> c_int;
+}
diff -Naur vendor-41.0.5/openssl-sys/src/handwritten/x509_vfy.rs vendor-41.0.7/openssl-sys/src/handwritten/x509_vfy.rs
--- vendor-41.0.5/openssl-sys/src/handwritten/x509_vfy.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/openssl-sys/src/handwritten/x509_vfy.rs	1969-12-31 19:00:00.000000000 -0500
@@ -118,6 +118,12 @@
     #[cfg(any(ossl102, libressl261))]
     pub fn X509_VERIFY_PARAM_set_hostflags(param: *mut X509_VERIFY_PARAM, flags: c_uint);
     #[cfg(any(ossl102, libressl261))]
+    pub fn X509_VERIFY_PARAM_set1_email(
+        param: *mut X509_VERIFY_PARAM,
+        email: *const c_char,
+        emaillen: size_t,
+    ) -> c_int;
+    #[cfg(any(ossl102, libressl261))]
     pub fn X509_VERIFY_PARAM_set1_ip(
         param: *mut X509_VERIFY_PARAM,
         ip: *const c_uchar,
diff -Naur vendor-41.0.5/openssl-sys/src/lib.rs vendor-41.0.7/openssl-sys/src/lib.rs
--- vendor-41.0.5/openssl-sys/src/lib.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/openssl-sys/src/lib.rs	1969-12-31 19:00:00.000000000 -0500
@@ -1,20 +1,17 @@
 #![allow(
     clippy::missing_safety_doc,
-    clippy::unreadable_literal,
-    clippy::uninlined_format_args,
-    clippy::upper_case_acronyms,
     dead_code,
     non_camel_case_types,
     non_snake_case,
     non_upper_case_globals,
-    overflowing_literals,
     unused_imports
 )]
+#![cfg_attr(feature = "unstable_boringssl", allow(ambiguous_glob_reexports))]
 #![doc(html_root_url = "https://docs.rs/openssl-sys/0.9")]
 #![recursion_limit = "128"] // configure fixed limit across all rust versions
 
 extern crate libc;
-pub use libc::*;
+pub use libc::c_int;
 
 #[cfg(feature = "unstable_boringssl")]
 extern crate bssl_sys;
diff -Naur vendor-41.0.5/openssl-sys/src/obj_mac.rs vendor-41.0.7/openssl-sys/src/obj_mac.rs
--- vendor-41.0.5/openssl-sys/src/obj_mac.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/openssl-sys/src/obj_mac.rs	1969-12-31 19:00:00.000000000 -0500
@@ -135,6 +135,8 @@
 pub const NID_sha224WithRSAEncryption: c_int = 671;
 pub const NID_pkcs3: c_int = 27;
 pub const NID_dhKeyAgreement: c_int = 28;
+#[cfg(ossl110)]
+pub const NID_dhpublicnumber: c_int = 920;
 pub const NID_pkcs5: c_int = 187;
 pub const NID_pbeWithMD2AndDES_CBC: c_int = 9;
 pub const NID_pbeWithMD5AndDES_CBC: c_int = 10;
@@ -926,6 +928,8 @@
 pub const NID_X448: c_int = 1035;
 #[cfg(ossl110)]
 pub const NID_hkdf: c_int = 1036;
+#[cfg(libressl360)]
+pub const NID_hkdf: c_int = 1022;
 #[cfg(ossl111)]
 pub const NID_poly1305: c_int = 1061;
 #[cfg(ossl111)]
@@ -935,6 +939,8 @@
 #[cfg(ossl111)]
 pub const NID_ED448: c_int = 1088;
 #[cfg(ossl111)]
+pub const NID_sm2: c_int = 1172;
+#[cfg(ossl111)]
 pub const NID_sm3: c_int = 1143;
 #[cfg(libressl291)]
 pub const NID_sm3: c_int = 968;
@@ -972,13 +978,25 @@
 pub const NID_sm4_ctr: c_int = 979;
 #[cfg(ossl111)]
 pub const NID_sha3_224: c_int = 1096;
+#[cfg(libressl380)]
+pub const NID_sha3_224: c_int = 1031;
 #[cfg(ossl111)]
 pub const NID_sha3_256: c_int = 1097;
+#[cfg(libressl380)]
+pub const NID_sha3_256: c_int = 1032;
 #[cfg(ossl111)]
 pub const NID_sha3_384: c_int = 1098;
+#[cfg(libressl380)]
+pub const NID_sha3_384: c_int = 1033;
 #[cfg(ossl111)]
 pub const NID_sha3_512: c_int = 1099;
+#[cfg(libressl380)]
+pub const NID_sha3_512: c_int = 1034;
 #[cfg(ossl111)]
 pub const NID_shake128: c_int = 1100;
 #[cfg(ossl111)]
 pub const NID_shake256: c_int = 1101;
+#[cfg(ossl110)]
+pub const NID_chacha20_poly1305: c_int = 1018;
+#[cfg(libressl271)]
+pub const NID_chacha20_poly1305: c_int = 967;
diff -Naur vendor-41.0.5/openssl-sys/src/rsa.rs vendor-41.0.7/openssl-sys/src/rsa.rs
--- vendor-41.0.5/openssl-sys/src/rsa.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/openssl-sys/src/rsa.rs	1969-12-31 19:00:00.000000000 -0500
@@ -76,7 +76,7 @@
         EVP_PKEY_OP_TYPE_CRYPT,
         EVP_PKEY_CTRL_RSA_OAEP_LABEL,
         len,
-        label as *mut c_void,
+        label,
     )
 }
 
diff -Naur vendor-41.0.5/openssl-sys/src/ssl.rs vendor-41.0.7/openssl-sys/src/ssl.rs
--- vendor-41.0.5/openssl-sys/src/ssl.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/openssl-sys/src/ssl.rs	1969-12-31 19:00:00.000000000 -0500
@@ -349,6 +349,8 @@
 pub const SSL_CTRL_SET_SIGALGS_LIST: c_int = 98;
 #[cfg(ossl102)]
 pub const SSL_CTRL_SET_VERIFY_CERT_STORE: c_int = 106;
+#[cfg(ossl300)]
+pub const SSL_CTRL_GET_PEER_TMP_KEY: c_int = 109;
 #[cfg(ossl110)]
 pub const SSL_CTRL_GET_EXTMS_SUPPORT: c_int = 122;
 #[cfg(any(ossl110, libressl261))]
@@ -359,6 +361,8 @@
 pub const SSL_CTRL_GET_MIN_PROTO_VERSION: c_int = 130;
 #[cfg(any(ossl110g, libressl270))]
 pub const SSL_CTRL_GET_MAX_PROTO_VERSION: c_int = 131;
+#[cfg(ossl300)]
+pub const SSL_CTRL_GET_TMP_KEY: c_int = 133;
 
 pub unsafe fn SSL_CTX_set_tmp_dh(ctx: *mut SSL_CTX, dh: *mut DH) -> c_long {
     SSL_CTX_ctrl(ctx, SSL_CTRL_SET_TMP_DH, 0, dh as *mut c_void)
@@ -506,6 +510,17 @@
         }
     }
 }
+cfg_if! {
+    if #[cfg(ossl300)] {
+        pub unsafe fn SSL_get_peer_tmp_key(ssl: *mut SSL, key: *mut *mut EVP_PKEY) -> c_long {
+            SSL_ctrl(ssl, SSL_CTRL_GET_PEER_TMP_KEY, 0, key as *mut c_void)
+        }
+
+        pub unsafe fn SSL_get_tmp_key(ssl: *mut SSL, key: *mut *mut EVP_PKEY) -> c_long {
+            SSL_ctrl(ssl, SSL_CTRL_GET_TMP_KEY, 0, key as *mut c_void)
+        }
+    }
+}
 
 #[cfg(ossl111)]
 pub const SSL_CLIENT_HELLO_SUCCESS: c_int = 1;
diff -Naur vendor-41.0.5/openssl-sys/src/x509v3.rs vendor-41.0.7/openssl-sys/src/x509v3.rs
--- vendor-41.0.5/openssl-sys/src/x509v3.rs	1969-12-31 19:00:00.000000000 -0500
+++ vendor-41.0.7/openssl-sys/src/x509v3.rs	1969-12-31 19:00:00.000000000 -0500
@@ -89,8 +89,16 @@
 pub const X509_PURPOSE_ANY: c_int = 7;
 pub const X509_PURPOSE_OCSP_HELPER: c_int = 8;
 pub const X509_PURPOSE_TIMESTAMP_SIGN: c_int = 9;
+#[cfg(ossl320)]
+pub const X509_PURPOSE_CODE_SIGN: c_int = 10;
 pub const X509_PURPOSE_MIN: c_int = 1;
-pub const X509_PURPOSE_MAX: c_int = 9;
+cfg_if! {
+    if #[cfg(ossl320)] {
+        pub const X509_PURPOSE_MAX: c_int = 10;
+    } else {
+        pub const X509_PURPOSE_MAX: c_int = 9;
+    }
+}
 
 pub const CRL_REASON_UNSPECIFIED: c_int = 0;
 pub const CRL_REASON_KEY_COMPROMISE: c_int = 1;
