Skip to content

✨ feat(api): mark public enums and config structs #[non_exhaustive] - #2559

Closed
harehare wants to merge 1 commit into
mainfrom
feat/non-exhaustive-public-types
Closed

harehare wants to merge 1 commit into
mainfrom
feat/non-exhaustive-public-types

Conversation

@harehare

Copy link
Copy Markdown
Owner

Summary

Adding a variant or field is no longer a breaking change for downstream crates. This also keeps exhaustive matches on mq_markdown::Node from breaking when feature unification enables callout, embed or wikilink.

Type of Change

  • 🐛 Bug fix
  • ✨ New feature
  • ♻️ Refactor
  • 📝 Documentation
  • ⚡ Performance
  • ✅ Test
  • 📦 Build / dependencies
  • 👷 CI

Checklist

  • I ran cargo fmt and cargo clippy and addressed any warnings
  • I ran just test-all and all tests pass
  • I added or updated tests covering this change
  • I updated relevant documentation (/docs, crate README.md) if needed
  • I added a changelog entry if this is a user-facing change

Additional Context

Adding a variant or field is no longer a breaking change for downstream
crates. This also keeps exhaustive matches on `mq_markdown::Node` from
breaking when feature unification enables `callout`, `embed` or `wikilink`.

- enums: Node, Selector, RuntimeValue, AST Expr/Literal/Pattern and
  operators, and the error types (RuntimeError, SyntaxError, ModuleError,
  TypeError, HirError, ...)
- structs: Error and the option/config types (ConversionOptions,
  FormatterConfig, TypeCheckerOptions, RenderOptions, RetryConfig,
  ChromiumWaitConfig, ...), each with `with_*` builder methods since struct
  literals are no longer allowed outside the defining crate
- add HirError::symbol() so the exhaustive match stays in mq-hir
- CST types and AstNode are intentionally left exhaustive

BREAKING CHANGE: exhaustive matches on the listed enums need a wildcard arm,
and the listed structs can no longer be built with struct literals outside
their defining crate. Use `Default` and the `with_*` methods.
@codspeed

codspeed Bot commented Oct 12, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

⚠️ 1 benchmark spent significant time in system calls

System calls cannot be consistently instrumented, so they are not included in the measure, which understates the real cost. Please switch to the Walltime instrument to accurately measure system calls.

Measurement and system calls

✅ 43 untouched benchmarks
⏩ 35 skipped benchmarks1


Comparing feat/non-exhaustive-public-types (a102e5e) with main (e68ad52)

Open in CodSpeed

Footnotes

  1. 35 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@harehare harehare closed this Oct 12, 2026
@harehare
harehare deleted the feat/non-exhaustive-public-types branch October 15, 2026 12:15
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.

1 participant