mirror of
https://github.com/apple/swift-nio-imap
synced 2026-11-29 05:24:23 +00:00
ParserError shrinks from 40 to 24 bytes. A private Storage enum holds a pointer to a StaticString hint, a digit-count hint formatted when read, or a boxed String. The throw site is a ThrowSite: file pointer, UInt32 line, UInt8 length. - Hints are StaticString, so the compiler rejects interpolation. Computed hints use `init(dynamicHint:)`, which allocates. - `parseNDigits` uses `init(expectedDigits:got:)` instead of interpolating on every mismatch. - `hint` is computed; assigning it boxes. A custom Mirror (public `CustomReflectable` conformance) keeps the printed form. - Behavior change: `file` names the throwing site. The `(#fileID)` defaults named ParserErrors.swift, and the three `parseOneOf` overloads' named ParseInput+Combinators.swift; the array form's "none of the options match" now names the calling file. - `NoForwardProgress` stores a `ThrowSite` too. Public API addition: `CustomReflectable` conformance, which keeps `file` and `line` in its Mirror. - ThrowSite and LiteralHint are @unchecked Sendable: they point at immortal literals. Both join the unsafe-seams list in ParseInput.swift. Untyped throws still box every error, so the size buys little here. It is for typed throws, next, which return the error in registers.