Don't declare testing::TempDir() in dump.cc itself.

Change-Id: I029655a5509aa43494906b9a22eee25a5e8d3f3b
Reviewed-on: https://code-review.googlesource.com/c/re2/+/46815
Reviewed-by: Paul Wankadia <junyer@google.com>
diff --git a/re2/testing/dump.cc b/re2/testing/dump.cc
index 85cfea2..cad0910 100644
--- a/re2/testing/dump.cc
+++ b/re2/testing/dump.cc
@@ -25,11 +25,6 @@
 #include "re2/stringpiece.h"
 #include "re2/regexp.h"
 
-// Cause a link error if this file is used outside of testing.
-namespace testing {
-std::string TempDir();
-}  // namespace testing
-
 namespace re2 {
 
 static const char* kOpcodeNames[] = {
@@ -156,7 +151,8 @@
 }
 
 std::string Regexp::Dump() {
-  // Make sure being called from a unit test.
+  // Make sure that we are being called from a unit test.
+  // Should cause a link error if used outside of testing.
   CHECK(!::testing::TempDir().empty());
 
   std::string s;
diff --git a/util/test.h b/util/test.h
index 3fed3d5..54e6f8f 100644
--- a/util/test.h
+++ b/util/test.h
@@ -8,6 +8,10 @@
 #include "util/util.h"
 #include "util/logging.h"
 
+namespace testing {
+std::string TempDir();
+}  // namespace testing
+
 #define TEST(x, y) \
 	void x##y(void); \
 	TestRegisterer r##x##y(x##y, # x "." # y); \