Skip to content

Commit

Permalink
Fix libfmt errors from not finding enum formatter
Browse files Browse the repository at this point in the history
Summary:
Recent versions of libfmt have become more strict and require `enum` types to be formattable:

    static assertion failed due to requirement 'formattable': Cannot format an argument. To make type T formattable provide a formatter<T> specialization: https://fmt.dev/latest/api.html#udt

This is a quick fix to simply use the underlying type.

X-link: facebook/folly#2022

Reviewed By: yfeldblum

Differential Revision:
D46973532
Ninja: Flaky land-time

Pulled By: ot

fbshipit-source-id: 49b64e3885703c2157e66979e0523b5245a9470a
  • Loading branch information
mhx authored and facebook-github-bot committed Jun 26, 2023
1 parent e313210 commit b34bdb3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion third-party/folly/src/folly/futures/detail/Core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <new>

#include <fmt/core.h>
#include <folly/Utility.h>
#include <folly/lang/Assume.h>

namespace folly {
Expand All @@ -30,7 +31,7 @@ namespace {
template <class Enum>
void terminate_unexpected_state(fmt::string_view context, Enum state) {
terminate_with<std::logic_error>(
fmt::format("{} unexpected state: {}", context, state));
fmt::format("{} unexpected state: {}", context, to_underlying(state)));
}

} // namespace
Expand Down

0 comments on commit b34bdb3

Please sign in to comment.