[libc++] [LIBCXX-DEBUG-FIXME] <span>, like <string_view>, has no use for debug iterators.

A span has no idea what container (if any) "owns" its iterators, nor
under what circumstances they might become invalidated.

However, continue to use `__wrap_iter<T*>` instead of raw `T*` outside
of debug mode, because we've been shipping `std::span` since Clang 7
and ldionne doesn't want to break ABI. (Namely, the mangling of functions
taking `span::iterator` as a parameter.) Permit using raw `T*` there,
but only under an ABI macro: `_LIBCPP_ABI_SPAN_POINTER_ITERATORS`.

Differential Revision: https://reviews.llvm.org/D101003

NOKEYCHECK=True
GitOrigin-RevId: 6946f0ecca64f3af6b9e28cced9c982de2748f19
diff --git a/include/__config b/include/__config
index 96860c0..97d3289 100644
--- a/include/__config
+++ b/include/__config
@@ -106,6 +106,8 @@
 #  define _LIBCPP_ABI_OPTIMIZED_FUNCTION
 // All the regex constants must be distinct and nonzero.
 #  define _LIBCPP_ABI_REGEX_CONSTANTS_NONZERO
+// Use raw pointers, not wrapped ones, for std::span's iterator type.
+#  define _LIBCPP_ABI_SPAN_POINTER_ITERATORS
 // Re-worked external template instantiations for std::string with a focus on
 // performance and fast-path inlining.
 #  define _LIBCPP_ABI_STRING_OPTIMIZED_EXTERNAL_INSTANTIATION
diff --git a/include/span b/include/span
index b475740..4c621ab 100644
--- a/include/span
+++ b/include/span
@@ -200,7 +200,11 @@
     using const_pointer          = const _Tp *;
     using reference              = _Tp &;
     using const_reference        = const _Tp &;
-    using iterator               =  __wrap_iter<pointer>;
+#if (_LIBCPP_DEBUG_LEVEL == 2) || defined(_LIBCPP_ABI_SPAN_POINTER_ITERATORS)
+    using iterator               = pointer;
+#else
+    using iterator               = __wrap_iter<pointer>;
+#endif
     using reverse_iterator       = _VSTD::reverse_iterator<iterator>;
 
     static constexpr size_type extent = _Extent;
@@ -375,7 +379,11 @@
     using const_pointer          = const _Tp *;
     using reference              = _Tp &;
     using const_reference        = const _Tp &;
-    using iterator               =  __wrap_iter<pointer>;
+#if (_LIBCPP_DEBUG_LEVEL == 2) || defined(_LIBCPP_ABI_SPAN_POINTER_ITERATORS)
+    using iterator               = pointer;
+#else
+    using iterator               = __wrap_iter<pointer>;
+#endif
     using reverse_iterator       = _VSTD::reverse_iterator<iterator>;
 
     static constexpr size_type extent = dynamic_extent;
diff --git a/test/std/containers/views/span.cons/deduct.pass.cpp b/test/std/containers/views/span.cons/deduct.pass.cpp
index cbb6a97..aeb0540 100644
--- a/test/std/containers/views/span.cons/deduct.pass.cpp
+++ b/test/std/containers/views/span.cons/deduct.pass.cpp
@@ -7,7 +7,6 @@
 //
 //===---------------------------------------------------------------------===//
 // UNSUPPORTED: c++03, c++11, c++14, c++17
-// XFAIL: LIBCXX-DEBUG-FIXME
 
 // <span>
 
diff --git a/test/std/containers/views/span.iterators/begin.pass.cpp b/test/std/containers/views/span.iterators/begin.pass.cpp
index 25254f6..f6b2401 100644
--- a/test/std/containers/views/span.iterators/begin.pass.cpp
+++ b/test/std/containers/views/span.iterators/begin.pass.cpp
@@ -6,7 +6,6 @@
 //
 //===----------------------------------------------------------------------===//
 // UNSUPPORTED: c++03, c++11, c++14, c++17
-// XFAIL: LIBCXX-DEBUG-FIXME
 
 // <span>
 
diff --git a/test/std/containers/views/span.iterators/end.pass.cpp b/test/std/containers/views/span.iterators/end.pass.cpp
index 88564e5..d531537 100644
--- a/test/std/containers/views/span.iterators/end.pass.cpp
+++ b/test/std/containers/views/span.iterators/end.pass.cpp
@@ -6,7 +6,6 @@
 //
 //===----------------------------------------------------------------------===//
 // UNSUPPORTED: c++03, c++11, c++14, c++17
-// XFAIL: LIBCXX-DEBUG-FIXME
 
 // <span>
 
diff --git a/test/std/containers/views/span.iterators/rbegin.pass.cpp b/test/std/containers/views/span.iterators/rbegin.pass.cpp
index 1f0fb66..26e4389 100644
--- a/test/std/containers/views/span.iterators/rbegin.pass.cpp
+++ b/test/std/containers/views/span.iterators/rbegin.pass.cpp
@@ -6,7 +6,6 @@
 //
 //===----------------------------------------------------------------------===//
 // UNSUPPORTED: c++03, c++11, c++14, c++17
-// XFAIL: LIBCXX-DEBUG-FIXME
 
 // <span>
 
diff --git a/test/std/containers/views/span.iterators/rend.pass.cpp b/test/std/containers/views/span.iterators/rend.pass.cpp
index 0d11f3b..c2bd13a 100644
--- a/test/std/containers/views/span.iterators/rend.pass.cpp
+++ b/test/std/containers/views/span.iterators/rend.pass.cpp
@@ -6,7 +6,6 @@
 //
 //===----------------------------------------------------------------------===//
 // UNSUPPORTED: c++03, c++11, c++14, c++17
-// XFAIL: LIBCXX-DEBUG-FIXME
 
 // <span>
 
diff --git a/test/std/containers/views/span.sub/first.pass.cpp b/test/std/containers/views/span.sub/first.pass.cpp
index 25234f1..ab0875b 100644
--- a/test/std/containers/views/span.sub/first.pass.cpp
+++ b/test/std/containers/views/span.sub/first.pass.cpp
@@ -7,7 +7,6 @@
 //
 //===---------------------------------------------------------------------===//
 // UNSUPPORTED: c++03, c++11, c++14, c++17
-// XFAIL: LIBCXX-DEBUG-FIXME
 
 // <span>
 
diff --git a/test/std/containers/views/span.sub/last.pass.cpp b/test/std/containers/views/span.sub/last.pass.cpp
index 7d0371f..ea3b3cd 100644
--- a/test/std/containers/views/span.sub/last.pass.cpp
+++ b/test/std/containers/views/span.sub/last.pass.cpp
@@ -7,7 +7,6 @@
 //
 //===---------------------------------------------------------------------===//
 // UNSUPPORTED: c++03, c++11, c++14, c++17
-// XFAIL: LIBCXX-DEBUG-FIXME
 
 // <span>
 
diff --git a/test/std/containers/views/span.sub/subspan.pass.cpp b/test/std/containers/views/span.sub/subspan.pass.cpp
index 01db122..347f6fd 100644
--- a/test/std/containers/views/span.sub/subspan.pass.cpp
+++ b/test/std/containers/views/span.sub/subspan.pass.cpp
@@ -7,7 +7,6 @@
 //
 //===---------------------------------------------------------------------===//
 // UNSUPPORTED: c++03, c++11, c++14, c++17
-// XFAIL: LIBCXX-DEBUG-FIXME
 
 // <span>