Implement `Debug` for `EncodeWide`

Since `std::os::windows::ffi::EncodeWide` was reexported from
`std::sys_common::wtf8::EncodeWide`, which has
`#![allow(missing_debug_implementations)]` in the parent module, it did
not implement `Debug`. When it was moved to `core`, a placeholder impl
was added; fill it in.
diff --git a/library/alloc/src/wtf8/tests.rs b/library/alloc/src/wtf8/tests.rs
index 291f63f..a72ad08 100644
--- a/library/alloc/src/wtf8/tests.rs
+++ b/library/alloc/src/wtf8/tests.rs
@@ -580,6 +580,17 @@ fn wtf8_encode_wide_size_hint() {
 }
 
 #[test]
+fn wtf8_encode_wide_debug() {
+    let mut string = Wtf8Buf::from_str("aé ");
+    string.push(CodePoint::from_u32(0xD83D).unwrap());
+    string.push_char('💩');
+    assert_eq!(
+        format!("{:?}", string.encode_wide()),
+        r#"EncodeWide(['a', 'é', ' ', 0xD83D, 0xD83D, 0xDCA9])"#
+    );
+}
+
+#[test]
 fn wtf8_clone_into() {
     let mut string = Wtf8Buf::new();
     clone_into(Wtf8::from_str("green"), &mut string);
diff --git a/library/core/src/wtf8.rs b/library/core/src/wtf8.rs
index de0dfa5..0c03496 100644
--- a/library/core/src/wtf8.rs
+++ b/library/core/src/wtf8.rs
@@ -562,15 +562,36 @@ fn size_hint(&self) -> (usize, Option<usize>) {
     }
 }
 
-impl fmt::Debug for EncodeWide<'_> {
-    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
-        f.debug_struct("EncodeWide").finish_non_exhaustive()
-    }
-}
-
 #[stable(feature = "encode_wide_fused_iterator", since = "1.62.0")]
 impl FusedIterator for EncodeWide<'_> {}
 
+#[stable(feature = "encode_wide_debug", since = "CURRENT_RUSTC_VERSION")]
+impl fmt::Debug for EncodeWide<'_> {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        struct CodeUnit(u16);
+        impl fmt::Debug for CodeUnit {
+            fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+                // This output attempts to balance readability with precision.
+                // Render characters which take only one WTF-16 code unit using
+                // `char` syntax and everything else as code units with hex
+                // integer syntax (including paired and unpaired surrogate
+                // halves). Since Rust has no `char`-like type for WTF-16, this
+                // isn't perfect, so if this output isn't suitable, it is open
+                // to being changed (see #140153).
+                match char::from_u32(self.0 as u32) {
+                    Some(c) => write!(f, "{c:?}"),
+                    None => write!(f, "0x{:04X}", self.0),
+                }
+            }
+        }
+
+        write!(f, "EncodeWide(")?;
+        f.debug_list().entries(self.clone().map(CodeUnit)).finish()?;
+        write!(f, ")")?;
+        Ok(())
+    }
+}
+
 impl Hash for CodePoint {
     #[inline]
     fn hash<H: Hasher>(&self, state: &mut H) {
diff --git a/library/std/src/sys_common/mod.rs b/library/std/src/sys_common/mod.rs
index ec45c72..c6cb1b0 100644
--- a/library/std/src/sys_common/mod.rs
+++ b/library/std/src/sys_common/mod.rs
@@ -15,7 +15,6 @@
 //! Progress on this is tracked in #84187.
 
 #![allow(missing_docs)]
-#![allow(missing_debug_implementations)]
 
 #[cfg(test)]
 mod tests;