Skip to content

Commit 5630b0f

Browse files
authored
Fixed serde content detection for serde >= 1.0.220 (#582)
* Fixed serde content detection for serde >= 1.0.220 * Add regression test for #581 * Use once_cell to cache the type ids * Remove the arbitrary fuzzer * Remove test relying on serde internals
1 parent 3184df3 commit 5630b0f

File tree

13 files changed

+180
-6568
lines changed

13 files changed

+180
-6568
lines changed

.github/workflows/ci.yaml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ name: CI
22
on:
33
push:
44
branches:
5-
- master
6-
- 'v*.*'
5+
- master
6+
- "v*.*"
77
pull_request:
88
branches:
9-
- master
10-
- 'v*.*'
9+
- master
10+
- "v*.*"
1111
schedule:
12-
- cron: '0 0 * * 0'
12+
- cron: "0 0 * * 0"
1313

1414
jobs:
1515
lock:
@@ -73,7 +73,11 @@ jobs:
7373
cargo update -p serde_bytes --precise 0.11.16
7474
cargo update -p indexmap --precise 2.5.0
7575
cargo update -p once_cell --precise 1.20.3
76-
if: ${{ matrix.rust == '1.64.0' || matrix.rust == '1.81.0' }}
76+
cargo update -p quote --precise 1.0.41
77+
cargo update -p syn$(perl -ne 'm/syn (2\.\d+\.\d+)/ && print "\@$1\n"' Cargo.lock) --precise 2.0.106
78+
cargo update -p typetag --precise 0.2.20
79+
cargo update -p erased-serde --precise 0.4.8
80+
if: ${{ matrix.rust == '1.64.0' }}
7781
- name: Check
7882
run: |
7983
cargo hack check --feature-powerset --no-dev-deps
@@ -108,7 +112,7 @@ jobs:
108112
components: clippy
109113
override: true
110114
- run: cd fuzz && cargo clippy --all -- -D warnings
111-
115+
112116
rustfmt:
113117
name: "Format: stable"
114118
runs-on: ubuntu-latest

.github/workflows/cibench.yml

Lines changed: 0 additions & 32 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77
## Unreleased
88

99
### Additions
10+
1011
- Added `into_inner()` method to `ron::ser::Serializer` to retrieve the inner writer. ([#588](https://github.com/ron-rs/ron/pull/588))
1112

13+
### Bug Fixes
14+
15+
- Fixed untagged enum deserialisation for serde >= 1.0.220 with better serde content detection ([#582](https://github.com/ron-rs/ron/pull/582))
16+
1217
## [0.11.0] - 2025-08-27
1318

1419
### API Changes

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ serde = { version = "1.0.181", default-features = false, features = ["alloc"] }
3939
serde_derive = { version = "1.0.181", default-features = false }
4040
unicode-ident = { version = "1.0", default-features = false }
4141
unicode-segmentation = { version = "1.12.0", optional = true, default-features = false }
42+
typeid = { version = "1.0.1", default-features = false }
43+
once_cell = { version = "1.20", default-features = false, features = ["alloc", "race"] }
4244

4345
[dev-dependencies]
4446
serde = { version = "1.0.181", default-features = false, features = ["std", "derive"] }

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ Please file a [new issue](https://github.com/ron-rs/ron/issues/new) if you come
224224

225225
While RON guarantees roundtrips like Rust -> RON -> Rust for Rust types using non-`deserialize_any`-based implementations, RON does not yet make any guarantees about roundtrips through `ron::Value`. For instance, even when RON -> Rust works, RON -> `ron::Value` -> Rust, or RON -> `ron::Value` -> RON -> Rust may not work. We plan on improving `ron::Value` in an upcoming version of RON, though this work is partially blocked on [serde#1183](https://github.com/serde-rs/serde/issues/1183).
226226

227-
[^serde-enum-hack]: Deserialising an internally, adjacently, or un-tagged enum requires detecting `serde`'s internal `serde::__private::de::content::Content` content type so that RON can describe the deserialised data structure in serde's internal JSON-like format. This detection only works for the automatically-derived [`Deserialize`](https://docs.rs/serde/latest/serde/de/trait.Deserialize.html) impls on enums. See [#451](https://github.com/ron-rs/ron/pull/451) for more details.
227+
[^serde-enum-hack]: Deserialising an internally, adjacently, or un-tagged enum requires detecting `serde`'s internal default buffer/content type so that RON can describe the deserialised data structure in serde's internal JSON-like format. A more robust implementation is blocked on [serde#1183](https://github.com/serde-rs/serde/issues/1183).
228228

229229
[^serde-flatten-hack]: Deserialising a flattened struct from a map requires that the struct's [`Visitor::expecting`](https://docs.rs/serde/latest/serde/de/trait.Visitor.html#tymethod.expecting) implementation formats a string starting with `"struct "`. This is the case for automatically-derived [`Deserialize`](https://docs.rs/serde/latest/serde/de/trait.Deserialize.html) impls on structs. See [#455](https://github.com/ron-rs/ron/pull/455) for more details.
230230

fuzz/Cargo.toml

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,8 @@ edition = "2018"
99
cargo-fuzz = true
1010

1111
[dependencies]
12-
arbitrary = { version = "1.0", default-features = false, features = ["derive"] }
1312
libfuzzer-sys = { version = "0.4", default-features = false, features = ["link_libfuzzer"] }
1413
ron = { path = "..", default-features = false, features = ["integer128", "std"] }
15-
serde = { version = "1.0", default-features = false, features = ["std", "derive"] }
16-
erased-serde = { version = "0.4", default-features = false, features = ["std"] }
17-
anyhow = { version = "1.0", default-features = false, features = ["std"] }
18-
criterion = { version = "0.5", default-features = false }
19-
serde_path_to_error = { version = "0.1", default-features = false }
2014

2115
# Prevent this from interfering with workspaces
2216
[workspace]
@@ -27,14 +21,3 @@ name = "from_str"
2721
path = "fuzz_targets/from_str.rs"
2822
test = false
2923
doc = false
30-
31-
[[bin]]
32-
name = "arbitrary"
33-
path = "fuzz_targets/arbitrary.rs"
34-
test = false
35-
doc = false
36-
37-
[[bench]]
38-
name = "bench"
39-
path = "fuzz_targets/bench/main.rs"
40-
harness = false

fuzz/fuzz_targets/arbitrary.rs

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)