html-to-markdown 2.24.1 → 2.24.3
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 +9 -6
- data/ext/html-to-markdown-rb/native/Cargo.lock +13 -13
- data/ext/html-to-markdown-rb/native/Cargo.toml +1 -1
- data/lib/html_to_markdown/version.rb +1 -1
- data/rust-vendor/bytemuck/.cargo-checksum.json +1 -1
- data/rust-vendor/bytemuck/.cargo_vcs_info.json +1 -1
- data/rust-vendor/bytemuck/.github/workflows/rust.yml +4 -4
- data/rust-vendor/bytemuck/Cargo.lock +16 -9
- data/rust-vendor/bytemuck/Cargo.toml +6 -2
- data/rust-vendor/bytemuck/Cargo.toml.orig +7 -6
- data/rust-vendor/bytemuck/changelog.md +5 -0
- data/rust-vendor/bytemuck/src/must.rs +1 -1
- data/rust-vendor/bytemuck/src/pod.rs +13 -0
- data/rust-vendor/bytemuck/src/zeroable.rs +13 -0
- data/rust-vendor/bytemuck/src/zeroable_in_option.rs +2 -2
- data/rust-vendor/bytemuck/tests/std_tests.rs +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 +8 -0
- data/rust-vendor/cc/Cargo.lock +3 -3
- data/rust-vendor/cc/Cargo.toml +2 -2
- data/rust-vendor/cc/Cargo.toml.orig +2 -2
- data/rust-vendor/cc/src/lib.rs +1 -0
- data/rust-vendor/cc/src/target/generated.rs +10 -0
- data/rust-vendor/find-msvc-tools/.cargo-checksum.json +1 -1
- data/rust-vendor/find-msvc-tools/.cargo_vcs_info.json +1 -1
- data/rust-vendor/find-msvc-tools/CHANGELOG.md +6 -0
- data/rust-vendor/find-msvc-tools/Cargo.lock +1 -1
- data/rust-vendor/find-msvc-tools/Cargo.toml +1 -1
- data/rust-vendor/find-msvc-tools/Cargo.toml.orig +1 -1
- data/rust-vendor/find-msvc-tools/src/find_tools.rs +55 -20
- data/rust-vendor/html-to-markdown-rs/src/converter/handlers/link.rs +1 -9
- data/rust-vendor/html-to-markdown-rs/src/converter/inline/link.rs +2 -11
- data/rust-vendor/html-to-markdown-rs/src/converter/list/definition.rs +30 -7
- data/rust-vendor/html-to-markdown-rs/src/converter/semantic/definition_list.rs +30 -7
- data/rust-vendor/html-to-markdown-rs/tests/issue_199_regressions.rs +15 -0
- data/rust-vendor/html-to-markdown-rs/tests/issue_200_regressions.rs +36 -0
- data/rust-vendor/zerocopy/.cargo-checksum.json +1 -1
- data/rust-vendor/zerocopy/.cargo_vcs_info.json +2 -1
- data/rust-vendor/zerocopy/Cargo.lock +3 -3
- data/rust-vendor/zerocopy/Cargo.toml +4 -4
- data/rust-vendor/zerocopy/Cargo.toml.orig +4 -4
- data/rust-vendor/zerocopy/src/doctests.rs +27 -0
- data/rust-vendor/zerocopy/src/error.rs +30 -0
- data/rust-vendor/zerocopy/src/layout.rs +239 -135
- data/rust-vendor/zerocopy/src/lib.rs +16 -0
- data/rust-vendor/zerocopy/src/macros.rs +255 -125
- data/rust-vendor/zerocopy/src/pointer/mod.rs +1 -1
- data/rust-vendor/zerocopy/src/pointer/ptr.rs +109 -23
- data/rust-vendor/zerocopy/src/util/macro_util.rs +344 -383
- data/rust-vendor/zerocopy/src/util/mod.rs +38 -0
- data/rust-vendor/zerocopy/tests/ui-msrv/transmute-mut-const.stderr +8 -0
- data/rust-vendor/zerocopy/tests/ui-msrv/transmute-mut-dst-not-a-reference.stderr +10 -0
- data/rust-vendor/zerocopy/tests/ui-msrv/transmute-mut-src-unsized.stderr +11 -3
- data/rust-vendor/zerocopy/tests/ui-msrv/transmute-ref-dst-mutable.stderr +10 -0
- data/rust-vendor/zerocopy/tests/ui-msrv/transmute-ref-dst-not-a-reference.stderr +10 -0
- data/rust-vendor/zerocopy/tests/ui-msrv/transmute-ref-src-dst-not-references.stderr +10 -0
- data/rust-vendor/zerocopy/tests/ui-msrv/transmute-ref-src-unsized.stderr +11 -3
- data/rust-vendor/zerocopy/tests/ui-msrv/try_transmute_mut-dst-not-tryfrombytes.stderr +0 -10
- data/rust-vendor/zerocopy/tests/ui-msrv/try_transmute_ref-dst-mutable.stderr +1 -1
- data/rust-vendor/zerocopy/tests/ui-msrv/try_transmute_ref-dst-not-immutable-tryfrombytes.stderr +0 -10
- data/rust-vendor/zerocopy/tests/ui-msrv/try_transmute_ref-src-not-immutable-intobytes.stderr +1 -11
- data/rust-vendor/zerocopy/tests/ui-nightly/transmute-mut-const.stderr +9 -0
- data/rust-vendor/zerocopy/tests/ui-nightly/transmute-mut-dst-not-a-reference.stderr +10 -0
- data/rust-vendor/zerocopy/tests/ui-nightly/transmute-mut-src-unsized.stderr +16 -8
- data/rust-vendor/zerocopy/tests/ui-nightly/transmute-ref-dst-mutable.stderr +10 -0
- data/rust-vendor/zerocopy/tests/ui-nightly/transmute-ref-dst-not-a-reference.stderr +10 -0
- data/rust-vendor/zerocopy/tests/ui-nightly/transmute-ref-src-dst-not-references.stderr +10 -0
- data/rust-vendor/zerocopy/tests/ui-nightly/transmute-ref-src-unsized.stderr +16 -8
- data/rust-vendor/zerocopy/tests/ui-nightly/try_transmute_mut-dst-not-tryfrombytes.stderr +38 -38
- data/rust-vendor/zerocopy/tests/ui-nightly/try_transmute_ref-dst-not-immutable-tryfrombytes.stderr +33 -33
- data/rust-vendor/zerocopy/tests/ui-nightly/try_transmute_ref-src-not-immutable-intobytes.stderr +12 -12
- data/rust-vendor/zerocopy/tests/ui-stable/transmute-mut-const.stderr +9 -0
- data/rust-vendor/zerocopy/tests/ui-stable/transmute-mut-dst-not-a-reference.stderr +10 -0
- data/rust-vendor/zerocopy/tests/ui-stable/transmute-mut-src-unsized.stderr +16 -8
- data/rust-vendor/zerocopy/tests/ui-stable/transmute-ref-dst-mutable.stderr +10 -0
- data/rust-vendor/zerocopy/tests/ui-stable/transmute-ref-dst-not-a-reference.stderr +10 -0
- data/rust-vendor/zerocopy/tests/ui-stable/transmute-ref-src-dst-not-references.stderr +10 -0
- data/rust-vendor/zerocopy/tests/ui-stable/transmute-ref-src-unsized.stderr +16 -8
- data/rust-vendor/zerocopy/tests/ui-stable/try_transmute_mut-dst-not-tryfrombytes.stderr +38 -38
- data/rust-vendor/zerocopy/tests/ui-stable/try_transmute_ref-dst-not-immutable-tryfrombytes.stderr +33 -33
- data/rust-vendor/zerocopy/tests/ui-stable/try_transmute_ref-src-not-immutable-intobytes.stderr +12 -12
- 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 +1 -1
- data/rust-vendor/zerocopy-derive/Cargo.toml +1 -1
- data/rust-vendor/zerocopy-derive/Cargo.toml.orig +1 -1
- data/rust-vendor/zerocopy-derive/tests/ui-nightly/enum.stderr +3 -3
- data/rust-vendor/zerocopy-derive/tests/ui-nightly/struct.stderr +5 -5
- data/rust-vendor/zerocopy-derive/tests/ui-stable/enum.stderr +3 -3
- data/rust-vendor/zerocopy-derive/tests/ui-stable/struct.stderr +5 -5
- 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 +16 -16
- 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 +54 -93
- metadata +4 -50
- data/rust-vendor/zerocopy/tests/ui-msrv/transmute-mut-dst-unsized.rs +0 -15
- data/rust-vendor/zerocopy/tests/ui-msrv/transmute-mut-dst-unsized.stderr +0 -8
- data/rust-vendor/zerocopy/tests/ui-msrv/transmute-ref-dst-unsized.rs +0 -15
- data/rust-vendor/zerocopy/tests/ui-msrv/transmute-ref-dst-unsized.stderr +0 -8
- data/rust-vendor/zerocopy/tests/ui-msrv/try_transmute_mut-alignment-increase.rs +0 -19
- data/rust-vendor/zerocopy/tests/ui-msrv/try_transmute_mut-alignment-increase.stderr +0 -9
- data/rust-vendor/zerocopy/tests/ui-msrv/try_transmute_mut-size-decrease.rs +0 -19
- data/rust-vendor/zerocopy/tests/ui-msrv/try_transmute_mut-size-decrease.stderr +0 -9
- data/rust-vendor/zerocopy/tests/ui-msrv/try_transmute_mut-size-increase.rs +0 -19
- data/rust-vendor/zerocopy/tests/ui-msrv/try_transmute_mut-size-increase.stderr +0 -17
- data/rust-vendor/zerocopy/tests/ui-msrv/try_transmute_ref-alignment-increase.rs +0 -18
- data/rust-vendor/zerocopy/tests/ui-msrv/try_transmute_ref-alignment-increase.stderr +0 -9
- data/rust-vendor/zerocopy/tests/ui-msrv/try_transmute_ref-size-decrease.rs +0 -18
- data/rust-vendor/zerocopy/tests/ui-msrv/try_transmute_ref-size-decrease.stderr +0 -9
- data/rust-vendor/zerocopy/tests/ui-msrv/try_transmute_ref-size-increase.rs +0 -18
- data/rust-vendor/zerocopy/tests/ui-msrv/try_transmute_ref-size-increase.stderr +0 -9
- data/rust-vendor/zerocopy/tests/ui-nightly/transmute-mut-dst-unsized.rs +0 -15
- data/rust-vendor/zerocopy/tests/ui-nightly/transmute-mut-dst-unsized.stderr +0 -16
- data/rust-vendor/zerocopy/tests/ui-nightly/transmute-ref-dst-unsized.rs +0 -15
- data/rust-vendor/zerocopy/tests/ui-nightly/transmute-ref-dst-unsized.stderr +0 -16
- data/rust-vendor/zerocopy/tests/ui-nightly/try_transmute_mut-alignment-increase.rs +0 -19
- data/rust-vendor/zerocopy/tests/ui-nightly/try_transmute_mut-alignment-increase.stderr +0 -9
- data/rust-vendor/zerocopy/tests/ui-nightly/try_transmute_mut-size-decrease.rs +0 -19
- data/rust-vendor/zerocopy/tests/ui-nightly/try_transmute_mut-size-decrease.stderr +0 -9
- data/rust-vendor/zerocopy/tests/ui-nightly/try_transmute_mut-size-increase.rs +0 -19
- data/rust-vendor/zerocopy/tests/ui-nightly/try_transmute_mut-size-increase.stderr +0 -17
- data/rust-vendor/zerocopy/tests/ui-nightly/try_transmute_ref-alignment-increase.rs +0 -18
- data/rust-vendor/zerocopy/tests/ui-nightly/try_transmute_ref-alignment-increase.stderr +0 -9
- data/rust-vendor/zerocopy/tests/ui-nightly/try_transmute_ref-size-decrease.rs +0 -18
- data/rust-vendor/zerocopy/tests/ui-nightly/try_transmute_ref-size-decrease.stderr +0 -9
- data/rust-vendor/zerocopy/tests/ui-nightly/try_transmute_ref-size-increase.rs +0 -18
- data/rust-vendor/zerocopy/tests/ui-nightly/try_transmute_ref-size-increase.stderr +0 -9
- data/rust-vendor/zerocopy/tests/ui-stable/transmute-mut-dst-unsized.rs +0 -15
- data/rust-vendor/zerocopy/tests/ui-stable/transmute-mut-dst-unsized.stderr +0 -16
- data/rust-vendor/zerocopy/tests/ui-stable/transmute-ref-dst-unsized.rs +0 -15
- data/rust-vendor/zerocopy/tests/ui-stable/transmute-ref-dst-unsized.stderr +0 -16
- data/rust-vendor/zerocopy/tests/ui-stable/try_transmute_mut-alignment-increase.rs +0 -19
- data/rust-vendor/zerocopy/tests/ui-stable/try_transmute_mut-alignment-increase.stderr +0 -9
- data/rust-vendor/zerocopy/tests/ui-stable/try_transmute_mut-size-decrease.rs +0 -19
- data/rust-vendor/zerocopy/tests/ui-stable/try_transmute_mut-size-decrease.stderr +0 -9
- data/rust-vendor/zerocopy/tests/ui-stable/try_transmute_mut-size-increase.rs +0 -19
- data/rust-vendor/zerocopy/tests/ui-stable/try_transmute_mut-size-increase.stderr +0 -17
- data/rust-vendor/zerocopy/tests/ui-stable/try_transmute_ref-alignment-increase.rs +0 -18
- data/rust-vendor/zerocopy/tests/ui-stable/try_transmute_ref-alignment-increase.stderr +0 -9
- data/rust-vendor/zerocopy/tests/ui-stable/try_transmute_ref-size-decrease.rs +0 -18
- data/rust-vendor/zerocopy/tests/ui-stable/try_transmute_ref-size-decrease.stderr +0 -9
- data/rust-vendor/zerocopy/tests/ui-stable/try_transmute_ref-size-increase.rs +0 -18
- data/rust-vendor/zerocopy/tests/ui-stable/try_transmute_ref-size-increase.stderr +0 -9
|
@@ -795,6 +795,7 @@ mod _transitions {
|
|
|
795
795
|
}
|
|
796
796
|
|
|
797
797
|
/// Casts of the referent type.
|
|
798
|
+
pub(crate) use _casts::TryWithError;
|
|
798
799
|
mod _casts {
|
|
799
800
|
use core::cell::UnsafeCell;
|
|
800
801
|
|
|
@@ -912,6 +913,89 @@ mod _casts {
|
|
|
912
913
|
let tag = unsafe { tag.assume_alignment() };
|
|
913
914
|
tag.unify_invariants()
|
|
914
915
|
}
|
|
916
|
+
|
|
917
|
+
/// Attempts to transform the pointer, restoring the original on
|
|
918
|
+
/// failure.
|
|
919
|
+
///
|
|
920
|
+
/// # Safety
|
|
921
|
+
///
|
|
922
|
+
/// If `I::Aliasing != Shared`, then if `f` returns `Err(err)`, no copy
|
|
923
|
+
/// of `f`'s argument must exist outside of `err`.
|
|
924
|
+
#[inline(always)]
|
|
925
|
+
pub(crate) unsafe fn try_with_unchecked<U, J, E, F>(
|
|
926
|
+
self,
|
|
927
|
+
f: F,
|
|
928
|
+
) -> Result<Ptr<'a, U, J>, E::Mapped>
|
|
929
|
+
where
|
|
930
|
+
U: 'a + ?Sized,
|
|
931
|
+
J: Invariants<Aliasing = I::Aliasing>,
|
|
932
|
+
E: TryWithError<Self>,
|
|
933
|
+
F: FnOnce(Ptr<'a, T, I>) -> Result<Ptr<'a, U, J>, E>,
|
|
934
|
+
{
|
|
935
|
+
let old_inner = self.as_inner();
|
|
936
|
+
#[rustfmt::skip]
|
|
937
|
+
let res = f(self).map_err(#[inline(always)] move |err: E| {
|
|
938
|
+
err.map(#[inline(always)] |src| {
|
|
939
|
+
drop(src);
|
|
940
|
+
|
|
941
|
+
// SAFETY:
|
|
942
|
+
// 0. Aliasing is either `Shared` or `Exclusive`:
|
|
943
|
+
// - If aliasing is `Shared`, then it cannot violate
|
|
944
|
+
// aliasing make another copy of this pointer (in fact,
|
|
945
|
+
// using `I::Aliasing = Shared`, we could have just
|
|
946
|
+
// cloned `self`).
|
|
947
|
+
// - If aliasing is `Exclusive`, then `f` is not allowed
|
|
948
|
+
// to make another copy of `self`. In `map_err`, we are
|
|
949
|
+
// consuming the only value in the returned `Result`.
|
|
950
|
+
// By invariant on `E: TryWithError<Self>`, that `err:
|
|
951
|
+
// E` only contains a single `Self` and no other
|
|
952
|
+
// non-ZST fields which could be `Ptr`s or references
|
|
953
|
+
// to `self`'s referent. By the same invariant, `map`
|
|
954
|
+
// consumes this single `Self` and passes it to this
|
|
955
|
+
// closure. Since `self` was, by invariant on
|
|
956
|
+
// `Exclusive`, the only `Ptr` or reference live for
|
|
957
|
+
// `'a` with this referent, and since we `drop(src)`
|
|
958
|
+
// above, there are no copies left, and so we are
|
|
959
|
+
// creating the only copy.
|
|
960
|
+
// 1. `self` conforms to `I::Aliasing` by invariant on
|
|
961
|
+
// `Ptr`, and `old_inner` has the same address, so it
|
|
962
|
+
// does too.
|
|
963
|
+
// 2. `f` could not have violated `self`'s validity without
|
|
964
|
+
// itself being unsound. Assuming that `f` is sound, the
|
|
965
|
+
// referent of `self` is still valid for `T`.
|
|
966
|
+
unsafe { Ptr::from_inner(old_inner) }
|
|
967
|
+
})
|
|
968
|
+
});
|
|
969
|
+
res
|
|
970
|
+
}
|
|
971
|
+
|
|
972
|
+
/// Attempts to transform the pointer, restoring the original on
|
|
973
|
+
/// failure.
|
|
974
|
+
pub(crate) fn try_with<U, J, E, F>(self, f: F) -> Result<Ptr<'a, U, J>, E::Mapped>
|
|
975
|
+
where
|
|
976
|
+
U: 'a + ?Sized,
|
|
977
|
+
J: Invariants<Aliasing = I::Aliasing>,
|
|
978
|
+
E: TryWithError<Self>,
|
|
979
|
+
F: FnOnce(Ptr<'a, T, I>) -> Result<Ptr<'a, U, J>, E>,
|
|
980
|
+
I: Invariants<Aliasing = Shared>,
|
|
981
|
+
{
|
|
982
|
+
// SAFETY: `I::Aliasing = Shared`, so the safety condition does not
|
|
983
|
+
// apply.
|
|
984
|
+
unsafe { self.try_with_unchecked(f) }
|
|
985
|
+
}
|
|
986
|
+
}
|
|
987
|
+
|
|
988
|
+
/// # Safety
|
|
989
|
+
///
|
|
990
|
+
/// `Self` only contains a single `Self::Inner`, and `Self::Mapped` only
|
|
991
|
+
/// contains a single `MappedInner`. Other than that, `Self` and
|
|
992
|
+
/// `Self::Mapped` contain no non-ZST fields.
|
|
993
|
+
///
|
|
994
|
+
/// `map` must pass ownership of `self`'s sole `Self::Inner` to `f`.
|
|
995
|
+
pub(crate) unsafe trait TryWithError<MappedInner> {
|
|
996
|
+
type Inner;
|
|
997
|
+
type Mapped;
|
|
998
|
+
fn map<F: FnOnce(Self::Inner) -> MappedInner>(self, f: F) -> Self::Mapped;
|
|
915
999
|
}
|
|
916
1000
|
|
|
917
1001
|
impl<'a, T, I> Ptr<'a, T, I>
|
|
@@ -1078,30 +1162,18 @@ mod _casts {
|
|
|
1078
1162
|
U: 'a + ?Sized + KnownLayout + Read<I::Aliasing, R>,
|
|
1079
1163
|
[u8]: Read<I::Aliasing, R>,
|
|
1080
1164
|
{
|
|
1081
|
-
//
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
// Restore the initial alignment invariant of `self`.
|
|
1091
|
-
//
|
|
1092
|
-
// SAFETY: The referent type of `slf` is now equal to
|
|
1093
|
-
// that of `self`, but the alignment invariants
|
|
1094
|
-
// nominally differ. Since `slf` and `self` refer to the
|
|
1095
|
-
// same memory and no actions have been taken that would
|
|
1096
|
-
// violate the original invariants on `self`, it is
|
|
1097
|
-
// sound to apply the alignment invariant of `self` onto
|
|
1098
|
-
// `slf`.
|
|
1099
|
-
let slf = unsafe { slf.assume_alignment::<I::Alignment>() };
|
|
1100
|
-
let slf = slf.unify_invariants();
|
|
1101
|
-
Err(CastError::Size(SizeError::<_, U>::new(slf)))
|
|
1165
|
+
// SAFETY: The provided closure returns the only copy of `slf`.
|
|
1166
|
+
unsafe {
|
|
1167
|
+
self.try_with_unchecked(|slf| match slf.try_cast_into(CastType::Prefix, meta) {
|
|
1168
|
+
Ok((slf, remainder)) => {
|
|
1169
|
+
if remainder.len() == 0 {
|
|
1170
|
+
Ok(slf)
|
|
1171
|
+
} else {
|
|
1172
|
+
Err(CastError::Size(SizeError::<_, U>::new(())))
|
|
1173
|
+
}
|
|
1102
1174
|
}
|
|
1103
|
-
|
|
1104
|
-
|
|
1175
|
+
Err(err) => Err(err.map_src(|_slf| ())),
|
|
1176
|
+
})
|
|
1105
1177
|
}
|
|
1106
1178
|
}
|
|
1107
1179
|
}
|
|
@@ -1439,4 +1511,18 @@ mod tests {
|
|
|
1439
1511
|
// succeed.
|
|
1440
1512
|
test!(Dst, 8, usize::MAX - 8 + 1, None);
|
|
1441
1513
|
}
|
|
1514
|
+
|
|
1515
|
+
#[test]
|
|
1516
|
+
fn test_try_cast_into_no_leftover_restores_original_slice() {
|
|
1517
|
+
let bytes = [0u8; 4];
|
|
1518
|
+
let ptr = Ptr::from_ref(&bytes[..]);
|
|
1519
|
+
let res = ptr.try_cast_into_no_leftover::<[u8; 2], BecauseImmutable>(None);
|
|
1520
|
+
match res {
|
|
1521
|
+
Ok(_) => panic!("should have failed due to leftover bytes"),
|
|
1522
|
+
Err(CastError::Size(e)) => {
|
|
1523
|
+
assert_eq!(e.into_src().len(), 4, "Should return original slice length");
|
|
1524
|
+
}
|
|
1525
|
+
Err(e) => panic!("wrong error type: {:?}", e),
|
|
1526
|
+
}
|
|
1527
|
+
}
|
|
1442
1528
|
}
|