Releases

Rust developers get serde_test2, revived crate for serialization testing

A crate used by 18.6k GitHub repos is back as serde_test2, with no_std support, stricter checks, and fixes that would have caught bugs in time.

Sam Ortega2 min read
Published
Listen to this article0:00 min
Share this article:
Rust developers get serde_test2, revived crate for serialization testing
AI-generated illustration
This article contains affiliate links, marked with a blue dot. We may earn a small commission at no extra cost to you.

A crate used by 18.6k GitHub repositories and packages just got a new caretaker, and the update does more than unfreeze an archive. serde_test2 brings the old serde_test testing pattern back to life with stricter serialization checks, no_std support, and a set of breaking changes meant to catch bugs that the original crate let slide.

Jacob Pratt, who maintains the fork under the handle jhpratt, announced serde_test2 as version 2.0.0 because the release changes behavior in ways that can break existing tests. For most projects, the migration is still straightforward: swap serde_test = "1.x.y" for serde_test2 = "2.0.0" in Cargo.toml and keep moving. The original serde_test repository was archived on Dec. 17, 2024, and the maintainer said unresolved issues in that dead-end branch pushed the fork forward.

The biggest practical changes land where Rust test suites actually feel them. Token now supports U128 and I128, the enum is marked #[non_exhaustive], unit variant indexing is included, and map, struct, and tuple lengths are checked more strictly. That stricter validation matters because it exposed tests that were simply wrong, including one case where a suite expected five fields even though six were present. The maintainer also said deserialization does not silently fall back to deserialize_any, and the concrete deserializer is always used when it is called. In the announcement, that kind of tightening is tied directly to real mistakes, with the claim that at least two bugs in time would not have happened if the behavior had been in place earlier.

serde_test2 also adds #![no_std] support, though alloc is still required, so this is not an allocation-free crate. The minimum supported Rust version moved from 1.56 to 1.61, and the dependency switched from serde to serde_core. That matters because serde_core carries Serde’s trait definitions without derive support, while serde remains the crate you reach for when you want the macros that generate Serialize and Deserialize implementations.

This is the sort of maintenance release Rust depends on: not flashy, but the kind that keeps a widely used test utility trustworthy. The old serde_test crate had been the convenient way to assert token sequences instead of round-tripping through a full data format, and issue threads had been asking for better Token::UnitVariant validation and stronger deserialization checks for years. serde_test2 finally turns those requests into behavior, which is exactly why this small release carries outsized practical value.

Know something we missed? Have a correction or additional information?

Submit a Tip

Never miss a story.
Get Rust Programming updates weekly.

The top stories delivered to your inbox.

Free forever · Unsubscribe anytime

Discussion

More Rust Programming News