Skip to content

Conversation

@RAprogramm
Copy link
Owner

Summary

  • add template formatter variants for hex, binary, pointer and exponential rendering
  • extend the template parser, derive backend and tests to exercise the richer formatter set
  • bump crate versions/docs to 0.5.3/0.1.1 so downstream manifests stay in sync

Testing

  • cargo +nightly fmt --
  • cargo +1.90.0 clippy -- -D warnings
  • cargo +1.90.0 build --all-targets
  • cargo +1.90.0 test --all
  • cargo +1.90.0 doc --no-deps
  • cargo deny check
  • cargo audit

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

@RAprogramm RAprogramm merged commit 5dcd519 into new_version Sep 19, 2025
1 of 2 checks passed
@RAprogramm RAprogramm deleted the codex/add-enum-variants-for-formatter-traits branch September 19, 2025 04:30
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.

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".

Comment on lines +372 to +383
TemplateFormatter::Pointer {
alternate
} => {
if alternate {
quote! { write!(f, "{:#p}", #expr)?; }
} else if pointer_value {
quote! {{
let value = #expr;
core::fmt::Pointer::fmt(&value, f)?;
}}
} else {
quote! { core::fmt::Pointer::fmt(#expr, f)?; }

Choose a reason for hiding this comment

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

[P1] Pointer formatter prints field addresses instead of pointer values

The pointer branch in format_placeholder still hands core::fmt::Pointer a reference to the placeholder expression (&value) even when pointer_value is true. For raw pointers, immutable references, NonNull, or {self:p}, this means the generated Display impl prints the address of the local/field that stores the pointer instead of the pointer value itself—{ptr:p} formats like format!("{:p}", &ptr) rather than format!("{:p}", ptr). As a result, pointer placeholders yield stack/field addresses rather than the intended target pointer, diverging from Rust’s built‑in pointer formatting. The branch should format the pointer value directly without introducing another &.

Useful? React with 👍 / 👎.

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