diff --git a/hpb_generator/tests/BUILD b/hpb_generator/tests/BUILD index f6a93b1d80..6f463229a0 100644 --- a/hpb_generator/tests/BUILD +++ b/hpb_generator/tests/BUILD @@ -154,8 +154,8 @@ # "@com_google_googletest//:gtest", "@com_google_googletest//:gtest_main", # "@com_google_absl//absl/status:statusor", # "@com_google_absl//absl/strings", +# "//hpb:requires", # "//protos", -# "//protos:requires", # "//upb:mem", # "//protos:repeated_field", # ], diff --git a/hpb_generator/tests/test_generated.cc b/hpb_generator/tests/test_generated.cc index 40636c2ee2..e2f56b8093 100644 --- a/hpb_generator/tests/test_generated.cc +++ b/hpb_generator/tests/test_generated.cc @@ -21,10 +21,10 @@ #include "google/protobuf/compiler/hpb/tests/child_model.upb.proto.h" #include "google/protobuf/compiler/hpb/tests/no_package.upb.proto.h" #include "google/protobuf/compiler/hpb/tests/test_model.upb.proto.h" +#include "google/protobuf/hpb/requires.h" #include "protos/protos.h" #include "protos/repeated_field.h" #include "protos/repeated_field_iterator.h" -#include "protos/requires.h" #include "upb/mem/arena.h" #include "upb/mem/arena.hpp" diff --git a/protos/BUILD b/protos/BUILD index 0aaeca52b8..7d646b1bfc 100644 --- a/protos/BUILD +++ b/protos/BUILD @@ -96,9 +96,4 @@ # visibility = ["//visibility:public"], # ) # -# cc_library( -# name = "requires", -# hdrs = ["requires.h"], -# visibility = ["//visibility:public"], -# ) # end:google_only diff --git a/protos/requires.h b/protos/requires.h deleted file mode 100644 index f7ea016392..0000000000 --- a/protos/requires.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef THIRD_PARTY_UPB_PROTOS_REQUIRES_H_ -#define THIRD_PARTY_UPB_PROTOS_REQUIRES_H_ - -#include -namespace protos::internal { -// Ports C++20 `requires` to C++17. -// C++20 ideal: -// if constexpr (requires { t.foo(); }) { ... } -// Our C++17 stopgap solution: -// if constexpr (Requires([](auto x) -> decltype(x.foo()) {})) { ... } -template -constexpr bool Requires(F) { - return std::is_invocable_v; -} -} // namespace protos::internal - -#endif // THIRD_PARTY_UPB_PROTOS_REQUIRES_H_