Skip to content

Swift/Shared: Use C++23 format instead of fmt - #23264

Open
jketema wants to merge 2 commits into
mainfrom
jketema/fmt
Open

jketema wants to merge 2 commits into
mainfrom
jketema/fmt

Conversation

@jketema

@jketema jketema commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Updating fmt is a pain, because we need to patch it. Use format instead, which almost has feature parity in C++23.

@github-actions github-actions Bot added the Swift label Nov 26, 2026
Comment thread swift/logging/SwiftLogging.h Dismissed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Replacing bundled fmt with std::format requires confirming runtime and chrono-formatting compatibility on production Linux and macOS targets using toolchain settings outside this checkout.

No open issues 🎉

What changed in this PR

Replaces fmt with C++23 std::format in Swift logging and shared C++ diagnostics, removing the need to maintain a patched formatting dependency.

Changes:

  • Migrates diagnostic message and timestamp formatting to std::format.
  • Adds adapters for filesystem paths and error codes, which lack C++23 formatters.
  • Removes fmt from the affected Bazel targets and module dependencies.
File Description
swift/​logging/​SwiftLogging.h Uses standard formatting with path and error-code adapters.
swift/​logging/​BUILD.bazel Removes the logging target’s fmt dependency.
shared/​cpp/​Diagnostics.h Adds an explicit <chrono> include.
shared/​cpp/​Diagnostics.cpp Uses std::format for diagnostic timestamps.
shared/​cpp/​BUILD.bazel Removes the shared C++ target’s fmt dependency.
MODULE.bazel Removes the patched fmt module dependency.

Review effort: Balanced (adaptive)

@jketema
jketema marked this pull request as ready for review November 28, 2026 16:06
@jketema
jketema requested review from a team as code owners November 28, 2026 16:06

This branch has not been deployed

No deployments
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.

3 participants