Skip to content

[v0.9] Breaking: Treat Some like any newtype variant#413

Closed
juntyr wants to merge 2 commits into
ron-rs:masterfrom
juntyr:unwrap-some-variant-newtype
Closed

[v0.9] Breaking: Treat Some like any newtype variant#413
juntyr wants to merge 2 commits into
ron-rs:masterfrom
juntyr:unwrap-some-variant-newtype

Conversation

@juntyr

@juntyr juntyr commented Oct 4, 2022

Copy link
Copy Markdown
Member

How should Some be treated in the presence of the unwrap_variant_newtypes extension? With that extension, NewtypeVariant(Some(a: 42, b: 24)) already worked, but Some(a: 42, b: 24) did not. In my opinion Some is just a newtype variant and should parse consistently here. @torkleyy what are your thoughts?

  • I've included my change in CHANGELOG.md

@codecov-commenter

codecov-commenter commented Oct 4, 2022

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 87.09677% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.93%. Comparing base (2b9a50c) to head (9b94603).
⚠️ Report is 113 commits behind head on master.

Files with missing lines Patch % Lines
tests/250_variant_newtypes.rs 87.50% 3 Missing ⚠️
src/de/mod.rs 85.71% 1 Missing ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #413      +/-   ##
==========================================
- Coverage   91.25%   89.93%   -1.32%     
==========================================
  Files          56       56              
  Lines        6542     6668     +126     
==========================================
+ Hits         5970     5997      +27     
- Misses        572      671      +99     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@juntyr juntyr force-pushed the unwrap-some-variant-newtype branch from 62b7571 to 9b94603 Compare October 8, 2022 08:06
@juntyr juntyr marked this pull request as ready for review October 8, 2022 08:06

@torkleyy torkleyy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the change makes sense, but I'm wondering if it will break anything in practice. In any case this change needs to be in a breaking version release. Maybe we should merge it when we are about to release other breaking changes.

@juntyr

juntyr commented Oct 12, 2022

Copy link
Copy Markdown
Member Author

I think the change makes sense, but I'm wondering if it will break anything in practice. In any case this change needs to be in a breaking version release. Maybe we should merge it when we are about to release other breaking changes.

Good point! I agree that we can keep around this change until we’re ready for 0.9 as it’s quite small and won’t be difficult to rebase then

@juntyr juntyr changed the title Breaking: Treat Some like any newtype variant [0.9] Breaking: Treat Some like any newtype variant Oct 12, 2022
@juntyr juntyr changed the title [0.9] Breaking: Treat Some like any newtype variant [v0.9] Breaking: Treat Some like any newtype variant Oct 12, 2022
juntyr added a commit to juntyr/ron that referenced this pull request Jul 16, 2023
@juntyr

juntyr commented Jul 16, 2023

Copy link
Copy Markdown
Member Author

#465 shows that this might actually be a bad idea, as Some(a: 42) cannot be handled (without very big and hacky stretches) inside deserialize_any.

@juntyr juntyr marked this pull request as draft July 16, 2023 20:24
juntyr added a commit to juntyr/ron that referenced this pull request Jul 17, 2023
juntyr added a commit to juntyr/ron that referenced this pull request Aug 16, 2023
juntyr added a commit to juntyr/ron that referenced this pull request Aug 17, 2023
juntyr added a commit to juntyr/ron that referenced this pull request Aug 17, 2023
@juntyr

juntyr commented Aug 17, 2023

Copy link
Copy Markdown
Member Author

#465 now includes and supersedes this PR

@juntyr juntyr closed this Aug 17, 2023
juntyr added a commit to juntyr/ron that referenced this pull request Aug 19, 2023
juntyr added a commit to juntyr/ron that referenced this pull request Aug 19, 2023
juntyr added a commit that referenced this pull request Aug 20, 2023
* Early prototyping with a typed arbitrary fuzzer (ser only so far) and reading in the corpus

* Also fuzz the ser::PrettyConfig (identation-excluded)

* Start implementing the arbitrary typed data deserialising fuzzing

* Fix None inside stack of implicit Some-s

* Detect problematic Some inside deserialize_any with unwrap_variant_newtypes

* Fix clippy::useless_conversion lint

* Another alternative: allow newtype variant unwrapping in deserialize_any, also for Some + Fix check_struct_type lookahead

* Fix PartialOrd impls for Map and Float

* Implement arbitrary tuple struct (static field names slice FIXME) fuzzing deserialisation

* Fully fix Float comparison with total_ord

* Fix clippy lints

* Finished arbitrary struct and enum deserialisation fuzzing

* Create CI workflow for benchmarking

* Fix corpus download and unzip

* Give benchmark the comparison branch name

* Restrict the benchmark to unique cases (ty, value, ron)

* Add test for the Serialize identifier validation

* Add tests for further fuzzer-found bugs

* Add the extensive CHANGELOG entry

* Add the test and changelog entry from the subsumed #413

* Add an early return + more tests for the expensive newtype or tuple check for unwrapping newtype variants
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants