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
|
@@ -1,456 +0,0 @@
|
|
|
1
|
-
// Copyright 2024 The Fuchsia Authors
|
|
2
|
-
//
|
|
3
|
-
// Licensed under a BSD-style license <LICENSE-BSD>, Apache License, Version 2.0
|
|
4
|
-
// <LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0>, or the MIT
|
|
5
|
-
// license <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your option.
|
|
6
|
-
// This file may not be copied, modified, or distributed except according to
|
|
7
|
-
// those terms.
|
|
8
|
-
|
|
9
|
-
use proc_macro2::TokenStream;
|
|
10
|
-
use quote::quote;
|
|
11
|
-
use syn::{
|
|
12
|
-
parse_quote, spanned::Spanned as _, DataEnum, DeriveInput, Error, Fields, Generics, Ident,
|
|
13
|
-
Index, Path,
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
use crate::{
|
|
17
|
-
derive_has_field_struct_union, derive_try_from_bytes_inner, repr::EnumRepr, DataExt,
|
|
18
|
-
FieldBounds, ImplBlockBuilder, Trait,
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
/// Generates a tag enum for the given enum. This generates an enum with the
|
|
22
|
-
/// same non-align `repr`s, variants, and corresponding discriminants, but none
|
|
23
|
-
/// of the fields.
|
|
24
|
-
pub(crate) fn generate_tag_enum(repr: &EnumRepr, data: &DataEnum) -> TokenStream {
|
|
25
|
-
let variants = data.variants.iter().map(|v| {
|
|
26
|
-
let ident = &v.ident;
|
|
27
|
-
if let Some((eq, discriminant)) = &v.discriminant {
|
|
28
|
-
quote! { #ident #eq #discriminant }
|
|
29
|
-
} else {
|
|
30
|
-
quote! { #ident }
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
// Don't include any `repr(align)` when generating the tag enum, as that
|
|
35
|
-
// could add padding after the tag but before any variants, which is not the
|
|
36
|
-
// correct behavior.
|
|
37
|
-
let repr = match repr {
|
|
38
|
-
EnumRepr::Transparent(span) => quote::quote_spanned! { *span => #[repr(transparent)] },
|
|
39
|
-
EnumRepr::Compound(c, _) => quote! { #c },
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
quote! {
|
|
43
|
-
#repr
|
|
44
|
-
#[allow(dead_code, non_camel_case_types)]
|
|
45
|
-
enum ___ZerocopyTag {
|
|
46
|
-
#(#variants,)*
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// SAFETY: `___ZerocopyTag` has no fields, and so it does not permit
|
|
50
|
-
// interior mutation.
|
|
51
|
-
unsafe impl ::zerocopy::Immutable for ___ZerocopyTag {
|
|
52
|
-
fn only_derive_is_allowed_to_implement_this_trait() {}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
fn tag_ident(variant_ident: &Ident) -> Ident {
|
|
58
|
-
ident!(("___ZEROCOPY_TAG_{}", variant_ident), variant_ident.span())
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/// Generates a constant for the tag associated with each variant of the enum.
|
|
62
|
-
/// When we match on the enum's tag, each arm matches one of these constants. We
|
|
63
|
-
/// have to use constants here because:
|
|
64
|
-
///
|
|
65
|
-
/// - The type that we're matching on is not the type of the tag, it's an
|
|
66
|
-
/// integer of the same size as the tag type and with the same bit patterns.
|
|
67
|
-
/// - We can't read the enum tag as an enum because the bytes may not represent
|
|
68
|
-
/// a valid variant.
|
|
69
|
-
/// - Patterns do not currently support const expressions, so we have to assign
|
|
70
|
-
/// these constants to names rather than use them inline in the `match`
|
|
71
|
-
/// statement.
|
|
72
|
-
fn generate_tag_consts(data: &DataEnum) -> TokenStream {
|
|
73
|
-
let tags = data.variants.iter().map(|v| {
|
|
74
|
-
let variant_ident = &v.ident;
|
|
75
|
-
let tag_ident = tag_ident(variant_ident);
|
|
76
|
-
|
|
77
|
-
quote! {
|
|
78
|
-
// This casts the enum variant to its discriminant, and then
|
|
79
|
-
// converts the discriminant to the target integral type via a
|
|
80
|
-
// numeric cast [1].
|
|
81
|
-
//
|
|
82
|
-
// Because these are the same size, this is defined to be a no-op
|
|
83
|
-
// and therefore is a lossless conversion [2].
|
|
84
|
-
//
|
|
85
|
-
// [1] Per https://doc.rust-lang.org/1.81.0/reference/expressions/operator-expr.html#enum-cast:
|
|
86
|
-
//
|
|
87
|
-
// Casts an enum to its discriminant.
|
|
88
|
-
//
|
|
89
|
-
// [2] Per https://doc.rust-lang.org/1.81.0/reference/expressions/operator-expr.html#numeric-cast:
|
|
90
|
-
//
|
|
91
|
-
// Casting between two integers of the same size (e.g. i32 -> u32)
|
|
92
|
-
// is a no-op.
|
|
93
|
-
#[allow(non_upper_case_globals)]
|
|
94
|
-
const #tag_ident: ___ZerocopyTagPrimitive =
|
|
95
|
-
___ZerocopyTag::#variant_ident as ___ZerocopyTagPrimitive;
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
quote! {
|
|
100
|
-
#(#tags)*
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
fn variant_struct_ident(variant_ident: &Ident) -> Ident {
|
|
105
|
-
ident!(("___ZerocopyVariantStruct_{}", variant_ident), variant_ident.span())
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
/// Generates variant structs for the given enum variant.
|
|
109
|
-
///
|
|
110
|
-
/// These are structs associated with each variant of an enum. They are
|
|
111
|
-
/// `repr(C)` tuple structs with the same fields as the variant after a
|
|
112
|
-
/// `MaybeUninit<___ZerocopyInnerTag>`.
|
|
113
|
-
///
|
|
114
|
-
/// In order to unify the generated types for `repr(C)` and `repr(int)` enums,
|
|
115
|
-
/// we use a "fused" representation with fields for both an inner tag and an
|
|
116
|
-
/// outer tag. Depending on the repr, we will set one of these tags to the tag
|
|
117
|
-
/// type and the other to `()`. This lets us generate the same code but put the
|
|
118
|
-
/// tags in different locations.
|
|
119
|
-
fn generate_variant_structs(
|
|
120
|
-
enum_name: &Ident,
|
|
121
|
-
generics: &Generics,
|
|
122
|
-
data: &DataEnum,
|
|
123
|
-
zerocopy_crate: &Path,
|
|
124
|
-
) -> TokenStream {
|
|
125
|
-
let (impl_generics, ty_generics, where_clause) = generics.split_for_impl();
|
|
126
|
-
|
|
127
|
-
// All variant structs have a `PhantomData<MyEnum<...>>` field because we
|
|
128
|
-
// don't know which generic parameters each variant will use, and unused
|
|
129
|
-
// generic parameters are a compile error.
|
|
130
|
-
let phantom_ty = quote! {
|
|
131
|
-
core_reexport::marker::PhantomData<#enum_name #ty_generics>
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
let variant_structs = data.variants.iter().filter_map(|variant| {
|
|
135
|
-
// We don't generate variant structs for unit variants because we only
|
|
136
|
-
// need to check the tag. This helps cut down our generated code a bit.
|
|
137
|
-
if matches!(variant.fields, Fields::Unit) {
|
|
138
|
-
return None;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
let variant_struct_ident = variant_struct_ident(&variant.ident);
|
|
142
|
-
let field_types = variant.fields.iter().map(|f| &f.ty);
|
|
143
|
-
|
|
144
|
-
let variant_struct = parse_quote! {
|
|
145
|
-
#[repr(C)]
|
|
146
|
-
#[allow(non_snake_case)]
|
|
147
|
-
struct #variant_struct_ident #impl_generics (
|
|
148
|
-
core_reexport::mem::MaybeUninit<___ZerocopyInnerTag>,
|
|
149
|
-
#(#field_types,)*
|
|
150
|
-
#phantom_ty,
|
|
151
|
-
) #where_clause;
|
|
152
|
-
};
|
|
153
|
-
|
|
154
|
-
// We do this rather than emitting `#[derive(::zerocopy::TryFromBytes)]`
|
|
155
|
-
// because that is not hygienic, and this is also more performant.
|
|
156
|
-
let try_from_bytes_impl =
|
|
157
|
-
derive_try_from_bytes_inner(&variant_struct, Trait::TryFromBytes, zerocopy_crate)
|
|
158
|
-
.expect("derive_try_from_bytes_inner should not fail on synthesized type");
|
|
159
|
-
|
|
160
|
-
Some(quote! {
|
|
161
|
-
#variant_struct
|
|
162
|
-
#try_from_bytes_impl
|
|
163
|
-
})
|
|
164
|
-
});
|
|
165
|
-
|
|
166
|
-
quote! {
|
|
167
|
-
#(#variant_structs)*
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
fn variants_union_field_ident(ident: &Ident) -> Ident {
|
|
172
|
-
// Field names are prefixed with `__field_` to prevent name collision
|
|
173
|
-
// with the `__nonempty` field.
|
|
174
|
-
ident!(("__field_{}", ident), ident.span())
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
fn generate_variants_union(
|
|
178
|
-
generics: &Generics,
|
|
179
|
-
data: &DataEnum,
|
|
180
|
-
zerocopy_crate: &Path,
|
|
181
|
-
) -> TokenStream {
|
|
182
|
-
let (_, ty_generics, _) = generics.split_for_impl();
|
|
183
|
-
|
|
184
|
-
let fields = data.variants.iter().filter_map(|variant| {
|
|
185
|
-
// We don't generate variant structs for unit variants because we only
|
|
186
|
-
// need to check the tag. This helps cut down our generated code a bit.
|
|
187
|
-
if matches!(variant.fields, Fields::Unit) {
|
|
188
|
-
return None;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
let field_name = variants_union_field_ident(&variant.ident);
|
|
192
|
-
let variant_struct_ident = variant_struct_ident(&variant.ident);
|
|
193
|
-
|
|
194
|
-
Some(quote! {
|
|
195
|
-
#field_name: core_reexport::mem::ManuallyDrop<
|
|
196
|
-
#variant_struct_ident #ty_generics
|
|
197
|
-
>,
|
|
198
|
-
})
|
|
199
|
-
});
|
|
200
|
-
|
|
201
|
-
let variants_union = parse_quote! {
|
|
202
|
-
#[repr(C)]
|
|
203
|
-
#[allow(non_snake_case)]
|
|
204
|
-
union ___ZerocopyVariants #generics {
|
|
205
|
-
#(#fields)*
|
|
206
|
-
// Enums can have variants with no fields, but unions must
|
|
207
|
-
// have at least one field. So we just add a trailing unit
|
|
208
|
-
// to ensure that this union always has at least one field.
|
|
209
|
-
// Because this union is `repr(C)`, this unit type does not
|
|
210
|
-
// affect the layout.
|
|
211
|
-
__nonempty: (),
|
|
212
|
-
}
|
|
213
|
-
};
|
|
214
|
-
|
|
215
|
-
let has_field =
|
|
216
|
-
derive_has_field_struct_union(&variants_union, &variants_union.data, zerocopy_crate);
|
|
217
|
-
|
|
218
|
-
quote! {
|
|
219
|
-
#variants_union
|
|
220
|
-
#has_field
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
/// Generates an implementation of `is_bit_valid` for an arbitrary enum.
|
|
225
|
-
///
|
|
226
|
-
/// The general process is:
|
|
227
|
-
///
|
|
228
|
-
/// 1. Generate a tag enum. This is an enum with the same repr, variants, and
|
|
229
|
-
/// corresponding discriminants as the original enum, but without any fields
|
|
230
|
-
/// on the variants. This gives us access to an enum where the variants have
|
|
231
|
-
/// the same discriminants as the one we're writing `is_bit_valid` for.
|
|
232
|
-
/// 2. Make constants from the variants of the tag enum. We need these because
|
|
233
|
-
/// we can't put const exprs in match arms.
|
|
234
|
-
/// 3. Generate variant structs. These are structs which have the same fields as
|
|
235
|
-
/// each variant of the enum, and are `#[repr(C)]` with an optional "inner
|
|
236
|
-
/// tag".
|
|
237
|
-
/// 4. Generate a variants union, with one field for each variant struct type.
|
|
238
|
-
/// 5. And finally, our raw enum is a `#[repr(C)]` struct of an "outer tag" and
|
|
239
|
-
/// the variants union.
|
|
240
|
-
///
|
|
241
|
-
/// See these reference links for fully-worked example decompositions.
|
|
242
|
-
///
|
|
243
|
-
/// - `repr(C)`: <https://doc.rust-lang.org/reference/type-layout.html#reprc-enums-with-fields>
|
|
244
|
-
/// - `repr(int)`: <https://doc.rust-lang.org/reference/type-layout.html#primitive-representation-of-enums-with-fields>
|
|
245
|
-
/// - `repr(C, int)`: <https://doc.rust-lang.org/reference/type-layout.html#combining-primitive-representations-of-enums-with-fields-and-reprc>
|
|
246
|
-
pub(crate) fn derive_is_bit_valid(
|
|
247
|
-
ast: &DeriveInput,
|
|
248
|
-
enum_ident: &Ident,
|
|
249
|
-
repr: &EnumRepr,
|
|
250
|
-
generics: &Generics,
|
|
251
|
-
data: &DataEnum,
|
|
252
|
-
zerocopy_crate: &Path,
|
|
253
|
-
) -> Result<TokenStream, Error> {
|
|
254
|
-
let trait_path = Trait::TryFromBytes.crate_path(zerocopy_crate);
|
|
255
|
-
let tag_enum = generate_tag_enum(repr, data);
|
|
256
|
-
let tag_consts = generate_tag_consts(data);
|
|
257
|
-
|
|
258
|
-
let (outer_tag_type, inner_tag_type) = if repr.is_c() {
|
|
259
|
-
(quote! { ___ZerocopyTag }, quote! { () })
|
|
260
|
-
} else if repr.is_primitive() {
|
|
261
|
-
(quote! { () }, quote! { ___ZerocopyTag })
|
|
262
|
-
} else {
|
|
263
|
-
return Err(Error::new(
|
|
264
|
-
ast.span(),
|
|
265
|
-
"must have #[repr(C)] or #[repr(Int)] attribute in order to guarantee this type's memory layout",
|
|
266
|
-
));
|
|
267
|
-
};
|
|
268
|
-
|
|
269
|
-
let variant_structs = generate_variant_structs(enum_ident, generics, data, zerocopy_crate);
|
|
270
|
-
let variants_union = generate_variants_union(generics, data, zerocopy_crate);
|
|
271
|
-
|
|
272
|
-
let (impl_generics, ty_generics, where_clause) = generics.split_for_impl();
|
|
273
|
-
|
|
274
|
-
let has_fields = data.variants().into_iter().flat_map(|(variant, fields)| {
|
|
275
|
-
let variant_ident = &variant.unwrap().ident;
|
|
276
|
-
let variants_union_field_ident = variants_union_field_ident(variant_ident);
|
|
277
|
-
let field: Box<syn::Type> = parse_quote!(());
|
|
278
|
-
fields.into_iter().enumerate().map(move |(idx, (vis, ident, ty))| {
|
|
279
|
-
// Rust does not presently support explicit visibility modifiers on
|
|
280
|
-
// enum fields, but we guard against the possibility to ensure this
|
|
281
|
-
// derive remains sound.
|
|
282
|
-
assert!(matches!(vis, syn::Visibility::Inherited));
|
|
283
|
-
let variant_struct_field_index = Index::from(idx + 1);
|
|
284
|
-
let (_, ty_generics, _) = generics.split_for_impl();
|
|
285
|
-
ImplBlockBuilder::new(
|
|
286
|
-
ast,
|
|
287
|
-
data,
|
|
288
|
-
Trait::HasField {
|
|
289
|
-
variant_id: parse_quote!({ #zerocopy_crate::ident_id!(#variant_ident) }),
|
|
290
|
-
// Since Rust does not presently support explicit visibility
|
|
291
|
-
// modifiers on enum fields, any public type is suitable
|
|
292
|
-
// here; we use `()`.
|
|
293
|
-
field: field.clone(),
|
|
294
|
-
field_id: parse_quote!({ #zerocopy_crate::ident_id!(#ident) }),
|
|
295
|
-
},
|
|
296
|
-
FieldBounds::None,
|
|
297
|
-
zerocopy_crate,
|
|
298
|
-
)
|
|
299
|
-
.inner_extras(quote! {
|
|
300
|
-
type Type = #ty;
|
|
301
|
-
|
|
302
|
-
#[inline(always)]
|
|
303
|
-
fn project(slf: #zerocopy_crate::pointer::PtrInner<'_, Self>) -> *mut Self::Type {
|
|
304
|
-
use #zerocopy_crate::pointer::cast::{CastSized, Projection};
|
|
305
|
-
|
|
306
|
-
slf.project::<___ZerocopyRawEnum #ty_generics, CastSized>()
|
|
307
|
-
.project::<_, Projection<_, { #zerocopy_crate::STRUCT_VARIANT_ID }, { #zerocopy_crate::ident_id!(variants) }>>()
|
|
308
|
-
.project::<_, Projection<_, { #zerocopy_crate::UNION_VARIANT_ID }, { #zerocopy_crate::ident_id!(#variants_union_field_ident) }>>()
|
|
309
|
-
.project::<_, Projection<_, { #zerocopy_crate::STRUCT_VARIANT_ID }, { #zerocopy_crate::ident_id!(value) }>>()
|
|
310
|
-
.project::<_, Projection<_, { #zerocopy_crate::STRUCT_VARIANT_ID }, { #zerocopy_crate::ident_id!(#variant_struct_field_index) }>>()
|
|
311
|
-
.as_ptr()
|
|
312
|
-
}
|
|
313
|
-
})
|
|
314
|
-
.build()
|
|
315
|
-
})
|
|
316
|
-
});
|
|
317
|
-
|
|
318
|
-
let match_arms = data.variants.iter().map(|variant| {
|
|
319
|
-
let tag_ident = tag_ident(&variant.ident);
|
|
320
|
-
let variant_struct_ident = variant_struct_ident(&variant.ident);
|
|
321
|
-
let variants_union_field_ident = variants_union_field_ident(&variant.ident);
|
|
322
|
-
|
|
323
|
-
if matches!(variant.fields, Fields::Unit) {
|
|
324
|
-
// Unit variants don't need any further validation beyond checking
|
|
325
|
-
// the tag.
|
|
326
|
-
quote! {
|
|
327
|
-
#tag_ident => true
|
|
328
|
-
}
|
|
329
|
-
} else {
|
|
330
|
-
quote! {
|
|
331
|
-
#tag_ident => {
|
|
332
|
-
// SAFETY: Since we know that the tag is `#tag_ident`, we
|
|
333
|
-
// know that no other `&`s exist which refer to this enum
|
|
334
|
-
// as any other variant.
|
|
335
|
-
let variant_md = unsafe { variants.cast_unchecked::<
|
|
336
|
-
core_reexport::mem::ManuallyDrop<#variant_struct_ident #ty_generics>,
|
|
337
|
-
#zerocopy_crate::pointer::cast::Projection<
|
|
338
|
-
_,
|
|
339
|
-
{ #zerocopy_crate::UNION_VARIANT_ID },
|
|
340
|
-
{ #zerocopy_crate::ident_id!(#variants_union_field_ident) }
|
|
341
|
-
>
|
|
342
|
-
>() };
|
|
343
|
-
let variant = variant_md.cast::<
|
|
344
|
-
#variant_struct_ident #ty_generics,
|
|
345
|
-
#zerocopy_crate::pointer::cast::CastSized,
|
|
346
|
-
#zerocopy_crate::pointer::BecauseInvariantsEq
|
|
347
|
-
>();
|
|
348
|
-
<
|
|
349
|
-
#variant_struct_ident #ty_generics as #trait_path
|
|
350
|
-
>::is_bit_valid(variant)
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
});
|
|
355
|
-
|
|
356
|
-
let raw_enum: DeriveInput = parse_quote! {
|
|
357
|
-
#[repr(C)]
|
|
358
|
-
struct ___ZerocopyRawEnum #generics {
|
|
359
|
-
tag: ___ZerocopyOuterTag,
|
|
360
|
-
variants: ___ZerocopyVariants #ty_generics,
|
|
361
|
-
}
|
|
362
|
-
};
|
|
363
|
-
|
|
364
|
-
let self_ident = &ast.ident;
|
|
365
|
-
let invariants_eq_impl = quote! {
|
|
366
|
-
// SAFETY: `___ZerocopyRawEnum` is designed to have the same layout,
|
|
367
|
-
// validity, and invariants as `Self`.
|
|
368
|
-
unsafe impl #impl_generics #zerocopy_crate::pointer::InvariantsEq<___ZerocopyRawEnum #ty_generics> for #self_ident #ty_generics #where_clause {}
|
|
369
|
-
};
|
|
370
|
-
|
|
371
|
-
let raw_enum_projections =
|
|
372
|
-
derive_has_field_struct_union(&raw_enum, &raw_enum.data, zerocopy_crate);
|
|
373
|
-
|
|
374
|
-
let raw_enum = quote! {
|
|
375
|
-
#raw_enum
|
|
376
|
-
#invariants_eq_impl
|
|
377
|
-
#raw_enum_projections
|
|
378
|
-
};
|
|
379
|
-
|
|
380
|
-
Ok(quote! {
|
|
381
|
-
// SAFETY: We use `is_bit_valid` to validate that the bit pattern of the
|
|
382
|
-
// enum's tag corresponds to one of the enum's discriminants. Then, we
|
|
383
|
-
// check the bit validity of each field of the corresponding variant.
|
|
384
|
-
// Thus, this is a sound implementation of `is_bit_valid`.
|
|
385
|
-
fn is_bit_valid<___ZerocopyAliasing>(
|
|
386
|
-
candidate: #zerocopy_crate::Maybe<'_, Self, ___ZerocopyAliasing>,
|
|
387
|
-
) -> #zerocopy_crate::util::macro_util::core_reexport::primitive::bool
|
|
388
|
-
where
|
|
389
|
-
___ZerocopyAliasing: #zerocopy_crate::pointer::invariant::Reference,
|
|
390
|
-
{
|
|
391
|
-
use #zerocopy_crate::util::macro_util::core_reexport;
|
|
392
|
-
|
|
393
|
-
#tag_enum
|
|
394
|
-
|
|
395
|
-
type ___ZerocopyTagPrimitive = #zerocopy_crate::util::macro_util::SizeToTag<
|
|
396
|
-
{ core_reexport::mem::size_of::<___ZerocopyTag>() },
|
|
397
|
-
>;
|
|
398
|
-
|
|
399
|
-
#tag_consts
|
|
400
|
-
|
|
401
|
-
type ___ZerocopyOuterTag = #outer_tag_type;
|
|
402
|
-
type ___ZerocopyInnerTag = #inner_tag_type;
|
|
403
|
-
|
|
404
|
-
// SAFETY: `___ZerocopyRawEnum` is designed to match the layout of
|
|
405
|
-
// the `Self` enum, which has a `___ZerocopyTag` tag as its first
|
|
406
|
-
// field.
|
|
407
|
-
//
|
|
408
|
-
// `project` is implemented using a cast which preserves or shrinks
|
|
409
|
-
// the set of referent bytes and preserves provenance.
|
|
410
|
-
unsafe impl #generics #zerocopy_crate::HasField<(), { #zerocopy_crate::STRUCT_VARIANT_ID }, { #zerocopy_crate::ident_id!(tag) }> for ___ZerocopyRawEnum #ty_generics {
|
|
411
|
-
fn only_derive_is_allowed_to_implement_this_trait() {}
|
|
412
|
-
|
|
413
|
-
type Type = ___ZerocopyTag;
|
|
414
|
-
|
|
415
|
-
#[inline(always)]
|
|
416
|
-
fn project(slf: #zerocopy_crate::pointer::PtrInner<'_, Self>) -> *mut Self::Type {
|
|
417
|
-
slf.as_ptr().cast()
|
|
418
|
-
}
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
#variant_structs
|
|
422
|
-
|
|
423
|
-
#variants_union
|
|
424
|
-
|
|
425
|
-
#raw_enum
|
|
426
|
-
|
|
427
|
-
#(#has_fields)*
|
|
428
|
-
|
|
429
|
-
let mut raw_enum = candidate.cast::<
|
|
430
|
-
___ZerocopyRawEnum #ty_generics,
|
|
431
|
-
#zerocopy_crate::pointer::cast::CastSized,
|
|
432
|
-
#zerocopy_crate::pointer::BecauseInvariantsEq
|
|
433
|
-
>();
|
|
434
|
-
|
|
435
|
-
let tag = {
|
|
436
|
-
let tag_ptr = raw_enum.reborrow().project::<
|
|
437
|
-
(),
|
|
438
|
-
{ #zerocopy_crate::ident_id!(tag) }
|
|
439
|
-
>().cast::<
|
|
440
|
-
___ZerocopyTagPrimitive,
|
|
441
|
-
#zerocopy_crate::pointer::cast::CastSized,
|
|
442
|
-
_
|
|
443
|
-
>();
|
|
444
|
-
tag_ptr.recall_validity::<_, (_, (_, _))>().read_unaligned::<#zerocopy_crate::BecauseImmutable>()
|
|
445
|
-
};
|
|
446
|
-
|
|
447
|
-
let variants = raw_enum.project::<_, { #zerocopy_crate::ident_id!(variants) }>();
|
|
448
|
-
|
|
449
|
-
#[allow(non_upper_case_globals)]
|
|
450
|
-
match tag {
|
|
451
|
-
#(#match_arms,)*
|
|
452
|
-
_ => false,
|
|
453
|
-
}
|
|
454
|
-
}
|
|
455
|
-
})
|
|
456
|
-
}
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
// Copyright 2019 The Fuchsia Authors
|
|
2
|
-
//
|
|
3
|
-
// Licensed under a BSD-style license <LICENSE-BSD>, Apache License, Version 2.0
|
|
4
|
-
// <LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0>, or the MIT
|
|
5
|
-
// license <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your option.
|
|
6
|
-
// This file may not be copied, modified, or distributed except according to
|
|
7
|
-
// those terms.
|
|
8
|
-
|
|
9
|
-
use proc_macro2::{Span, TokenStream};
|
|
10
|
-
use quote::ToTokens;
|
|
11
|
-
use syn::{Data, DataEnum, DataStruct, DataUnion, Field, Ident, Index, Type, Variant, Visibility};
|
|
12
|
-
|
|
13
|
-
pub(crate) trait DataExt {
|
|
14
|
-
/// Extracts the names and types of all fields. For enums, extracts the
|
|
15
|
-
/// names and types of fields from each variant. For tuple structs, the
|
|
16
|
-
/// names are the indices used to index into the struct (ie, `0`, `1`, etc).
|
|
17
|
-
///
|
|
18
|
-
/// FIXME: Extracting field names for enums doesn't really make sense. Types
|
|
19
|
-
/// makes sense because we don't care about where they live - we just care
|
|
20
|
-
/// about transitive ownership. But for field names, we'd only use them when
|
|
21
|
-
/// generating is_bit_valid, which cares about where they live.
|
|
22
|
-
fn fields(&self) -> Vec<(&Visibility, TokenStream, &Type)>;
|
|
23
|
-
|
|
24
|
-
fn variants(&self) -> Vec<(Option<&Variant>, Vec<(&Visibility, TokenStream, &Type)>)>;
|
|
25
|
-
|
|
26
|
-
fn tag(&self) -> Option<Ident>;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
impl DataExt for Data {
|
|
30
|
-
fn fields(&self) -> Vec<(&Visibility, TokenStream, &Type)> {
|
|
31
|
-
match self {
|
|
32
|
-
Data::Struct(strc) => strc.fields(),
|
|
33
|
-
Data::Enum(enm) => enm.fields(),
|
|
34
|
-
Data::Union(un) => un.fields(),
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
fn variants(&self) -> Vec<(Option<&Variant>, Vec<(&Visibility, TokenStream, &Type)>)> {
|
|
39
|
-
match self {
|
|
40
|
-
Data::Struct(strc) => strc.variants(),
|
|
41
|
-
Data::Enum(enm) => enm.variants(),
|
|
42
|
-
Data::Union(un) => un.variants(),
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
fn tag(&self) -> Option<Ident> {
|
|
47
|
-
match self {
|
|
48
|
-
Data::Struct(strc) => strc.tag(),
|
|
49
|
-
Data::Enum(enm) => enm.tag(),
|
|
50
|
-
Data::Union(un) => un.tag(),
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
impl DataExt for DataStruct {
|
|
56
|
-
fn fields(&self) -> Vec<(&Visibility, TokenStream, &Type)> {
|
|
57
|
-
map_fields(&self.fields)
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
fn variants(&self) -> Vec<(Option<&Variant>, Vec<(&Visibility, TokenStream, &Type)>)> {
|
|
61
|
-
vec![(None, self.fields())]
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
fn tag(&self) -> Option<Ident> {
|
|
65
|
-
None
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
impl DataExt for DataEnum {
|
|
70
|
-
fn fields(&self) -> Vec<(&Visibility, TokenStream, &Type)> {
|
|
71
|
-
map_fields(self.variants.iter().flat_map(|var| &var.fields))
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
fn variants(&self) -> Vec<(Option<&Variant>, Vec<(&Visibility, TokenStream, &Type)>)> {
|
|
75
|
-
self.variants.iter().map(|var| (Some(var), map_fields(&var.fields))).collect()
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
fn tag(&self) -> Option<Ident> {
|
|
79
|
-
Some(Ident::new("___ZerocopyTag", Span::call_site()))
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
impl DataExt for DataUnion {
|
|
84
|
-
fn fields(&self) -> Vec<(&Visibility, TokenStream, &Type)> {
|
|
85
|
-
map_fields(&self.fields.named)
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
fn variants(&self) -> Vec<(Option<&Variant>, Vec<(&Visibility, TokenStream, &Type)>)> {
|
|
89
|
-
vec![(None, self.fields())]
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
fn tag(&self) -> Option<Ident> {
|
|
93
|
-
None
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
fn map_fields<'a>(
|
|
98
|
-
fields: impl 'a + IntoIterator<Item = &'a Field>,
|
|
99
|
-
) -> Vec<(&'a Visibility, TokenStream, &'a Type)> {
|
|
100
|
-
fields
|
|
101
|
-
.into_iter()
|
|
102
|
-
.enumerate()
|
|
103
|
-
.map(|(idx, f)| {
|
|
104
|
-
(
|
|
105
|
-
&f.vis,
|
|
106
|
-
f.ident
|
|
107
|
-
.as_ref()
|
|
108
|
-
.map(ToTokens::to_token_stream)
|
|
109
|
-
.unwrap_or_else(|| Index::from(idx).to_token_stream()),
|
|
110
|
-
&f.ty,
|
|
111
|
-
)
|
|
112
|
-
})
|
|
113
|
-
.collect()
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
pub(crate) fn to_ident_str(t: &impl ToString) -> String {
|
|
117
|
-
let s = t.to_string();
|
|
118
|
-
if let Some(stripped) = s.strip_prefix("r#") {
|
|
119
|
-
stripped.to_string()
|
|
120
|
-
} else {
|
|
121
|
-
s
|
|
122
|
-
}
|
|
123
|
-
}
|