html-to-markdown 2.23.4 → 2.24.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +7 -7
- data/README.md +9 -7
- data/ext/html-to-markdown-rb/native/Cargo.lock +21 -21
- data/ext/html-to-markdown-rb/native/Cargo.toml +1 -3
- data/lib/html_to_markdown/cli_proxy.rb +5 -2
- data/lib/html_to_markdown/version.rb +1 -1
- data/rust-vendor/cc/.cargo-checksum.json +1 -1
- data/rust-vendor/cc/.cargo_vcs_info.json +1 -1
- data/rust-vendor/cc/CHANGELOG.md +7 -0
- data/rust-vendor/cc/Cargo.lock +1 -1
- data/rust-vendor/cc/Cargo.toml +1 -1
- data/rust-vendor/cc/Cargo.toml.orig +1 -1
- data/rust-vendor/cc/src/target/generated.rs +1 -0
- data/rust-vendor/cc/src/target/parser.rs +4 -0
- data/rust-vendor/html-to-markdown-rs/README.md +1 -1
- data/rust-vendor/html-to-markdown-rs/src/convert_api.rs +90 -15
- data/rust-vendor/html-to-markdown-rs/src/converter/block/preformatted.rs +15 -4
- data/rust-vendor/html-to-markdown-rs/src/converter/handlers/graphic.rs +5 -3
- data/rust-vendor/html-to-markdown-rs/src/converter/media/svg.rs +5 -1
- data/rust-vendor/html-to-markdown-rs/src/converter/text/processing.rs +15 -8
- data/rust-vendor/html-to-markdown-rs/src/converter/utility/preprocessing.rs +43 -18
- data/rust-vendor/html-to-markdown-rs/src/lib.rs +6 -6
- data/rust-vendor/html-to-markdown-rs/src/validation.rs +68 -29
- data/rust-vendor/html-to-markdown-rs/tests/issue_190_regressions.rs +121 -0
- data/rust-vendor/html-to-markdown-rs/tests/skip_images_test.rs +21 -0
- data/rust-vendor/proc-macro2/.cargo-checksum.json +1 -1
- data/rust-vendor/proc-macro2/.cargo_vcs_info.json +1 -1
- data/rust-vendor/proc-macro2/Cargo.lock +14 -89
- data/rust-vendor/proc-macro2/Cargo.toml +1 -1
- data/rust-vendor/proc-macro2/Cargo.toml.orig +1 -1
- data/rust-vendor/proc-macro2/src/fallback.rs +37 -23
- data/rust-vendor/proc-macro2/src/lib.rs +1 -1
- data/rust-vendor/quote/.cargo-checksum.json +1 -1
- data/rust-vendor/quote/.cargo_vcs_info.json +1 -1
- data/rust-vendor/quote/.github/workflows/ci.yml +1 -1
- data/rust-vendor/quote/Cargo.lock +17 -17
- data/rust-vendor/quote/Cargo.toml +1 -1
- data/rust-vendor/quote/Cargo.toml.orig +1 -1
- data/rust-vendor/quote/src/format.rs +2 -2
- data/rust-vendor/quote/src/lib.rs +1 -1
- data/rust-vendor/quote/src/runtime.rs +2 -2
- data/rust-vendor/quote/tests/test.rs +6 -0
- data/rust-vendor/quote/tests/ui/does-not-have-iter-interpolated-dup.stderr +2 -2
- data/rust-vendor/quote/tests/ui/does-not-have-iter-interpolated.stderr +2 -2
- data/rust-vendor/quote/tests/ui/does-not-have-iter-separated.stderr +2 -2
- data/rust-vendor/quote/tests/ui/does-not-have-iter.stderr +2 -2
- data/rust-vendor/quote/tests/ui/not-repeatable.stderr +8 -8
- data/rust-vendor/siphasher/.cargo-checksum.json +1 -1
- data/rust-vendor/siphasher/.cargo_vcs_info.json +1 -1
- data/rust-vendor/siphasher/.github/workflows/issues.yml +17 -0
- data/rust-vendor/siphasher/COPYING +1 -1
- data/rust-vendor/siphasher/Cargo.lock +89 -0
- data/rust-vendor/siphasher/Cargo.toml +23 -13
- data/rust-vendor/siphasher/Cargo.toml.orig +1 -1
- data/rust-vendor/siphasher/src/common.rs +65 -0
- data/rust-vendor/siphasher/src/lib.rs +1 -1
- data/rust-vendor/siphasher/src/sip.rs +2 -68
- data/rust-vendor/siphasher/src/sip128.rs +15 -74
- data/rust-vendor/siphasher/src/tests.rs +1 -1
- data/rust-vendor/siphasher/src/tests128.rs +1 -1
- data/rust-vendor/uuid/.cargo-checksum.json +1 -1
- data/rust-vendor/uuid/.cargo_vcs_info.json +1 -1
- data/rust-vendor/uuid/Cargo.lock +125 -96
- data/rust-vendor/uuid/Cargo.toml +4 -11
- data/rust-vendor/uuid/Cargo.toml.orig +5 -14
- data/rust-vendor/uuid/README.md +3 -3
- data/rust-vendor/uuid/src/builder.rs +2 -1
- data/rust-vendor/uuid/src/external/serde_support.rs +209 -142
- data/rust-vendor/uuid/src/lib.rs +9 -11
- data/rust-vendor/uuid/src/macros.rs +9 -54
- data/rust-vendor/uuid/src/non_nil.rs +49 -2
- data/rust-vendor/web_atoms/.cargo-checksum.json +1 -1
- data/rust-vendor/web_atoms/.cargo_vcs_info.json +1 -1
- data/rust-vendor/web_atoms/Cargo.lock +1 -1
- data/rust-vendor/web_atoms/Cargo.toml +1 -1
- data/rust-vendor/web_atoms/Cargo.toml.orig +1 -1
- data/rust-vendor/web_atoms/local_names.txt +3 -0
- data/rust-vendor/zerocopy/.cargo-checksum.json +1 -1
- data/rust-vendor/zerocopy/.cargo_vcs_info.json +1 -1
- data/rust-vendor/zerocopy/Cargo.lock +5 -9
- data/rust-vendor/zerocopy/Cargo.toml +10 -18
- data/rust-vendor/zerocopy/Cargo.toml.orig +6 -14
- data/rust-vendor/zerocopy/Cargo.toml.std +58 -0
- data/rust-vendor/zerocopy/agent_docs/ui_tests.md +5 -5
- data/rust-vendor/zerocopy/cargo.sh +1 -1
- data/rust-vendor/zerocopy/ci/check_fmt.sh +1 -1
- data/rust-vendor/zerocopy/ci/check_readme.sh +1 -1
- data/rust-vendor/zerocopy/ci/check_stale_stderr.sh +44 -0
- data/rust-vendor/zerocopy/githooks/pre-push +2 -0
- data/rust-vendor/zerocopy/src/byte_slice.rs +1 -1
- data/rust-vendor/zerocopy/src/byteorder.rs +0 -1
- data/rust-vendor/zerocopy/src/impls.rs +334 -118
- data/rust-vendor/zerocopy/src/layout.rs +9 -0
- data/rust-vendor/zerocopy/src/lib.rs +163 -74
- data/rust-vendor/zerocopy/src/macros.rs +4 -8
- data/rust-vendor/zerocopy/src/pointer/inner.rs +4 -4
- data/rust-vendor/zerocopy/src/pointer/invariant.rs +22 -5
- data/rust-vendor/zerocopy/src/pointer/mod.rs +155 -18
- data/rust-vendor/zerocopy/src/pointer/ptr.rs +133 -182
- data/rust-vendor/zerocopy/src/pointer/transmute.rs +99 -106
- data/rust-vendor/zerocopy/src/ref.rs +4 -4
- data/rust-vendor/zerocopy/src/util/macro_util.rs +73 -127
- data/rust-vendor/zerocopy/src/util/macros.rs +61 -150
- data/rust-vendor/zerocopy/src/wrappers.rs +249 -3
- data/rust-vendor/zerocopy/tests/include.rs +67 -0
- data/rust-vendor/zerocopy/tests/ui-msrv/diagnostic-not-implemented-from-bytes.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-msrv/diagnostic-not-implemented-from-bytes.stderr +6 -6
- data/rust-vendor/zerocopy/tests/ui-msrv/diagnostic-not-implemented-from-zeros.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-msrv/diagnostic-not-implemented-from-zeros.stderr +4 -4
- data/rust-vendor/zerocopy/tests/ui-msrv/diagnostic-not-implemented-immutable.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-msrv/diagnostic-not-implemented-immutable.stderr +6 -6
- data/rust-vendor/zerocopy/tests/ui-msrv/diagnostic-not-implemented-into-bytes.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-msrv/diagnostic-not-implemented-into-bytes.stderr +6 -6
- data/rust-vendor/zerocopy/tests/ui-msrv/diagnostic-not-implemented-issue-1296.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-msrv/diagnostic-not-implemented-issue-1296.stderr +8 -8
- data/rust-vendor/zerocopy/tests/ui-msrv/diagnostic-not-implemented-known-layout.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-msrv/diagnostic-not-implemented-known-layout.stderr +6 -6
- data/rust-vendor/zerocopy/tests/ui-msrv/diagnostic-not-implemented-try-from-bytes.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-msrv/diagnostic-not-implemented-try-from-bytes.stderr +6 -6
- data/rust-vendor/zerocopy/tests/ui-msrv/diagnostic-not-implemented-unaligned.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-msrv/diagnostic-not-implemented-unaligned.stderr +4 -4
- data/rust-vendor/zerocopy/tests/ui-msrv/include_value_not_from_bytes.rs +3 -5
- data/rust-vendor/zerocopy/tests/ui-msrv/include_value_not_from_bytes.stderr +10 -10
- data/rust-vendor/zerocopy/tests/ui-msrv/include_value_wrong_size.rs +1 -4
- data/rust-vendor/zerocopy/tests/ui-msrv/include_value_wrong_size.stderr +3 -3
- data/rust-vendor/zerocopy/tests/ui-msrv/invalid-impls/invalid-impls.rs +0 -1
- data/rust-vendor/zerocopy/tests/ui-msrv/invalid-impls/invalid-impls.stderr +35 -35
- data/rust-vendor/zerocopy/tests/ui-msrv/transmute-dst-not-frombytes.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-msrv/transmute-dst-not-frombytes.stderr +6 -6
- data/rust-vendor/zerocopy/tests/ui-msrv/transmute-mut-const.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-msrv/transmute-mut-const.stderr +10 -10
- data/rust-vendor/zerocopy/tests/ui-msrv/transmute-mut-dst-not-a-reference.rs +0 -2
- data/rust-vendor/zerocopy/tests/ui-msrv/transmute-mut-dst-not-a-reference.stderr +2 -2
- data/rust-vendor/zerocopy/tests/ui-msrv/transmute-mut-dst-not-frombytes.rs +0 -2
- data/rust-vendor/zerocopy/tests/ui-msrv/transmute-mut-dst-not-frombytes.stderr +2 -2
- data/rust-vendor/zerocopy/tests/ui-msrv/transmute-mut-dst-not-intobytes.rs +0 -2
- data/rust-vendor/zerocopy/tests/ui-msrv/transmute-mut-dst-not-intobytes.stderr +2 -2
- data/rust-vendor/zerocopy/tests/ui-msrv/transmute-mut-dst-unsized.rs +0 -2
- data/rust-vendor/zerocopy/tests/ui-msrv/transmute-mut-dst-unsized.stderr +2 -2
- data/rust-vendor/zerocopy/tests/ui-msrv/transmute-mut-src-dst-not-references.rs +0 -2
- data/rust-vendor/zerocopy/tests/ui-msrv/transmute-mut-src-dst-not-references.stderr +2 -2
- data/rust-vendor/zerocopy/tests/ui-msrv/transmute-mut-src-immutable.rs +0 -2
- data/rust-vendor/zerocopy/tests/ui-msrv/transmute-mut-src-immutable.stderr +2 -2
- data/rust-vendor/zerocopy/tests/ui-msrv/transmute-mut-src-not-a-reference.rs +0 -2
- data/rust-vendor/zerocopy/tests/ui-msrv/transmute-mut-src-not-a-reference.stderr +2 -2
- data/rust-vendor/zerocopy/tests/ui-msrv/transmute-mut-src-not-frombytes.rs +0 -2
- data/rust-vendor/zerocopy/tests/ui-msrv/transmute-mut-src-not-frombytes.stderr +2 -2
- data/rust-vendor/zerocopy/tests/ui-msrv/transmute-mut-src-not-intobytes.rs +0 -2
- data/rust-vendor/zerocopy/tests/ui-msrv/transmute-mut-src-not-intobytes.stderr +2 -2
- data/rust-vendor/zerocopy/tests/ui-msrv/transmute-mut-src-unsized.rs +0 -2
- data/rust-vendor/zerocopy/tests/ui-msrv/transmute-mut-src-unsized.stderr +2 -2
- data/rust-vendor/zerocopy/tests/ui-msrv/transmute-ptr-to-usize.rs +0 -2
- data/rust-vendor/zerocopy/tests/ui-msrv/transmute-ptr-to-usize.stderr +4 -4
- data/rust-vendor/zerocopy/tests/ui-msrv/transmute-ref-dst-mutable.rs +0 -2
- data/rust-vendor/zerocopy/tests/ui-msrv/transmute-ref-dst-mutable.stderr +6 -6
- data/rust-vendor/zerocopy/tests/ui-msrv/transmute-ref-dst-not-a-reference.rs +0 -2
- data/rust-vendor/zerocopy/tests/ui-msrv/transmute-ref-dst-not-a-reference.stderr +6 -6
- data/rust-vendor/zerocopy/tests/ui-msrv/transmute-ref-dst-not-frombytes.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-msrv/transmute-ref-dst-not-frombytes.stderr +6 -6
- data/rust-vendor/zerocopy/tests/ui-msrv/transmute-ref-dst-not-nocell.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-msrv/transmute-ref-dst-not-nocell.stderr +6 -6
- data/rust-vendor/zerocopy/tests/ui-msrv/transmute-ref-dst-unsized.rs +0 -2
- data/rust-vendor/zerocopy/tests/ui-msrv/transmute-ref-dst-unsized.stderr +2 -2
- data/rust-vendor/zerocopy/tests/ui-msrv/transmute-ref-src-dst-not-references.rs +0 -2
- data/rust-vendor/zerocopy/tests/ui-msrv/transmute-ref-src-dst-not-references.stderr +8 -8
- data/rust-vendor/zerocopy/tests/ui-msrv/transmute-ref-src-not-a-reference.rs +0 -2
- data/rust-vendor/zerocopy/tests/ui-msrv/transmute-ref-src-not-a-reference.stderr +2 -2
- data/rust-vendor/zerocopy/tests/ui-msrv/transmute-ref-src-not-intobytes.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-msrv/transmute-ref-src-not-intobytes.stderr +12 -12
- data/rust-vendor/zerocopy/tests/ui-msrv/transmute-ref-src-not-nocell.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-msrv/transmute-ref-src-not-nocell.stderr +12 -12
- data/rust-vendor/zerocopy/tests/ui-msrv/transmute-ref-src-unsized.rs +0 -2
- data/rust-vendor/zerocopy/tests/ui-msrv/transmute-ref-src-unsized.stderr +2 -2
- data/rust-vendor/zerocopy/tests/ui-msrv/transmute-size-decrease.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-msrv/transmute-size-decrease.stderr +2 -2
- data/rust-vendor/zerocopy/tests/ui-msrv/transmute-size-increase-allow-shrink.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-msrv/transmute-size-increase-allow-shrink.stderr +2 -2
- data/rust-vendor/zerocopy/tests/ui-msrv/transmute-size-increase.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-msrv/transmute-size-increase.stderr +2 -2
- data/rust-vendor/zerocopy/tests/ui-msrv/transmute-src-not-intobytes.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-msrv/transmute-src-not-intobytes.stderr +6 -6
- data/rust-vendor/zerocopy/tests/ui-msrv/try_transmute-dst-not-tryfrombytes.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-msrv/try_transmute-dst-not-tryfrombytes.stderr +12 -12
- data/rust-vendor/zerocopy/tests/ui-msrv/try_transmute-size-decrease.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-msrv/try_transmute-size-decrease.stderr +2 -2
- data/rust-vendor/zerocopy/tests/ui-msrv/try_transmute-size-increase.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-msrv/try_transmute-size-increase.stderr +2 -2
- data/rust-vendor/zerocopy/tests/ui-msrv/try_transmute-src-not-intobytes.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-msrv/try_transmute-src-not-intobytes.stderr +4 -4
- data/rust-vendor/zerocopy/tests/ui-msrv/try_transmute_mut-alignment-increase.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-msrv/try_transmute_mut-alignment-increase.stderr +2 -2
- data/rust-vendor/zerocopy/tests/ui-msrv/try_transmute_mut-dst-not-tryfrombytes.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-msrv/try_transmute_mut-dst-not-tryfrombytes.stderr +16 -16
- data/rust-vendor/zerocopy/tests/ui-msrv/try_transmute_mut-size-decrease.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-msrv/try_transmute_mut-size-decrease.stderr +2 -2
- data/rust-vendor/zerocopy/tests/ui-msrv/try_transmute_mut-size-increase.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-msrv/try_transmute_mut-size-increase.stderr +4 -4
- data/rust-vendor/zerocopy/tests/ui-msrv/try_transmute_mut-src-not-frombytes.rs +0 -2
- data/rust-vendor/zerocopy/tests/ui-msrv/try_transmute_mut-src-not-frombytes.stderr +6 -6
- data/rust-vendor/zerocopy/tests/ui-msrv/try_transmute_mut-src-not-intobytes.rs +0 -2
- data/rust-vendor/zerocopy/tests/ui-msrv/try_transmute_mut-src-not-intobytes.stderr +6 -6
- data/rust-vendor/zerocopy/tests/ui-msrv/try_transmute_ref-alignment-increase.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-msrv/try_transmute_ref-alignment-increase.stderr +2 -2
- data/rust-vendor/zerocopy/tests/ui-msrv/try_transmute_ref-dst-mutable.rs +0 -2
- data/rust-vendor/zerocopy/tests/ui-msrv/try_transmute_ref-dst-mutable.stderr +4 -4
- data/rust-vendor/zerocopy/tests/ui-msrv/try_transmute_ref-dst-not-immutable-tryfrombytes.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-msrv/try_transmute_ref-dst-not-immutable-tryfrombytes.stderr +16 -16
- data/rust-vendor/zerocopy/tests/ui-msrv/try_transmute_ref-size-decrease.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-msrv/try_transmute_ref-size-decrease.stderr +2 -2
- data/rust-vendor/zerocopy/tests/ui-msrv/try_transmute_ref-size-increase.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-msrv/try_transmute_ref-size-increase.stderr +2 -2
- data/rust-vendor/zerocopy/tests/ui-msrv/try_transmute_ref-src-not-immutable-intobytes.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-msrv/try_transmute_ref-src-not-immutable-intobytes.stderr +8 -8
- data/rust-vendor/zerocopy/tests/ui-nightly/diagnostic-not-implemented-from-bytes.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-nightly/diagnostic-not-implemented-from-bytes.stderr +15 -15
- data/rust-vendor/zerocopy/tests/ui-nightly/diagnostic-not-implemented-from-zeros.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-nightly/diagnostic-not-implemented-from-zeros.stderr +12 -12
- data/rust-vendor/zerocopy/tests/ui-nightly/diagnostic-not-implemented-immutable.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-nightly/diagnostic-not-implemented-immutable.stderr +13 -13
- data/rust-vendor/zerocopy/tests/ui-nightly/diagnostic-not-implemented-into-bytes.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-nightly/diagnostic-not-implemented-into-bytes.stderr +8 -8
- data/rust-vendor/zerocopy/tests/ui-nightly/diagnostic-not-implemented-issue-1296.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-nightly/diagnostic-not-implemented-issue-1296.stderr +16 -16
- data/rust-vendor/zerocopy/tests/ui-nightly/diagnostic-not-implemented-known-layout.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-nightly/diagnostic-not-implemented-known-layout.stderr +8 -8
- data/rust-vendor/zerocopy/tests/ui-nightly/diagnostic-not-implemented-try-from-bytes.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-nightly/diagnostic-not-implemented-try-from-bytes.stderr +15 -15
- data/rust-vendor/zerocopy/tests/ui-nightly/diagnostic-not-implemented-unaligned.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-nightly/diagnostic-not-implemented-unaligned.stderr +5 -5
- data/rust-vendor/zerocopy/tests/ui-nightly/include_value_not_from_bytes.rs +3 -5
- data/rust-vendor/zerocopy/tests/ui-nightly/include_value_not_from_bytes.stderr +21 -21
- data/rust-vendor/zerocopy/tests/ui-nightly/include_value_wrong_size.rs +1 -4
- data/rust-vendor/zerocopy/tests/ui-nightly/include_value_wrong_size.stderr +8 -8
- data/rust-vendor/zerocopy/tests/ui-nightly/invalid-impls/invalid-impls.rs +0 -1
- data/rust-vendor/zerocopy/tests/ui-nightly/invalid-impls/invalid-impls.stderr +35 -51
- data/rust-vendor/zerocopy/tests/ui-nightly/ptr-is-invariant-over-v.stderr +2 -2
- data/rust-vendor/zerocopy/tests/ui-nightly/transmute-dst-not-frombytes.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-nightly/transmute-dst-not-frombytes.stderr +15 -15
- data/rust-vendor/zerocopy/tests/ui-nightly/transmute-mut-const.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-nightly/transmute-mut-const.stderr +7 -7
- data/rust-vendor/zerocopy/tests/ui-nightly/transmute-mut-dst-not-a-reference.rs +0 -2
- data/rust-vendor/zerocopy/tests/ui-nightly/transmute-mut-dst-not-a-reference.stderr +2 -2
- data/rust-vendor/zerocopy/tests/ui-nightly/transmute-mut-dst-not-frombytes.rs +0 -2
- data/rust-vendor/zerocopy/tests/ui-nightly/transmute-mut-dst-not-frombytes.stderr +12 -12
- data/rust-vendor/zerocopy/tests/ui-nightly/transmute-mut-dst-not-intobytes.rs +0 -2
- data/rust-vendor/zerocopy/tests/ui-nightly/transmute-mut-dst-not-intobytes.stderr +5 -5
- data/rust-vendor/zerocopy/tests/ui-nightly/transmute-mut-dst-unsized.rs +0 -2
- data/rust-vendor/zerocopy/tests/ui-nightly/transmute-mut-dst-unsized.stderr +3 -3
- data/rust-vendor/zerocopy/tests/ui-nightly/transmute-mut-src-dst-not-references.rs +0 -2
- data/rust-vendor/zerocopy/tests/ui-nightly/transmute-mut-src-dst-not-references.stderr +3 -3
- data/rust-vendor/zerocopy/tests/ui-nightly/transmute-mut-src-immutable.rs +0 -2
- data/rust-vendor/zerocopy/tests/ui-nightly/transmute-mut-src-immutable.stderr +2 -2
- data/rust-vendor/zerocopy/tests/ui-nightly/transmute-mut-src-not-a-reference.rs +0 -2
- data/rust-vendor/zerocopy/tests/ui-nightly/transmute-mut-src-not-a-reference.stderr +3 -3
- data/rust-vendor/zerocopy/tests/ui-nightly/transmute-mut-src-not-frombytes.rs +0 -2
- data/rust-vendor/zerocopy/tests/ui-nightly/transmute-mut-src-not-frombytes.stderr +12 -12
- data/rust-vendor/zerocopy/tests/ui-nightly/transmute-mut-src-not-intobytes.rs +0 -2
- data/rust-vendor/zerocopy/tests/ui-nightly/transmute-mut-src-not-intobytes.stderr +5 -5
- data/rust-vendor/zerocopy/tests/ui-nightly/transmute-mut-src-unsized.rs +0 -2
- data/rust-vendor/zerocopy/tests/ui-nightly/transmute-mut-src-unsized.stderr +3 -3
- data/rust-vendor/zerocopy/tests/ui-nightly/transmute-ptr-to-usize.rs +0 -2
- data/rust-vendor/zerocopy/tests/ui-nightly/transmute-ptr-to-usize.stderr +4 -4
- data/rust-vendor/zerocopy/tests/ui-nightly/transmute-ref-dst-mutable.rs +0 -2
- data/rust-vendor/zerocopy/tests/ui-nightly/transmute-ref-dst-mutable.stderr +6 -6
- data/rust-vendor/zerocopy/tests/ui-nightly/transmute-ref-dst-not-a-reference.rs +0 -2
- data/rust-vendor/zerocopy/tests/ui-nightly/transmute-ref-dst-not-a-reference.stderr +6 -6
- data/rust-vendor/zerocopy/tests/ui-nightly/transmute-ref-dst-not-frombytes.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-nightly/transmute-ref-dst-not-frombytes.stderr +16 -16
- data/rust-vendor/zerocopy/tests/ui-nightly/transmute-ref-dst-not-nocell.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-nightly/transmute-ref-dst-not-nocell.stderr +14 -14
- data/rust-vendor/zerocopy/tests/ui-nightly/transmute-ref-dst-unsized.rs +0 -2
- data/rust-vendor/zerocopy/tests/ui-nightly/transmute-ref-dst-unsized.stderr +3 -3
- data/rust-vendor/zerocopy/tests/ui-nightly/transmute-ref-src-dst-not-references.rs +0 -2
- data/rust-vendor/zerocopy/tests/ui-nightly/transmute-ref-src-dst-not-references.stderr +9 -9
- data/rust-vendor/zerocopy/tests/ui-nightly/transmute-ref-src-not-a-reference.rs +0 -2
- data/rust-vendor/zerocopy/tests/ui-nightly/transmute-ref-src-not-a-reference.stderr +3 -3
- data/rust-vendor/zerocopy/tests/ui-nightly/transmute-ref-src-not-intobytes.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-nightly/transmute-ref-src-not-intobytes.stderr +18 -18
- data/rust-vendor/zerocopy/tests/ui-nightly/transmute-ref-src-not-nocell.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-nightly/transmute-ref-src-not-nocell.stderr +28 -28
- data/rust-vendor/zerocopy/tests/ui-nightly/transmute-ref-src-unsized.rs +0 -2
- data/rust-vendor/zerocopy/tests/ui-nightly/transmute-ref-src-unsized.stderr +3 -3
- data/rust-vendor/zerocopy/tests/ui-nightly/transmute-size-decrease.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-nightly/transmute-size-decrease.stderr +4 -4
- data/rust-vendor/zerocopy/tests/ui-nightly/transmute-size-increase-allow-shrink.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-nightly/transmute-size-increase-allow-shrink.stderr +4 -4
- data/rust-vendor/zerocopy/tests/ui-nightly/transmute-size-increase.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-nightly/transmute-size-increase.stderr +4 -4
- data/rust-vendor/zerocopy/tests/ui-nightly/transmute-src-not-intobytes.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-nightly/transmute-src-not-intobytes.stderr +8 -8
- data/rust-vendor/zerocopy/tests/ui-nightly/try_transmute-dst-not-tryfrombytes.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-nightly/try_transmute-dst-not-tryfrombytes.stderr +43 -43
- data/rust-vendor/zerocopy/tests/ui-nightly/try_transmute-size-decrease.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-nightly/try_transmute-size-decrease.stderr +2 -2
- data/rust-vendor/zerocopy/tests/ui-nightly/try_transmute-size-increase.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-nightly/try_transmute-size-increase.stderr +2 -2
- data/rust-vendor/zerocopy/tests/ui-nightly/try_transmute-src-not-intobytes.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-nightly/try_transmute-src-not-intobytes.stderr +8 -8
- data/rust-vendor/zerocopy/tests/ui-nightly/try_transmute_mut-alignment-increase.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-nightly/try_transmute_mut-alignment-increase.stderr +4 -4
- data/rust-vendor/zerocopy/tests/ui-nightly/try_transmute_mut-dst-not-tryfrombytes.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-nightly/try_transmute_mut-dst-not-tryfrombytes.stderr +51 -51
- data/rust-vendor/zerocopy/tests/ui-nightly/try_transmute_mut-size-decrease.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-nightly/try_transmute_mut-size-decrease.stderr +2 -2
- data/rust-vendor/zerocopy/tests/ui-nightly/try_transmute_mut-size-increase.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-nightly/try_transmute_mut-size-increase.stderr +4 -4
- data/rust-vendor/zerocopy/tests/ui-nightly/try_transmute_mut-src-not-frombytes.rs +0 -2
- data/rust-vendor/zerocopy/tests/ui-nightly/try_transmute_mut-src-not-frombytes.stderr +29 -29
- data/rust-vendor/zerocopy/tests/ui-nightly/try_transmute_mut-src-not-intobytes.rs +0 -2
- data/rust-vendor/zerocopy/tests/ui-nightly/try_transmute_mut-src-not-intobytes.stderr +22 -22
- data/rust-vendor/zerocopy/tests/ui-nightly/try_transmute_ref-alignment-increase.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-nightly/try_transmute_ref-alignment-increase.stderr +4 -4
- data/rust-vendor/zerocopy/tests/ui-nightly/try_transmute_ref-dst-mutable.rs +0 -2
- data/rust-vendor/zerocopy/tests/ui-nightly/try_transmute_ref-dst-mutable.stderr +6 -6
- data/rust-vendor/zerocopy/tests/ui-nightly/try_transmute_ref-dst-not-immutable-tryfrombytes.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-nightly/try_transmute_ref-dst-not-immutable-tryfrombytes.stderr +56 -56
- data/rust-vendor/zerocopy/tests/ui-nightly/try_transmute_ref-size-decrease.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-nightly/try_transmute_ref-size-decrease.stderr +2 -2
- data/rust-vendor/zerocopy/tests/ui-nightly/try_transmute_ref-size-increase.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-nightly/try_transmute_ref-size-increase.stderr +4 -4
- data/rust-vendor/zerocopy/tests/ui-nightly/try_transmute_ref-src-not-immutable-intobytes.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-nightly/try_transmute_ref-src-not-immutable-intobytes.stderr +21 -21
- data/rust-vendor/zerocopy/tests/ui-stable/diagnostic-not-implemented-from-bytes.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-stable/diagnostic-not-implemented-from-bytes.stderr +15 -15
- data/rust-vendor/zerocopy/tests/ui-stable/diagnostic-not-implemented-from-zeros.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-stable/diagnostic-not-implemented-from-zeros.stderr +12 -12
- data/rust-vendor/zerocopy/tests/ui-stable/diagnostic-not-implemented-immutable.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-stable/diagnostic-not-implemented-immutable.stderr +13 -13
- data/rust-vendor/zerocopy/tests/ui-stable/diagnostic-not-implemented-into-bytes.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-stable/diagnostic-not-implemented-into-bytes.stderr +8 -8
- data/rust-vendor/zerocopy/tests/ui-stable/diagnostic-not-implemented-issue-1296.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-stable/diagnostic-not-implemented-issue-1296.stderr +16 -16
- data/rust-vendor/zerocopy/tests/ui-stable/diagnostic-not-implemented-known-layout.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-stable/diagnostic-not-implemented-known-layout.stderr +8 -8
- data/rust-vendor/zerocopy/tests/ui-stable/diagnostic-not-implemented-try-from-bytes.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-stable/diagnostic-not-implemented-try-from-bytes.stderr +15 -15
- data/rust-vendor/zerocopy/tests/ui-stable/diagnostic-not-implemented-unaligned.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-stable/diagnostic-not-implemented-unaligned.stderr +5 -5
- data/rust-vendor/zerocopy/tests/ui-stable/include_value_not_from_bytes.rs +3 -5
- data/rust-vendor/zerocopy/tests/ui-stable/include_value_not_from_bytes.stderr +21 -21
- data/rust-vendor/zerocopy/tests/ui-stable/include_value_wrong_size.rs +1 -4
- data/rust-vendor/zerocopy/tests/ui-stable/include_value_wrong_size.stderr +8 -8
- data/rust-vendor/zerocopy/tests/ui-stable/invalid-impls/invalid-impls.rs +0 -1
- data/rust-vendor/zerocopy/tests/ui-stable/invalid-impls/invalid-impls.stderr +37 -37
- data/rust-vendor/zerocopy/tests/ui-stable/ptr-is-invariant-over-v.stderr +2 -2
- data/rust-vendor/zerocopy/tests/ui-stable/transmute-dst-not-frombytes.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-stable/transmute-dst-not-frombytes.stderr +15 -15
- data/rust-vendor/zerocopy/tests/ui-stable/transmute-mut-const.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-stable/transmute-mut-const.stderr +6 -6
- data/rust-vendor/zerocopy/tests/ui-stable/transmute-mut-dst-not-a-reference.rs +0 -2
- data/rust-vendor/zerocopy/tests/ui-stable/transmute-mut-dst-not-a-reference.stderr +2 -2
- data/rust-vendor/zerocopy/tests/ui-stable/transmute-mut-dst-not-frombytes.rs +0 -2
- data/rust-vendor/zerocopy/tests/ui-stable/transmute-mut-dst-not-frombytes.stderr +11 -11
- data/rust-vendor/zerocopy/tests/ui-stable/transmute-mut-dst-not-intobytes.rs +0 -2
- data/rust-vendor/zerocopy/tests/ui-stable/transmute-mut-dst-not-intobytes.stderr +4 -4
- data/rust-vendor/zerocopy/tests/ui-stable/transmute-mut-dst-unsized.rs +0 -2
- data/rust-vendor/zerocopy/tests/ui-stable/transmute-mut-dst-unsized.stderr +2 -2
- data/rust-vendor/zerocopy/tests/ui-stable/transmute-mut-src-dst-not-references.rs +0 -2
- data/rust-vendor/zerocopy/tests/ui-stable/transmute-mut-src-dst-not-references.stderr +3 -3
- data/rust-vendor/zerocopy/tests/ui-stable/transmute-mut-src-immutable.rs +0 -2
- data/rust-vendor/zerocopy/tests/ui-stable/transmute-mut-src-immutable.stderr +2 -2
- data/rust-vendor/zerocopy/tests/ui-stable/transmute-mut-src-not-a-reference.rs +0 -2
- data/rust-vendor/zerocopy/tests/ui-stable/transmute-mut-src-not-a-reference.stderr +3 -3
- data/rust-vendor/zerocopy/tests/ui-stable/transmute-mut-src-not-frombytes.rs +0 -2
- data/rust-vendor/zerocopy/tests/ui-stable/transmute-mut-src-not-frombytes.stderr +11 -11
- data/rust-vendor/zerocopy/tests/ui-stable/transmute-mut-src-not-intobytes.rs +0 -2
- data/rust-vendor/zerocopy/tests/ui-stable/transmute-mut-src-not-intobytes.stderr +4 -4
- data/rust-vendor/zerocopy/tests/ui-stable/transmute-mut-src-unsized.rs +0 -2
- data/rust-vendor/zerocopy/tests/ui-stable/transmute-mut-src-unsized.stderr +2 -2
- data/rust-vendor/zerocopy/tests/ui-stable/transmute-ptr-to-usize.rs +0 -2
- data/rust-vendor/zerocopy/tests/ui-stable/transmute-ptr-to-usize.stderr +9 -5
- data/rust-vendor/zerocopy/tests/ui-stable/transmute-ref-dst-mutable.rs +0 -2
- data/rust-vendor/zerocopy/tests/ui-stable/transmute-ref-dst-mutable.stderr +6 -6
- data/rust-vendor/zerocopy/tests/ui-stable/transmute-ref-dst-not-a-reference.rs +0 -2
- data/rust-vendor/zerocopy/tests/ui-stable/transmute-ref-dst-not-a-reference.stderr +6 -6
- data/rust-vendor/zerocopy/tests/ui-stable/transmute-ref-dst-not-frombytes.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-stable/transmute-ref-dst-not-frombytes.stderr +16 -16
- data/rust-vendor/zerocopy/tests/ui-stable/transmute-ref-dst-not-nocell.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-stable/transmute-ref-dst-not-nocell.stderr +14 -14
- data/rust-vendor/zerocopy/tests/ui-stable/transmute-ref-dst-unsized.rs +0 -2
- data/rust-vendor/zerocopy/tests/ui-stable/transmute-ref-dst-unsized.stderr +2 -2
- data/rust-vendor/zerocopy/tests/ui-stable/transmute-ref-src-dst-not-references.rs +0 -2
- data/rust-vendor/zerocopy/tests/ui-stable/transmute-ref-src-dst-not-references.stderr +9 -9
- data/rust-vendor/zerocopy/tests/ui-stable/transmute-ref-src-not-a-reference.rs +0 -2
- data/rust-vendor/zerocopy/tests/ui-stable/transmute-ref-src-not-a-reference.stderr +3 -3
- data/rust-vendor/zerocopy/tests/ui-stable/transmute-ref-src-not-intobytes.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-stable/transmute-ref-src-not-intobytes.stderr +18 -18
- data/rust-vendor/zerocopy/tests/ui-stable/transmute-ref-src-not-nocell.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-stable/transmute-ref-src-not-nocell.stderr +28 -28
- data/rust-vendor/zerocopy/tests/ui-stable/transmute-ref-src-unsized.rs +0 -2
- data/rust-vendor/zerocopy/tests/ui-stable/transmute-ref-src-unsized.stderr +2 -2
- data/rust-vendor/zerocopy/tests/ui-stable/transmute-size-decrease.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-stable/transmute-size-decrease.stderr +4 -4
- data/rust-vendor/zerocopy/tests/ui-stable/transmute-size-increase-allow-shrink.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-stable/transmute-size-increase-allow-shrink.stderr +4 -4
- data/rust-vendor/zerocopy/tests/ui-stable/transmute-size-increase.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-stable/transmute-size-increase.stderr +4 -4
- data/rust-vendor/zerocopy/tests/ui-stable/transmute-src-not-intobytes.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-stable/transmute-src-not-intobytes.stderr +8 -8
- data/rust-vendor/zerocopy/tests/ui-stable/try_transmute-dst-not-tryfrombytes.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-stable/try_transmute-dst-not-tryfrombytes.stderr +42 -42
- data/rust-vendor/zerocopy/tests/ui-stable/try_transmute-size-decrease.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-stable/try_transmute-size-decrease.stderr +2 -2
- data/rust-vendor/zerocopy/tests/ui-stable/try_transmute-size-increase.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-stable/try_transmute-size-increase.stderr +2 -2
- data/rust-vendor/zerocopy/tests/ui-stable/try_transmute-src-not-intobytes.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-stable/try_transmute-src-not-intobytes.stderr +7 -7
- data/rust-vendor/zerocopy/tests/ui-stable/try_transmute_mut-alignment-increase.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-stable/try_transmute_mut-alignment-increase.stderr +2 -2
- data/rust-vendor/zerocopy/tests/ui-stable/try_transmute_mut-dst-not-tryfrombytes.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-stable/try_transmute_mut-dst-not-tryfrombytes.stderr +49 -49
- data/rust-vendor/zerocopy/tests/ui-stable/try_transmute_mut-size-decrease.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-stable/try_transmute_mut-size-decrease.stderr +2 -2
- data/rust-vendor/zerocopy/tests/ui-stable/try_transmute_mut-size-increase.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-stable/try_transmute_mut-size-increase.stderr +4 -4
- data/rust-vendor/zerocopy/tests/ui-stable/try_transmute_mut-src-not-frombytes.rs +0 -2
- data/rust-vendor/zerocopy/tests/ui-stable/try_transmute_mut-src-not-frombytes.stderr +26 -26
- data/rust-vendor/zerocopy/tests/ui-stable/try_transmute_mut-src-not-intobytes.rs +0 -2
- data/rust-vendor/zerocopy/tests/ui-stable/try_transmute_mut-src-not-intobytes.stderr +19 -19
- data/rust-vendor/zerocopy/tests/ui-stable/try_transmute_ref-alignment-increase.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-stable/try_transmute_ref-alignment-increase.stderr +2 -2
- data/rust-vendor/zerocopy/tests/ui-stable/try_transmute_ref-dst-mutable.rs +0 -2
- data/rust-vendor/zerocopy/tests/ui-stable/try_transmute_ref-dst-mutable.stderr +6 -6
- data/rust-vendor/zerocopy/tests/ui-stable/try_transmute_ref-dst-not-immutable-tryfrombytes.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-stable/try_transmute_ref-dst-not-immutable-tryfrombytes.stderr +54 -54
- data/rust-vendor/zerocopy/tests/ui-stable/try_transmute_ref-size-decrease.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-stable/try_transmute_ref-size-decrease.stderr +2 -2
- data/rust-vendor/zerocopy/tests/ui-stable/try_transmute_ref-size-increase.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-stable/try_transmute_ref-size-increase.stderr +2 -2
- data/rust-vendor/zerocopy/tests/ui-stable/try_transmute_ref-src-not-immutable-intobytes.rs +1 -3
- data/rust-vendor/zerocopy/tests/ui-stable/try_transmute_ref-src-not-immutable-intobytes.stderr +19 -19
- data/rust-vendor/zerocopy-derive/.cargo-checksum.json +1 -1
- data/rust-vendor/zerocopy-derive/.cargo_vcs_info.json +1 -1
- data/rust-vendor/zerocopy-derive/Cargo.lock +3 -11
- data/rust-vendor/zerocopy-derive/Cargo.toml +13 -11
- data/rust-vendor/zerocopy-derive/Cargo.toml.orig +7 -10
- data/rust-vendor/zerocopy-derive/src/derive/from_bytes.rs +188 -0
- data/rust-vendor/zerocopy-derive/src/derive/into_bytes.rs +158 -0
- data/rust-vendor/zerocopy-derive/src/derive/known_layout.rs +348 -0
- data/rust-vendor/zerocopy-derive/src/derive/mod.rs +130 -0
- data/rust-vendor/zerocopy-derive/src/derive/try_from_bytes.rs +729 -0
- data/rust-vendor/zerocopy-derive/src/derive/unaligned.rs +78 -0
- data/rust-vendor/zerocopy-derive/src/lib.rs +31 -1893
- data/rust-vendor/zerocopy-derive/src/output_tests/expected/eq.expected.rs +17 -0
- data/rust-vendor/zerocopy-derive/src/output_tests/expected/from_bytes_enum.expected.rs +64 -0
- data/rust-vendor/zerocopy-derive/src/output_tests/expected/from_bytes_struct.expected.rs +64 -0
- data/rust-vendor/zerocopy-derive/src/output_tests/expected/from_bytes_union.expected.rs +144 -0
- data/rust-vendor/zerocopy-derive/src/output_tests/expected/from_zeros.expected.rs +39 -0
- data/rust-vendor/zerocopy-derive/src/output_tests/expected/hash.expected.rs +24 -0
- data/rust-vendor/zerocopy-derive/src/output_tests/expected/immutable.expected.rs +17 -0
- data/rust-vendor/zerocopy-derive/src/output_tests/expected/into_bytes_enum.expected.rs +17 -0
- data/rust-vendor/zerocopy-derive/src/output_tests/expected/into_bytes_struct_basic.expected.rs +25 -0
- data/rust-vendor/zerocopy-derive/src/output_tests/expected/into_bytes_struct_empty.expected.rs +17 -0
- data/rust-vendor/zerocopy-derive/src/output_tests/expected/into_bytes_struct_trailing.expected.rs +25 -0
- data/rust-vendor/zerocopy-derive/src/output_tests/expected/into_bytes_struct_trailing_generic.expected.rs +21 -0
- data/rust-vendor/zerocopy-derive/src/output_tests/expected/known_layout_repr_c_struct.expected.rs +135 -0
- data/rust-vendor/zerocopy-derive/src/output_tests/expected/known_layout_struct.expected.rs +34 -0
- data/rust-vendor/zerocopy-derive/src/output_tests/expected/split_at_repr_c.expected.rs +22 -0
- data/rust-vendor/zerocopy-derive/src/output_tests/expected/split_at_repr_transparent.expected.rs +22 -0
- data/rust-vendor/zerocopy-derive/src/output_tests/expected/try_from_bytes.expected.rs +22 -0
- data/rust-vendor/zerocopy-derive/src/output_tests/expected/try_from_bytes_enum_1.expected.rs +2802 -0
- data/rust-vendor/zerocopy-derive/src/output_tests/expected/try_from_bytes_enum_2.expected.rs +2802 -0
- data/rust-vendor/zerocopy-derive/src/output_tests/expected/try_from_bytes_enum_3.expected.rs +2802 -0
- data/rust-vendor/zerocopy-derive/src/output_tests/expected/try_from_bytes_trivial_is_bit_valid_enum.expected.rs +22 -0
- data/rust-vendor/zerocopy-derive/src/output_tests/expected/unaligned.expected.rs +17 -0
- data/rust-vendor/zerocopy-derive/src/output_tests/mod.rs +960 -0
- data/rust-vendor/zerocopy-derive/src/util.rs +757 -0
- data/rust-vendor/zerocopy-derive/tests/deprecated.rs +6 -0
- data/rust-vendor/zerocopy-derive/tests/enum_from_zeros.rs +9 -0
- data/rust-vendor/zerocopy-derive/tests/enum_known_layout.rs +4 -0
- data/rust-vendor/zerocopy-derive/tests/enum_no_cell.rs +4 -0
- data/rust-vendor/zerocopy-derive/tests/enum_to_bytes.rs +14 -0
- data/rust-vendor/zerocopy-derive/tests/enum_try_from_bytes.rs +37 -15
- data/rust-vendor/zerocopy-derive/tests/enum_unaligned.rs +4 -0
- data/rust-vendor/zerocopy-derive/tests/eq.rs +1 -0
- data/rust-vendor/zerocopy-derive/tests/hash.rs +1 -0
- data/rust-vendor/zerocopy-derive/tests/hygiene.rs +3 -1
- data/rust-vendor/zerocopy-derive/tests/include.rs +26 -4
- data/rust-vendor/zerocopy-derive/tests/issue_2117.rs +1 -0
- data/rust-vendor/zerocopy-derive/tests/issue_2835.rs +2 -1
- data/rust-vendor/zerocopy-derive/tests/issue_2880.rs +292 -0
- data/rust-vendor/zerocopy-derive/tests/issue_2915.rs +78 -0
- data/rust-vendor/zerocopy-derive/tests/paths_and_modules.rs +3 -0
- data/rust-vendor/zerocopy-derive/tests/priv_in_pub.rs +2 -0
- data/rust-vendor/zerocopy-derive/tests/struct_from_bytes.rs +6 -0
- data/rust-vendor/zerocopy-derive/tests/struct_from_zeros.rs +6 -0
- data/rust-vendor/zerocopy-derive/tests/struct_known_layout.rs +9 -0
- data/rust-vendor/zerocopy-derive/tests/struct_no_cell.rs +8 -0
- data/rust-vendor/zerocopy-derive/tests/struct_to_bytes.rs +17 -0
- data/rust-vendor/zerocopy-derive/tests/struct_try_from_bytes.rs +29 -65
- data/rust-vendor/zerocopy-derive/tests/struct_unaligned.rs +7 -0
- data/rust-vendor/zerocopy-derive/tests/ui-msrv/derive_transparent.rs +3 -2
- data/rust-vendor/zerocopy-derive/tests/ui-msrv/derive_transparent.stderr +32 -32
- data/rust-vendor/zerocopy-derive/tests/ui-msrv/enum.rs +48 -1
- data/rust-vendor/zerocopy-derive/tests/ui-msrv/enum.stderr +129 -126
- data/rust-vendor/zerocopy-derive/tests/ui-msrv/enum_from_bytes_u8_too_few.rs +2 -1
- data/rust-vendor/zerocopy-derive/tests/ui-msrv/enum_from_bytes_u8_too_few.stderr +6 -6
- data/rust-vendor/zerocopy-derive/tests/ui-msrv/late_compile_pass.rs +9 -2
- data/rust-vendor/zerocopy-derive/tests/ui-msrv/late_compile_pass.stderr +37 -37
- data/rust-vendor/zerocopy-derive/tests/ui-msrv/mid_compile_pass.rs +6 -2
- data/rust-vendor/zerocopy-derive/tests/ui-msrv/mid_compile_pass.stderr +26 -26
- data/rust-vendor/zerocopy-derive/tests/ui-msrv/msrv_specific.rs +3 -2
- data/rust-vendor/zerocopy-derive/tests/ui-msrv/msrv_specific.stderr +7 -7
- data/rust-vendor/zerocopy-derive/tests/ui-msrv/privacy.rs +66 -29
- data/rust-vendor/zerocopy-derive/tests/ui-msrv/privacy.stderr +78 -78
- data/rust-vendor/zerocopy-derive/tests/ui-msrv/struct.rs +34 -2
- data/rust-vendor/zerocopy-derive/tests/ui-msrv/struct.stderr +79 -79
- data/rust-vendor/zerocopy-derive/tests/ui-msrv/union.rs +12 -1
- data/rust-vendor/zerocopy-derive/tests/ui-msrv/union.stderr +29 -29
- data/rust-vendor/zerocopy-derive/tests/ui-msrv/union_into_bytes_cfg/union_into_bytes_cfg.rs +3 -2
- data/rust-vendor/zerocopy-derive/tests/ui-nightly/absence_of_deprecated_warning.rs +3 -2
- data/rust-vendor/zerocopy-derive/tests/ui-nightly/absence_of_deprecated_warning.stderr +2 -2
- data/rust-vendor/zerocopy-derive/tests/ui-nightly/derive_transparent.rs +3 -2
- data/rust-vendor/zerocopy-derive/tests/ui-nightly/derive_transparent.stderr +57 -57
- data/rust-vendor/zerocopy-derive/tests/ui-nightly/enum.rs +48 -1
- data/rust-vendor/zerocopy-derive/tests/ui-nightly/enum.stderr +200 -192
- data/rust-vendor/zerocopy-derive/tests/ui-nightly/enum_from_bytes_u8_too_few.rs +2 -1
- data/rust-vendor/zerocopy-derive/tests/ui-nightly/enum_from_bytes_u8_too_few.stderr +6 -6
- data/rust-vendor/zerocopy-derive/tests/ui-nightly/late_compile_pass.rs +9 -2
- data/rust-vendor/zerocopy-derive/tests/ui-nightly/late_compile_pass.stderr +105 -105
- data/rust-vendor/zerocopy-derive/tests/ui-nightly/mid_compile_pass.rs +6 -2
- data/rust-vendor/zerocopy-derive/tests/ui-nightly/mid_compile_pass.stderr +29 -29
- data/rust-vendor/zerocopy-derive/tests/ui-nightly/privacy.rs +66 -29
- data/rust-vendor/zerocopy-derive/tests/ui-nightly/privacy.stderr +15 -15
- data/rust-vendor/zerocopy-derive/tests/ui-nightly/struct.rs +34 -2
- data/rust-vendor/zerocopy-derive/tests/ui-nightly/struct.stderr +130 -129
- data/rust-vendor/zerocopy-derive/tests/ui-nightly/union.rs +12 -1
- data/rust-vendor/zerocopy-derive/tests/ui-nightly/union.stderr +42 -42
- data/rust-vendor/zerocopy-derive/tests/ui-nightly/union_into_bytes_cfg/union_into_bytes_cfg.rs +3 -2
- data/rust-vendor/zerocopy-derive/tests/ui-stable/derive_transparent.rs +3 -2
- data/rust-vendor/zerocopy-derive/tests/ui-stable/derive_transparent.stderr +57 -57
- data/rust-vendor/zerocopy-derive/tests/ui-stable/enum.rs +48 -1
- data/rust-vendor/zerocopy-derive/tests/ui-stable/enum.stderr +201 -186
- data/rust-vendor/zerocopy-derive/tests/ui-stable/enum_from_bytes_u8_too_few.rs +2 -1
- data/rust-vendor/zerocopy-derive/tests/ui-stable/enum_from_bytes_u8_too_few.stderr +6 -6
- data/rust-vendor/zerocopy-derive/tests/ui-stable/late_compile_pass.rs +9 -2
- data/rust-vendor/zerocopy-derive/tests/ui-stable/late_compile_pass.stderr +105 -105
- data/rust-vendor/zerocopy-derive/tests/ui-stable/mid_compile_pass.rs +6 -2
- data/rust-vendor/zerocopy-derive/tests/ui-stable/mid_compile_pass.stderr +29 -29
- data/rust-vendor/zerocopy-derive/tests/ui-stable/privacy.rs +66 -29
- data/rust-vendor/zerocopy-derive/tests/ui-stable/privacy.stderr +15 -15
- data/rust-vendor/zerocopy-derive/tests/ui-stable/struct.rs +34 -2
- data/rust-vendor/zerocopy-derive/tests/ui-stable/struct.stderr +158 -129
- data/rust-vendor/zerocopy-derive/tests/ui-stable/union.rs +12 -1
- data/rust-vendor/zerocopy-derive/tests/ui-stable/union.stderr +48 -44
- data/rust-vendor/zerocopy-derive/tests/ui-stable/union_into_bytes_cfg/union_into_bytes_cfg.rs +3 -2
- data/rust-vendor/zerocopy-derive/tests/union_from_bytes.rs +15 -0
- data/rust-vendor/zerocopy-derive/tests/union_from_zeros.rs +14 -0
- data/rust-vendor/zerocopy-derive/tests/union_known_layout.rs +5 -0
- data/rust-vendor/zerocopy-derive/tests/union_no_cell.rs +5 -0
- data/rust-vendor/zerocopy-derive/tests/union_to_bytes.rs +5 -0
- data/rust-vendor/zerocopy-derive/tests/union_try_from_bytes.rs +34 -74
- data/rust-vendor/zerocopy-derive/tests/union_unaligned.rs +4 -1
- data/rust-vendor/zerocopy-derive/tests/unsafe_cell.rs +3 -0
- data/rust-vendor/zmij/.cargo-checksum.json +1 -1
- data/rust-vendor/zmij/.cargo_vcs_info.json +1 -1
- data/rust-vendor/zmij/Cargo.lock +10 -10
- data/rust-vendor/zmij/Cargo.toml +1 -1
- data/rust-vendor/zmij/Cargo.toml.orig +1 -1
- data/rust-vendor/zmij/README.md +1 -1
- data/rust-vendor/zmij/src/lib.rs +132 -158
- data/rust-vendor/zune-jpeg/.cargo-checksum.json +1 -1
- data/rust-vendor/zune-jpeg/.cargo_vcs_info.json +1 -1
- data/rust-vendor/zune-jpeg/Cargo.lock +1 -1
- data/rust-vendor/zune-jpeg/Cargo.toml +1 -1
- data/rust-vendor/zune-jpeg/Cargo.toml.orig +1 -1
- data/rust-vendor/zune-jpeg/src/bitstream.rs +1 -1
- data/rust-vendor/zune-jpeg/src/components.rs +2 -1
- data/rust-vendor/zune-jpeg/src/decoder.rs +3 -23
- data/rust-vendor/zune-jpeg/src/headers.rs +19 -1
- data/rust-vendor/zune-jpeg/src/lib.rs +1 -0
- data/rust-vendor/zune-jpeg/src/mcu.rs +6 -6
- data/rust-vendor/zune-jpeg/src/mcu_prog.rs +22 -34
- data/rust-vendor/zune-jpeg/src/upsampler/avx2.rs +3 -1
- data/rust-vendor/zune-jpeg/src/upsampler/neon.rs +13 -23
- data/rust-vendor/zune-jpeg/src/upsampler/portable_simd.rs +4 -1
- data/rust-vendor/zune-jpeg/src/upsampler/scalar.rs +4 -1
- metadata +41 -8
- data/rust-vendor/zerocopy/tests/ui-stable/transmute-mut-src-dst-unsized.stderr +0 -183
- data/rust-vendor/zerocopy/tests/ui-stable/transmute-ref-src-dst-unsized.stderr +0 -183
- data/rust-vendor/zerocopy-derive/src/enum.rs +0 -456
- data/rust-vendor/zerocopy-derive/src/ext.rs +0 -123
- data/rust-vendor/zerocopy-derive/src/output_tests.rs +0 -5608
- data/rust-vendor/zerocopy-derive/tests/crate_path.rs +0 -189
|
@@ -756,6 +756,15 @@ mod cast_from {
|
|
|
756
756
|
{
|
|
757
757
|
}
|
|
758
758
|
|
|
759
|
+
// SAFETY: The implementation of `Project::project` preserves the size of
|
|
760
|
+
// the referent (see inline comments for a more detailed proof of this).
|
|
761
|
+
unsafe impl<Src, Dst> crate::pointer::cast::CastExact<Src, Dst> for CastFrom<Dst>
|
|
762
|
+
where
|
|
763
|
+
Src: KnownLayout<PointerMetadata = usize> + ?Sized,
|
|
764
|
+
Dst: KnownLayout<PointerMetadata = usize> + ?Sized,
|
|
765
|
+
{
|
|
766
|
+
}
|
|
767
|
+
|
|
759
768
|
// SAFETY: `project` produces a pointer which refers to the same referent
|
|
760
769
|
// bytes as its input, or to a subset of them (see inline comments for a
|
|
761
770
|
// more detailed proof of this). It does this using provenance-preserving
|
|
@@ -375,7 +375,8 @@ use core::{
|
|
|
375
375
|
#[cfg(feature = "std")]
|
|
376
376
|
use std::io;
|
|
377
377
|
|
|
378
|
-
|
|
378
|
+
#[doc(hidden)]
|
|
379
|
+
pub use crate::pointer::invariant::{self, BecauseExclusive};
|
|
379
380
|
#[doc(hidden)]
|
|
380
381
|
pub use crate::pointer::PtrInner;
|
|
381
382
|
pub use crate::{
|
|
@@ -1103,6 +1104,29 @@ const _: () = unsafe {
|
|
|
1103
1104
|
pub const STRUCT_VARIANT_ID: i128 = -1;
|
|
1104
1105
|
#[doc(hidden)]
|
|
1105
1106
|
pub const UNION_VARIANT_ID: i128 = -2;
|
|
1107
|
+
#[doc(hidden)]
|
|
1108
|
+
pub const REPR_C_UNION_VARIANT_ID: i128 = -3;
|
|
1109
|
+
|
|
1110
|
+
/// # Safety
|
|
1111
|
+
///
|
|
1112
|
+
/// `Self::ProjectToTag` must satisfy its safety invariant.
|
|
1113
|
+
#[doc(hidden)]
|
|
1114
|
+
pub unsafe trait HasTag {
|
|
1115
|
+
fn only_derive_is_allowed_to_implement_this_trait()
|
|
1116
|
+
where
|
|
1117
|
+
Self: Sized;
|
|
1118
|
+
|
|
1119
|
+
/// The type's enum tag, or `()` for non-enum types.
|
|
1120
|
+
type Tag: Immutable;
|
|
1121
|
+
|
|
1122
|
+
/// A pointer projection from `Self` to its tag.
|
|
1123
|
+
///
|
|
1124
|
+
/// # Safety
|
|
1125
|
+
///
|
|
1126
|
+
/// It must be the case that, for all `slf: Ptr<'_, Self, I>`, it is sound
|
|
1127
|
+
/// to project from `slf` to `Ptr<'_, Self::Tag, I>` using this projection.
|
|
1128
|
+
type ProjectToTag: pointer::cast::Project<Self, Self::Tag>;
|
|
1129
|
+
}
|
|
1106
1130
|
|
|
1107
1131
|
/// Projects a given field from `Self`.
|
|
1108
1132
|
///
|
|
@@ -1114,10 +1138,13 @@ pub const UNION_VARIANT_ID: i128 = -2;
|
|
|
1114
1138
|
///
|
|
1115
1139
|
/// A field `f` is `HasField` for `Self` if and only if:
|
|
1116
1140
|
///
|
|
1117
|
-
/// - If `Self`
|
|
1141
|
+
/// - If `Self` has the layout of a struct or union type, then `VARIANT_ID` is
|
|
1118
1142
|
/// `STRUCT_VARIANT_ID` or `UNION_VARIANT_ID` respectively; otherwise, if
|
|
1119
|
-
/// `Self`
|
|
1120
|
-
/// variant in which `f` appears.
|
|
1143
|
+
/// `Self` has the layout of an enum type, `VARIANT_ID` is the numerical index
|
|
1144
|
+
/// of the enum variant in which `f` appears. Note that `Self` does not need
|
|
1145
|
+
/// to actually *be* such a type – it just needs to have the same layout as
|
|
1146
|
+
/// such a type. For example, a `#[repr(transparent)]` wrapper around an enum
|
|
1147
|
+
/// has the same layout as that enum.
|
|
1121
1148
|
/// - If `f` has name `n`, `FIELD_ID` is `zerocopy::ident_id!(n)`; otherwise,
|
|
1122
1149
|
/// if `f` is at index `i`, `FIELD_ID` is `zerocopy::ident_id!(i)`.
|
|
1123
1150
|
/// - `Field` is a type with the same visibility as `f`.
|
|
@@ -1130,7 +1157,9 @@ pub const UNION_VARIANT_ID: i128 = -2;
|
|
|
1130
1157
|
///
|
|
1131
1158
|
/// The implementation of `project` must satisfy its safety post-condition.
|
|
1132
1159
|
#[doc(hidden)]
|
|
1133
|
-
pub unsafe trait HasField<Field, const VARIANT_ID: i128, const FIELD_ID: i128
|
|
1160
|
+
pub unsafe trait HasField<Field, const VARIANT_ID: i128, const FIELD_ID: i128>:
|
|
1161
|
+
HasTag
|
|
1162
|
+
{
|
|
1134
1163
|
fn only_derive_is_allowed_to_implement_this_trait()
|
|
1135
1164
|
where
|
|
1136
1165
|
Self: Sized;
|
|
@@ -1140,13 +1169,117 @@ pub unsafe trait HasField<Field, const VARIANT_ID: i128, const FIELD_ID: i128> {
|
|
|
1140
1169
|
|
|
1141
1170
|
/// Projects from `slf` to the field.
|
|
1142
1171
|
///
|
|
1172
|
+
/// Users should generally not call `project` directly, and instead should
|
|
1173
|
+
/// use high-level APIs like [`PtrInner::project`] or [`Ptr::project`].
|
|
1174
|
+
///
|
|
1143
1175
|
/// # Safety
|
|
1144
1176
|
///
|
|
1145
1177
|
/// The returned pointer refers to a non-strict subset of the bytes of
|
|
1146
1178
|
/// `slf`'s referent, and has the same provenance as `slf`.
|
|
1179
|
+
#[must_use]
|
|
1147
1180
|
fn project(slf: PtrInner<'_, Self>) -> *mut Self::Type;
|
|
1148
1181
|
}
|
|
1149
1182
|
|
|
1183
|
+
/// Projects a given field from `Self`.
|
|
1184
|
+
///
|
|
1185
|
+
/// Implementations of this trait encode the conditions under which a field can
|
|
1186
|
+
/// be projected from a `Ptr<'_, Self, I>`, and how the invariants of that
|
|
1187
|
+
/// [`Ptr`] (`I`) determine the invariants of pointers projected from it. In
|
|
1188
|
+
/// other words, it is a type-level function over invariants; `I` goes in,
|
|
1189
|
+
/// `Self::Invariants` comes out.
|
|
1190
|
+
///
|
|
1191
|
+
/// # Safety
|
|
1192
|
+
///
|
|
1193
|
+
/// `T: ProjectField<Field, I, VARIANT_ID, FIELD_ID>` if, for a
|
|
1194
|
+
/// `ptr: Ptr<'_, T, I>` such that `T::is_projectable(ptr).is_ok()`,
|
|
1195
|
+
/// `<T as HasField<Field, VARIANT_ID, FIELD_ID>>::project(ptr.as_inner())`
|
|
1196
|
+
/// conforms to `T::Invariants`.
|
|
1197
|
+
#[doc(hidden)]
|
|
1198
|
+
pub unsafe trait ProjectField<Field, I, const VARIANT_ID: i128, const FIELD_ID: i128>:
|
|
1199
|
+
HasField<Field, VARIANT_ID, FIELD_ID>
|
|
1200
|
+
where
|
|
1201
|
+
I: invariant::Invariants,
|
|
1202
|
+
{
|
|
1203
|
+
fn only_derive_is_allowed_to_implement_this_trait()
|
|
1204
|
+
where
|
|
1205
|
+
Self: Sized;
|
|
1206
|
+
|
|
1207
|
+
/// The invariants of the projected field pointer, with respect to the
|
|
1208
|
+
/// invariants, `I`, of the containing pointer. The aliasing dimension of
|
|
1209
|
+
/// the invariants is guaranteed to remain unchanged.
|
|
1210
|
+
type Invariants: invariant::Invariants<Aliasing = I::Aliasing>;
|
|
1211
|
+
|
|
1212
|
+
/// The failure mode of projection. `()` if the projection is fallible,
|
|
1213
|
+
/// otherwise [`core::convert::Infallible`].
|
|
1214
|
+
type Error;
|
|
1215
|
+
|
|
1216
|
+
/// Is the given field projectable from `ptr`?
|
|
1217
|
+
///
|
|
1218
|
+
/// If a field with [`Self::Invariants`] is projectable from the referent,
|
|
1219
|
+
/// this function produces an `Ok(ptr)` from which the projection can be
|
|
1220
|
+
/// made; otherwise `Err`.
|
|
1221
|
+
///
|
|
1222
|
+
/// This method must be overriden if the field's projectability depends on
|
|
1223
|
+
/// the value of the bytes in `ptr`.
|
|
1224
|
+
#[inline(always)]
|
|
1225
|
+
fn is_projectable<'a>(_ptr: Ptr<'a, Self::Tag, I>) -> Result<(), Self::Error> {
|
|
1226
|
+
trait IsInfallible {
|
|
1227
|
+
const IS_INFALLIBLE: bool;
|
|
1228
|
+
}
|
|
1229
|
+
|
|
1230
|
+
struct Projection<T, Field, I, const VARIANT_ID: i128, const FIELD_ID: i128>(
|
|
1231
|
+
PhantomData<(Field, I, T)>,
|
|
1232
|
+
)
|
|
1233
|
+
where
|
|
1234
|
+
T: ?Sized + HasField<Field, VARIANT_ID, FIELD_ID>,
|
|
1235
|
+
I: invariant::Invariants;
|
|
1236
|
+
|
|
1237
|
+
impl<T, Field, I, const VARIANT_ID: i128, const FIELD_ID: i128> IsInfallible
|
|
1238
|
+
for Projection<T, Field, I, VARIANT_ID, FIELD_ID>
|
|
1239
|
+
where
|
|
1240
|
+
T: ?Sized + HasField<Field, VARIANT_ID, FIELD_ID>,
|
|
1241
|
+
I: invariant::Invariants,
|
|
1242
|
+
{
|
|
1243
|
+
const IS_INFALLIBLE: bool = {
|
|
1244
|
+
let is_infallible = match VARIANT_ID {
|
|
1245
|
+
// For nondestructive projections of struct and union
|
|
1246
|
+
// fields, the projected field's satisfaction of
|
|
1247
|
+
// `Invariants` does not depend on the value of the
|
|
1248
|
+
// referent. This default implementation of `is_projectable`
|
|
1249
|
+
// is non-destructive, as it does not overwrite any part of
|
|
1250
|
+
// the referent.
|
|
1251
|
+
crate::STRUCT_VARIANT_ID | crate::UNION_VARIANT_ID => true,
|
|
1252
|
+
_enum_variant => {
|
|
1253
|
+
use crate::invariant::{Validity, ValidityKind};
|
|
1254
|
+
match I::Validity::KIND {
|
|
1255
|
+
// The `Uninit` and `Initialized` validity
|
|
1256
|
+
// invariants do not depend on the enum's tag. In
|
|
1257
|
+
// particular, we don't actually care about what
|
|
1258
|
+
// variant is present – we can treat *any* range of
|
|
1259
|
+
// uninitialized or initialized memory as containing
|
|
1260
|
+
// an uninitialized or initialized instance of *any*
|
|
1261
|
+
// type – the type itself is irrelevant.
|
|
1262
|
+
ValidityKind::Uninit | ValidityKind::Initialized => true,
|
|
1263
|
+
// The projectability of an enum field from an
|
|
1264
|
+
// `AsInitialized` or `Valid` state is a dynamic
|
|
1265
|
+
// property of its tag.
|
|
1266
|
+
ValidityKind::AsInitialized | ValidityKind::Valid => false,
|
|
1267
|
+
}
|
|
1268
|
+
}
|
|
1269
|
+
};
|
|
1270
|
+
const_assert!(is_infallible);
|
|
1271
|
+
is_infallible
|
|
1272
|
+
};
|
|
1273
|
+
}
|
|
1274
|
+
|
|
1275
|
+
const_assert!(
|
|
1276
|
+
<Projection<Self, Field, I, VARIANT_ID, FIELD_ID> as IsInfallible>::IS_INFALLIBLE
|
|
1277
|
+
);
|
|
1278
|
+
|
|
1279
|
+
Ok(())
|
|
1280
|
+
}
|
|
1281
|
+
}
|
|
1282
|
+
|
|
1150
1283
|
/// Analyzes whether a type is [`FromZeros`].
|
|
1151
1284
|
///
|
|
1152
1285
|
/// This derive analyzes, at compile time, whether the annotated type satisfies
|
|
@@ -1344,14 +1477,12 @@ pub use zerocopy_derive::Immutable;
|
|
|
1344
1477
|
// # Safety (Internal)
|
|
1345
1478
|
//
|
|
1346
1479
|
// If `T: Immutable`, unsafe code *inside of this crate* may assume that, given
|
|
1347
|
-
// `t: &T`, `t` does not
|
|
1348
|
-
//
|
|
1349
|
-
// (
|
|
1350
|
-
// `
|
|
1351
|
-
// exhibit [undefined behavior].
|
|
1480
|
+
// `t: &T`, `t` does not permit interior mutation of its referent. Because
|
|
1481
|
+
// [`UnsafeCell`] is the only type which permits interior mutation, it is
|
|
1482
|
+
// sufficient (though not necessary) to guarantee that `T` contains no
|
|
1483
|
+
// `UnsafeCell`s.
|
|
1352
1484
|
//
|
|
1353
1485
|
// [`UnsafeCell`]: core::cell::UnsafeCell
|
|
1354
|
-
// [undefined behavior]: https://raphlinus.github.io/programming/rust/2018/08/17/undefined-behavior.html
|
|
1355
1486
|
#[cfg_attr(
|
|
1356
1487
|
feature = "derive",
|
|
1357
1488
|
doc = "[derive]: zerocopy_derive::Immutable",
|
|
@@ -1566,7 +1697,7 @@ pub unsafe trait TryFromBytes {
|
|
|
1566
1697
|
/// [`UnsafeCell`]: core::cell::UnsafeCell
|
|
1567
1698
|
/// [`Shared`]: invariant::Shared
|
|
1568
1699
|
#[doc(hidden)]
|
|
1569
|
-
fn is_bit_valid
|
|
1700
|
+
fn is_bit_valid(candidate: Maybe<'_, Self>) -> bool;
|
|
1570
1701
|
|
|
1571
1702
|
/// Attempts to interpret the given `source` as a `&Self`.
|
|
1572
1703
|
///
|
|
@@ -1653,11 +1784,6 @@ pub unsafe trait TryFromBytes {
|
|
|
1653
1784
|
// This call may panic. If that happens, it doesn't cause any soundness
|
|
1654
1785
|
// issues, as we have not generated any invalid state which we need to
|
|
1655
1786
|
// fix before returning.
|
|
1656
|
-
//
|
|
1657
|
-
// Note that one panic or post-monomorphization error condition is
|
|
1658
|
-
// calling `try_into_valid` (and thus `is_bit_valid`) with a shared
|
|
1659
|
-
// pointer when `Self: !Immutable`. Since `Self: Immutable`, this panic
|
|
1660
|
-
// condition will not happen.
|
|
1661
1787
|
match source.try_into_valid() {
|
|
1662
1788
|
Ok(valid) => Ok(valid.as_ref()),
|
|
1663
1789
|
Err(e) => {
|
|
@@ -1932,16 +2058,9 @@ pub unsafe trait TryFromBytes {
|
|
|
1932
2058
|
// This call may panic. If that happens, it doesn't cause any soundness
|
|
1933
2059
|
// issues, as we have not generated any invalid state which we need to
|
|
1934
2060
|
// fix before returning.
|
|
1935
|
-
//
|
|
1936
|
-
// Note that one panic or post-monomorphization error condition is
|
|
1937
|
-
// calling `try_into_valid` (and thus `is_bit_valid`) with a shared
|
|
1938
|
-
// pointer when `Self: !Immutable`. Since `Self: Immutable`, this panic
|
|
1939
|
-
// condition will not happen.
|
|
1940
2061
|
match source.try_into_valid() {
|
|
1941
2062
|
Ok(source) => Ok(source.as_mut()),
|
|
1942
|
-
Err(e) =>
|
|
1943
|
-
Err(e.map_src(|src| src.as_bytes::<BecauseExclusive>().as_mut()).into())
|
|
1944
|
-
}
|
|
2063
|
+
Err(e) => Err(e.map_src(|src| src.as_bytes().as_mut()).into()),
|
|
1945
2064
|
}
|
|
1946
2065
|
}
|
|
1947
2066
|
Err(e) => Err(e.map_src(Ptr::as_mut).into()),
|
|
@@ -2227,11 +2346,6 @@ pub unsafe trait TryFromBytes {
|
|
|
2227
2346
|
// This call may panic. If that happens, it doesn't cause any soundness
|
|
2228
2347
|
// issues, as we have not generated any invalid state which we need to
|
|
2229
2348
|
// fix before returning.
|
|
2230
|
-
//
|
|
2231
|
-
// Note that one panic or post-monomorphization error condition is
|
|
2232
|
-
// calling `try_into_valid` (and thus `is_bit_valid`) with a shared
|
|
2233
|
-
// pointer when `Self: !Immutable`. Since `Self: Immutable`, this panic
|
|
2234
|
-
// condition will not happen.
|
|
2235
2349
|
match source.try_into_valid() {
|
|
2236
2350
|
Ok(source) => Ok(source.as_ref()),
|
|
2237
2351
|
Err(e) => {
|
|
@@ -2514,16 +2628,9 @@ pub unsafe trait TryFromBytes {
|
|
|
2514
2628
|
// This call may panic. If that happens, it doesn't cause any soundness
|
|
2515
2629
|
// issues, as we have not generated any invalid state which we need to
|
|
2516
2630
|
// fix before returning.
|
|
2517
|
-
//
|
|
2518
|
-
// Note that one panic or post-monomorphization error condition is
|
|
2519
|
-
// calling `try_into_valid` (and thus `is_bit_valid`) with a shared
|
|
2520
|
-
// pointer when `Self: !Immutable`. Since `Self: Immutable`, this panic
|
|
2521
|
-
// condition will not happen.
|
|
2522
2631
|
match source.try_into_valid() {
|
|
2523
2632
|
Ok(source) => Ok(source.as_mut()),
|
|
2524
|
-
Err(e) =>
|
|
2525
|
-
Err(e.map_src(|src| src.as_bytes::<BecauseExclusive>().as_mut()).into())
|
|
2526
|
-
}
|
|
2633
|
+
Err(e) => Err(e.map_src(|src| src.as_bytes().as_mut()).into()),
|
|
2527
2634
|
}
|
|
2528
2635
|
}
|
|
2529
2636
|
Err(e) => Err(e.map_src(Ptr::as_mut).into()),
|
|
@@ -2911,11 +3018,6 @@ fn try_ref_from_prefix_suffix<T: TryFromBytes + KnownLayout + Immutable + ?Sized
|
|
|
2911
3018
|
// This call may panic. If that happens, it doesn't cause any soundness
|
|
2912
3019
|
// issues, as we have not generated any invalid state which we need to
|
|
2913
3020
|
// fix before returning.
|
|
2914
|
-
//
|
|
2915
|
-
// Note that one panic or post-monomorphization error condition is
|
|
2916
|
-
// calling `try_into_valid` (and thus `is_bit_valid`) with a shared
|
|
2917
|
-
// pointer when `Self: !Immutable`. Since `Self: Immutable`, this panic
|
|
2918
|
-
// condition will not happen.
|
|
2919
3021
|
match source.try_into_valid() {
|
|
2920
3022
|
Ok(valid) => Ok((valid.as_ref(), prefix_suffix.as_ref())),
|
|
2921
3023
|
Err(e) => Err(e.map_src(|src| src.as_bytes::<BecauseImmutable>().as_ref()).into()),
|
|
@@ -2936,14 +3038,9 @@ fn try_mut_from_prefix_suffix<T: IntoBytes + TryFromBytes + KnownLayout + ?Sized
|
|
|
2936
3038
|
// This call may panic. If that happens, it doesn't cause any soundness
|
|
2937
3039
|
// issues, as we have not generated any invalid state which we need to
|
|
2938
3040
|
// fix before returning.
|
|
2939
|
-
//
|
|
2940
|
-
// Note that one panic or post-monomorphization error condition is
|
|
2941
|
-
// calling `try_into_valid` (and thus `is_bit_valid`) with a shared
|
|
2942
|
-
// pointer when `Self: !Immutable`. Since `Self: Immutable`, this panic
|
|
2943
|
-
// condition will not happen.
|
|
2944
3041
|
match candidate.try_into_valid() {
|
|
2945
3042
|
Ok(valid) => Ok((valid.as_mut(), prefix_suffix.as_mut())),
|
|
2946
|
-
Err(e) => Err(e.map_src(|src| src.as_bytes
|
|
3043
|
+
Err(e) => Err(e.map_src(|src| src.as_bytes().as_mut()).into()),
|
|
2947
3044
|
}
|
|
2948
3045
|
}
|
|
2949
3046
|
Err(e) => Err(e.map_src(Ptr::as_mut).into()),
|
|
@@ -2974,7 +3071,7 @@ unsafe fn try_read_from<S, T: TryFromBytes>(
|
|
|
2974
3071
|
// via `c_ptr` so long as it is live, so we don't need to worry about the
|
|
2975
3072
|
// fact that `c_ptr` may have more restricted validity than `candidate`.
|
|
2976
3073
|
let c_ptr = unsafe { c_ptr.assume_validity::<invariant::Initialized>() };
|
|
2977
|
-
let c_ptr = c_ptr.
|
|
3074
|
+
let mut c_ptr = c_ptr.cast::<_, crate::pointer::cast::CastSized, _>();
|
|
2978
3075
|
|
|
2979
3076
|
// Since we don't have `T: KnownLayout`, we hack around that by using
|
|
2980
3077
|
// `Wrapping<T>`, which implements `KnownLayout` even if `T` doesn't.
|
|
@@ -2982,12 +3079,7 @@ unsafe fn try_read_from<S, T: TryFromBytes>(
|
|
|
2982
3079
|
// This call may panic. If that happens, it doesn't cause any soundness
|
|
2983
3080
|
// issues, as we have not generated any invalid state which we need to fix
|
|
2984
3081
|
// before returning.
|
|
2985
|
-
|
|
2986
|
-
// Note that one panic or post-monomorphization error condition is calling
|
|
2987
|
-
// `try_into_valid` (and thus `is_bit_valid`) with a shared pointer when
|
|
2988
|
-
// `Self: !Immutable`. Since `Self: Immutable`, this panic condition will
|
|
2989
|
-
// not happen.
|
|
2990
|
-
if !Wrapping::<T>::is_bit_valid(c_ptr.forget_aligned()) {
|
|
3082
|
+
if !Wrapping::<T>::is_bit_valid(c_ptr.reborrow_shared().forget_aligned()) {
|
|
2991
3083
|
return Err(ValidityError::new(source).into());
|
|
2992
3084
|
}
|
|
2993
3085
|
|
|
@@ -4358,8 +4450,8 @@ pub unsafe trait FromBytes: FromZeros {
|
|
|
4358
4450
|
/// ```
|
|
4359
4451
|
///
|
|
4360
4452
|
/// Since an explicit `count` is provided, this method supports types with
|
|
4361
|
-
/// zero-sized trailing slice elements. Methods such as [`
|
|
4362
|
-
/// do not take an explicit count do not support such types.
|
|
4453
|
+
/// zero-sized trailing slice elements. Methods such as [`mut_from_bytes`]
|
|
4454
|
+
/// which do not take an explicit count do not support such types.
|
|
4363
4455
|
///
|
|
4364
4456
|
/// ```
|
|
4365
4457
|
/// use zerocopy::*;
|
|
@@ -4377,7 +4469,7 @@ pub unsafe trait FromBytes: FromZeros {
|
|
|
4377
4469
|
/// assert_eq!(zsty.trailing_dst.len(), 42);
|
|
4378
4470
|
/// ```
|
|
4379
4471
|
///
|
|
4380
|
-
/// [`
|
|
4472
|
+
/// [`mut_from_bytes`]: FromBytes::mut_from_bytes
|
|
4381
4473
|
#[must_use = "has no side effects"]
|
|
4382
4474
|
#[inline]
|
|
4383
4475
|
fn mut_from_bytes_with_elems(
|
|
@@ -4390,9 +4482,7 @@ pub unsafe trait FromBytes: FromZeros {
|
|
|
4390
4482
|
let source = Ptr::from_mut(source);
|
|
4391
4483
|
let maybe_slf = source.try_cast_into_no_leftover::<_, BecauseImmutable>(Some(count));
|
|
4392
4484
|
match maybe_slf {
|
|
4393
|
-
Ok(slf) => Ok(slf
|
|
4394
|
-
.recall_validity::<_, (_, (_, (BecauseExclusive, BecauseExclusive)))>()
|
|
4395
|
-
.as_mut()),
|
|
4485
|
+
Ok(slf) => Ok(slf.recall_validity::<_, (_, (_, BecauseExclusive))>().as_mut()),
|
|
4396
4486
|
Err(err) => Err(err.map_src(|s| s.as_mut())),
|
|
4397
4487
|
}
|
|
4398
4488
|
}
|
|
@@ -4750,7 +4840,7 @@ pub unsafe trait FromBytes: FromZeros {
|
|
|
4750
4840
|
// cannot be violated even though `buf` may have more permissive bit
|
|
4751
4841
|
// validity than `ptr`.
|
|
4752
4842
|
let ptr = unsafe { ptr.assume_validity::<invariant::Initialized>() };
|
|
4753
|
-
let ptr = ptr.as_bytes
|
|
4843
|
+
let ptr = ptr.as_bytes();
|
|
4754
4844
|
src.read_exact(ptr.as_mut())?;
|
|
4755
4845
|
// SAFETY: `buf` entirely consists of initialized bytes, and `Self` is
|
|
4756
4846
|
// `FromBytes`.
|
|
@@ -5118,10 +5208,8 @@ pub unsafe trait IntoBytes {
|
|
|
5118
5208
|
// initialized.
|
|
5119
5209
|
// - Since `slf` is derived from `self`, and `self` is an immutable
|
|
5120
5210
|
// reference, the only other references to this memory region that
|
|
5121
|
-
// could exist are other immutable references,
|
|
5122
|
-
//
|
|
5123
|
-
// `UnsafeCell`s, which are the only types for which this rule
|
|
5124
|
-
// wouldn't be sufficient.
|
|
5211
|
+
// could exist are other immutable references, which by `Self:
|
|
5212
|
+
// Immutable` don't permit mutation.
|
|
5125
5213
|
// - The total size of the resulting slice is no larger than
|
|
5126
5214
|
// `isize::MAX` because no allocation produced by safe code can be
|
|
5127
5215
|
// larger than `isize::MAX`.
|
|
@@ -6232,7 +6320,7 @@ mod tests {
|
|
|
6232
6320
|
|
|
6233
6321
|
#[test]
|
|
6234
6322
|
fn test_object_safety() {
|
|
6235
|
-
fn
|
|
6323
|
+
fn _takes_immutable(_: &dyn Immutable) {}
|
|
6236
6324
|
fn _takes_unaligned(_: &dyn Unaligned) {}
|
|
6237
6325
|
}
|
|
6238
6326
|
|
|
@@ -6447,10 +6535,10 @@ mod tests {
|
|
|
6447
6535
|
}
|
|
6448
6536
|
|
|
6449
6537
|
#[test]
|
|
6450
|
-
fn
|
|
6451
|
-
// Test `FromBytes::{
|
|
6452
|
-
// Exhaustive coverage for these methods is covered by
|
|
6453
|
-
// which these helper methods defer to.
|
|
6538
|
+
fn test_ref_from_mut_from_bytes() {
|
|
6539
|
+
// Test `FromBytes::{ref_from_bytes, mut_from_bytes}{,_prefix,Suffix}`
|
|
6540
|
+
// success cases. Exhaustive coverage for these methods is covered by
|
|
6541
|
+
// the `Ref` tests above, which these helper methods defer to.
|
|
6454
6542
|
|
|
6455
6543
|
let mut buf =
|
|
6456
6544
|
Align::<[u8; 16], AU64>::new([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]);
|
|
@@ -6482,8 +6570,9 @@ mod tests {
|
|
|
6482
6570
|
}
|
|
6483
6571
|
|
|
6484
6572
|
#[test]
|
|
6485
|
-
fn
|
|
6486
|
-
// Test `FromBytes::{
|
|
6573
|
+
fn test_ref_from_mut_from_bytes_error() {
|
|
6574
|
+
// Test `FromBytes::{ref_from_bytes, mut_from_bytes}{,_prefix,Suffix}`
|
|
6575
|
+
// error cases.
|
|
6487
6576
|
|
|
6488
6577
|
// Fail because the buffer is too large.
|
|
6489
6578
|
let mut buf = Align::<[u8; 16], AU64>::default();
|
|
@@ -895,10 +895,8 @@ macro_rules! cryptocorrosion_derive_traits {
|
|
|
895
895
|
$($field_ty: $crate::FromBytes,)*
|
|
896
896
|
)?
|
|
897
897
|
{
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
A: $crate::pointer::invariant::Reference
|
|
901
|
-
{
|
|
898
|
+
#[inline]
|
|
899
|
+
fn is_bit_valid(_c: $crate::Maybe<'_, Self>) -> bool {
|
|
902
900
|
// SAFETY: This macro only accepts `#[repr(C)]` and
|
|
903
901
|
// `#[repr(transparent)]` structs, and this `impl` block
|
|
904
902
|
// requires all field types to be `FromBytes`. Thus, all
|
|
@@ -1038,10 +1036,8 @@ macro_rules! cryptocorrosion_derive_traits {
|
|
|
1038
1036
|
$field_ty: $crate::FromBytes,
|
|
1039
1037
|
)*
|
|
1040
1038
|
{
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
A: $crate::pointer::invariant::Reference
|
|
1044
|
-
{
|
|
1039
|
+
#[inline]
|
|
1040
|
+
fn is_bit_valid(_c: $crate::Maybe<'_, Self>) -> bool {
|
|
1045
1041
|
// SAFETY: This macro only accepts `#[repr(C)]` unions, and this
|
|
1046
1042
|
// `impl` block requires all field types to be `FromBytes`.
|
|
1047
1043
|
// Thus, all initialized byte sequences constitutes valid
|
|
@@ -178,8 +178,8 @@ impl<'a, T: ?Sized> PtrInner<'a, T> {
|
|
|
178
178
|
|
|
179
179
|
/// # Safety
|
|
180
180
|
///
|
|
181
|
-
/// The caller may assume that the resulting `PtrInner` addresses
|
|
182
|
-
/// of the bytes of `self`'s referent
|
|
181
|
+
/// The caller may assume that the resulting `PtrInner` addresses the subset
|
|
182
|
+
/// of the bytes of `self`'s referent addressed by `C::project(self)`.
|
|
183
183
|
#[must_use]
|
|
184
184
|
#[inline(always)]
|
|
185
185
|
pub fn project<U: ?Sized, C: cast::Project<T, U>>(self) -> PtrInner<'a, U> {
|
|
@@ -517,8 +517,8 @@ impl<'a, T, const N: usize> PtrInner<'a, [T; N]> {
|
|
|
517
517
|
// operations, it has provenance for its entire referent.
|
|
518
518
|
// 1. By the above lemma, if `slice`'s referent is not zero sized, then
|
|
519
519
|
// `A` is guaranteed to live for at least `'a`, because it is derived
|
|
520
|
-
// from the same allocation as `self`, which, by invariant on
|
|
521
|
-
// lives for at least `'a`.
|
|
520
|
+
// from the same allocation as `self`, which, by invariant on
|
|
521
|
+
// `PtrInner`, lives for at least `'a`.
|
|
522
522
|
unsafe { PtrInner::new(slice) }
|
|
523
523
|
}
|
|
524
524
|
}
|
|
@@ -83,7 +83,16 @@ pub trait Alignment: Sealed {}
|
|
|
83
83
|
/// mechanism (e.g. a `&` reference used to derive `src`) to write `x` where
|
|
84
84
|
/// `x ∈ S(T, V)` but `x ∉ S(U, W)`, which would violate the guarantee that
|
|
85
85
|
/// `dst`'s referent may only contain values in `S(U, W)`.
|
|
86
|
-
pub unsafe trait Validity: Sealed {
|
|
86
|
+
pub unsafe trait Validity: Sealed {
|
|
87
|
+
const KIND: ValidityKind;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
pub enum ValidityKind {
|
|
91
|
+
Uninit,
|
|
92
|
+
AsInitialized,
|
|
93
|
+
Initialized,
|
|
94
|
+
Valid,
|
|
95
|
+
}
|
|
87
96
|
|
|
88
97
|
/// An [`Aliasing`] invariant which is either [`Shared`] or [`Exclusive`].
|
|
89
98
|
///
|
|
@@ -137,7 +146,9 @@ pub enum Uninit {}
|
|
|
137
146
|
// function of any property of `T` other than its bit validity (in fact, it's
|
|
138
147
|
// not even a property of `T`'s bit validity, but this is more than we are
|
|
139
148
|
// required to uphold).
|
|
140
|
-
unsafe impl Validity for Uninit {
|
|
149
|
+
unsafe impl Validity for Uninit {
|
|
150
|
+
const KIND: ValidityKind = ValidityKind::Uninit;
|
|
151
|
+
}
|
|
141
152
|
|
|
142
153
|
/// The byte ranges initialized in `T` are also initialized in the referent of a
|
|
143
154
|
/// `Ptr<T>`.
|
|
@@ -169,7 +180,9 @@ unsafe impl Validity for Uninit {}
|
|
|
169
180
|
pub enum AsInitialized {}
|
|
170
181
|
// SAFETY: `AsInitialized`'s validity is well-defined for all `T: ?Sized`, and
|
|
171
182
|
// is not a function of any property of `T` other than its bit validity.
|
|
172
|
-
unsafe impl Validity for AsInitialized {
|
|
183
|
+
unsafe impl Validity for AsInitialized {
|
|
184
|
+
const KIND: ValidityKind = ValidityKind::AsInitialized;
|
|
185
|
+
}
|
|
173
186
|
|
|
174
187
|
/// The byte ranges in the referent are fully initialized. In other words, if
|
|
175
188
|
/// the referent is `N` bytes long, then it contains a bit-valid `[u8; N]`.
|
|
@@ -178,14 +191,18 @@ pub enum Initialized {}
|
|
|
178
191
|
// not a function of any property of `T` other than its bit validity (in fact,
|
|
179
192
|
// it's not even a property of `T`'s bit validity, but this is more than we are
|
|
180
193
|
// required to uphold).
|
|
181
|
-
unsafe impl Validity for Initialized {
|
|
194
|
+
unsafe impl Validity for Initialized {
|
|
195
|
+
const KIND: ValidityKind = ValidityKind::Initialized;
|
|
196
|
+
}
|
|
182
197
|
|
|
183
198
|
/// The referent of a `Ptr<T>` is valid for `T`, upholding bit validity and any
|
|
184
199
|
/// library safety invariants.
|
|
185
200
|
pub enum Valid {}
|
|
186
201
|
// SAFETY: `Valid`'s validity is well-defined for all `T: ?Sized`, and is not a
|
|
187
202
|
// function of any property of `T` other than its bit validity.
|
|
188
|
-
unsafe impl Validity for Valid {
|
|
203
|
+
unsafe impl Validity for Valid {
|
|
204
|
+
const KIND: ValidityKind = ValidityKind::Valid;
|
|
205
|
+
}
|
|
189
206
|
|
|
190
207
|
/// # Safety
|
|
191
208
|
///
|