[libcxx-commits] [libcxx] [libcxxabi] [libc++] Granularize <cstddef> includes (PR #108696)

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Sun Sep 15 04:05:36 PDT 2024


https://github.com/philnik777 updated https://github.com/llvm/llvm-project/pull/108696

>From 6bfe8136c0744068ea2c134b5c4cf8f3323e7ef5 Mon Sep 17 00:00:00 2001
From: Nikolas Klauser <nikolasklauser at berlin.de>
Date: Sat, 14 Sep 2024 14:45:17 +0200
Subject: [PATCH] [libc++] Granularize <cstddef> includes

---
 libcxx/include/__algorithm/copy_move_common.h |  2 +-
 libcxx/include/__algorithm/inplace_merge.h    |  1 +
 libcxx/include/__algorithm/mismatch.h         |  2 +-
 libcxx/include/__algorithm/shuffle.h          |  2 +-
 libcxx/include/__algorithm/simd_utils.h       |  2 +-
 libcxx/include/__algorithm/stable_partition.h |  1 +
 libcxx/include/__algorithm/stable_sort.h      |  1 +
 libcxx/include/__atomic/aliases.h             |  3 +-
 libcxx/include/__atomic/atomic.h              |  2 +-
 libcxx/include/__atomic/atomic_ref.h          |  4 +-
 libcxx/include/__atomic/cxx_atomic_impl.h     |  2 +-
 libcxx/include/__charconv/to_chars_integral.h |  2 +-
 .../__compare/common_comparison_category.h    |  2 +-
 libcxx/include/__concepts/swappable.h         |  2 +-
 libcxx/include/__coroutine/coroutine_handle.h |  3 +-
 libcxx/include/__exception/exception_ptr.h    |  1 -
 libcxx/include/__exception/nested_exception.h |  1 -
 libcxx/include/__exception/operations.h       |  1 -
 .../include/__filesystem/directory_iterator.h |  1 -
 libcxx/include/__filesystem/path.h            |  1 -
 libcxx/include/__filesystem/path_iterator.h   |  3 --
 .../recursive_directory_iterator.h            |  1 -
 libcxx/include/__format/buffer.h              |  1 -
 .../include/__format/escaped_output_table.h   |  2 +-
 .../extended_grapheme_cluster_table.h         |  2 +-
 libcxx/include/__format/format_args.h         |  2 +-
 libcxx/include/__format/format_context.h      |  1 -
 libcxx/include/__format/format_string.h       |  2 +-
 .../__format/formatter_floating_point.h       |  1 -
 libcxx/include/__format/formatter_output.h    |  1 -
 libcxx/include/__format/formatter_pointer.h   |  2 +-
 .../__format/indic_conjunct_break_table.h     |  2 +-
 .../include/__format/width_estimation_table.h |  2 +-
 libcxx/include/__functional/bind.h            |  1 -
 libcxx/include/__functional/hash.h            |  1 -
 libcxx/include/__hash_table                   |  1 +
 libcxx/include/__iterator/access.h            |  2 +-
 libcxx/include/__iterator/aliasing_iterator.h |  2 +-
 .../include/__iterator/back_insert_iterator.h |  2 +-
 libcxx/include/__iterator/data.h              |  1 -
 libcxx/include/__iterator/empty.h             |  1 -
 .../__iterator/front_insert_iterator.h        |  2 +-
 .../include/__iterator/incrementable_traits.h |  2 +-
 libcxx/include/__iterator/insert_iterator.h   |  2 +-
 libcxx/include/__iterator/istream_iterator.h  |  2 +-
 libcxx/include/__iterator/iterator.h          |  2 +-
 libcxx/include/__iterator/iterator_traits.h   |  2 +-
 libcxx/include/__iterator/ostream_iterator.h  |  2 +-
 .../include/__iterator/ostreambuf_iterator.h  |  2 +-
 libcxx/include/__iterator/reverse_access.h    |  1 -
 .../include/__iterator/segmented_iterator.h   |  2 +-
 libcxx/include/__iterator/size.h              |  3 +-
 libcxx/include/__iterator/wrap_iter.h         |  2 +-
 libcxx/include/__mdspan/default_accessor.h    |  3 +-
 libcxx/include/__mdspan/extents.h             |  3 +-
 libcxx/include/__mdspan/layout_left.h         |  3 --
 libcxx/include/__mdspan/layout_right.h        |  4 +-
 libcxx/include/__mdspan/layout_stride.h       |  2 -
 libcxx/include/__mdspan/mdspan.h              |  3 --
 libcxx/include/__memory/align.h               |  2 +-
 libcxx/include/__memory/aligned_alloc.h       |  1 -
 libcxx/include/__memory/allocate_at_least.h   |  2 +-
 libcxx/include/__memory/allocation_guard.h    |  1 -
 libcxx/include/__memory/allocator.h           |  2 +-
 libcxx/include/__memory/allocator_traits.h    |  2 +-
 libcxx/include/__memory/assume_aligned.h      |  2 +-
 .../include/__memory/builtin_new_allocator.h  |  1 -
 libcxx/include/__memory/compressed_pair.h     |  2 +-
 libcxx/include/__memory/destruct_n.h          |  2 +-
 libcxx/include/__memory/pointer_traits.h      |  2 +-
 .../include/__memory/raw_storage_iterator.h   |  2 +-
 libcxx/include/__memory/shared_ptr.h          |  2 +-
 libcxx/include/__memory/temporary_buffer.h    |  3 +-
 libcxx/include/__memory/unique_ptr.h          |  3 +-
 libcxx/include/__memory/uses_allocator.h      |  1 -
 .../__memory_resource/memory_resource.h       |  3 +-
 .../monotonic_buffer_resource.h               |  2 +-
 .../__memory_resource/polymorphic_allocator.h |  3 +-
 .../include/__memory_resource/pool_options.h  |  2 +-
 .../synchronized_pool_resource.h              |  1 -
 .../unsynchronized_pool_resource.h            |  2 +-
 libcxx/include/__numeric/midpoint.h           |  1 -
 libcxx/include/__ostream/basic_ostream.h      |  1 -
 libcxx/include/__pstl/backends/libdispatch.h  |  1 -
 libcxx/include/__pstl/backends/std_thread.h   |  1 -
 libcxx/include/__pstl/cpu_algos/cpu_traits.h  |  1 -
 libcxx/include/__pstl/cpu_algos/find_if.h     |  1 -
 .../__pstl/cpu_algos/transform_reduce.h       |  1 -
 .../include/__random/discard_block_engine.h   |  2 +-
 .../include/__random/discrete_distribution.h  |  1 -
 .../__random/independent_bits_engine.h        |  2 +-
 libcxx/include/__random/log2.h                |  2 +-
 .../__random/mersenne_twister_engine.h        |  2 +-
 .../piecewise_constant_distribution.h         |  1 +
 .../__random/piecewise_linear_distribution.h  |  1 +
 .../include/__random/shuffle_order_engine.h   |  2 +-
 .../__random/subtract_with_carry_engine.h     |  2 +-
 .../__random/uniform_int_distribution.h       |  2 +-
 libcxx/include/__ranges/access.h              |  2 +-
 libcxx/include/__ranges/counted.h             |  2 +-
 libcxx/include/__ranges/drop_view.h           |  1 -
 libcxx/include/__ranges/elements_view.h       |  1 -
 libcxx/include/__ranges/empty_view.h          |  2 +-
 libcxx/include/__ranges/istream_view.h        |  2 +-
 libcxx/include/__ranges/repeat_view.h         |  1 +
 libcxx/include/__ranges/single_view.h         |  3 +-
 libcxx/include/__ranges/size.h                |  3 +-
 libcxx/include/__ranges/subrange.h            |  2 +-
 libcxx/include/__ranges/take_view.h           |  1 -
 libcxx/include/__ranges/to.h                  |  2 +-
 libcxx/include/__split_buffer                 |  2 +-
 .../__stop_token/intrusive_shared_ptr.h       |  2 +-
 libcxx/include/__string/char_traits.h         |  1 -
 .../include/__string/constexpr_c_functions.h  |  2 +-
 libcxx/include/__system_error/error_code.h    |  1 -
 .../include/__system_error/error_condition.h  |  1 -
 libcxx/include/__utility/in_place.h           |  2 +-
 libcxx/include/__utility/integer_sequence.h   |  2 +-
 libcxx/include/__utility/pair.h               |  2 +-
 libcxx/include/__utility/priority_tag.h       |  2 +-
 libcxx/include/__utility/small_buffer.h       |  2 +-
 libcxx/include/__utility/swap.h               |  2 +-
 libcxx/include/__variant/monostate.h          |  2 +-
 libcxx/include/array                          |  1 +
 libcxx/include/atomic                         |  1 +
 libcxx/include/barrier                        |  2 +-
 libcxx/include/bitset                         |  1 -
 libcxx/include/charconv                       |  1 +
 libcxx/include/compare                        |  1 +
 libcxx/include/concepts                       |  5 +-
 libcxx/include/coroutine                      |  1 +
 libcxx/include/exception                      |  1 +
 .../include/experimental/__simd/aligned_tag.h |  2 +-
 .../include/experimental/__simd/declaration.h |  2 +-
 .../include/experimental/__simd/reference.h   |  2 +-
 libcxx/include/experimental/__simd/scalar.h   |  2 +-
 libcxx/include/experimental/__simd/simd.h     |  2 +-
 .../include/experimental/__simd/simd_mask.h   |  2 +-
 libcxx/include/experimental/__simd/traits.h   |  2 +-
 libcxx/include/experimental/__simd/utility.h  |  2 +-
 libcxx/include/experimental/__simd/vec_ext.h  |  2 +-
 libcxx/include/experimental/iterator          |  1 +
 libcxx/include/experimental/memory            |  5 +-
 libcxx/include/experimental/propagate_const   |  5 +-
 libcxx/include/experimental/simd              |  4 ++
 libcxx/include/experimental/type_traits       |  4 ++
 libcxx/include/experimental/utility           |  4 ++
 libcxx/include/initializer_list               |  7 ++-
 libcxx/include/iterator                       |  1 +
 libcxx/include/latch                          |  3 +-
 libcxx/include/module.modulemap               |  6 ++-
 libcxx/include/mutex                          |  1 -
 libcxx/include/new                            |  3 +-
 libcxx/include/numbers                        |  1 +
 libcxx/include/semaphore                      |  3 +-
 libcxx/include/span                           |  3 +-
 libcxx/include/stdexcept                      |  1 +
 libcxx/include/stop_token                     |  1 +
 libcxx/include/string_view                    |  1 -
 libcxx/include/tuple                          |  3 +-
 libcxx/include/typeindex                      |  1 +
 libcxx/include/typeinfo                       |  4 +-
 libcxx/include/utility                        |  1 +
 libcxx/include/valarray                       |  2 +-
 libcxx/include/variant                        |  1 +
 libcxx/src/memory_resource.cpp                |  1 +
 .../random_shuffle.cxx1z.pass.cpp             |  1 +
 .../sequences/deque/asan_turning_off.pass.cpp |  1 +
 .../test/libcxx/transitive_includes/cxx23.csv | 53 -------------------
 .../test/libcxx/transitive_includes/cxx26.csv | 53 -------------------
 .../template.bitset/includes.pass.cpp         |  6 +--
 .../mdspan/extents/CtorTestCombinations.h     |  5 +-
 .../views/mdspan/extents/obs_static.pass.cpp  |  3 +-
 .../mdspan/layout_left/ctor.default.pass.cpp  |  3 +-
 .../mdspan/layout_left/ctor.extents.pass.cpp  |  3 +-
 .../layout_left/required_span_size.pass.cpp   |  3 +-
 .../mdspan/layout_right/ctor.default.pass.cpp |  3 +-
 .../mdspan/layout_right/ctor.extents.pass.cpp |  3 +-
 .../layout_right/required_span_size.pass.cpp  |  3 +-
 .../layout_stride/ctor.default.pass.cpp       |  3 +-
 .../layout_stride/required_span_size.pass.cpp |  3 +-
 .../span.cons/iterator_sentinel.verify.cpp    |  3 +-
 .../span.objectrep/as_bytes.pass.cpp          |  3 +-
 .../span.objectrep/as_writable_bytes.pass.cpp |  3 +-
 .../syserr/is_error_code_enum.pass.cpp        |  4 +-
 .../incrementable_traits.compile.pass.cpp     |  6 +--
 .../test/std/numerics/bit/byteswap.pass.cpp   |  1 +
 .../range.repeat.view/iterator/minus.pass.cpp |  4 +-
 .../temporary_buffer.pass.cpp                 |  2 +-
 libcxxabi/src/private_typeinfo.cpp            |  4 +-
 190 files changed, 208 insertions(+), 290 deletions(-)

diff --git a/libcxx/include/__algorithm/copy_move_common.h b/libcxx/include/__algorithm/copy_move_common.h
index 8a98451a8f9653..d76bf4903aaa9b 100644
--- a/libcxx/include/__algorithm/copy_move_common.h
+++ b/libcxx/include/__algorithm/copy_move_common.h
@@ -13,6 +13,7 @@
 #include <__algorithm/unwrap_iter.h>
 #include <__algorithm/unwrap_range.h>
 #include <__config>
+#include <__cstddef/size_t.h>
 #include <__iterator/iterator_traits.h>
 #include <__memory/pointer_traits.h>
 #include <__string/constexpr_c_functions.h>
@@ -24,7 +25,6 @@
 #include <__type_traits/is_volatile.h>
 #include <__utility/move.h>
 #include <__utility/pair.h>
-#include <cstddef>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/include/__algorithm/inplace_merge.h b/libcxx/include/__algorithm/inplace_merge.h
index a6bcc66a2fa47a..299678e214b165 100644
--- a/libcxx/include/__algorithm/inplace_merge.h
+++ b/libcxx/include/__algorithm/inplace_merge.h
@@ -18,6 +18,7 @@
 #include <__algorithm/rotate.h>
 #include <__algorithm/upper_bound.h>
 #include <__config>
+#include <__cstddef/ptrdiff_t.h>
 #include <__functional/identity.h>
 #include <__iterator/advance.h>
 #include <__iterator/distance.h>
diff --git a/libcxx/include/__algorithm/mismatch.h b/libcxx/include/__algorithm/mismatch.h
index 0fae7f6e3fe323..85ff248cba63f9 100644
--- a/libcxx/include/__algorithm/mismatch.h
+++ b/libcxx/include/__algorithm/mismatch.h
@@ -15,6 +15,7 @@
 #include <__algorithm/simd_utils.h>
 #include <__algorithm/unwrap_iter.h>
 #include <__config>
+#include <__cstddef/size_t.h>
 #include <__functional/identity.h>
 #include <__iterator/aliasing_iterator.h>
 #include <__type_traits/desugars_to.h>
@@ -25,7 +26,6 @@
 #include <__utility/move.h>
 #include <__utility/pair.h>
 #include <__utility/unreachable.h>
-#include <cstddef>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/include/__algorithm/shuffle.h b/libcxx/include/__algorithm/shuffle.h
index c9c56ce8c2c0b1..7177fbb469ba7c 100644
--- a/libcxx/include/__algorithm/shuffle.h
+++ b/libcxx/include/__algorithm/shuffle.h
@@ -11,12 +11,12 @@
 
 #include <__algorithm/iterator_operations.h>
 #include <__config>
+#include <__cstddef/ptrdiff_t.h>
 #include <__iterator/iterator_traits.h>
 #include <__random/uniform_int_distribution.h>
 #include <__utility/forward.h>
 #include <__utility/move.h>
 #include <__utility/swap.h>
-#include <cstddef>
 #include <cstdint>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__algorithm/simd_utils.h b/libcxx/include/__algorithm/simd_utils.h
index 56518dafa3193b..4e3e4f2b9404e3 100644
--- a/libcxx/include/__algorithm/simd_utils.h
+++ b/libcxx/include/__algorithm/simd_utils.h
@@ -14,10 +14,10 @@
 #include <__bit/countl.h>
 #include <__bit/countr.h>
 #include <__config>
+#include <__cstddef/size_t.h>
 #include <__type_traits/is_arithmetic.h>
 #include <__type_traits/is_same.h>
 #include <__utility/integer_sequence.h>
-#include <cstddef>
 #include <cstdint>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__algorithm/stable_partition.h b/libcxx/include/__algorithm/stable_partition.h
index 8bb1eaf2d22495..fb0d21017b8bbe 100644
--- a/libcxx/include/__algorithm/stable_partition.h
+++ b/libcxx/include/__algorithm/stable_partition.h
@@ -12,6 +12,7 @@
 #include <__algorithm/iterator_operations.h>
 #include <__algorithm/rotate.h>
 #include <__config>
+#include <__cstddef/ptrdiff_t.h>
 #include <__iterator/advance.h>
 #include <__iterator/distance.h>
 #include <__iterator/iterator_traits.h>
diff --git a/libcxx/include/__algorithm/stable_sort.h b/libcxx/include/__algorithm/stable_sort.h
index 726e7e16b3564a..f4eaaa361d491f 100644
--- a/libcxx/include/__algorithm/stable_sort.h
+++ b/libcxx/include/__algorithm/stable_sort.h
@@ -15,6 +15,7 @@
 #include <__algorithm/iterator_operations.h>
 #include <__algorithm/sort.h>
 #include <__config>
+#include <__cstddef/ptrdiff_t.h>
 #include <__debug_utils/strict_weak_ordering_check.h>
 #include <__iterator/iterator_traits.h>
 #include <__memory/destruct_n.h>
diff --git a/libcxx/include/__atomic/aliases.h b/libcxx/include/__atomic/aliases.h
index e27e09af6b77d9..6bd34c8f13a4cb 100644
--- a/libcxx/include/__atomic/aliases.h
+++ b/libcxx/include/__atomic/aliases.h
@@ -14,9 +14,10 @@
 #include <__atomic/contention_t.h>
 #include <__atomic/is_always_lock_free.h>
 #include <__config>
+#include <__cstddef/ptrdiff_t.h>
+#include <__cstddef/size_t.h>
 #include <__type_traits/conditional.h>
 #include <__type_traits/make_unsigned.h>
-#include <cstddef>
 #include <cstdint>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__atomic/atomic.h b/libcxx/include/__atomic/atomic.h
index af6d12b5e4ce91..113475cb1f0079 100644
--- a/libcxx/include/__atomic/atomic.h
+++ b/libcxx/include/__atomic/atomic.h
@@ -14,6 +14,7 @@
 #include <__atomic/cxx_atomic_impl.h>
 #include <__atomic/memory_order.h>
 #include <__config>
+#include <__cstddef/ptrdiff_t.h>
 #include <__functional/operations.h>
 #include <__memory/addressof.h>
 #include <__type_traits/enable_if.h>
@@ -25,7 +26,6 @@
 #include <__type_traits/remove_pointer.h>
 #include <__type_traits/remove_volatile.h>
 #include <__utility/forward.h>
-#include <cstddef>
 #include <cstring>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__atomic/atomic_ref.h b/libcxx/include/__atomic/atomic_ref.h
index 92e9247e2e50eb..1f7c30f783bd27 100644
--- a/libcxx/include/__atomic/atomic_ref.h
+++ b/libcxx/include/__atomic/atomic_ref.h
@@ -24,11 +24,11 @@
 #include <__concepts/arithmetic.h>
 #include <__concepts/same_as.h>
 #include <__config>
+#include <__cstddef/byte.h>
+#include <__cstddef/ptrdiff_t.h>
 #include <__memory/addressof.h>
 #include <__type_traits/has_unique_object_representation.h>
 #include <__type_traits/is_trivially_copyable.h>
-#include <cstddef>
-#include <cstdint>
 #include <cstring>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__atomic/cxx_atomic_impl.h b/libcxx/include/__atomic/cxx_atomic_impl.h
index 18e88aa97bec75..4f33bd200018dc 100644
--- a/libcxx/include/__atomic/cxx_atomic_impl.h
+++ b/libcxx/include/__atomic/cxx_atomic_impl.h
@@ -12,11 +12,11 @@
 #include <__atomic/memory_order.h>
 #include <__atomic/to_gcc_order.h>
 #include <__config>
+#include <__cstddef/ptrdiff_t.h>
 #include <__memory/addressof.h>
 #include <__type_traits/is_assignable.h>
 #include <__type_traits/is_trivially_copyable.h>
 #include <__type_traits/remove_const.h>
-#include <cstddef>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/include/__charconv/to_chars_integral.h b/libcxx/include/__charconv/to_chars_integral.h
index ccb5856df17993..4fa6c1bf82f8e0 100644
--- a/libcxx/include/__charconv/to_chars_integral.h
+++ b/libcxx/include/__charconv/to_chars_integral.h
@@ -18,6 +18,7 @@
 #include <__charconv/to_chars_result.h>
 #include <__charconv/traits.h>
 #include <__config>
+#include <__cstddef/ptrdiff_t.h>
 #include <__system_error/errc.h>
 #include <__type_traits/enable_if.h>
 #include <__type_traits/integral_constant.h>
@@ -26,7 +27,6 @@
 #include <__type_traits/make_32_64_or_128_bit.h>
 #include <__type_traits/make_unsigned.h>
 #include <__utility/unreachable.h>
-#include <cstddef>
 #include <cstdint>
 #include <limits>
 
diff --git a/libcxx/include/__compare/common_comparison_category.h b/libcxx/include/__compare/common_comparison_category.h
index 7aeb3da03a4f4a..215922abad6b0e 100644
--- a/libcxx/include/__compare/common_comparison_category.h
+++ b/libcxx/include/__compare/common_comparison_category.h
@@ -11,8 +11,8 @@
 
 #include <__compare/ordering.h>
 #include <__config>
+#include <__cstddef/size_t.h>
 #include <__type_traits/is_same.h>
-#include <cstddef>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/include/__concepts/swappable.h b/libcxx/include/__concepts/swappable.h
index d339488a087a5c..985c733021a0d7 100644
--- a/libcxx/include/__concepts/swappable.h
+++ b/libcxx/include/__concepts/swappable.h
@@ -14,6 +14,7 @@
 #include <__concepts/common_reference_with.h>
 #include <__concepts/constructible.h>
 #include <__config>
+#include <__cstddef/size_t.h>
 #include <__type_traits/extent.h>
 #include <__type_traits/is_nothrow_assignable.h>
 #include <__type_traits/is_nothrow_constructible.h>
@@ -22,7 +23,6 @@
 #include <__utility/forward.h>
 #include <__utility/move.h>
 #include <__utility/swap.h>
-#include <cstddef>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/include/__coroutine/coroutine_handle.h b/libcxx/include/__coroutine/coroutine_handle.h
index 4557a6643c2393..e2cde20498d843 100644
--- a/libcxx/include/__coroutine/coroutine_handle.h
+++ b/libcxx/include/__coroutine/coroutine_handle.h
@@ -11,11 +11,12 @@
 
 #include <__assert>
 #include <__config>
+#include <__cstddef/nullptr_t.h>
+#include <__cstddef/size_t.h>
 #include <__functional/hash.h>
 #include <__memory/addressof.h>
 #include <__type_traits/remove_cv.h>
 #include <compare>
-#include <cstddef>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/include/__exception/exception_ptr.h b/libcxx/include/__exception/exception_ptr.h
index 9e5351f534a1c1..0b2fcf51183f8f 100644
--- a/libcxx/include/__exception/exception_ptr.h
+++ b/libcxx/include/__exception/exception_ptr.h
@@ -14,7 +14,6 @@
 #include <__memory/addressof.h>
 #include <__memory/construct_at.h>
 #include <__type_traits/decay.h>
-#include <cstddef>
 #include <cstdlib>
 #include <new>
 #include <typeinfo>
diff --git a/libcxx/include/__exception/nested_exception.h b/libcxx/include/__exception/nested_exception.h
index 8e817e1c069788..cff25813d78e48 100644
--- a/libcxx/include/__exception/nested_exception.h
+++ b/libcxx/include/__exception/nested_exception.h
@@ -22,7 +22,6 @@
 #include <__type_traits/is_final.h>
 #include <__type_traits/is_polymorphic.h>
 #include <__utility/forward.h>
-#include <cstddef>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/include/__exception/operations.h b/libcxx/include/__exception/operations.h
index c8744eb297a4e8..15520c558a0b4e 100644
--- a/libcxx/include/__exception/operations.h
+++ b/libcxx/include/__exception/operations.h
@@ -10,7 +10,6 @@
 #define _LIBCPP___EXCEPTION_OPERATIONS_H
 
 #include <__config>
-#include <cstddef>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/include/__filesystem/directory_iterator.h b/libcxx/include/__filesystem/directory_iterator.h
index e0246d8001e195..621e9bf9258efb 100644
--- a/libcxx/include/__filesystem/directory_iterator.h
+++ b/libcxx/include/__filesystem/directory_iterator.h
@@ -22,7 +22,6 @@
 #include <__ranges/enable_view.h>
 #include <__system_error/error_code.h>
 #include <__utility/move.h>
-#include <cstddef>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/include/__filesystem/path.h b/libcxx/include/__filesystem/path.h
index f0d39680430ec5..a3afd617bbbd8d 100644
--- a/libcxx/include/__filesystem/path.h
+++ b/libcxx/include/__filesystem/path.h
@@ -22,7 +22,6 @@
 #include <__type_traits/remove_const.h>
 #include <__type_traits/remove_pointer.h>
 #include <__utility/move.h>
-#include <cstddef>
 #include <string>
 #include <string_view>
 
diff --git a/libcxx/include/__filesystem/path_iterator.h b/libcxx/include/__filesystem/path_iterator.h
index f4d486d86cf380..e0f601662d4620 100644
--- a/libcxx/include/__filesystem/path_iterator.h
+++ b/libcxx/include/__filesystem/path_iterator.h
@@ -14,9 +14,6 @@
 #include <__config>
 #include <__filesystem/path.h>
 #include <__iterator/iterator_traits.h>
-#include <cstddef>
-#include <string>
-#include <string_view>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/include/__filesystem/recursive_directory_iterator.h b/libcxx/include/__filesystem/recursive_directory_iterator.h
index caa1396eb301fc..1be92a8bd5f492 100644
--- a/libcxx/include/__filesystem/recursive_directory_iterator.h
+++ b/libcxx/include/__filesystem/recursive_directory_iterator.h
@@ -21,7 +21,6 @@
 #include <__ranges/enable_view.h>
 #include <__system_error/error_code.h>
 #include <__utility/move.h>
-#include <cstddef>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/include/__format/buffer.h b/libcxx/include/__format/buffer.h
index ce9ac0c81e315a..618b8ef0256432 100644
--- a/libcxx/include/__format/buffer.h
+++ b/libcxx/include/__format/buffer.h
@@ -37,7 +37,6 @@
 #include <__type_traits/conditional.h>
 #include <__utility/exception_guard.h>
 #include <__utility/move.h>
-#include <cstddef>
 #include <string_view>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__format/escaped_output_table.h b/libcxx/include/__format/escaped_output_table.h
index bdf86cb6f99ccb..7a0b35239861e0 100644
--- a/libcxx/include/__format/escaped_output_table.h
+++ b/libcxx/include/__format/escaped_output_table.h
@@ -63,7 +63,7 @@
 
 #include <__algorithm/ranges_upper_bound.h>
 #include <__config>
-#include <cstddef>
+#include <__cstddef/ptrdiff_t.h>
 #include <cstdint>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__format/extended_grapheme_cluster_table.h b/libcxx/include/__format/extended_grapheme_cluster_table.h
index 7dbc239f5f5cd6..7653a9e03b815d 100644
--- a/libcxx/include/__format/extended_grapheme_cluster_table.h
+++ b/libcxx/include/__format/extended_grapheme_cluster_table.h
@@ -63,8 +63,8 @@
 
 #include <__algorithm/ranges_upper_bound.h>
 #include <__config>
+#include <__cstddef/ptrdiff_t.h>
 #include <__iterator/access.h>
-#include <cstddef>
 #include <cstdint>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__format/format_args.h b/libcxx/include/__format/format_args.h
index e19b4458e41a5b..b98663c06ea4d8 100644
--- a/libcxx/include/__format/format_args.h
+++ b/libcxx/include/__format/format_args.h
@@ -11,10 +11,10 @@
 #define _LIBCPP___FORMAT_FORMAT_ARGS_H
 
 #include <__config>
+#include <__cstddef/size_t.h>
 #include <__format/format_arg.h>
 #include <__format/format_arg_store.h>
 #include <__fwd/format.h>
-#include <cstddef>
 #include <cstdint>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__format/format_context.h b/libcxx/include/__format/format_context.h
index a9be17b855837d..f3b686367dd290 100644
--- a/libcxx/include/__format/format_context.h
+++ b/libcxx/include/__format/format_context.h
@@ -23,7 +23,6 @@
 #include <__memory/addressof.h>
 #include <__utility/move.h>
 #include <__variant/monostate.h>
-#include <cstddef>
 
 #ifndef _LIBCPP_HAS_NO_LOCALIZATION
 #  include <__locale>
diff --git a/libcxx/include/__format/format_string.h b/libcxx/include/__format/format_string.h
index a499afee8874a5..5db5973dd5889f 100644
--- a/libcxx/include/__format/format_string.h
+++ b/libcxx/include/__format/format_string.h
@@ -12,10 +12,10 @@
 
 #include <__assert>
 #include <__config>
+#include <__cstddef/size_t.h>
 #include <__format/format_error.h>
 #include <__iterator/concepts.h>
 #include <__iterator/iterator_traits.h> // iter_value_t
-#include <cstddef>
 #include <cstdint>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__format/formatter_floating_point.h b/libcxx/include/__format/formatter_floating_point.h
index fc95dd3f22bbe7..9ffe20a1a72a06 100644
--- a/libcxx/include/__format/formatter_floating_point.h
+++ b/libcxx/include/__format/formatter_floating_point.h
@@ -36,7 +36,6 @@
 #include <__utility/move.h>
 #include <__utility/unreachable.h>
 #include <cmath>
-#include <cstddef>
 
 #ifndef _LIBCPP_HAS_NO_LOCALIZATION
 #  include <__locale>
diff --git a/libcxx/include/__format/formatter_output.h b/libcxx/include/__format/formatter_output.h
index 34c4c87313a450..cd3c454378912d 100644
--- a/libcxx/include/__format/formatter_output.h
+++ b/libcxx/include/__format/formatter_output.h
@@ -28,7 +28,6 @@
 #include <__memory/pointer_traits.h>
 #include <__utility/move.h>
 #include <__utility/unreachable.h>
-#include <cstddef>
 #include <string_view>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__format/formatter_pointer.h b/libcxx/include/__format/formatter_pointer.h
index 6e0fa9a1b4f196..4ef48c168d0d8b 100644
--- a/libcxx/include/__format/formatter_pointer.h
+++ b/libcxx/include/__format/formatter_pointer.h
@@ -11,13 +11,13 @@
 #define _LIBCPP___FORMAT_FORMATTER_POINTER_H
 
 #include <__config>
+#include <__cstddef/nullptr_t.h>
 #include <__format/concepts.h>
 #include <__format/format_parse_context.h>
 #include <__format/formatter.h>
 #include <__format/formatter_integral.h>
 #include <__format/formatter_output.h>
 #include <__format/parser_std_format_spec.h>
-#include <cstddef>
 #include <cstdint>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__format/indic_conjunct_break_table.h b/libcxx/include/__format/indic_conjunct_break_table.h
index 39dd45da771fc2..df6cfe6a02f348 100644
--- a/libcxx/include/__format/indic_conjunct_break_table.h
+++ b/libcxx/include/__format/indic_conjunct_break_table.h
@@ -63,8 +63,8 @@
 
 #include <__algorithm/ranges_upper_bound.h>
 #include <__config>
+#include <__cstddef/ptrdiff_t.h>
 #include <__iterator/access.h>
-#include <cstddef>
 #include <cstdint>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__format/width_estimation_table.h b/libcxx/include/__format/width_estimation_table.h
index 23a08746b91031..5b4b3950c6a1d0 100644
--- a/libcxx/include/__format/width_estimation_table.h
+++ b/libcxx/include/__format/width_estimation_table.h
@@ -63,7 +63,7 @@
 
 #include <__algorithm/ranges_upper_bound.h>
 #include <__config>
-#include <cstddef>
+#include <__cstddef/ptrdiff_t.h>
 #include <cstdint>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__functional/bind.h b/libcxx/include/__functional/bind.h
index b4f46441da5074..88332345dfb718 100644
--- a/libcxx/include/__functional/bind.h
+++ b/libcxx/include/__functional/bind.h
@@ -17,7 +17,6 @@
 #include <__type_traits/decay.h>
 #include <__type_traits/is_reference_wrapper.h>
 #include <__type_traits/is_void.h>
-#include <cstddef>
 #include <tuple>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__functional/hash.h b/libcxx/include/__functional/hash.h
index a9e450edd39f53..1f46968bb9a4ec 100644
--- a/libcxx/include/__functional/hash.h
+++ b/libcxx/include/__functional/hash.h
@@ -19,7 +19,6 @@
 #include <__type_traits/underlying_type.h>
 #include <__utility/pair.h>
 #include <__utility/swap.h>
-#include <cstddef>
 #include <cstdint>
 #include <cstring>
 
diff --git a/libcxx/include/__hash_table b/libcxx/include/__hash_table
index d5fbc92a3dfc4e..74a1e3a1ac2a81 100644
--- a/libcxx/include/__hash_table
+++ b/libcxx/include/__hash_table
@@ -15,6 +15,7 @@
 #include <__assert>
 #include <__bit/countl.h>
 #include <__config>
+#include <__cstddef/ptrdiff_t.h>
 #include <__functional/hash.h>
 #include <__functional/invoke.h>
 #include <__iterator/iterator_traits.h>
diff --git a/libcxx/include/__iterator/access.h b/libcxx/include/__iterator/access.h
index acc4f60bf697ea..d42855f9254873 100644
--- a/libcxx/include/__iterator/access.h
+++ b/libcxx/include/__iterator/access.h
@@ -11,7 +11,7 @@
 #define _LIBCPP___ITERATOR_ACCESS_H
 
 #include <__config>
-#include <cstddef>
+#include <__cstddef/size_t.h>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/include/__iterator/aliasing_iterator.h b/libcxx/include/__iterator/aliasing_iterator.h
index 94ba577078b5e8..aeb5b4a88ec375 100644
--- a/libcxx/include/__iterator/aliasing_iterator.h
+++ b/libcxx/include/__iterator/aliasing_iterator.h
@@ -10,10 +10,10 @@
 #define _LIBCPP___ITERATOR_ALIASING_ITERATOR_H
 
 #include <__config>
+#include <__cstddef/ptrdiff_t.h>
 #include <__iterator/iterator_traits.h>
 #include <__memory/pointer_traits.h>
 #include <__type_traits/is_trivial.h>
-#include <cstddef>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/include/__iterator/back_insert_iterator.h b/libcxx/include/__iterator/back_insert_iterator.h
index 6d3dd4b12966fe..9a594875338854 100644
--- a/libcxx/include/__iterator/back_insert_iterator.h
+++ b/libcxx/include/__iterator/back_insert_iterator.h
@@ -11,11 +11,11 @@
 #define _LIBCPP___ITERATOR_BACK_INSERT_ITERATOR_H
 
 #include <__config>
+#include <__cstddef/ptrdiff_t.h>
 #include <__iterator/iterator.h>
 #include <__iterator/iterator_traits.h>
 #include <__memory/addressof.h>
 #include <__utility/move.h>
-#include <cstddef>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/include/__iterator/data.h b/libcxx/include/__iterator/data.h
index b7c1603652b0e6..5f2624c2b819ed 100644
--- a/libcxx/include/__iterator/data.h
+++ b/libcxx/include/__iterator/data.h
@@ -11,7 +11,6 @@
 #define _LIBCPP___ITERATOR_DATA_H
 
 #include <__config>
-#include <cstddef>
 #include <initializer_list>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__iterator/empty.h b/libcxx/include/__iterator/empty.h
index 773f2776955b2a..f2c653bcb329ba 100644
--- a/libcxx/include/__iterator/empty.h
+++ b/libcxx/include/__iterator/empty.h
@@ -11,7 +11,6 @@
 #define _LIBCPP___ITERATOR_EMPTY_H
 
 #include <__config>
-#include <cstddef>
 #include <initializer_list>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__iterator/front_insert_iterator.h b/libcxx/include/__iterator/front_insert_iterator.h
index 7f2c54ec87442e..80819cd22ae6c1 100644
--- a/libcxx/include/__iterator/front_insert_iterator.h
+++ b/libcxx/include/__iterator/front_insert_iterator.h
@@ -11,11 +11,11 @@
 #define _LIBCPP___ITERATOR_FRONT_INSERT_ITERATOR_H
 
 #include <__config>
+#include <__cstddef/ptrdiff_t.h>
 #include <__iterator/iterator.h>
 #include <__iterator/iterator_traits.h>
 #include <__memory/addressof.h>
 #include <__utility/move.h>
-#include <cstddef>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/include/__iterator/incrementable_traits.h b/libcxx/include/__iterator/incrementable_traits.h
index a228b228f6e552..37c8daddf8a861 100644
--- a/libcxx/include/__iterator/incrementable_traits.h
+++ b/libcxx/include/__iterator/incrementable_traits.h
@@ -12,13 +12,13 @@
 
 #include <__concepts/arithmetic.h>
 #include <__config>
+#include <__cstddef/ptrdiff_t.h>
 #include <__type_traits/conditional.h>
 #include <__type_traits/is_object.h>
 #include <__type_traits/is_primary_template.h>
 #include <__type_traits/make_signed.h>
 #include <__type_traits/remove_cvref.h>
 #include <__utility/declval.h>
-#include <cstddef>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/include/__iterator/insert_iterator.h b/libcxx/include/__iterator/insert_iterator.h
index 8b7574dc9ec0af..b3311042014f8f 100644
--- a/libcxx/include/__iterator/insert_iterator.h
+++ b/libcxx/include/__iterator/insert_iterator.h
@@ -11,12 +11,12 @@
 #define _LIBCPP___ITERATOR_INSERT_ITERATOR_H
 
 #include <__config>
+#include <__cstddef/ptrdiff_t.h>
 #include <__iterator/iterator.h>
 #include <__iterator/iterator_traits.h>
 #include <__memory/addressof.h>
 #include <__ranges/access.h>
 #include <__utility/move.h>
-#include <cstddef>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/include/__iterator/istream_iterator.h b/libcxx/include/__iterator/istream_iterator.h
index 58c9ac6d4cccea..a6c74d00178d29 100644
--- a/libcxx/include/__iterator/istream_iterator.h
+++ b/libcxx/include/__iterator/istream_iterator.h
@@ -11,13 +11,13 @@
 #define _LIBCPP___ITERATOR_ISTREAM_ITERATOR_H
 
 #include <__config>
+#include <__cstddef/ptrdiff_t.h>
 #include <__fwd/istream.h>
 #include <__fwd/string.h>
 #include <__iterator/default_sentinel.h>
 #include <__iterator/iterator.h>
 #include <__iterator/iterator_traits.h>
 #include <__memory/addressof.h>
-#include <cstddef>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/include/__iterator/iterator.h b/libcxx/include/__iterator/iterator.h
index ba9308f3c22430..1591655313ddec 100644
--- a/libcxx/include/__iterator/iterator.h
+++ b/libcxx/include/__iterator/iterator.h
@@ -11,7 +11,7 @@
 #define _LIBCPP___ITERATOR_ITERATOR_H
 
 #include <__config>
-#include <cstddef>
+#include <__cstddef/ptrdiff_t.h>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/include/__iterator/iterator_traits.h b/libcxx/include/__iterator/iterator_traits.h
index 4d9ad480cc4a29..eb6ba8b62fb30f 100644
--- a/libcxx/include/__iterator/iterator_traits.h
+++ b/libcxx/include/__iterator/iterator_traits.h
@@ -18,6 +18,7 @@
 #include <__concepts/same_as.h>
 #include <__concepts/totally_ordered.h>
 #include <__config>
+#include <__cstddef/ptrdiff_t.h>
 #include <__fwd/pair.h>
 #include <__iterator/incrementable_traits.h>
 #include <__iterator/readable_traits.h>
@@ -36,7 +37,6 @@
 #include <__type_traits/remove_cvref.h>
 #include <__type_traits/void_t.h>
 #include <__utility/declval.h>
-#include <cstddef>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/include/__iterator/ostream_iterator.h b/libcxx/include/__iterator/ostream_iterator.h
index 05697e62d9dcb9..93ecc03010d07c 100644
--- a/libcxx/include/__iterator/ostream_iterator.h
+++ b/libcxx/include/__iterator/ostream_iterator.h
@@ -11,12 +11,12 @@
 #define _LIBCPP___ITERATOR_OSTREAM_ITERATOR_H
 
 #include <__config>
+#include <__cstddef/ptrdiff_t.h>
 #include <__fwd/ostream.h>
 #include <__fwd/string.h>
 #include <__iterator/iterator.h>
 #include <__iterator/iterator_traits.h>
 #include <__memory/addressof.h>
-#include <cstddef>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/include/__iterator/ostreambuf_iterator.h b/libcxx/include/__iterator/ostreambuf_iterator.h
index dda0094dc3f535..4a1891762176dc 100644
--- a/libcxx/include/__iterator/ostreambuf_iterator.h
+++ b/libcxx/include/__iterator/ostreambuf_iterator.h
@@ -11,9 +11,9 @@
 #define _LIBCPP___ITERATOR_OSTREAMBUF_ITERATOR_H
 
 #include <__config>
+#include <__cstddef/ptrdiff_t.h>
 #include <__iterator/iterator.h>
 #include <__iterator/iterator_traits.h>
-#include <cstddef>
 #include <iosfwd> // for forward declaration of basic_streambuf
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__iterator/reverse_access.h b/libcxx/include/__iterator/reverse_access.h
index 54d7270b04a537..f6e60c3fb75b34 100644
--- a/libcxx/include/__iterator/reverse_access.h
+++ b/libcxx/include/__iterator/reverse_access.h
@@ -12,7 +12,6 @@
 
 #include <__config>
 #include <__iterator/reverse_iterator.h>
-#include <cstddef>
 #include <initializer_list>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__iterator/segmented_iterator.h b/libcxx/include/__iterator/segmented_iterator.h
index f3cd1e5fa1f5da..8cb54a35a7f5ea 100644
--- a/libcxx/include/__iterator/segmented_iterator.h
+++ b/libcxx/include/__iterator/segmented_iterator.h
@@ -41,8 +41,8 @@
 //   Returns the iterator composed of the segment iterator and local iterator.
 
 #include <__config>
+#include <__cstddef/size_t.h>
 #include <__type_traits/integral_constant.h>
-#include <cstddef>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/include/__iterator/size.h b/libcxx/include/__iterator/size.h
index 876e6963f77d91..84e2e3b21f1d5d 100644
--- a/libcxx/include/__iterator/size.h
+++ b/libcxx/include/__iterator/size.h
@@ -11,9 +11,10 @@
 #define _LIBCPP___ITERATOR_SIZE_H
 
 #include <__config>
+#include <__cstddef/ptrdiff_t.h>
+#include <__cstddef/size_t.h>
 #include <__type_traits/common_type.h>
 #include <__type_traits/make_signed.h>
-#include <cstddef>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/include/__iterator/wrap_iter.h b/libcxx/include/__iterator/wrap_iter.h
index 549d8ff2dbd7db..2856833e600798 100644
--- a/libcxx/include/__iterator/wrap_iter.h
+++ b/libcxx/include/__iterator/wrap_iter.h
@@ -13,13 +13,13 @@
 #include <__compare/ordering.h>
 #include <__compare/three_way_comparable.h>
 #include <__config>
+#include <__cstddef/size_t.h>
 #include <__iterator/iterator_traits.h>
 #include <__memory/addressof.h>
 #include <__memory/pointer_traits.h>
 #include <__type_traits/enable_if.h>
 #include <__type_traits/integral_constant.h>
 #include <__type_traits/is_convertible.h>
-#include <cstddef>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/include/__mdspan/default_accessor.h b/libcxx/include/__mdspan/default_accessor.h
index 1cc5f15545fc8c..d6f3ddb998e962 100644
--- a/libcxx/include/__mdspan/default_accessor.h
+++ b/libcxx/include/__mdspan/default_accessor.h
@@ -18,12 +18,11 @@
 #define _LIBCPP___MDSPAN_DEFAULT_ACCESSOR_H
 
 #include <__config>
+#include <__cstddef/size_t.h>
 #include <__type_traits/is_abstract.h>
 #include <__type_traits/is_array.h>
 #include <__type_traits/is_convertible.h>
 #include <__type_traits/remove_const.h>
-#include <cinttypes>
-#include <cstddef>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/include/__mdspan/extents.h b/libcxx/include/__mdspan/extents.h
index 3d2c2771a834b4..edbc30a7a40e42 100644
--- a/libcxx/include/__mdspan/extents.h
+++ b/libcxx/include/__mdspan/extents.h
@@ -21,6 +21,7 @@
 #include <__config>
 
 #include <__concepts/arithmetic.h>
+#include <__cstddef/byte.h>
 #include <__type_traits/common_type.h>
 #include <__type_traits/is_convertible.h>
 #include <__type_traits/is_nothrow_constructible.h>
@@ -29,9 +30,7 @@
 #include <__utility/integer_sequence.h>
 #include <__utility/unreachable.h>
 #include <array>
-#include <cinttypes>
 #include <concepts>
-#include <cstddef>
 #include <limits>
 #include <span>
 
diff --git a/libcxx/include/__mdspan/layout_left.h b/libcxx/include/__mdspan/layout_left.h
index 59574e83b0d7b1..288b3dd8038ee2 100644
--- a/libcxx/include/__mdspan/layout_left.h
+++ b/libcxx/include/__mdspan/layout_left.h
@@ -27,9 +27,6 @@
 #include <__type_traits/is_nothrow_constructible.h>
 #include <__utility/integer_sequence.h>
 #include <array>
-#include <cinttypes>
-#include <cstddef>
-#include <limits>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/include/__mdspan/layout_right.h b/libcxx/include/__mdspan/layout_right.h
index d1acdb41238f7f..72922d1049c7a1 100644
--- a/libcxx/include/__mdspan/layout_right.h
+++ b/libcxx/include/__mdspan/layout_right.h
@@ -19,6 +19,7 @@
 
 #include <__assert>
 #include <__config>
+#include <__cstddef/size_t.h>
 #include <__fwd/mdspan.h>
 #include <__mdspan/extents.h>
 #include <__type_traits/common_type.h>
@@ -26,9 +27,6 @@
 #include <__type_traits/is_convertible.h>
 #include <__type_traits/is_nothrow_constructible.h>
 #include <__utility/integer_sequence.h>
-#include <cinttypes>
-#include <cstddef>
-#include <limits>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/include/__mdspan/layout_stride.h b/libcxx/include/__mdspan/layout_stride.h
index c57f596431c7c5..bb93de97751457 100644
--- a/libcxx/include/__mdspan/layout_stride.h
+++ b/libcxx/include/__mdspan/layout_stride.h
@@ -32,8 +32,6 @@
 #include <__utility/integer_sequence.h>
 #include <__utility/swap.h>
 #include <array>
-#include <cinttypes>
-#include <cstddef>
 #include <limits>
 #include <span>
 
diff --git a/libcxx/include/__mdspan/mdspan.h b/libcxx/include/__mdspan/mdspan.h
index 1ff4fd4ba4a829..3f9b35b185b167 100644
--- a/libcxx/include/__mdspan/mdspan.h
+++ b/libcxx/include/__mdspan/mdspan.h
@@ -37,9 +37,6 @@
 #include <__type_traits/remove_reference.h>
 #include <__utility/integer_sequence.h>
 #include <array>
-#include <cinttypes>
-#include <cstddef>
-#include <limits>
 #include <span>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__memory/align.h b/libcxx/include/__memory/align.h
index bbb995f4a8c8ed..402eac3380925d 100644
--- a/libcxx/include/__memory/align.h
+++ b/libcxx/include/__memory/align.h
@@ -10,7 +10,7 @@
 #define _LIBCPP___MEMORY_ALIGN_H
 
 #include <__config>
-#include <cstddef>
+#include <__cstddef/size_t.h>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/include/__memory/aligned_alloc.h b/libcxx/include/__memory/aligned_alloc.h
index cb424328bcafc1..8d4f0c1f07d821 100644
--- a/libcxx/include/__memory/aligned_alloc.h
+++ b/libcxx/include/__memory/aligned_alloc.h
@@ -10,7 +10,6 @@
 #define _LIBCPP___MEMORY_ALIGNED_ALLOC_H
 
 #include <__config>
-#include <cstddef>
 #include <cstdlib>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__memory/allocate_at_least.h b/libcxx/include/__memory/allocate_at_least.h
index a10e4fbaead38b..9b5a8bcbd4596b 100644
--- a/libcxx/include/__memory/allocate_at_least.h
+++ b/libcxx/include/__memory/allocate_at_least.h
@@ -10,8 +10,8 @@
 #define _LIBCPP___MEMORY_ALLOCATE_AT_LEAST_H
 
 #include <__config>
+#include <__cstddef/size_t.h>
 #include <__memory/allocator_traits.h>
-#include <cstddef>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/include/__memory/allocation_guard.h b/libcxx/include/__memory/allocation_guard.h
index cb870af7be6760..66d6a5002c299e 100644
--- a/libcxx/include/__memory/allocation_guard.h
+++ b/libcxx/include/__memory/allocation_guard.h
@@ -14,7 +14,6 @@
 #include <__memory/addressof.h>
 #include <__memory/allocator_traits.h>
 #include <__utility/move.h>
-#include <cstddef>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/include/__memory/allocator.h b/libcxx/include/__memory/allocator.h
index cd146da8e7eb5c..ddb4179940b8b1 100644
--- a/libcxx/include/__memory/allocator.h
+++ b/libcxx/include/__memory/allocator.h
@@ -11,6 +11,7 @@
 #define _LIBCPP___MEMORY_ALLOCATOR_H
 
 #include <__config>
+#include <__cstddef/ptrdiff_t.h>
 #include <__memory/addressof.h>
 #include <__memory/allocate_at_least.h>
 #include <__memory/allocator_traits.h>
@@ -20,7 +21,6 @@
 #include <__type_traits/is_void.h>
 #include <__type_traits/is_volatile.h>
 #include <__utility/forward.h>
-#include <cstddef>
 #include <new>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__memory/allocator_traits.h b/libcxx/include/__memory/allocator_traits.h
index 082c36d4b8c7ad..97e6dd9c81c1e7 100644
--- a/libcxx/include/__memory/allocator_traits.h
+++ b/libcxx/include/__memory/allocator_traits.h
@@ -11,6 +11,7 @@
 #define _LIBCPP___MEMORY_ALLOCATOR_TRAITS_H
 
 #include <__config>
+#include <__cstddef/size_t.h>
 #include <__memory/construct_at.h>
 #include <__memory/pointer_traits.h>
 #include <__type_traits/enable_if.h>
@@ -22,7 +23,6 @@
 #include <__type_traits/void_t.h>
 #include <__utility/declval.h>
 #include <__utility/forward.h>
-#include <cstddef>
 #include <limits>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__memory/assume_aligned.h b/libcxx/include/__memory/assume_aligned.h
index c7ba2a99c7e226..08f1772cd6dfa6 100644
--- a/libcxx/include/__memory/assume_aligned.h
+++ b/libcxx/include/__memory/assume_aligned.h
@@ -12,8 +12,8 @@
 
 #include <__assert>
 #include <__config>
+#include <__cstddef/size_t.h>
 #include <__type_traits/is_constant_evaluated.h>
-#include <cstddef>
 #include <cstdint>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__memory/builtin_new_allocator.h b/libcxx/include/__memory/builtin_new_allocator.h
index c6f7f3c5ff52a1..128288efb05bc1 100644
--- a/libcxx/include/__memory/builtin_new_allocator.h
+++ b/libcxx/include/__memory/builtin_new_allocator.h
@@ -11,7 +11,6 @@
 
 #include <__config>
 #include <__memory/unique_ptr.h>
-#include <cstddef>
 #include <new>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__memory/compressed_pair.h b/libcxx/include/__memory/compressed_pair.h
index 40e5cfc35fb040..6f7fbfee11bf4a 100644
--- a/libcxx/include/__memory/compressed_pair.h
+++ b/libcxx/include/__memory/compressed_pair.h
@@ -11,6 +11,7 @@
 #define _LIBCPP___MEMORY_COMPRESSED_PAIR_H
 
 #include <__config>
+#include <__cstddef/size_t.h>
 #include <__fwd/tuple.h>
 #include <__tuple/tuple_indices.h>
 #include <__type_traits/decay.h>
@@ -24,7 +25,6 @@
 #include <__utility/forward.h>
 #include <__utility/move.h>
 #include <__utility/piecewise_construct.h>
-#include <cstddef>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/include/__memory/destruct_n.h b/libcxx/include/__memory/destruct_n.h
index 78635ad0af04bd..66adefb0f51fc7 100644
--- a/libcxx/include/__memory/destruct_n.h
+++ b/libcxx/include/__memory/destruct_n.h
@@ -10,9 +10,9 @@
 #define _LIBCPP___MEMORY_DESTRUCT_N_H
 
 #include <__config>
+#include <__cstddef/size_t.h>
 #include <__type_traits/integral_constant.h>
 #include <__type_traits/is_trivially_destructible.h>
-#include <cstddef>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/include/__memory/pointer_traits.h b/libcxx/include/__memory/pointer_traits.h
index 8e08eb74413ee5..cc799543b8ef15 100644
--- a/libcxx/include/__memory/pointer_traits.h
+++ b/libcxx/include/__memory/pointer_traits.h
@@ -11,6 +11,7 @@
 #define _LIBCPP___MEMORY_POINTER_TRAITS_H
 
 #include <__config>
+#include <__cstddef/ptrdiff_t.h>
 #include <__memory/addressof.h>
 #include <__type_traits/conditional.h>
 #include <__type_traits/conjunction.h>
@@ -22,7 +23,6 @@
 #include <__type_traits/void_t.h>
 #include <__utility/declval.h>
 #include <__utility/forward.h>
-#include <cstddef>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/include/__memory/raw_storage_iterator.h b/libcxx/include/__memory/raw_storage_iterator.h
index 774878aa1c5e81..2ee4c074d8d337 100644
--- a/libcxx/include/__memory/raw_storage_iterator.h
+++ b/libcxx/include/__memory/raw_storage_iterator.h
@@ -11,11 +11,11 @@
 #define _LIBCPP___MEMORY_RAW_STORAGE_ITERATOR_H
 
 #include <__config>
+#include <__cstddef/ptrdiff_t.h>
 #include <__iterator/iterator.h>
 #include <__iterator/iterator_traits.h>
 #include <__memory/addressof.h>
 #include <__utility/move.h>
-#include <cstddef>
 #include <new>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__memory/shared_ptr.h b/libcxx/include/__memory/shared_ptr.h
index 5dcd475e2c9f9d..aec10b1e9e9934 100644
--- a/libcxx/include/__memory/shared_ptr.h
+++ b/libcxx/include/__memory/shared_ptr.h
@@ -13,6 +13,7 @@
 #include <__compare/compare_three_way.h>
 #include <__compare/ordering.h>
 #include <__config>
+#include <__cstddef/ptrdiff_t.h>
 #include <__exception/exception.h>
 #include <__functional/binary_function.h>
 #include <__functional/operations.h>
@@ -51,7 +52,6 @@
 #include <__utility/move.h>
 #include <__utility/swap.h>
 #include <__verbose_abort>
-#include <cstddef>
 #include <new>
 #include <typeinfo>
 #if !defined(_LIBCPP_HAS_NO_ATOMIC_HEADER)
diff --git a/libcxx/include/__memory/temporary_buffer.h b/libcxx/include/__memory/temporary_buffer.h
index 633c9dcf65c5df..0f3b9166c010b7 100644
--- a/libcxx/include/__memory/temporary_buffer.h
+++ b/libcxx/include/__memory/temporary_buffer.h
@@ -11,8 +11,9 @@
 #define _LIBCPP___MEMORY_TEMPORARY_BUFFER_H
 
 #include <__config>
+#include <__cstddef/ptrdiff_t.h>
+#include <__cstddef/size_t.h>
 #include <__utility/pair.h>
-#include <cstddef>
 #include <new>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__memory/unique_ptr.h b/libcxx/include/__memory/unique_ptr.h
index 392cf421378214..8d04a33cacdaf2 100644
--- a/libcxx/include/__memory/unique_ptr.h
+++ b/libcxx/include/__memory/unique_ptr.h
@@ -14,6 +14,8 @@
 #include <__compare/compare_three_way_result.h>
 #include <__compare/three_way_comparable.h>
 #include <__config>
+#include <__cstddef/nullptr_t.h>
+#include <__cstddef/size_t.h>
 #include <__functional/hash.h>
 #include <__functional/operations.h>
 #include <__memory/allocator_traits.h> // __pointer
@@ -41,7 +43,6 @@
 #include <__utility/declval.h>
 #include <__utility/forward.h>
 #include <__utility/move.h>
-#include <cstddef>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/include/__memory/uses_allocator.h b/libcxx/include/__memory/uses_allocator.h
index 16504e8b2a9989..20aa0e6b7f2724 100644
--- a/libcxx/include/__memory/uses_allocator.h
+++ b/libcxx/include/__memory/uses_allocator.h
@@ -13,7 +13,6 @@
 #include <__config>
 #include <__type_traits/integral_constant.h>
 #include <__type_traits/is_convertible.h>
-#include <cstddef>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/include/__memory_resource/memory_resource.h b/libcxx/include/__memory_resource/memory_resource.h
index ea85e50cd568bc..f93f10fe21a2d0 100644
--- a/libcxx/include/__memory_resource/memory_resource.h
+++ b/libcxx/include/__memory_resource/memory_resource.h
@@ -10,8 +10,9 @@
 #define _LIBCPP___MEMORY_RESOURCE_MEMORY_RESOURCE_H
 
 #include <__config>
+#include <__cstddef/max_align_t.h>
+#include <__cstddef/size_t.h>
 #include <__fwd/memory_resource.h>
-#include <cstddef>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/include/__memory_resource/monotonic_buffer_resource.h b/libcxx/include/__memory_resource/monotonic_buffer_resource.h
index f45b30fdb38616..c5a2b556707f6a 100644
--- a/libcxx/include/__memory_resource/monotonic_buffer_resource.h
+++ b/libcxx/include/__memory_resource/monotonic_buffer_resource.h
@@ -10,9 +10,9 @@
 #define _LIBCPP___MEMORY_RESOURCE_MONOTONIC_BUFFER_RESOURCE_H
 
 #include <__config>
+#include <__cstddef/size_t.h>
 #include <__memory/addressof.h>
 #include <__memory_resource/memory_resource.h>
-#include <cstddef>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/include/__memory_resource/polymorphic_allocator.h b/libcxx/include/__memory_resource/polymorphic_allocator.h
index fb36d5cad78ec6..30fa5c2170d502 100644
--- a/libcxx/include/__memory_resource/polymorphic_allocator.h
+++ b/libcxx/include/__memory_resource/polymorphic_allocator.h
@@ -11,10 +11,11 @@
 
 #include <__assert>
 #include <__config>
+#include <__cstddef/byte.h>
+#include <__cstddef/max_align_t.h>
 #include <__fwd/pair.h>
 #include <__memory_resource/memory_resource.h>
 #include <__utility/exception_guard.h>
-#include <cstddef>
 #include <limits>
 #include <new>
 #include <tuple>
diff --git a/libcxx/include/__memory_resource/pool_options.h b/libcxx/include/__memory_resource/pool_options.h
index 442959836c7ef3..324b8aaa8502b1 100644
--- a/libcxx/include/__memory_resource/pool_options.h
+++ b/libcxx/include/__memory_resource/pool_options.h
@@ -10,7 +10,7 @@
 #define _LIBCPP___MEMORY_RESOURCE_POOL_OPTIONS_H
 
 #include <__config>
-#include <cstddef>
+#include <__cstddef/size_t.h>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/include/__memory_resource/synchronized_pool_resource.h b/libcxx/include/__memory_resource/synchronized_pool_resource.h
index 50a673c2861d10..2679afc16617ba 100644
--- a/libcxx/include/__memory_resource/synchronized_pool_resource.h
+++ b/libcxx/include/__memory_resource/synchronized_pool_resource.h
@@ -13,7 +13,6 @@
 #include <__memory_resource/memory_resource.h>
 #include <__memory_resource/pool_options.h>
 #include <__memory_resource/unsynchronized_pool_resource.h>
-#include <cstddef>
 #include <mutex>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__memory_resource/unsynchronized_pool_resource.h b/libcxx/include/__memory_resource/unsynchronized_pool_resource.h
index 783db84262af72..92da16c559fea8 100644
--- a/libcxx/include/__memory_resource/unsynchronized_pool_resource.h
+++ b/libcxx/include/__memory_resource/unsynchronized_pool_resource.h
@@ -10,9 +10,9 @@
 #define _LIBCPP___MEMORY_RESOURCE_UNSYNCHRONIZED_POOL_RESOURCE_H
 
 #include <__config>
+#include <__cstddef/size_t.h>
 #include <__memory_resource/memory_resource.h>
 #include <__memory_resource/pool_options.h>
-#include <cstddef>
 #include <cstdint>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__numeric/midpoint.h b/libcxx/include/__numeric/midpoint.h
index 5ef30d4ec50f5a..c08eb8f3819b20 100644
--- a/libcxx/include/__numeric/midpoint.h
+++ b/libcxx/include/__numeric/midpoint.h
@@ -21,7 +21,6 @@
 #include <__type_traits/is_void.h>
 #include <__type_traits/make_unsigned.h>
 #include <__type_traits/remove_pointer.h>
-#include <cstddef>
 #include <limits>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__ostream/basic_ostream.h b/libcxx/include/__ostream/basic_ostream.h
index e0698ccb4842a5..b213dd6e554ec1 100644
--- a/libcxx/include/__ostream/basic_ostream.h
+++ b/libcxx/include/__ostream/basic_ostream.h
@@ -20,7 +20,6 @@
 #include <__type_traits/void_t.h>
 #include <__utility/declval.h>
 #include <bitset>
-#include <cstddef>
 #include <ios>
 #include <locale>
 #include <new> // for __throw_bad_alloc
diff --git a/libcxx/include/__pstl/backends/libdispatch.h b/libcxx/include/__pstl/backends/libdispatch.h
index 2d6ab49c8f7f3a..5bef3cfe313593 100644
--- a/libcxx/include/__pstl/backends/libdispatch.h
+++ b/libcxx/include/__pstl/backends/libdispatch.h
@@ -37,7 +37,6 @@
 #include <__utility/exception_guard.h>
 #include <__utility/move.h>
 #include <__utility/pair.h>
-#include <cstddef>
 #include <new>
 #include <optional>
 
diff --git a/libcxx/include/__pstl/backends/std_thread.h b/libcxx/include/__pstl/backends/std_thread.h
index 19b985f860a174..dd2c3f15403e3d 100644
--- a/libcxx/include/__pstl/backends/std_thread.h
+++ b/libcxx/include/__pstl/backends/std_thread.h
@@ -22,7 +22,6 @@
 #include <__pstl/cpu_algos/transform_reduce.h>
 #include <__utility/empty.h>
 #include <__utility/move.h>
-#include <cstddef>
 #include <optional>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__pstl/cpu_algos/cpu_traits.h b/libcxx/include/__pstl/cpu_algos/cpu_traits.h
index 5e59752fa5723c..ec1622419d0490 100644
--- a/libcxx/include/__pstl/cpu_algos/cpu_traits.h
+++ b/libcxx/include/__pstl/cpu_algos/cpu_traits.h
@@ -10,7 +10,6 @@
 #define _LIBCPP___PSTL_CPU_ALGOS_CPU_TRAITS_H
 
 #include <__config>
-#include <cstddef>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/include/__pstl/cpu_algos/find_if.h b/libcxx/include/__pstl/cpu_algos/find_if.h
index cd92e5a99f12f8..ebb4ecb4a0ed36 100644
--- a/libcxx/include/__pstl/cpu_algos/find_if.h
+++ b/libcxx/include/__pstl/cpu_algos/find_if.h
@@ -21,7 +21,6 @@
 #include <__type_traits/is_execution_policy.h>
 #include <__utility/move.h>
 #include <__utility/pair.h>
-#include <cstddef>
 #include <optional>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__pstl/cpu_algos/transform_reduce.h b/libcxx/include/__pstl/cpu_algos/transform_reduce.h
index aafbf1ca96b40d..e9f622d832cd5c 100644
--- a/libcxx/include/__pstl/cpu_algos/transform_reduce.h
+++ b/libcxx/include/__pstl/cpu_algos/transform_reduce.h
@@ -20,7 +20,6 @@
 #include <__type_traits/is_arithmetic.h>
 #include <__type_traits/is_execution_policy.h>
 #include <__utility/move.h>
-#include <cstddef>
 #include <new>
 #include <optional>
 
diff --git a/libcxx/include/__random/discard_block_engine.h b/libcxx/include/__random/discard_block_engine.h
index 07f599067279e6..f319557a573657 100644
--- a/libcxx/include/__random/discard_block_engine.h
+++ b/libcxx/include/__random/discard_block_engine.h
@@ -10,11 +10,11 @@
 #define _LIBCPP___RANDOM_DISCARD_BLOCK_ENGINE_H
 
 #include <__config>
+#include <__cstddef/size_t.h>
 #include <__random/is_seed_sequence.h>
 #include <__type_traits/enable_if.h>
 #include <__type_traits/is_convertible.h>
 #include <__utility/move.h>
-#include <cstddef>
 #include <iosfwd>
 #include <limits>
 
diff --git a/libcxx/include/__random/discrete_distribution.h b/libcxx/include/__random/discrete_distribution.h
index bb72dd6cb5074c..a8498cd7c76a32 100644
--- a/libcxx/include/__random/discrete_distribution.h
+++ b/libcxx/include/__random/discrete_distribution.h
@@ -13,7 +13,6 @@
 #include <__config>
 #include <__random/is_valid.h>
 #include <__random/uniform_real_distribution.h>
-#include <cstddef>
 #include <iosfwd>
 #include <numeric>
 #include <vector>
diff --git a/libcxx/include/__random/independent_bits_engine.h b/libcxx/include/__random/independent_bits_engine.h
index 0f4a7b82b98f89..20f56e9b575609 100644
--- a/libcxx/include/__random/independent_bits_engine.h
+++ b/libcxx/include/__random/independent_bits_engine.h
@@ -10,6 +10,7 @@
 #define _LIBCPP___RANDOM_INDEPENDENT_BITS_ENGINE_H
 
 #include <__config>
+#include <__cstddef/size_t.h>
 #include <__fwd/istream.h>
 #include <__fwd/ostream.h>
 #include <__random/is_seed_sequence.h>
@@ -18,7 +19,6 @@
 #include <__type_traits/enable_if.h>
 #include <__type_traits/is_convertible.h>
 #include <__utility/move.h>
-#include <cstddef>
 #include <limits>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__random/log2.h b/libcxx/include/__random/log2.h
index 74b4889c6402b5..2de7bd0ba52a4a 100644
--- a/libcxx/include/__random/log2.h
+++ b/libcxx/include/__random/log2.h
@@ -10,8 +10,8 @@
 #define _LIBCPP___RANDOM_LOG2_H
 
 #include <__config>
+#include <__cstddef/size_t.h>
 #include <__type_traits/conditional.h>
-#include <cstddef>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/include/__random/mersenne_twister_engine.h b/libcxx/include/__random/mersenne_twister_engine.h
index 1f50e608ce8d4e..9dd87f9ce71a11 100644
--- a/libcxx/include/__random/mersenne_twister_engine.h
+++ b/libcxx/include/__random/mersenne_twister_engine.h
@@ -12,9 +12,9 @@
 #include <__algorithm/equal.h>
 #include <__algorithm/min.h>
 #include <__config>
+#include <__cstddef/size_t.h>
 #include <__random/is_seed_sequence.h>
 #include <__type_traits/enable_if.h>
-#include <cstddef>
 #include <cstdint>
 #include <iosfwd>
 #include <limits>
diff --git a/libcxx/include/__random/piecewise_constant_distribution.h b/libcxx/include/__random/piecewise_constant_distribution.h
index e19380f97c35ec..7cb1efe0812856 100644
--- a/libcxx/include/__random/piecewise_constant_distribution.h
+++ b/libcxx/include/__random/piecewise_constant_distribution.h
@@ -11,6 +11,7 @@
 
 #include <__algorithm/upper_bound.h>
 #include <__config>
+#include <__cstddef/ptrdiff_t.h>
 #include <__random/is_valid.h>
 #include <__random/uniform_real_distribution.h>
 #include <iosfwd>
diff --git a/libcxx/include/__random/piecewise_linear_distribution.h b/libcxx/include/__random/piecewise_linear_distribution.h
index 43769dc825e65b..59f51033b5510c 100644
--- a/libcxx/include/__random/piecewise_linear_distribution.h
+++ b/libcxx/include/__random/piecewise_linear_distribution.h
@@ -11,6 +11,7 @@
 
 #include <__algorithm/upper_bound.h>
 #include <__config>
+#include <__cstddef/ptrdiff_t.h>
 #include <__random/is_valid.h>
 #include <__random/uniform_real_distribution.h>
 #include <cmath>
diff --git a/libcxx/include/__random/shuffle_order_engine.h b/libcxx/include/__random/shuffle_order_engine.h
index f54ed17e38383a..53f6c08971105e 100644
--- a/libcxx/include/__random/shuffle_order_engine.h
+++ b/libcxx/include/__random/shuffle_order_engine.h
@@ -11,12 +11,12 @@
 
 #include <__algorithm/equal.h>
 #include <__config>
+#include <__cstddef/size_t.h>
 #include <__random/is_seed_sequence.h>
 #include <__type_traits/enable_if.h>
 #include <__type_traits/integral_constant.h>
 #include <__type_traits/is_convertible.h>
 #include <__utility/move.h>
-#include <cstddef>
 #include <cstdint>
 #include <iosfwd>
 
diff --git a/libcxx/include/__random/subtract_with_carry_engine.h b/libcxx/include/__random/subtract_with_carry_engine.h
index 926333cdda45ee..e087ab4a3c2c7b 100644
--- a/libcxx/include/__random/subtract_with_carry_engine.h
+++ b/libcxx/include/__random/subtract_with_carry_engine.h
@@ -12,10 +12,10 @@
 #include <__algorithm/equal.h>
 #include <__algorithm/min.h>
 #include <__config>
+#include <__cstddef/size_t.h>
 #include <__random/is_seed_sequence.h>
 #include <__random/linear_congruential_engine.h>
 #include <__type_traits/enable_if.h>
-#include <cstddef>
 #include <cstdint>
 #include <iosfwd>
 #include <limits>
diff --git a/libcxx/include/__random/uniform_int_distribution.h b/libcxx/include/__random/uniform_int_distribution.h
index 4e3ca3efe56866..fa2c33755b7398 100644
--- a/libcxx/include/__random/uniform_int_distribution.h
+++ b/libcxx/include/__random/uniform_int_distribution.h
@@ -11,11 +11,11 @@
 
 #include <__bit/countl.h>
 #include <__config>
+#include <__cstddef/size_t.h>
 #include <__random/is_valid.h>
 #include <__random/log2.h>
 #include <__type_traits/conditional.h>
 #include <__type_traits/make_unsigned.h>
-#include <cstddef>
 #include <cstdint>
 #include <iosfwd>
 #include <limits>
diff --git a/libcxx/include/__ranges/access.h b/libcxx/include/__ranges/access.h
index c0a40c5e10178a..bbacef3eae6be1 100644
--- a/libcxx/include/__ranges/access.h
+++ b/libcxx/include/__ranges/access.h
@@ -12,6 +12,7 @@
 
 #include <__concepts/class_or_enum.h>
 #include <__config>
+#include <__cstddef/size_t.h>
 #include <__iterator/concepts.h>
 #include <__iterator/readable_traits.h>
 #include <__ranges/enable_borrowed_range.h>
@@ -21,7 +22,6 @@
 #include <__type_traits/remove_reference.h>
 #include <__utility/auto_cast.h>
 #include <__utility/declval.h>
-#include <cstddef>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/include/__ranges/counted.h b/libcxx/include/__ranges/counted.h
index e365deca4e632d..65bf1a371ec780 100644
--- a/libcxx/include/__ranges/counted.h
+++ b/libcxx/include/__ranges/counted.h
@@ -12,6 +12,7 @@
 
 #include <__concepts/convertible_to.h>
 #include <__config>
+#include <__cstddef/size_t.h>
 #include <__iterator/concepts.h>
 #include <__iterator/counted_iterator.h>
 #include <__iterator/default_sentinel.h>
@@ -22,7 +23,6 @@
 #include <__type_traits/decay.h>
 #include <__utility/forward.h>
 #include <__utility/move.h>
-#include <cstddef>
 #include <span>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__ranges/drop_view.h b/libcxx/include/__ranges/drop_view.h
index 853e22a402cad1..bbf5474345a701 100644
--- a/libcxx/include/__ranges/drop_view.h
+++ b/libcxx/include/__ranges/drop_view.h
@@ -42,7 +42,6 @@
 #include <__utility/auto_cast.h>
 #include <__utility/forward.h>
 #include <__utility/move.h>
-#include <cstddef>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/include/__ranges/elements_view.h b/libcxx/include/__ranges/elements_view.h
index 989d36fbcaaae5..4db8d89a552619 100644
--- a/libcxx/include/__ranges/elements_view.h
+++ b/libcxx/include/__ranges/elements_view.h
@@ -37,7 +37,6 @@
 #include <__utility/declval.h>
 #include <__utility/forward.h>
 #include <__utility/move.h>
-#include <cstddef>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/include/__ranges/empty_view.h b/libcxx/include/__ranges/empty_view.h
index 6c04b0200c35f2..fc08492110f53c 100644
--- a/libcxx/include/__ranges/empty_view.h
+++ b/libcxx/include/__ranges/empty_view.h
@@ -11,10 +11,10 @@
 #define _LIBCPP___RANGES_EMPTY_VIEW_H
 
 #include <__config>
+#include <__cstddef/size_t.h>
 #include <__ranges/enable_borrowed_range.h>
 #include <__ranges/view_interface.h>
 #include <__type_traits/is_object.h>
-#include <cstddef>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/include/__ranges/istream_view.h b/libcxx/include/__ranges/istream_view.h
index cd7096d35c2c1f..1820ef2a4c1f7e 100644
--- a/libcxx/include/__ranges/istream_view.h
+++ b/libcxx/include/__ranges/istream_view.h
@@ -14,6 +14,7 @@
 #include <__concepts/derived_from.h>
 #include <__concepts/movable.h>
 #include <__config>
+#include <__cstddef/ptrdiff_t.h>
 #include <__fwd/istream.h>
 #include <__fwd/string.h>
 #include <__iterator/default_sentinel.h>
@@ -22,7 +23,6 @@
 #include <__ranges/view_interface.h>
 #include <__type_traits/remove_cvref.h>
 #include <__utility/forward.h>
-#include <cstddef>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/include/__ranges/repeat_view.h b/libcxx/include/__ranges/repeat_view.h
index 53e4beb270ad01..93ceaf1711d329 100644
--- a/libcxx/include/__ranges/repeat_view.h
+++ b/libcxx/include/__ranges/repeat_view.h
@@ -15,6 +15,7 @@
 #include <__concepts/same_as.h>
 #include <__concepts/semiregular.h>
 #include <__config>
+#include <__cstddef/ptrdiff_t.h>
 #include <__iterator/concepts.h>
 #include <__iterator/iterator_traits.h>
 #include <__iterator/unreachable_sentinel.h>
diff --git a/libcxx/include/__ranges/single_view.h b/libcxx/include/__ranges/single_view.h
index 45244f34994d74..955578b99cf58b 100644
--- a/libcxx/include/__ranges/single_view.h
+++ b/libcxx/include/__ranges/single_view.h
@@ -12,6 +12,8 @@
 
 #include <__concepts/constructible.h>
 #include <__config>
+#include <__cstddef/ptrdiff_t.h>
+#include <__cstddef/size_t.h>
 #include <__ranges/movable_box.h>
 #include <__ranges/range_adaptor.h>
 #include <__ranges/view_interface.h>
@@ -20,7 +22,6 @@
 #include <__utility/forward.h>
 #include <__utility/in_place.h>
 #include <__utility/move.h>
-#include <cstddef>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/include/__ranges/size.h b/libcxx/include/__ranges/size.h
index 40b0c6b6aad7a3..5da3a6ff268e80 100644
--- a/libcxx/include/__ranges/size.h
+++ b/libcxx/include/__ranges/size.h
@@ -13,6 +13,8 @@
 #include <__concepts/arithmetic.h>
 #include <__concepts/class_or_enum.h>
 #include <__config>
+#include <__cstddef/ptrdiff_t.h>
+#include <__cstddef/size_t.h>
 #include <__iterator/concepts.h>
 #include <__iterator/iterator_traits.h>
 #include <__ranges/access.h>
@@ -22,7 +24,6 @@
 #include <__type_traits/remove_cvref.h>
 #include <__utility/auto_cast.h>
 #include <__utility/declval.h>
-#include <cstddef>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/include/__ranges/subrange.h b/libcxx/include/__ranges/subrange.h
index 144746babb325f..a40eab3c5a257e 100644
--- a/libcxx/include/__ranges/subrange.h
+++ b/libcxx/include/__ranges/subrange.h
@@ -17,6 +17,7 @@
 #include <__concepts/derived_from.h>
 #include <__concepts/different_from.h>
 #include <__config>
+#include <__cstddef/size_t.h>
 #include <__fwd/subrange.h>
 #include <__iterator/advance.h>
 #include <__iterator/concepts.h>
@@ -40,7 +41,6 @@
 #include <__type_traits/remove_const.h>
 #include <__type_traits/remove_pointer.h>
 #include <__utility/move.h>
-#include <cstddef>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/include/__ranges/take_view.h b/libcxx/include/__ranges/take_view.h
index 27ca8155a69b18..d4d2781e48b3f2 100644
--- a/libcxx/include/__ranges/take_view.h
+++ b/libcxx/include/__ranges/take_view.h
@@ -42,7 +42,6 @@
 #include <__utility/auto_cast.h>
 #include <__utility/forward.h>
 #include <__utility/move.h>
-#include <cstddef>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/include/__ranges/to.h b/libcxx/include/__ranges/to.h
index e0abe6290b8f7d..b4bad8911ee3dc 100644
--- a/libcxx/include/__ranges/to.h
+++ b/libcxx/include/__ranges/to.h
@@ -16,6 +16,7 @@
 #include <__concepts/derived_from.h>
 #include <__concepts/same_as.h>
 #include <__config>
+#include <__cstddef/ptrdiff_t.h>
 #include <__functional/bind_back.h>
 #include <__iterator/back_insert_iterator.h>
 #include <__iterator/insert_iterator.h>
@@ -33,7 +34,6 @@
 #include <__type_traits/type_identity.h>
 #include <__utility/declval.h>
 #include <__utility/forward.h>
-#include <cstddef>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/include/__split_buffer b/libcxx/include/__split_buffer
index bab724d1b8963b..3ca882e383018a 100644
--- a/libcxx/include/__split_buffer
+++ b/libcxx/include/__split_buffer
@@ -14,6 +14,7 @@
 #include <__algorithm/move.h>
 #include <__algorithm/move_backward.h>
 #include <__config>
+#include <__cstddef/size_t.h>
 #include <__iterator/distance.h>
 #include <__iterator/iterator_traits.h>
 #include <__iterator/move_iterator.h>
@@ -35,7 +36,6 @@
 #include <__type_traits/remove_reference.h>
 #include <__utility/forward.h>
 #include <__utility/move.h>
-#include <cstddef>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/include/__stop_token/intrusive_shared_ptr.h b/libcxx/include/__stop_token/intrusive_shared_ptr.h
index f00cea5bc2b670..d20c5227ec7291 100644
--- a/libcxx/include/__stop_token/intrusive_shared_ptr.h
+++ b/libcxx/include/__stop_token/intrusive_shared_ptr.h
@@ -13,10 +13,10 @@
 #include <__atomic/atomic.h>
 #include <__atomic/memory_order.h>
 #include <__config>
+#include <__cstddef/nullptr_t.h>
 #include <__type_traits/is_reference.h>
 #include <__utility/move.h>
 #include <__utility/swap.h>
-#include <cstddef>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/include/__string/char_traits.h b/libcxx/include/__string/char_traits.h
index 2660ac2ede2d5c..8654a333334144 100644
--- a/libcxx/include/__string/char_traits.h
+++ b/libcxx/include/__string/char_traits.h
@@ -23,7 +23,6 @@
 #include <__string/constexpr_c_functions.h>
 #include <__type_traits/is_constant_evaluated.h>
 #include <__utility/is_pointer_in_range.h>
-#include <cstddef>
 #include <cstdint>
 #include <cstdio>
 #include <iosfwd>
diff --git a/libcxx/include/__string/constexpr_c_functions.h b/libcxx/include/__string/constexpr_c_functions.h
index 9b8871e2e71a38..16801bf2015c17 100644
--- a/libcxx/include/__string/constexpr_c_functions.h
+++ b/libcxx/include/__string/constexpr_c_functions.h
@@ -10,6 +10,7 @@
 #define _LIBCPP___STRING_CONSTEXPR_C_FUNCTIONS_H
 
 #include <__config>
+#include <__cstddef/size_t.h>
 #include <__memory/addressof.h>
 #include <__memory/construct_at.h>
 #include <__type_traits/datasizeof.h>
@@ -25,7 +26,6 @@
 #include <__type_traits/is_trivially_lexicographically_comparable.h>
 #include <__type_traits/remove_cv.h>
 #include <__utility/is_pointer_in_range.h>
-#include <cstddef>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/include/__system_error/error_code.h b/libcxx/include/__system_error/error_code.h
index 475f2bb96a56d9..6fa673b4ff713b 100644
--- a/libcxx/include/__system_error/error_code.h
+++ b/libcxx/include/__system_error/error_code.h
@@ -17,7 +17,6 @@
 #include <__system_error/errc.h>
 #include <__system_error/error_category.h>
 #include <__system_error/error_condition.h>
-#include <cstddef>
 #include <string>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__system_error/error_condition.h b/libcxx/include/__system_error/error_condition.h
index 42898c1f0e9013..bfee6528c3f1d2 100644
--- a/libcxx/include/__system_error/error_condition.h
+++ b/libcxx/include/__system_error/error_condition.h
@@ -16,7 +16,6 @@
 #include <__functional/unary_function.h>
 #include <__system_error/errc.h>
 #include <__system_error/error_category.h>
-#include <cstddef>
 #include <string>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__utility/in_place.h b/libcxx/include/__utility/in_place.h
index 459b271675261c..edaa4e02c55f54 100644
--- a/libcxx/include/__utility/in_place.h
+++ b/libcxx/include/__utility/in_place.h
@@ -10,9 +10,9 @@
 #define _LIBCPP___UTILITY_IN_PLACE_H
 
 #include <__config>
+#include <__cstddef/size_t.h>
 #include <__type_traits/integral_constant.h>
 #include <__type_traits/remove_cvref.h>
-#include <cstddef>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/include/__utility/integer_sequence.h b/libcxx/include/__utility/integer_sequence.h
index ccce9433e7a801..35eb606ee37f67 100644
--- a/libcxx/include/__utility/integer_sequence.h
+++ b/libcxx/include/__utility/integer_sequence.h
@@ -10,8 +10,8 @@
 #define _LIBCPP___UTILITY_INTEGER_SEQUENCE_H
 
 #include <__config>
+#include <__cstddef/size_t.h>
 #include <__type_traits/is_integral.h>
-#include <cstddef>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/include/__utility/pair.h b/libcxx/include/__utility/pair.h
index 78534a3f399f25..cca6490476db11 100644
--- a/libcxx/include/__utility/pair.h
+++ b/libcxx/include/__utility/pair.h
@@ -13,6 +13,7 @@
 #include <__compare/synth_three_way.h>
 #include <__concepts/different_from.h>
 #include <__config>
+#include <__cstddef/size_t.h>
 #include <__fwd/array.h>
 #include <__fwd/pair.h>
 #include <__fwd/tuple.h>
@@ -43,7 +44,6 @@
 #include <__utility/forward.h>
 #include <__utility/move.h>
 #include <__utility/piecewise_construct.h>
-#include <cstddef>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/include/__utility/priority_tag.h b/libcxx/include/__utility/priority_tag.h
index a159ce7f1afb34..ef7cf162b9b4ca 100644
--- a/libcxx/include/__utility/priority_tag.h
+++ b/libcxx/include/__utility/priority_tag.h
@@ -10,7 +10,7 @@
 #define _LIBCPP___UTILITY_PRIORITY_TAG_H
 
 #include <__config>
-#include <cstddef>
+#include <__cstddef/size_t.h>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/include/__utility/small_buffer.h b/libcxx/include/__utility/small_buffer.h
index 9e13797573d2d7..70e068f89f62ed 100644
--- a/libcxx/include/__utility/small_buffer.h
+++ b/libcxx/include/__utility/small_buffer.h
@@ -10,13 +10,13 @@
 #define _LIBCPP___UTILITY_SMALL_BUFFER_H
 
 #include <__config>
+#include <__cstddef/byte.h>
 #include <__memory/construct_at.h>
 #include <__type_traits/decay.h>
 #include <__type_traits/is_trivially_constructible.h>
 #include <__type_traits/is_trivially_destructible.h>
 #include <__utility/exception_guard.h>
 #include <__utility/forward.h>
-#include <cstddef>
 #include <new>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__utility/swap.h b/libcxx/include/__utility/swap.h
index ecfbdec75a2aeb..666d6d50f0d916 100644
--- a/libcxx/include/__utility/swap.h
+++ b/libcxx/include/__utility/swap.h
@@ -10,6 +10,7 @@
 #define _LIBCPP___UTILITY_SWAP_H
 
 #include <__config>
+#include <__cstddef/size_t.h>
 #include <__type_traits/enable_if.h>
 #include <__type_traits/is_assignable.h>
 #include <__type_traits/is_constructible.h>
@@ -18,7 +19,6 @@
 #include <__type_traits/is_swappable.h>
 #include <__utility/declval.h>
 #include <__utility/move.h>
-#include <cstddef>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/include/__variant/monostate.h b/libcxx/include/__variant/monostate.h
index 16f156609eb7df..c5d2dacaf42051 100644
--- a/libcxx/include/__variant/monostate.h
+++ b/libcxx/include/__variant/monostate.h
@@ -12,8 +12,8 @@
 
 #include <__compare/ordering.h>
 #include <__config>
+#include <__cstddef/size_t.h>
 #include <__functional/hash.h>
-#include <cstddef>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/include/array b/libcxx/include/array
index fde7a7011e6432..ed3eaf44ed13d9 100644
--- a/libcxx/include/array
+++ b/libcxx/include/array
@@ -118,6 +118,7 @@ template <size_t I, class T, size_t N> const T&& get(const array<T, N>&&) noexce
 #include <__algorithm/swap_ranges.h>
 #include <__assert>
 #include <__config>
+#include <__cstddef/ptrdiff_t.h>
 #include <__fwd/array.h>
 #include <__iterator/reverse_iterator.h>
 #include <__iterator/wrap_iter.h>
diff --git a/libcxx/include/atomic b/libcxx/include/atomic
index 772ac998615a93..39ad92a557dcce 100644
--- a/libcxx/include/atomic
+++ b/libcxx/include/atomic
@@ -624,6 +624,7 @@ template <class T>
 #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
 #  include <cmath>
 #  include <compare>
+#  include <cstddef>
 #  include <cstdlib>
 #  include <cstring>
 #  include <type_traits>
diff --git a/libcxx/include/barrier b/libcxx/include/barrier
index abc014e8aaf5c0..36c30c7fe2e755 100644
--- a/libcxx/include/barrier
+++ b/libcxx/include/barrier
@@ -52,11 +52,11 @@ namespace std
 #  include <__assert>
 #  include <__atomic/atomic_base.h>
 #  include <__atomic/memory_order.h>
+#  include <__cstddef/ptrdiff_t.h>
 #  include <__memory/unique_ptr.h>
 #  include <__thread/poll_with_backoff.h>
 #  include <__thread/timed_backoff_policy.h>
 #  include <__utility/move.h>
-#  include <cstddef>
 #  include <cstdint>
 #  include <limits>
 #  include <version>
diff --git a/libcxx/include/bitset b/libcxx/include/bitset
index 6bd7bfe585f38a..340637b9f5b28a 100644
--- a/libcxx/include/bitset
+++ b/libcxx/include/bitset
@@ -135,7 +135,6 @@ template <size_t N> struct hash<std::bitset<N>>;
 #include <__functional/unary_function.h>
 #include <__type_traits/is_char_like_type.h>
 #include <climits>
-#include <cstddef>
 #include <stdexcept>
 #include <string_view>
 #include <version>
diff --git a/libcxx/include/charconv b/libcxx/include/charconv
index a2e270e9316dc7..649c22fa17f4a2 100644
--- a/libcxx/include/charconv
+++ b/libcxx/include/charconv
@@ -104,6 +104,7 @@ _LIBCPP_END_NAMESPACE_STD
 #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
 #  include <cmath>
 #  include <concepts>
+#  include <cstddef>
 #  include <cstdint>
 #  include <cstdlib>
 #  include <cstring>
diff --git a/libcxx/include/compare b/libcxx/include/compare
index 8a41835b148978..de0e4c7ec2280c 100644
--- a/libcxx/include/compare
+++ b/libcxx/include/compare
@@ -172,6 +172,7 @@ namespace std {
 
 #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
 #  include <cmath>
+#  include <cstddef>
 #  include <type_traits>
 #endif
 
diff --git a/libcxx/include/concepts b/libcxx/include/concepts
index e89d216a593725..6db2caebaf5b1a 100644
--- a/libcxx/include/concepts
+++ b/libcxx/include/concepts
@@ -158,11 +158,8 @@ namespace std {
 
 #include <version>
 
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 17
+#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
 #  include <cstddef>
-#endif
-
-#if _LIBCPP_STD_VER <= 20 && !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES)
 #  include <type_traits>
 #endif
 
diff --git a/libcxx/include/coroutine b/libcxx/include/coroutine
index ee54388ad5aaf8..18601717768c07 100644
--- a/libcxx/include/coroutine
+++ b/libcxx/include/coroutine
@@ -59,6 +59,7 @@ struct suspend_always;
 #endif
 
 #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+#  include <cstddef>
 #  include <iosfwd>
 #  include <limits>
 #  include <type_traits>
diff --git a/libcxx/include/exception b/libcxx/include/exception
index 64463e02cb16aa..88eaaf06bf4a26 100644
--- a/libcxx/include/exception
+++ b/libcxx/include/exception
@@ -89,6 +89,7 @@ template <class E> void rethrow_if_nested(const E& e);
 #endif
 
 #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+#  include <cstddef>
 #  include <cstdlib>
 #  include <type_traits>
 #endif
diff --git a/libcxx/include/experimental/__simd/aligned_tag.h b/libcxx/include/experimental/__simd/aligned_tag.h
index e364e146a60116..d208bf5c4fbb97 100644
--- a/libcxx/include/experimental/__simd/aligned_tag.h
+++ b/libcxx/include/experimental/__simd/aligned_tag.h
@@ -11,9 +11,9 @@
 #define _LIBCPP_EXPERIMENTAL___SIMD_ALIGNED_TAG_H
 
 #include <__config>
+#include <__cstddef/size_t.h>
 #include <__memory/assume_aligned.h>
 #include <__type_traits/remove_const.h>
-#include <cstddef>
 #include <experimental/__simd/traits.h>
 
 #if _LIBCPP_STD_VER >= 17 && defined(_LIBCPP_ENABLE_EXPERIMENTAL)
diff --git a/libcxx/include/experimental/__simd/declaration.h b/libcxx/include/experimental/__simd/declaration.h
index 2ac7224159cf35..1b4fcf958516c9 100644
--- a/libcxx/include/experimental/__simd/declaration.h
+++ b/libcxx/include/experimental/__simd/declaration.h
@@ -11,7 +11,7 @@
 #define _LIBCPP_EXPERIMENTAL___SIMD_DECLARATION_H
 
 #include <__config>
-#include <cstddef>
+#include <__cstddef/size_t.h>
 
 #if _LIBCPP_STD_VER >= 17 && defined(_LIBCPP_ENABLE_EXPERIMENTAL)
 
diff --git a/libcxx/include/experimental/__simd/reference.h b/libcxx/include/experimental/__simd/reference.h
index cba460baaa95bb..b9fe962348adc9 100644
--- a/libcxx/include/experimental/__simd/reference.h
+++ b/libcxx/include/experimental/__simd/reference.h
@@ -11,13 +11,13 @@
 #define _LIBCPP_EXPERIMENTAL___SIMD_REFERENCE_H
 
 #include <__config>
+#include <__cstddef/size_t.h>
 #include <__type_traits/enable_if.h>
 #include <__type_traits/is_assignable.h>
 #include <__type_traits/is_same.h>
 #include <__utility/declval.h>
 #include <__utility/forward.h>
 #include <__utility/move.h>
-#include <cstddef>
 #include <experimental/__simd/utility.h>
 
 _LIBCPP_PUSH_MACROS
diff --git a/libcxx/include/experimental/__simd/scalar.h b/libcxx/include/experimental/__simd/scalar.h
index a76933e1a5849d..9d59f8096e36c7 100644
--- a/libcxx/include/experimental/__simd/scalar.h
+++ b/libcxx/include/experimental/__simd/scalar.h
@@ -12,8 +12,8 @@
 
 #include <__assert>
 #include <__config>
+#include <__cstddef/size_t.h>
 #include <__type_traits/integral_constant.h>
-#include <cstddef>
 #include <experimental/__simd/declaration.h>
 #include <experimental/__simd/traits.h>
 
diff --git a/libcxx/include/experimental/__simd/simd.h b/libcxx/include/experimental/__simd/simd.h
index 2c65d19e67b36f..69373779541c11 100644
--- a/libcxx/include/experimental/__simd/simd.h
+++ b/libcxx/include/experimental/__simd/simd.h
@@ -11,11 +11,11 @@
 #define _LIBCPP_EXPERIMENTAL___SIMD_SIMD_H
 
 #include <__config>
+#include <__cstddef/size_t.h>
 #include <__type_traits/enable_if.h>
 #include <__type_traits/is_same.h>
 #include <__type_traits/remove_cvref.h>
 #include <__utility/forward.h>
-#include <cstddef>
 #include <experimental/__simd/declaration.h>
 #include <experimental/__simd/reference.h>
 #include <experimental/__simd/traits.h>
diff --git a/libcxx/include/experimental/__simd/simd_mask.h b/libcxx/include/experimental/__simd/simd_mask.h
index 55273194153134..27e7d50d4956b6 100644
--- a/libcxx/include/experimental/__simd/simd_mask.h
+++ b/libcxx/include/experimental/__simd/simd_mask.h
@@ -11,9 +11,9 @@
 #define _LIBCPP_EXPERIMENTAL___SIMD_SIMD_MASK_H
 
 #include <__config>
+#include <__cstddef/size_t.h>
 #include <__type_traits/enable_if.h>
 #include <__type_traits/is_same.h>
-#include <cstddef>
 #include <experimental/__simd/declaration.h>
 #include <experimental/__simd/reference.h>
 #include <experimental/__simd/traits.h>
diff --git a/libcxx/include/experimental/__simd/traits.h b/libcxx/include/experimental/__simd/traits.h
index b817df604ef72e..0bcc2eeba5ce8b 100644
--- a/libcxx/include/experimental/__simd/traits.h
+++ b/libcxx/include/experimental/__simd/traits.h
@@ -12,9 +12,9 @@
 
 #include <__bit/bit_ceil.h>
 #include <__config>
+#include <__cstddef/size_t.h>
 #include <__type_traits/integral_constant.h>
 #include <__type_traits/is_same.h>
-#include <cstddef>
 #include <experimental/__simd/declaration.h>
 #include <experimental/__simd/utility.h>
 
diff --git a/libcxx/include/experimental/__simd/utility.h b/libcxx/include/experimental/__simd/utility.h
index 0103b06b719532..2d902613a86bd0 100644
--- a/libcxx/include/experimental/__simd/utility.h
+++ b/libcxx/include/experimental/__simd/utility.h
@@ -11,6 +11,7 @@
 #define _LIBCPP_EXPERIMENTAL___SIMD_UTILITY_H
 
 #include <__config>
+#include <__cstddef/size_t.h>
 #include <__type_traits/is_arithmetic.h>
 #include <__type_traits/is_const.h>
 #include <__type_traits/is_constant_evaluated.h>
@@ -21,7 +22,6 @@
 #include <__type_traits/void_t.h>
 #include <__utility/declval.h>
 #include <__utility/integer_sequence.h>
-#include <cstddef>
 #include <cstdint>
 #include <limits>
 
diff --git a/libcxx/include/experimental/__simd/vec_ext.h b/libcxx/include/experimental/__simd/vec_ext.h
index 1f707cf3e18424..acfa73aa1040ad 100644
--- a/libcxx/include/experimental/__simd/vec_ext.h
+++ b/libcxx/include/experimental/__simd/vec_ext.h
@@ -13,10 +13,10 @@
 #include <__assert>
 #include <__bit/bit_ceil.h>
 #include <__config>
+#include <__cstddef/size_t.h>
 #include <__type_traits/integral_constant.h>
 #include <__utility/forward.h>
 #include <__utility/integer_sequence.h>
-#include <cstddef>
 #include <experimental/__simd/declaration.h>
 #include <experimental/__simd/traits.h>
 #include <experimental/__simd/utility.h>
diff --git a/libcxx/include/experimental/iterator b/libcxx/include/experimental/iterator
index edfe6e707bcec9..e110d356bcdbba 100644
--- a/libcxx/include/experimental/iterator
+++ b/libcxx/include/experimental/iterator
@@ -120,6 +120,7 @@ _LIBCPP_END_NAMESPACE_LFTS
 _LIBCPP_POP_MACROS
 
 #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+#  include <cstddef>
 #  include <iosfwd>
 #  include <type_traits>
 #endif
diff --git a/libcxx/include/experimental/memory b/libcxx/include/experimental/memory
index bf8a154690af01..48e42a0a88a649 100644
--- a/libcxx/include/experimental/memory
+++ b/libcxx/include/experimental/memory
@@ -50,6 +50,8 @@ public:
 */
 
 #include <__config>
+#include <__cstddef/nullptr_t.h>
+#include <__cstddef/size_t.h>
 #include <__functional/hash.h>
 #include <__functional/operations.h>
 #include <__type_traits/add_lvalue_reference.h>
@@ -57,7 +59,7 @@ public:
 #include <__type_traits/common_type.h>
 #include <__type_traits/enable_if.h>
 #include <__type_traits/is_convertible.h>
-#include <cstddef>
+#include <version>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
@@ -192,6 +194,7 @@ _LIBCPP_END_NAMESPACE_STD
 #endif // _LIBCPP_ENABLE_EXPERIMENTAL
 
 #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+#  include <cstddef>
 #  include <limits>
 #endif
 
diff --git a/libcxx/include/experimental/propagate_const b/libcxx/include/experimental/propagate_const
index 510d374bb4bf94..8466d4e9c7ef3c 100644
--- a/libcxx/include/experimental/propagate_const
+++ b/libcxx/include/experimental/propagate_const
@@ -108,6 +108,8 @@
 */
 
 #include <__config>
+#include <__cstddef/nullptr_t.h>
+#include <__cstddef/size_t.h>
 #include <__functional/operations.h>
 #include <__fwd/functional.h>
 #include <__type_traits/conditional.h>
@@ -128,7 +130,7 @@
 #include <__utility/forward.h>
 #include <__utility/move.h>
 #include <__utility/swap.h>
-#include <cstddef>
+#include <version>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
@@ -484,6 +486,7 @@ _LIBCPP_END_NAMESPACE_STD
 _LIBCPP_POP_MACROS
 
 #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+#  include <cstddef>
 #  include <type_traits>
 #endif
 
diff --git a/libcxx/include/experimental/simd b/libcxx/include/experimental/simd
index 35120b4b4aab42..1a868513d160b6 100644
--- a/libcxx/include/experimental/simd
+++ b/libcxx/include/experimental/simd
@@ -85,4 +85,8 @@ inline namespace parallelism_v2 {
 #include <experimental/__simd/traits.h>
 #include <experimental/__simd/vec_ext.h>
 
+#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+#  include <cstddef>
+#endif
+
 #endif /* _LIBCPP_EXPERIMENTAL_SIMD */
diff --git a/libcxx/include/experimental/type_traits b/libcxx/include/experimental/type_traits
index a4bb59afaf4ac2..6980fc3c51e465 100644
--- a/libcxx/include/experimental/type_traits
+++ b/libcxx/include/experimental/type_traits
@@ -148,6 +148,10 @@ constexpr bool is_detected_convertible_v = is_detected_convertible<_To, _Op, _Ar
 
 _LIBCPP_END_NAMESPACE_LFTS
 
+#  if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+#    include <cstddef>
+#  endif
+
 #endif /* _LIBCPP_STD_VER >= 14 */
 
 #endif /* _LIBCPP_EXPERIMENTAL_TYPE_TRAITS */
diff --git a/libcxx/include/experimental/utility b/libcxx/include/experimental/utility
index cbc7ad140e40c1..00151b967e496d 100644
--- a/libcxx/include/experimental/utility
+++ b/libcxx/include/experimental/utility
@@ -43,4 +43,8 @@ struct _LIBCPP_TEMPLATE_VIS erased_type {};
 
 _LIBCPP_END_NAMESPACE_LFTS
 
+#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+#  include <cstddef>
+#endif
+
 #endif /* _LIBCPP_EXPERIMENTAL_UTILITY */
diff --git a/libcxx/include/initializer_list b/libcxx/include/initializer_list
index 680ca1cd20d550..8b9325069c1296 100644
--- a/libcxx/include/initializer_list
+++ b/libcxx/include/initializer_list
@@ -43,7 +43,8 @@ template<class E> const E* end(initializer_list<E> il) noexcept; // constexpr in
 */
 
 #include <__config>
-#include <cstddef>
+#include <__cstddef/size_t.h>
+#include <version>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
@@ -95,4 +96,8 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Ep* end(initia
 
 } // namespace std
 
+#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+#  include <cstddef>
+#endif
+
 #endif // _LIBCPP_INITIALIZER_LIST
diff --git a/libcxx/include/iterator b/libcxx/include/iterator
index fca75f0a19ed1b..63fbae220b604e 100644
--- a/libcxx/include/iterator
+++ b/libcxx/include/iterator
@@ -743,6 +743,7 @@ template <class E> constexpr const E* data(initializer_list<E> il) noexcept;
 #endif
 
 #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+#  include <cstddef>
 #  include <cstdlib>
 #  include <exception>
 #  include <new>
diff --git a/libcxx/include/latch b/libcxx/include/latch
index b56e49bc768bf9..92dadf68bcaabb 100644
--- a/libcxx/include/latch
+++ b/libcxx/include/latch
@@ -48,7 +48,7 @@ namespace std
 #  include <__atomic/atomic_base.h>
 #  include <__atomic/atomic_sync.h>
 #  include <__atomic/memory_order.h>
-#  include <cstddef>
+#  include <__cstddef/ptrdiff_t.h>
 #  include <limits>
 #  include <version>
 
@@ -124,6 +124,7 @@ _LIBCPP_POP_MACROS
 
 #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
 #  include <atomic>
+#  include <cstddef>
 #endif
 
 #endif // _LIBCPP_LATCH
diff --git a/libcxx/include/module.modulemap b/libcxx/include/module.modulemap
index cc419122ed2a64..b3b0c66f4e766c 100644
--- a/libcxx/include/module.modulemap
+++ b/libcxx/include/module.modulemap
@@ -441,7 +441,10 @@ module std_cstdbool [system] {
 module std_cstddef [system] {
   header "cstddef"
   module byte         { header "__cstddef/byte.h" }
-  module max_align_t  { header "__cstddef/max_align_t.h" }
+  module max_align_t  {
+    header "__cstddef/max_align_t.h"
+    export *
+  }
   module nullptr_t    { header "__cstddef/nullptr_t.h" }
   module ptrdiff_t    { header "__cstddef/ptrdiff_t.h" }
   module size_t       { header "__cstddef/size_t.h" }
@@ -1531,6 +1534,7 @@ module std_private_memory_temp_value                      [system] { header "__m
 module std_private_memory_temporary_buffer                [system] {
   header "__memory/temporary_buffer.h"
   export std_private_utility_pair
+  export std_cstddef.ptrdiff_t
 }
 module std_private_memory_uninitialized_algorithms        [system] {
   header "__memory/uninitialized_algorithms.h"
diff --git a/libcxx/include/mutex b/libcxx/include/mutex
index 02c52dd72f02b0..427fce5f3ec463 100644
--- a/libcxx/include/mutex
+++ b/libcxx/include/mutex
@@ -199,7 +199,6 @@ template<class Callable, class ...Args>
 #include <__thread/id.h>
 #include <__thread/support.h>
 #include <__utility/forward.h>
-#include <cstddef>
 #include <limits>
 #ifndef _LIBCPP_CXX03_LANG
 #  include <tuple>
diff --git a/libcxx/include/new b/libcxx/include/new
index 3252b0bb1abcdb..79b6ee95201a28 100644
--- a/libcxx/include/new
+++ b/libcxx/include/new
@@ -87,12 +87,12 @@ void  operator delete[](void* ptr, void*) noexcept;
 */
 
 #include <__config>
+#include <__cstddef/size_t.h>
 #include <__exception/exception.h>
 #include <__type_traits/is_function.h>
 #include <__type_traits/is_same.h>
 #include <__type_traits/remove_cv.h>
 #include <__verbose_abort>
-#include <cstddef>
 #include <version>
 
 #if defined(_LIBCPP_ABI_VCRUNTIME)
@@ -361,6 +361,7 @@ inline constexpr size_t hardware_constructive_interference_size = __GCC_CONSTRUC
 _LIBCPP_END_NAMESPACE_STD
 
 #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+#  include <cstddef>
 #  include <cstdlib>
 #  include <type_traits>
 #endif
diff --git a/libcxx/include/numbers b/libcxx/include/numbers
index f48ba4baf38ffd..191563c3d8a5ff 100644
--- a/libcxx/include/numbers
+++ b/libcxx/include/numbers
@@ -158,6 +158,7 @@ _LIBCPP_END_NAMESPACE_STD
 
 #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
 #  include <concepts>
+#  include <cstddef>
 #  include <type_traits>
 #endif
 
diff --git a/libcxx/include/semaphore b/libcxx/include/semaphore
index bf6317c587e2f9..98122c96459a29 100644
--- a/libcxx/include/semaphore
+++ b/libcxx/include/semaphore
@@ -54,10 +54,10 @@ using binary_semaphore = counting_semaphore<1>; // since C++20
 #  include <__atomic/atomic_sync.h>
 #  include <__atomic/memory_order.h>
 #  include <__chrono/time_point.h>
+#  include <__cstddef/ptrdiff_t.h>
 #  include <__thread/poll_with_backoff.h>
 #  include <__thread/support.h>
 #  include <__thread/timed_backoff_policy.h>
-#  include <cstddef>
 #  include <limits>
 #  include <version>
 
@@ -181,6 +181,7 @@ _LIBCPP_POP_MACROS
 
 #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
 #  include <atomic>
+#  include <cstddef>
 #endif
 
 #endif // _LIBCPP_SEMAPHORE
diff --git a/libcxx/include/span b/libcxx/include/span
index a32f7a372e2ae1..896a3cd890186c 100644
--- a/libcxx/include/span
+++ b/libcxx/include/span
@@ -148,6 +148,8 @@ template<class R>
 #include <__concepts/convertible_to.h>
 #include <__concepts/equality_comparable.h>
 #include <__config>
+#include <__cstddef/byte.h>
+#include <__cstddef/ptrdiff_t.h>
 #include <__fwd/array.h>
 #include <__fwd/span.h>
 #include <__iterator/bounded_iter.h>
@@ -173,7 +175,6 @@ template<class R>
 #include <__type_traits/remove_reference.h>
 #include <__type_traits/type_identity.h>
 #include <__utility/forward.h>
-#include <cstddef> // for byte
 #include <initializer_list>
 #include <stdexcept>
 #include <version>
diff --git a/libcxx/include/stdexcept b/libcxx/include/stdexcept
index bdfc27aeac3742..b848537730b43b 100644
--- a/libcxx/include/stdexcept
+++ b/libcxx/include/stdexcept
@@ -278,6 +278,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
 _LIBCPP_END_NAMESPACE_STD
 
 #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+#  include <cstddef>
 #  include <cstdlib>
 #  include <exception>
 #  include <iosfwd>
diff --git a/libcxx/include/stop_token b/libcxx/include/stop_token
index d4e651d9541f4e..cf8d0cf9b91916 100644
--- a/libcxx/include/stop_token
+++ b/libcxx/include/stop_token
@@ -50,6 +50,7 @@ namespace std {
 #endif // !defined(_LIBCPP_HAS_NO_THREADS)
 
 #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+#  include <cstddef>
 #  include <iosfwd>
 #endif
 
diff --git a/libcxx/include/string_view b/libcxx/include/string_view
index 3b32117386388c..882970359454e7 100644
--- a/libcxx/include/string_view
+++ b/libcxx/include/string_view
@@ -233,7 +233,6 @@ namespace std {
 #include <__type_traits/remove_cvref.h>
 #include <__type_traits/remove_reference.h>
 #include <__type_traits/type_identity.h>
-#include <cstddef>
 #include <iosfwd>
 #include <limits>
 #include <stdexcept>
diff --git a/libcxx/include/tuple b/libcxx/include/tuple
index 5161c2aa97c2ba..a31985fe9c2280 100644
--- a/libcxx/include/tuple
+++ b/libcxx/include/tuple
@@ -213,6 +213,7 @@ template <class... Types>
 #include <__compare/common_comparison_category.h>
 #include <__compare/synth_three_way.h>
 #include <__config>
+#include <__cstddef/size_t.h>
 #include <__functional/invoke.h>
 #include <__fwd/array.h>
 #include <__fwd/pair.h>
@@ -259,7 +260,6 @@ template <class... Types>
 #include <__utility/move.h>
 #include <__utility/piecewise_construct.h>
 #include <__utility/swap.h>
-#include <cstddef>
 #include <version>
 
 // standard-mandated includes
@@ -1408,6 +1408,7 @@ _LIBCPP_POP_MACROS
 // clang-format on
 
 #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+#  include <cstddef>
 #  include <exception>
 #  include <iosfwd>
 #  include <new>
diff --git a/libcxx/include/typeindex b/libcxx/include/typeindex
index 6398aa40d616a7..9f8e65befcba41 100644
--- a/libcxx/include/typeindex
+++ b/libcxx/include/typeindex
@@ -98,6 +98,7 @@ struct _LIBCPP_TEMPLATE_VIS hash<type_index> : public __unary_function<type_inde
 _LIBCPP_END_NAMESPACE_STD
 
 #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+#  include <cstddef>
 #  include <iosfwd>
 #  include <new>
 #  include <utility>
diff --git a/libcxx/include/typeinfo b/libcxx/include/typeinfo
index a44fa4d73ee580..4a7a88723f86ae 100644
--- a/libcxx/include/typeinfo
+++ b/libcxx/include/typeinfo
@@ -57,12 +57,13 @@ public:
 */
 
 #include <__config>
+#include <__cstddef/size_t.h>
 #include <__exception/exception.h>
 #include <__type_traits/integral_constant.h>
 #include <__type_traits/is_constant_evaluated.h>
 #include <__verbose_abort>
-#include <cstddef>
 #include <cstdint>
+#include <version>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
@@ -383,6 +384,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
 _LIBCPP_END_NAMESPACE_STD
 
 #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+#  include <cstddef>
 #  include <cstdlib>
 #  include <type_traits>
 #endif
diff --git a/libcxx/include/utility b/libcxx/include/utility
index f97907fbf72e9d..138cc3ba31893e 100644
--- a/libcxx/include/utility
+++ b/libcxx/include/utility
@@ -301,6 +301,7 @@ template <class T>
 #endif
 
 #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+#  include <cstddef>
 #  include <cstdlib>
 #  include <iosfwd>
 #  include <type_traits>
diff --git a/libcxx/include/valarray b/libcxx/include/valarray
index 44341eb2ba6c14..c8c520d35b335b 100644
--- a/libcxx/include/valarray
+++ b/libcxx/include/valarray
@@ -352,6 +352,7 @@ template <class T> unspecified2 end(const valarray<T>& v);
 #include <__algorithm/unwrap_iter.h>
 #include <__assert>
 #include <__config>
+#include <__cstddef/ptrdiff_t.h>
 #include <__functional/operations.h>
 #include <__memory/addressof.h>
 #include <__memory/allocator.h>
@@ -361,7 +362,6 @@ template <class T> unspecified2 end(const valarray<T>& v);
 #include <__utility/move.h>
 #include <__utility/swap.h>
 #include <cmath>
-#include <cstddef>
 #include <new>
 #include <version>
 
diff --git a/libcxx/include/variant b/libcxx/include/variant
index 2fa5623d4f118a..443d22210fdd9c 100644
--- a/libcxx/include/variant
+++ b/libcxx/include/variant
@@ -1625,6 +1625,7 @@ _LIBCPP_END_NAMESPACE_STD
 _LIBCPP_POP_MACROS
 
 #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+#  include <cstddef>
 #  include <exception>
 #  include <tuple>
 #  include <type_traits>
diff --git a/libcxx/src/memory_resource.cpp b/libcxx/src/memory_resource.cpp
index d2ff3509c5a31e..ba966495a91ea3 100644
--- a/libcxx/src/memory_resource.cpp
+++ b/libcxx/src/memory_resource.cpp
@@ -6,6 +6,7 @@
 //
 //===----------------------------------------------------------------------===//
 
+#include <cstddef>
 #include <memory>
 #include <memory_resource>
 
diff --git a/libcxx/test/libcxx/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.cxx1z.pass.cpp b/libcxx/test/libcxx/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.cxx1z.pass.cpp
index c1acc100a66098..4e51014f20b18b 100644
--- a/libcxx/test/libcxx/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.cxx1z.pass.cpp
+++ b/libcxx/test/libcxx/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.cxx1z.pass.cpp
@@ -26,6 +26,7 @@
 // ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
 
 #include <algorithm>
+#include <cstddef>
 #include <vector>
 
 #include "test_macros.h"
diff --git a/libcxx/test/libcxx/containers/sequences/deque/asan_turning_off.pass.cpp b/libcxx/test/libcxx/containers/sequences/deque/asan_turning_off.pass.cpp
index e9b9cde64ee91a..b31775a873481d 100644
--- a/libcxx/test/libcxx/containers/sequences/deque/asan_turning_off.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/deque/asan_turning_off.pass.cpp
@@ -17,6 +17,7 @@
 // This test confirms that those allocators work after turning off annotations.
 
 #include <cassert>
+#include <cstddef>
 #include <deque>
 #include <new>
 
diff --git a/libcxx/test/libcxx/transitive_includes/cxx23.csv b/libcxx/test/libcxx/transitive_includes/cxx23.csv
index 453f139f542bf3..90fb04b324bdc9 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx23.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx23.csv
@@ -1,7 +1,6 @@
 algorithm cctype
 algorithm climits
 algorithm compare
-algorithm cstddef
 algorithm cstdint
 algorithm cstring
 algorithm ctime
@@ -15,7 +14,6 @@ algorithm optional
 algorithm ratio
 algorithm tuple
 algorithm version
-any cstddef
 any cstdint
 any cstring
 any initializer_list
@@ -25,7 +23,6 @@ any typeinfo
 any version
 array cctype
 array compare
-array cstddef
 array cstdint
 array cwchar
 array cwctype
@@ -35,7 +32,6 @@ array new
 array stdexcept
 array version
 atomic climits
-atomic cstddef
 atomic cstdint
 atomic cstring
 atomic ctime
@@ -43,7 +39,6 @@ atomic limits
 atomic ratio
 atomic version
 barrier climits
-barrier cstddef
 barrier cstdint
 barrier cstring
 barrier ctime
@@ -57,7 +52,6 @@ bit version
 bitset cctype
 bitset climits
 bitset compare
-bitset cstddef
 bitset cstdint
 bitset cstdio
 bitset cstring
@@ -105,7 +99,6 @@ ccomplex tuple
 ccomplex typeinfo
 ccomplex version
 charconv cerrno
-charconv cstddef
 charconv cstdint
 charconv initializer_list
 charconv limits
@@ -171,7 +164,6 @@ codecvt string_view
 codecvt tuple
 codecvt typeinfo
 codecvt version
-compare cstddef
 compare cstdint
 compare limits
 compare version
@@ -206,14 +198,12 @@ complex string_view
 complex tuple
 complex typeinfo
 complex version
-concepts cstddef
 concepts version
 condition_variable atomic
 condition_variable cctype
 condition_variable cerrno
 condition_variable climits
 condition_variable compare
-condition_variable cstddef
 condition_variable cstdint
 condition_variable cstdio
 condition_variable cstring
@@ -232,7 +222,6 @@ condition_variable tuple
 condition_variable typeinfo
 condition_variable version
 coroutine compare
-coroutine cstddef
 coroutine cstdint
 coroutine cstring
 coroutine limits
@@ -276,7 +265,6 @@ cwchar cwctype
 cwctype cctype
 deque cctype
 deque compare
-deque cstddef
 deque cstdint
 deque cstring
 deque cwchar
@@ -287,21 +275,18 @@ deque new
 deque stdexcept
 deque tuple
 deque version
-exception cstddef
 exception cstdint
 exception cstdlib
 exception new
 exception typeinfo
 exception version
 execution version
-expected cstddef
 expected cstdint
 expected initializer_list
 expected new
 expected version
 experimental/iterator compare
 experimental/iterator concepts
-experimental/iterator cstddef
 experimental/iterator cstdint
 experimental/iterator cstring
 experimental/iterator initializer_list
@@ -311,23 +296,18 @@ experimental/iterator limits
 experimental/iterator new
 experimental/iterator variant
 experimental/iterator version
-experimental/memory cstddef
 experimental/memory cstdint
 experimental/memory cstring
 experimental/memory version
-experimental/propagate_const cstddef
 experimental/propagate_const version
-experimental/simd cstddef
 experimental/simd cstdint
 experimental/simd limits
 experimental/simd version
-experimental/type_traits cstddef
 experimental/type_traits cstdint
 experimental/type_traits initializer_list
 experimental/type_traits type_traits
 experimental/type_traits version
 experimental/utility compare
-experimental/utility cstddef
 experimental/utility cstdint
 experimental/utility initializer_list
 experimental/utility limits
@@ -390,7 +370,6 @@ format typeinfo
 format version
 forward_list cctype
 forward_list compare
-forward_list cstddef
 forward_list cstdint
 forward_list cwchar
 forward_list cwctype
@@ -496,7 +475,6 @@ future thread
 future tuple
 future typeinfo
 future version
-initializer_list cstddef
 initializer_list version
 iomanip bitset
 iomanip cctype
@@ -617,7 +595,6 @@ istream typeinfo
 istream version
 iterator compare
 iterator concepts
-iterator cstddef
 iterator cstdint
 iterator cstring
 iterator initializer_list
@@ -627,7 +604,6 @@ iterator new
 iterator variant
 iterator version
 latch climits
-latch cstddef
 latch cstdint
 latch cstring
 latch ctime
@@ -637,7 +613,6 @@ latch version
 limits version
 list cctype
 list compare
-list cstddef
 list cstdint
 list cstring
 list cwchar
@@ -675,7 +650,6 @@ locale typeinfo
 locale version
 map cctype
 map compare
-map cstddef
 map cstdint
 map cstring
 map cwchar
@@ -689,10 +663,8 @@ map tuple
 map version
 mdspan array
 mdspan cctype
-mdspan cinttypes
 mdspan compare
 mdspan concepts
-mdspan cstddef
 mdspan cstdint
 mdspan cwchar
 mdspan cwctype
@@ -703,7 +675,6 @@ mdspan span
 mdspan stdexcept
 mdspan version
 memory compare
-memory cstddef
 memory cstdint
 memory cstring
 memory initializer_list
@@ -716,7 +687,6 @@ memory_resource cctype
 memory_resource cerrno
 memory_resource climits
 memory_resource compare
-memory_resource cstddef
 memory_resource cstdint
 memory_resource cstdio
 memory_resource cstring
@@ -739,7 +709,6 @@ mutex cctype
 mutex cerrno
 mutex climits
 mutex compare
-mutex cstddef
 mutex cstdint
 mutex cstdio
 mutex cstring
@@ -757,12 +726,10 @@ mutex string_view
 mutex tuple
 mutex typeinfo
 mutex version
-new cstddef
 new version
 numbers version
 numeric climits
 numeric compare
-numeric cstddef
 numeric cstdint
 numeric cstring
 numeric ctime
@@ -774,7 +741,6 @@ numeric ratio
 numeric tuple
 numeric version
 optional compare
-optional cstddef
 optional cstdint
 optional cstring
 optional initializer_list
@@ -897,7 +863,6 @@ random version
 ranges cctype
 ranges compare
 ranges concepts
-ranges cstddef
 ranges cstdint
 ranges cstring
 ranges cwchar
@@ -942,14 +907,12 @@ regex typeinfo
 regex vector
 regex version
 scoped_allocator compare
-scoped_allocator cstddef
 scoped_allocator cstdint
 scoped_allocator limits
 scoped_allocator new
 scoped_allocator tuple
 scoped_allocator version
 semaphore climits
-semaphore cstddef
 semaphore cstdint
 semaphore cstring
 semaphore ctime
@@ -958,7 +921,6 @@ semaphore ratio
 semaphore version
 set cctype
 set compare
-set cstddef
 set cstdint
 set cstring
 set cwchar
@@ -973,7 +935,6 @@ shared_mutex cctype
 shared_mutex cerrno
 shared_mutex climits
 shared_mutex compare
-shared_mutex cstddef
 shared_mutex cstdint
 shared_mutex cstdio
 shared_mutex cstring
@@ -992,7 +953,6 @@ shared_mutex tuple
 shared_mutex version
 source_location cstdint
 source_location version
-span cstddef
 span initializer_list
 span limits
 span stdexcept
@@ -1028,7 +988,6 @@ sstream typeinfo
 sstream version
 stack cctype
 stack compare
-stack cstddef
 stack cstdint
 stack cstring
 stack cwchar
@@ -1042,7 +1001,6 @@ stack tuple
 stack version
 stop_token atomic
 stop_token climits
-stop_token cstddef
 stop_token cstdint
 stop_token cstring
 stop_token ctime
@@ -1077,7 +1035,6 @@ streambuf version
 string cctype
 string climits
 string compare
-string cstddef
 string cstdint
 string cstdio
 string cstring
@@ -1093,7 +1050,6 @@ string tuple
 string version
 string_view cctype
 string_view compare
-string_view cstddef
 string_view cstdint
 string_view cstdio
 string_view cstring
@@ -1181,7 +1137,6 @@ system_error cctype
 system_error cerrno
 system_error climits
 system_error compare
-system_error cstddef
 system_error cstdint
 system_error cstdio
 system_error cstring
@@ -1229,23 +1184,19 @@ thread tuple
 thread typeinfo
 thread version
 tuple compare
-tuple cstddef
 tuple cstdint
 tuple limits
 tuple version
 type_traits cstdint
 type_traits version
 typeindex compare
-typeindex cstddef
 typeindex cstdint
 typeindex limits
 typeindex typeinfo
 typeindex version
-typeinfo cstddef
 typeinfo cstdint
 typeinfo version
 unordered_map compare
-unordered_map cstddef
 unordered_map cstdint
 unordered_map cstring
 unordered_map initializer_list
@@ -1256,7 +1207,6 @@ unordered_map stdexcept
 unordered_map tuple
 unordered_map version
 unordered_set compare
-unordered_set cstddef
 unordered_set cstdint
 unordered_set cstring
 unordered_set initializer_list
@@ -1266,20 +1216,17 @@ unordered_set optional
 unordered_set tuple
 unordered_set version
 utility compare
-utility cstddef
 utility cstdint
 utility initializer_list
 utility limits
 utility version
 valarray cmath
-valarray cstddef
 valarray cstdint
 valarray initializer_list
 valarray limits
 valarray new
 valarray version
 variant compare
-variant cstddef
 variant cstdint
 variant cstring
 variant initializer_list
diff --git a/libcxx/test/libcxx/transitive_includes/cxx26.csv b/libcxx/test/libcxx/transitive_includes/cxx26.csv
index 453f139f542bf3..90fb04b324bdc9 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx26.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx26.csv
@@ -1,7 +1,6 @@
 algorithm cctype
 algorithm climits
 algorithm compare
-algorithm cstddef
 algorithm cstdint
 algorithm cstring
 algorithm ctime
@@ -15,7 +14,6 @@ algorithm optional
 algorithm ratio
 algorithm tuple
 algorithm version
-any cstddef
 any cstdint
 any cstring
 any initializer_list
@@ -25,7 +23,6 @@ any typeinfo
 any version
 array cctype
 array compare
-array cstddef
 array cstdint
 array cwchar
 array cwctype
@@ -35,7 +32,6 @@ array new
 array stdexcept
 array version
 atomic climits
-atomic cstddef
 atomic cstdint
 atomic cstring
 atomic ctime
@@ -43,7 +39,6 @@ atomic limits
 atomic ratio
 atomic version
 barrier climits
-barrier cstddef
 barrier cstdint
 barrier cstring
 barrier ctime
@@ -57,7 +52,6 @@ bit version
 bitset cctype
 bitset climits
 bitset compare
-bitset cstddef
 bitset cstdint
 bitset cstdio
 bitset cstring
@@ -105,7 +99,6 @@ ccomplex tuple
 ccomplex typeinfo
 ccomplex version
 charconv cerrno
-charconv cstddef
 charconv cstdint
 charconv initializer_list
 charconv limits
@@ -171,7 +164,6 @@ codecvt string_view
 codecvt tuple
 codecvt typeinfo
 codecvt version
-compare cstddef
 compare cstdint
 compare limits
 compare version
@@ -206,14 +198,12 @@ complex string_view
 complex tuple
 complex typeinfo
 complex version
-concepts cstddef
 concepts version
 condition_variable atomic
 condition_variable cctype
 condition_variable cerrno
 condition_variable climits
 condition_variable compare
-condition_variable cstddef
 condition_variable cstdint
 condition_variable cstdio
 condition_variable cstring
@@ -232,7 +222,6 @@ condition_variable tuple
 condition_variable typeinfo
 condition_variable version
 coroutine compare
-coroutine cstddef
 coroutine cstdint
 coroutine cstring
 coroutine limits
@@ -276,7 +265,6 @@ cwchar cwctype
 cwctype cctype
 deque cctype
 deque compare
-deque cstddef
 deque cstdint
 deque cstring
 deque cwchar
@@ -287,21 +275,18 @@ deque new
 deque stdexcept
 deque tuple
 deque version
-exception cstddef
 exception cstdint
 exception cstdlib
 exception new
 exception typeinfo
 exception version
 execution version
-expected cstddef
 expected cstdint
 expected initializer_list
 expected new
 expected version
 experimental/iterator compare
 experimental/iterator concepts
-experimental/iterator cstddef
 experimental/iterator cstdint
 experimental/iterator cstring
 experimental/iterator initializer_list
@@ -311,23 +296,18 @@ experimental/iterator limits
 experimental/iterator new
 experimental/iterator variant
 experimental/iterator version
-experimental/memory cstddef
 experimental/memory cstdint
 experimental/memory cstring
 experimental/memory version
-experimental/propagate_const cstddef
 experimental/propagate_const version
-experimental/simd cstddef
 experimental/simd cstdint
 experimental/simd limits
 experimental/simd version
-experimental/type_traits cstddef
 experimental/type_traits cstdint
 experimental/type_traits initializer_list
 experimental/type_traits type_traits
 experimental/type_traits version
 experimental/utility compare
-experimental/utility cstddef
 experimental/utility cstdint
 experimental/utility initializer_list
 experimental/utility limits
@@ -390,7 +370,6 @@ format typeinfo
 format version
 forward_list cctype
 forward_list compare
-forward_list cstddef
 forward_list cstdint
 forward_list cwchar
 forward_list cwctype
@@ -496,7 +475,6 @@ future thread
 future tuple
 future typeinfo
 future version
-initializer_list cstddef
 initializer_list version
 iomanip bitset
 iomanip cctype
@@ -617,7 +595,6 @@ istream typeinfo
 istream version
 iterator compare
 iterator concepts
-iterator cstddef
 iterator cstdint
 iterator cstring
 iterator initializer_list
@@ -627,7 +604,6 @@ iterator new
 iterator variant
 iterator version
 latch climits
-latch cstddef
 latch cstdint
 latch cstring
 latch ctime
@@ -637,7 +613,6 @@ latch version
 limits version
 list cctype
 list compare
-list cstddef
 list cstdint
 list cstring
 list cwchar
@@ -675,7 +650,6 @@ locale typeinfo
 locale version
 map cctype
 map compare
-map cstddef
 map cstdint
 map cstring
 map cwchar
@@ -689,10 +663,8 @@ map tuple
 map version
 mdspan array
 mdspan cctype
-mdspan cinttypes
 mdspan compare
 mdspan concepts
-mdspan cstddef
 mdspan cstdint
 mdspan cwchar
 mdspan cwctype
@@ -703,7 +675,6 @@ mdspan span
 mdspan stdexcept
 mdspan version
 memory compare
-memory cstddef
 memory cstdint
 memory cstring
 memory initializer_list
@@ -716,7 +687,6 @@ memory_resource cctype
 memory_resource cerrno
 memory_resource climits
 memory_resource compare
-memory_resource cstddef
 memory_resource cstdint
 memory_resource cstdio
 memory_resource cstring
@@ -739,7 +709,6 @@ mutex cctype
 mutex cerrno
 mutex climits
 mutex compare
-mutex cstddef
 mutex cstdint
 mutex cstdio
 mutex cstring
@@ -757,12 +726,10 @@ mutex string_view
 mutex tuple
 mutex typeinfo
 mutex version
-new cstddef
 new version
 numbers version
 numeric climits
 numeric compare
-numeric cstddef
 numeric cstdint
 numeric cstring
 numeric ctime
@@ -774,7 +741,6 @@ numeric ratio
 numeric tuple
 numeric version
 optional compare
-optional cstddef
 optional cstdint
 optional cstring
 optional initializer_list
@@ -897,7 +863,6 @@ random version
 ranges cctype
 ranges compare
 ranges concepts
-ranges cstddef
 ranges cstdint
 ranges cstring
 ranges cwchar
@@ -942,14 +907,12 @@ regex typeinfo
 regex vector
 regex version
 scoped_allocator compare
-scoped_allocator cstddef
 scoped_allocator cstdint
 scoped_allocator limits
 scoped_allocator new
 scoped_allocator tuple
 scoped_allocator version
 semaphore climits
-semaphore cstddef
 semaphore cstdint
 semaphore cstring
 semaphore ctime
@@ -958,7 +921,6 @@ semaphore ratio
 semaphore version
 set cctype
 set compare
-set cstddef
 set cstdint
 set cstring
 set cwchar
@@ -973,7 +935,6 @@ shared_mutex cctype
 shared_mutex cerrno
 shared_mutex climits
 shared_mutex compare
-shared_mutex cstddef
 shared_mutex cstdint
 shared_mutex cstdio
 shared_mutex cstring
@@ -992,7 +953,6 @@ shared_mutex tuple
 shared_mutex version
 source_location cstdint
 source_location version
-span cstddef
 span initializer_list
 span limits
 span stdexcept
@@ -1028,7 +988,6 @@ sstream typeinfo
 sstream version
 stack cctype
 stack compare
-stack cstddef
 stack cstdint
 stack cstring
 stack cwchar
@@ -1042,7 +1001,6 @@ stack tuple
 stack version
 stop_token atomic
 stop_token climits
-stop_token cstddef
 stop_token cstdint
 stop_token cstring
 stop_token ctime
@@ -1077,7 +1035,6 @@ streambuf version
 string cctype
 string climits
 string compare
-string cstddef
 string cstdint
 string cstdio
 string cstring
@@ -1093,7 +1050,6 @@ string tuple
 string version
 string_view cctype
 string_view compare
-string_view cstddef
 string_view cstdint
 string_view cstdio
 string_view cstring
@@ -1181,7 +1137,6 @@ system_error cctype
 system_error cerrno
 system_error climits
 system_error compare
-system_error cstddef
 system_error cstdint
 system_error cstdio
 system_error cstring
@@ -1229,23 +1184,19 @@ thread tuple
 thread typeinfo
 thread version
 tuple compare
-tuple cstddef
 tuple cstdint
 tuple limits
 tuple version
 type_traits cstdint
 type_traits version
 typeindex compare
-typeindex cstddef
 typeindex cstdint
 typeindex limits
 typeindex typeinfo
 typeindex version
-typeinfo cstddef
 typeinfo cstdint
 typeinfo version
 unordered_map compare
-unordered_map cstddef
 unordered_map cstdint
 unordered_map cstring
 unordered_map initializer_list
@@ -1256,7 +1207,6 @@ unordered_map stdexcept
 unordered_map tuple
 unordered_map version
 unordered_set compare
-unordered_set cstddef
 unordered_set cstdint
 unordered_set cstring
 unordered_set initializer_list
@@ -1266,20 +1216,17 @@ unordered_set optional
 unordered_set tuple
 unordered_set version
 utility compare
-utility cstddef
 utility cstdint
 utility initializer_list
 utility limits
 utility version
 valarray cmath
-valarray cstddef
 valarray cstdint
 valarray initializer_list
 valarray limits
 valarray new
 valarray version
 variant compare
-variant cstddef
 variant cstdint
 variant cstring
 variant initializer_list
diff --git a/libcxx/test/libcxx/utilities/template.bitset/includes.pass.cpp b/libcxx/test/libcxx/utilities/template.bitset/includes.pass.cpp
index 42deaaa4b2d37e..214b0eff8d9d26 100644
--- a/libcxx/test/libcxx/utilities/template.bitset/includes.pass.cpp
+++ b/libcxx/test/libcxx/utilities/template.bitset/includes.pass.cpp
@@ -6,16 +6,12 @@
 //
 //===----------------------------------------------------------------------===//
 
-// test that <bitset> includes <cstddef>, <string>, <stdexcept> and <iosfwd>
+// test that <bitset> includes <string>, <stdexcept> and <iosfwd>
 
 #include <bitset>
 
 #include "test_macros.h"
 
-#ifndef _LIBCPP_CSTDDEF
-#error <cstddef> has not been included
-#endif
-
 #ifndef _LIBCPP_STRING
 #error <string> has not been included
 #endif
diff --git a/libcxx/test/std/containers/views/mdspan/extents/CtorTestCombinations.h b/libcxx/test/std/containers/views/mdspan/extents/CtorTestCombinations.h
index 18d4f4b61fb231..36f95704631f50 100644
--- a/libcxx/test/std/containers/views/mdspan/extents/CtorTestCombinations.h
+++ b/libcxx/test/std/containers/views/mdspan/extents/CtorTestCombinations.h
@@ -9,9 +9,10 @@
 
 // <mdspan>
 
-#include <mdspan>
-#include <cassert>
 #include <array>
+#include <cassert>
+#include <cstddef>
+#include <mdspan>
 #include <span>
 
 #include "../ConvertibleToIntegral.h"
diff --git a/libcxx/test/std/containers/views/mdspan/extents/obs_static.pass.cpp b/libcxx/test/std/containers/views/mdspan/extents/obs_static.pass.cpp
index 29dd9e2d270721..1d5f61d02e4ff7 100644
--- a/libcxx/test/std/containers/views/mdspan/extents/obs_static.pass.cpp
+++ b/libcxx/test/std/containers/views/mdspan/extents/obs_static.pass.cpp
@@ -26,8 +26,9 @@
 //   Returns: Di.
 //
 
-#include <mdspan>
 #include <cassert>
+#include <cstddef>
+#include <mdspan>
 #include <span> // dynamic_extent
 #include <utility>
 
diff --git a/libcxx/test/std/containers/views/mdspan/layout_left/ctor.default.pass.cpp b/libcxx/test/std/containers/views/mdspan/layout_left/ctor.default.pass.cpp
index 5a4040317d243f..12c59a4caf10e0 100644
--- a/libcxx/test/std/containers/views/mdspan/layout_left/ctor.default.pass.cpp
+++ b/libcxx/test/std/containers/views/mdspan/layout_left/ctor.default.pass.cpp
@@ -14,9 +14,10 @@
 //
 // constexpr mapping() noexcept = default;
 
-#include <mdspan>
 #include <cassert>
+#include <cstddef>
 #include <cstdint>
+#include <mdspan>
 #include <span> // dynamic_extent
 
 #include "test_macros.h"
diff --git a/libcxx/test/std/containers/views/mdspan/layout_left/ctor.extents.pass.cpp b/libcxx/test/std/containers/views/mdspan/layout_left/ctor.extents.pass.cpp
index 46505cb961bbdf..299012dc5af84d 100644
--- a/libcxx/test/std/containers/views/mdspan/layout_left/ctor.extents.pass.cpp
+++ b/libcxx/test/std/containers/views/mdspan/layout_left/ctor.extents.pass.cpp
@@ -17,9 +17,10 @@
 //
 // Effects: Direct-non-list-initializes extents_ with e.
 
-#include <mdspan>
 #include <cassert>
+#include <cstddef>
 #include <cstdint>
+#include <mdspan>
 #include <span> // dynamic_extent
 
 #include "test_macros.h"
diff --git a/libcxx/test/std/containers/views/mdspan/layout_left/required_span_size.pass.cpp b/libcxx/test/std/containers/views/mdspan/layout_left/required_span_size.pass.cpp
index 4cb111d29827a7..9ad61b0799c15f 100644
--- a/libcxx/test/std/containers/views/mdspan/layout_left/required_span_size.pass.cpp
+++ b/libcxx/test/std/containers/views/mdspan/layout_left/required_span_size.pass.cpp
@@ -14,9 +14,10 @@
 //
 // Returns: extents().fwd-prod-of-extents(extents_type::rank()).
 
-#include <mdspan>
 #include <cassert>
+#include <cstddef>
 #include <cstdint>
+#include <mdspan>
 #include <span> // dynamic_extent
 
 #include "test_macros.h"
diff --git a/libcxx/test/std/containers/views/mdspan/layout_right/ctor.default.pass.cpp b/libcxx/test/std/containers/views/mdspan/layout_right/ctor.default.pass.cpp
index f02174416f33cc..d644b0ff18d82b 100644
--- a/libcxx/test/std/containers/views/mdspan/layout_right/ctor.default.pass.cpp
+++ b/libcxx/test/std/containers/views/mdspan/layout_right/ctor.default.pass.cpp
@@ -14,9 +14,10 @@
 //
 // constexpr mapping() noexcept = default;
 
-#include <mdspan>
 #include <cassert>
+#include <cstddef>
 #include <cstdint>
+#include <mdspan>
 #include <span> // dynamic_extent
 
 #include "test_macros.h"
diff --git a/libcxx/test/std/containers/views/mdspan/layout_right/ctor.extents.pass.cpp b/libcxx/test/std/containers/views/mdspan/layout_right/ctor.extents.pass.cpp
index 9c2c39bc3cb3a5..cd0cff838fac53 100644
--- a/libcxx/test/std/containers/views/mdspan/layout_right/ctor.extents.pass.cpp
+++ b/libcxx/test/std/containers/views/mdspan/layout_right/ctor.extents.pass.cpp
@@ -17,9 +17,10 @@
 //
 // Effects: Direct-non-list-initializes extents_ with e.
 
-#include <mdspan>
 #include <cassert>
+#include <cstddef>
 #include <cstdint>
+#include <mdspan>
 #include <span> // dynamic_extent
 
 #include "test_macros.h"
diff --git a/libcxx/test/std/containers/views/mdspan/layout_right/required_span_size.pass.cpp b/libcxx/test/std/containers/views/mdspan/layout_right/required_span_size.pass.cpp
index 0128d8c26a83e7..0e354b2da54abc 100644
--- a/libcxx/test/std/containers/views/mdspan/layout_right/required_span_size.pass.cpp
+++ b/libcxx/test/std/containers/views/mdspan/layout_right/required_span_size.pass.cpp
@@ -15,9 +15,10 @@
 // Returns: extents().fwd-prod-of-extents(extents_type::rank()).
 
 
-#include <mdspan>
 #include <cassert>
+#include <cstddef>
 #include <cstdint>
+#include <mdspan>
 #include <span> // dynamic_extent
 
 #include "test_macros.h"
diff --git a/libcxx/test/std/containers/views/mdspan/layout_stride/ctor.default.pass.cpp b/libcxx/test/std/containers/views/mdspan/layout_stride/ctor.default.pass.cpp
index 108c4c6fca98e1..055986d80c7263 100644
--- a/libcxx/test/std/containers/views/mdspan/layout_stride/ctor.default.pass.cpp
+++ b/libcxx/test/std/containers/views/mdspan/layout_stride/ctor.default.pass.cpp
@@ -20,9 +20,10 @@
 // Effects: Direct-non-list-initializes extents_ with extents_type(), and for all d in the range [0, rank_),
 //          direct-non-list-initializes strides_[d] with layout_right::mapping<extents_type>().stride(d).
 
-#include <mdspan>
 #include <cassert>
+#include <cstddef>
 #include <cstdint>
+#include <mdspan>
 #include <span> // dynamic_extent
 
 #include "test_macros.h"
diff --git a/libcxx/test/std/containers/views/mdspan/layout_stride/required_span_size.pass.cpp b/libcxx/test/std/containers/views/mdspan/layout_stride/required_span_size.pass.cpp
index 870518994a9392..629849646bb228 100644
--- a/libcxx/test/std/containers/views/mdspan/layout_stride/required_span_size.pass.cpp
+++ b/libcxx/test/std/containers/views/mdspan/layout_stride/required_span_size.pass.cpp
@@ -19,10 +19,11 @@
 //
 //   Returns: REQUIRED-SPAN-SIZE(extents(), strides_).
 
-#include <mdspan>
 #include <array>
 #include <cassert>
+#include <cstddef>
 #include <cstdint>
+#include <mdspan>
 #include <span> // dynamic_extent
 
 #include "test_macros.h"
diff --git a/libcxx/test/std/containers/views/views.span/span.cons/iterator_sentinel.verify.cpp b/libcxx/test/std/containers/views/views.span/span.cons/iterator_sentinel.verify.cpp
index a31aa2af7b9dd7..937d8d921ea0b1 100644
--- a/libcxx/test/std/containers/views/views.span/span.cons/iterator_sentinel.verify.cpp
+++ b/libcxx/test/std/containers/views/views.span/span.cons/iterator_sentinel.verify.cpp
@@ -15,8 +15,9 @@
 //   If Extent is not equal to dynamic_extent, then last - first shall be equal to Extent.
 //
 
-#include <span>
+#include <cstddef>
 #include <iterator>
+#include <span>
 
 template<class T, std::size_t Extent>
 std::span<T, Extent> createImplicitSpan(T* first, T* last) {
diff --git a/libcxx/test/std/containers/views/views.span/span.objectrep/as_bytes.pass.cpp b/libcxx/test/std/containers/views/views.span/span.objectrep/as_bytes.pass.cpp
index 1f58d0f969f70e..a6c2a5a6baa7ef 100644
--- a/libcxx/test/std/containers/views/views.span/span.objectrep/as_bytes.pass.cpp
+++ b/libcxx/test/std/containers/views/views.span/span.objectrep/as_bytes.pass.cpp
@@ -17,8 +17,9 @@
 //     as_bytes(span<ElementType, Extent> s) noexcept;
 
 
-#include <span>
 #include <cassert>
+#include <cstddef>
+#include <span>
 #include <string>
 
 #include "test_macros.h"
diff --git a/libcxx/test/std/containers/views/views.span/span.objectrep/as_writable_bytes.pass.cpp b/libcxx/test/std/containers/views/views.span/span.objectrep/as_writable_bytes.pass.cpp
index 6b7bd5dcf0c1e8..b5bc58db57f6bb 100644
--- a/libcxx/test/std/containers/views/views.span/span.objectrep/as_writable_bytes.pass.cpp
+++ b/libcxx/test/std/containers/views/views.span/span.objectrep/as_writable_bytes.pass.cpp
@@ -17,8 +17,9 @@
 //     as_writable_bytes(span<ElementType, Extent> s) noexcept;
 
 
-#include <span>
 #include <cassert>
+#include <cstddef>
+#include <span>
 #include <string>
 
 #include "test_macros.h"
diff --git a/libcxx/test/std/diagnostics/syserr/is_error_code_enum.pass.cpp b/libcxx/test/std/diagnostics/syserr/is_error_code_enum.pass.cpp
index 3f614efee20361..437d0f0a91177a 100644
--- a/libcxx/test/std/diagnostics/syserr/is_error_code_enum.pass.cpp
+++ b/libcxx/test/std/diagnostics/syserr/is_error_code_enum.pass.cpp
@@ -12,8 +12,10 @@
 
 // template <> struct is_error_code_enum<> : public false_type {};
 
-#include <system_error>
+#include <cstddef>
 #include <string>
+#include <system_error>
+
 #include "test_macros.h"
 
 template <bool Expected, class T>
diff --git a/libcxx/test/std/iterators/iterator.requirements/iterator.assoc.types/incrementable.traits/incrementable_traits.compile.pass.cpp b/libcxx/test/std/iterators/iterator.requirements/iterator.assoc.types/incrementable.traits/incrementable_traits.compile.pass.cpp
index b1fe9e370a1cb5..6d07e973ec306e 100644
--- a/libcxx/test/std/iterators/iterator.requirements/iterator.assoc.types/incrementable.traits/incrementable_traits.compile.pass.cpp
+++ b/libcxx/test/std/iterators/iterator.requirements/iterator.assoc.types/incrementable.traits/incrementable_traits.compile.pass.cpp
@@ -11,11 +11,9 @@
 // template<class T>
 // struct incrementable_traits;
 
-#include <iterator>
-
 #include <concepts>
-
-#include "test_macros.h"
+#include <cstddef>
+#include <iterator>
 
 template <class T>
 concept check_has_difference_type = requires {
diff --git a/libcxx/test/std/numerics/bit/byteswap.pass.cpp b/libcxx/test/std/numerics/bit/byteswap.pass.cpp
index b87faf150177f3..9d4e328ed9d0f7 100644
--- a/libcxx/test/std/numerics/bit/byteswap.pass.cpp
+++ b/libcxx/test/std/numerics/bit/byteswap.pass.cpp
@@ -10,6 +10,7 @@
 
 #include <bit>
 #include <cassert>
+#include <cstddef>
 #include <cstdint>
 #include <utility>
 
diff --git a/libcxx/test/std/ranges/range.factories/range.repeat.view/iterator/minus.pass.cpp b/libcxx/test/std/ranges/range.factories/range.repeat.view/iterator/minus.pass.cpp
index 3a373741f4c0e4..523eefa69b4ca1 100644
--- a/libcxx/test/std/ranges/range.factories/range.repeat.view/iterator/minus.pass.cpp
+++ b/libcxx/test/std/ranges/range.factories/range.repeat.view/iterator/minus.pass.cpp
@@ -11,10 +11,10 @@
 // friend constexpr iterator operator-(iterator i, difference_type n);
 // friend constexpr difference_type operator-(const iterator& x, const iterator& y);
 
-#include <ranges>
 #include <cassert>
-#include <cstdint>
 #include <concepts>
+#include <cstddef>
+#include <ranges>
 
 constexpr bool test() {
   // <iterator> - difference_type
diff --git a/libcxx/test/std/utilities/memory/temporary.buffer/temporary_buffer.pass.cpp b/libcxx/test/std/utilities/memory/temporary.buffer/temporary_buffer.pass.cpp
index 6c0fbf2568fff6..eaf7356902140f 100644
--- a/libcxx/test/std/utilities/memory/temporary.buffer/temporary_buffer.pass.cpp
+++ b/libcxx/test/std/utilities/memory/temporary.buffer/temporary_buffer.pass.cpp
@@ -18,8 +18,8 @@
 //   void
 //   return_temporary_buffer(T* p);
 
-#include <memory>
 #include <cassert>
+#include <memory>
 #include <utility>
 
 #include "test_macros.h"
diff --git a/libcxxabi/src/private_typeinfo.cpp b/libcxxabi/src/private_typeinfo.cpp
index 9dba91e1985e34..2f631041f74c94 100644
--- a/libcxxabi/src/private_typeinfo.cpp
+++ b/libcxxabi/src/private_typeinfo.cpp
@@ -41,9 +41,11 @@
 // Defining _LIBCXXABI_FORGIVING_DYNAMIC_CAST does not help since can_catch() calls
 // is_equal() with use_strcmp=false so the string names are not compared.
 
-#include <cstdint>
 #include <cassert>
+#include <cstddef>
+#include <cstdint>
 #include <string.h>
+
 #include "abort_message.h"
 
 #ifdef _LIBCXXABI_FORGIVING_DYNAMIC_CAST



More information about the libcxx-commits mailing list