Skip to content

Conversation

@RAprogramm
Copy link
Owner

Summary

  • add a masterror-derive proc-macro crate that reimplements the Error derive using the shared parser from masterror-template
  • expose the new macro from masterror::Error and re-export the template helpers from the internal crate
  • update documentation and changelog to describe the native derive

Testing

  • cargo clippy -- -D warnings
  • cargo +nightly fmt --
  • cargo build --all-targets
  • cargo test --all
  • cargo doc --no-deps
  • cargo test --test error_derive_from_trybuild

https://chatgpt.com/codex/tasks/task_e_68cca81c89d0832b95fbcceefc305db1

@RAprogramm RAprogramm merged commit 1fc86c4 into new_version Sep 19, 2025
1 of 2 checks passed
@RAprogramm RAprogramm deleted the codex/create-proc-macro-crate-for-masterror branch September 19, 2025 01:39
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

Codex Review: Here are some suggestions.

match display {
DisplaySpec::Transparent {
..
} => {
if let Some(field) = fields.iter().next() {
let member = &field.member;
quote! { std::error::Error::source(&self.#member) }

[P1] Preserve wrapped error in transparent source()

When deriving #[error(transparent)], the generated source() calls std::error::Error::source(&self.#member) instead of returning the wrapped field itself. This skips the immediate cause in the error chain: a transparent wrapper over io::Error will now return None because it queries io::Error::source() rather than returning Some(&io_error). Downstream consumers walking the chain will miss the wrapped error entirely. The transparent impls should return the field (or its Option contents) as the source, mirroring thiserror, instead of delegating to the inner error’s own source().


Reply with @codex fix comments to fix any unresolved comments.

About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you open a pull request for review, mark a draft as ready, or comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex fix this CI failure" or "@codex address that feedback".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants