[libc++] Remove <utility> includes
Reviewed By: ldionne, Quuxplusone, #libc
Spies: libcxx-commits, arphaman
Differential Revision: https://reviews.llvm.org/D121054
NOKEYCHECK=True
GitOrigin-RevId: 1458458b558d3cbce5a8b1845ed43bbe141db2fd
diff --git a/docs/ReleaseNotes.rst b/docs/ReleaseNotes.rst
index bc3251e..ee1cc81 100644
--- a/docs/ReleaseNotes.rst
+++ b/docs/ReleaseNotes.rst
@@ -59,10 +59,10 @@
``<filesystem>`` header. The associated macro
``_LIBCPP_DEPRECATED_EXPERIMENTAL_FILESYSTEM`` has also been removed.
-- Some libc++ headers no longer transitively include all of ``<algorithm>``and ``<chrono>``.
+- Some libc++ headers no longer transitively include all of ``<algorithm>``, ``<chrono>`` and ``<utility>``.
If, after updating libc++, you see compiler errors related to missing declarations in
namespace ``std``, it might be because one of your source files now needs to
- ``#include <algorithm>`` and/or ``#include <chrono>``.
+ ``#include <algorithm>``, ``#include <chrono>`` and/or ``#include <utility>``.
- The integer distributions ``binomial_distribution``, ``discrete_distribution``,
``geometric_distribution``, ``negative_binomial_distribution``, ``poisson_distribution``,
diff --git a/include/__hash_table b/include/__hash_table
index eae111b..d531324 100644
--- a/include/__hash_table
+++ b/include/__hash_table
@@ -24,8 +24,6 @@
#include <memory>
#include <type_traits>
-#include <utility> // TODO: Remove this
-
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
diff --git a/include/__locale b/include/__locale
index a31112d..9fd707c 100644
--- a/include/__locale
+++ b/include/__locale
@@ -19,8 +19,6 @@
#include <mutex>
#include <string>
-#include <utility> // TODO: Remove this
-
#if defined(_LIBCPP_MSVCRT_LIKE)
# include <__support/win32/locale_win32.h>
# include <cstring>
diff --git a/include/algorithm b/include/algorithm
index 6fe66e4..8383b40 100644
--- a/include/algorithm
+++ b/include/algorithm
@@ -733,8 +733,6 @@
#include <type_traits>
#include <version>
-#include <utility> // TODO: Remove this
-
#include <__algorithm/adjacent_find.h>
#include <__algorithm/all_of.h>
#include <__algorithm/any_of.h>
diff --git a/include/array b/include/array
index ce41921..0b36608 100644
--- a/include/array
+++ b/include/array
@@ -123,8 +123,6 @@
#include <type_traits>
#include <version>
-#include <utility> // TODO: Remove this
-
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
diff --git a/include/experimental/memory_resource b/include/experimental/memory_resource
index 359ac70..16c7d8d 100644
--- a/include/experimental/memory_resource
+++ b/include/experimental/memory_resource
@@ -77,8 +77,6 @@
#include <stdexcept>
#include <type_traits>
-#include <utility> // TODO: Remove this
-
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
diff --git a/include/experimental/propagate_const b/include/experimental/propagate_const
index b6c3827..e622422 100644
--- a/include/experimental/propagate_const
+++ b/include/experimental/propagate_const
@@ -112,8 +112,6 @@
#include <functional>
#include <type_traits>
-#include <utility> // TODO: Remove this
-
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
diff --git a/include/functional b/include/functional
index 09f6ec5..d097861 100644
--- a/include/functional
+++ b/include/functional
@@ -527,8 +527,6 @@
#include <typeinfo>
#include <version>
-#include <utility> // TODO: Remove this
-
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
diff --git a/include/iterator b/include/iterator
index 3129395..852fa35 100644
--- a/include/iterator
+++ b/include/iterator
@@ -656,8 +656,6 @@
#include <type_traits>
#include <version>
-#include <utility> // TODO: Remove this
-
// TODO: remove these headers
#include <__functional/binary_function.h>
#include <__functional/invoke.h>
diff --git a/include/map b/include/map
index 4aae8db..2266e1a 100644
--- a/include/map
+++ b/include/map
@@ -546,8 +546,6 @@
#include <type_traits>
#include <version>
-#include <utility> // TODO: Remove this
-
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
diff --git a/include/memory b/include/memory
index 1fccdac..1991e29 100644
--- a/include/memory
+++ b/include/memory
@@ -835,8 +835,6 @@
#include <typeinfo>
#include <version>
-#include <utility> // TODO: Remove this
-
// TODO: remove these headers
#include <__functional/binary_function.h>
#include <__functional/invoke.h>
diff --git a/include/optional b/include/optional
index effee30..22b0cf1 100644
--- a/include/optional
+++ b/include/optional
@@ -172,8 +172,6 @@
#include <type_traits>
#include <version>
-#include <utility> // TODO: Remove this
-
// TODO: remove these headers
#include <__memory/allocator_arg_t.h>
#include <__memory/uses_allocator.h>
diff --git a/include/ranges b/include/ranges
index 25ed65b..b6c028d 100644
--- a/include/ranges
+++ b/include/ranges
@@ -256,6 +256,7 @@
#include <__ranges/transform_view.h>
#include <__ranges/view_interface.h>
#include <__ranges/views.h>
+#include <__tuple> // TODO: <ranges> has to export std::tuple_size. Replace this, once <tuple> is granularized.
#include <compare> // Required by the standard.
#include <initializer_list> // Required by the standard.
#include <iterator> // Required by the standard.
diff --git a/include/regex b/include/regex
index 56d92f2..661a08b 100644
--- a/include/regex
+++ b/include/regex
@@ -779,8 +779,6 @@
#include <vector>
#include <version>
-#include <utility> // TODO: Remove this
-
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
diff --git a/include/string b/include/string
index 1d0b783..c79c0ed 100644
--- a/include/string
+++ b/include/string
@@ -543,8 +543,6 @@
#include <type_traits>
#include <version>
-#include <utility> // TODO: Remove this
-
// TODO: remove these headers
#include <__functional/binary_function.h>
#include <__functional/invoke.h>
diff --git a/include/tuple b/include/tuple
index e1303f9..ea7245d 100644
--- a/include/tuple
+++ b/include/tuple
@@ -183,8 +183,6 @@
#include <type_traits>
#include <version>
-#include <utility> // TODO: Remove this
-
// TODO: remove these headers
#include <__functional/binary_function.h>
#include <__functional/invoke.h>
diff --git a/include/typeindex b/include/typeindex
index 592da67..f068039 100644
--- a/include/typeindex
+++ b/include/typeindex
@@ -50,8 +50,6 @@
#include <typeinfo>
#include <version>
-#include <utility> // TODO: Remove this
-
// TODO: remove these headers
#include <__functional/binary_function.h>
#include <__functional/invoke.h>
diff --git a/include/variant b/include/variant
index 2eb93ba..15c4367 100644
--- a/include/variant
+++ b/include/variant
@@ -219,8 +219,6 @@
#include <type_traits>
#include <version>
-#include <utility> // TODO: Remove this
-
// TODO: remove these headers
#include <__functional/binary_function.h>
#include <__functional/invoke.h>
diff --git a/include/vector b/include/vector
index b5bafbe..97a8524 100644
--- a/include/vector
+++ b/include/vector
@@ -302,8 +302,6 @@
#include <type_traits>
#include <version>
-#include <utility> // TODO: Remove this
-
// TODO: remove these headers
#include <__functional/binary_function.h>
#include <__functional/invoke.h>