refactor(core): derive Display and Error via thiserror in DecodeErrorKind and EncodeErrorKind#1261
Closed
Greg Lamberson (glamberson) wants to merge 1 commit into
Closed
Conversation
…Kind and EncodeErrorKind Refs Devolutions#1257. Companion to the std-only thiserror migration in the prior PR. ironrdp-core is split off because it is no_std-aware and the change requires Cargo.toml feature wiring that the other crates do not need. ### Changes - Adds `thiserror = { version = "2", default-features = false }` to dependencies. - Wires `thiserror/std` into the existing `std` feature: `std = ["alloc", "ironrdp-error/std", "thiserror/std"]`. - Derives `thiserror::Error` on `DecodeErrorKind` and `EncodeErrorKind` with per-variant `#[error("...")]` attributes that match the prior `write!(f, "...")` format strings exactly. - Each cfg-gated `UnsupportedValue` variant (with/without `alloc`) receives its own `#[error("...")]` attribute. - Removes the `#[cfg(feature = "std")] impl core::error::Error for *ErrorKind {}` gates. `core::error::Error` lives in `core` (stabilized Rust 1.81, well below MSRV 1.89), and `thiserror`'s derive emits an unconditional `impl`. The behaviour change is from "Error impl available only with std" to "Error impl always available", which is a strict superset. ### Public API impact None. The `pub type DecodeError = ironrdp_error::Error<DecodeErrorKind>` and `pub type EncodeError = ironrdp_error::Error<EncodeErrorKind>` aliases are unchanged. Consumers see no source-level break. ### no_std verification All three feature combinations build cleanly: - `cargo check -p ironrdp-core --no-default-features` (no_std, no alloc) - `cargo check -p ironrdp-core --no-default-features --features alloc` (no_std + alloc) - `cargo check -p ironrdp-core --features std` ### xtask verification - `cargo xtask check fmt`: clean - `cargo xtask check lints`: clean - `cargo xtask check locks`: clean (root and fuzz Cargo.lock both updated and included; the missing fuzz lock was the failure mode of the earlier Devolutions#1259 attempt) - `cargo xtask check typos`: clean - `cargo xtask check tests`: clean
This was referenced May 11, 2026
Contributor
Author
|
Closing per #1257 (#1257 (comment)). Change 1's premise is withdrawn after the Core Tier proc-macro invariant correction. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #1257. Companion to #1260.
Companion to the std-only
thiserrormigration in #1260.ironrdp-coreis split off because it isno_std-aware and the change requires Cargo.toml feature wiring that the other crates do not need.Changes
thiserror = { version = "2", default-features = false }to dependencies.thiserror/stdinto the existingstdfeature:std = ["alloc", "ironrdp-error/std", "thiserror/std"].thiserror::ErroronDecodeErrorKindandEncodeErrorKindwith per-variant#[error("...")]attributes that match the priorwrite!(f, "...")format strings exactly.UnsupportedValuevariant (with/withoutalloc) receives its own#[error("...")]attribute.#[cfg(feature = "std")] impl core::error::Error for *ErrorKind {}gates.core::error::Errorlives incore(stabilized Rust 1.81, well below MSRV 1.89), andthiserror's derive emits an unconditional impl. The behaviour change is from "Error impl available only with std" to "Error impl always available", which is a strict superset.Public API impact
None. The
pub type DecodeError = ironrdp_error::Error<DecodeErrorKind>andpub type EncodeError = ironrdp_error::Error<EncodeErrorKind>aliases are unchanged. Consumers see no source-level break.no_std verification
All three feature combinations build cleanly:
cargo check -p ironrdp-core --no-default-features(no_std, no alloc)cargo check -p ironrdp-core --no-default-features --features alloc(no_std + alloc)cargo check -p ironrdp-core --features stdxtask verification
cargo xtask check fmt: cleancargo xtask check lints: cleancargo xtask check locks: clean (both rootCargo.lockandfuzz/Cargo.lockupdated and included; the missing fuzz lock was the failure mode of the earlier refactor: derive Display and Error via thiserror across core, pdu, connector, session #1259 attempt)cargo xtask check typos: cleancargo xtask check tests: cleanDiff size
5 files changed, +20 −73 (net −53 lines of code removed).