fix(deps): update rust crate quick-xml to 0.42 - #82
fix(deps): update rust crate quick-xml to 0.42#82ferrlabs-renovate[bot] wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
WHAT CHANGED: 0.42's headline change is byte→string migration across the API. LocalName/Namespace::into_inner() now return &str instead of &[u8], event types (BytesText etc.) now Deref<Target = str> / implement AsRef<str> instead of AsRef<[u8]>, and Reader now rejects non-UTF-8 input instead of passing it through.
WHAT BREAKS HERE: this repo's two DAV XML parsers use exactly the byte-based patterns that were removed, so they won't compile against 0.42:
api/src/dav/propfind.rs:58and:61—String::from_utf8_lossy(...)called onlocal_name().into_inner()/namespace.into_inner(), which are now&str, not&[u8].api/src/dav/propfind.rs:85—element.local_name().into_inner() == b"prop"compares&strto a byte-string literal.api/src/dav/locking.rs:209and:212— same== b"owner"byte-literal comparison.api/src/dav/locking.rs:214—String::from_utf8_lossy(&raw)on aBytesText, which no longer offers&[u8](itsAsRef<[u8]>impl was removed in 0.42).
Blocking: none of these call sites were updated, so the crate does not compile. Fixes are one-liners once you're touching these files, e.g. propfind.rs:85 → element.local_name().into_inner() == "prop", and drop the from_utf8_lossy wrapper on lines 58/61/214 since the values are already valid &str/deref to str. Since propfind.rs/locking.rs aren't part of this diff, I can't attach GitHub suggestion blocks to them here.
WHY CI FAILS: build and Coverage both fail (exit 101, "1 error"). This matches the source-level break above rather than a flake — I couldn't pull the raw compiler text (log requires GitHub auth), but the failure is consistent with a compile error, not an unrelated/pre-existing failure, since main presumably still builds on quick-xml 0.41.
Do not silence this by pinning back the version — the fix is to update the three call sites for the new &str-based API.
32e281d to
f6d0d2f
Compare
Signed-off-by: ferrlabs-renovate[bot] <282300760+ferrlabs-renovate[bot]@users.noreply.github.com>
f6d0d2f to
daecba4
Compare
This PR contains the following updates:
0.41→0.42Release Notes
tafia/quick-xml (quick-xml)
v0.42.0Compare Source
This is a large release. The primary change is an ergonomic improvement across the entire API -
quick_xml now makes use of
&strandStringtypes where possible instead of&[u8]andVec<u8>. This requires significant refactoring of downstream code,but should result in a net simplification as well as potential performance improvements,
and opens up additional opportunities in future releases.
The MSRV has been raised to 1.86. We now use Rust 2024 Edition.
Breaking Changes
Non-UTF-8 input passed to
Reader::from_reader()withoutDecodingReaderwill nowproduce
Error::Encodinginstead of silently passing through invalid bytes.Use
DecodingReaderto transcode non-UTF-8 sources.QName,LocalName,Prefix,Namespace,PrefixDeclaration)now wrap
&strinstead of&[u8].into_inner()returns&str, andAsRef<str>is implemented (
AsRef<[u8]>has been removed).ResolveResult::Unknownnow containsStringinstead of
Vec<u8>, andNamespaceErrorvariants containStringinstead ofVec<u8>.decoder: Decoderfield from event types (BytesStart,BytesText,BytesCData,BytesRef) andAttributes. Thedecoder()method is no longer availableon these types. Decode methods on events now always assume UTF-8 input.
Error::missed_end()no longer takes aDecoderparameter.BytesStart,BytesEnd,BytesText,BytesCData,BytesPI,BytesRef) now storeCow<str>internally instead ofCow<[u8]>.into_inner()onBytesText,BytesCData,BytesPI, andBytesRefnow returnsCow<str>.BytesStart::set_name()now takes&strinstead of&[u8].Eventenum now implementDeref<Target = str>instead of
Deref<Target = [u8]>. ExplicitAsRef<str>impls are provided toavoid ambiguity.
decode()methods fromBytesText,BytesCData, andBytesRef.Content is already available as
&strviaDeref. Thexml10_content(),xml11_content(),xml_content(), andhtml_content()methods now returnCow<str>directly instead ofResult<Cow<str>, EncodingError>.Attribute::valueis nowCow<'a, str>instead ofCow<'a, [u8]>.The
From<(&[u8], &[u8])>impl has been removed.BytesDecl::version(),encoding(), andstandalone()now returnCow<'_, str>instead ofCow<'_, [u8]>.Reader::decoder()method. UseReader::encoding()instead(available with the
encodingfeature). Removeddecoder()from theXmlReadserde trait. Removed all methods from
Decoder(the struct is kept only forbackward compatibility with deprecated
Attributemethods).NamespaceError::TooManyDeclarationshas been renamed toTooManyBindings,and
NamespaceResolver::set_max_declarations_per_elementhas been renamed toNamespaceResolver::set_max_namespace_bindings, and the semantic behavior haschanged slightly. The default maximum has also been reduced from 256 to 128.
DeError::UnexpectedStartrenamed toDeError::MixedContent. That erroris emitted when you try to deserialize boolean, number or string
fieldfromsomething like
<field>text <tag/> another text</field>.Bug Fixes
\r,\n, and\tin attribute valuesas
&#​13;,&#​10;, and&#​9;respectively, preventing silent data loss fromXML attribute-value normalization on round-trip. Likewise
Attribute::fromperforms the same transformation.
Deserializernow correctly handles namespaces. Previouslythe namespace bindings might be applied or removed before the event actually
was consumed which lead to a couple of bugs.
Attributes::newandAttributes::htmlnow return empty iterators whentheir starting position is past the end of the input instead of panicking.
NamespaceResolver::push(and hence everyNsReaderStart/Emptyevent) now returns the new
NamespaceError::TooDeeplyNestedwhen a documentnests elements deeper than
u16::MAX, instead of overflowing the internalu16depth counter. Previously the unguardednesting_level += 1panickedunder
overflow-checksbuilds and silently wrapped in release, corruptingnamespace-scope bookkeeping on deeply nested untrusted input.
NamespaceResolvernow caps the total number of in-scope namespacebindings (default 128, configurable via
set_max_namespace_bindings),replacing the previous per-element
max_declarations_per_elementlimit.Deserializernow enforces a configurable recursion-depthlimit (default 128, matching
serde_json). Deeply nested XML returnsDeError::TooDeeplyNestedinstead of overflowing the native call stack.Use
Deserializer::recursion_limit()to adjust.\rin text content is now escaped as&#​13;by the serde serializer,BytesText::new(),escape(),partial_escape(), andminimal_escape(),preventing silent conversion to
\nfrom XML end-of-line normalization onround-trip. Note that
\rcannot be preserved through CDATA serializationbecause character references are not permitted inside CDATA sections.
Misc Changes
getting_started,writer,serde_roundtrip,reader_patterns,visitor) and anexamples/README.mdguide on choosing between the serde and pull-reader/writer APIs.
Attributemethods that take aDecoderparameter, sinceattribute values are now always valid UTF-8:
decoded_and_normalized_value(),decoded_and_normalized_value_with(),decode_and_unescape_value(), anddecode_and_unescape_value_with(). Usenormalized_value()andnormalized_value_with()instead.NamespaceResolver::withthat allows temporary applying namespacebindings from the start tag for the scope of a provided closure F, without making any
persistent change to the resolver. It is useful to check a peeked event which is
not yet consumed in custom implementations of peekable reader.
Deserializer::resolverandDeserializer::resolver_mutmethodsto get a namespace resolver used by this deserializer, because it no longer uses
an
NsReaderinternally.Hash,PartialOrd, andOrdacross allBytes*types.Configuration
📅 Schedule: (UTC)
🚦 Automerge: Enabled.
♻ Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
👻 Immortal: This PR will be recreated if closed unmerged. Get config help if that's undesired.
This PR has been generated by Mend Renovate CLI.