about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2021-12-28 13:59:26 +0100
committerGitHub <noreply@github.com>2021-12-28 13:59:26 +0100
commitc9cc9e589ce7fe4702a65ffcb646b5cf19bd5edd (patch)
treeec442a502bb3c5c25c059aa662d79123aed3d883
parent98c61b673e807a3f704dcc7b2ad81ebf99f3d7c4 (diff)
parent3115d8413af8599972c43a301514a0ad0d601c43 (diff)
downloadrust-c9cc9e589ce7fe4702a65ffcb646b5cf19bd5edd.tar.gz
rust-c9cc9e589ce7fe4702a65ffcb646b5cf19bd5edd.zip
Rollup merge of #92335 - ecstatic-morse:std-column-unicode, r=Manishearth
Document units for `std::column`

Fixes #92301.

r? ``@Manishearth`` (for the terminology and the Chinese)
-rw-r--r--library/core/src/macros/mod.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/library/core/src/macros/mod.rs b/library/core/src/macros/mod.rs
index af6718df653..d9389892c0c 100644
--- a/library/core/src/macros/mod.rs
+++ b/library/core/src/macros/mod.rs
@@ -1065,6 +1065,18 @@ pub(crate) mod builtin {
     /// let current_col = column!();
     /// println!("defined on column: {}", current_col);
     /// ```
+    ///
+    /// `column!` counts Unicode code points, not bytes or graphemes. As a result, the first two
+    /// invocations return the same value, but the third does not.
+    ///
+    /// ```
+    /// let a = ("foobar", column!()).1;
+    /// let b = ("人之初性本善", column!()).1;
+    /// let c = ("f̅o̅o̅b̅a̅r̅", column!()).1; // Uses combining overline (U+0305)
+    ///
+    /// assert_eq!(a, b);
+    /// assert_ne!(b, c);
+    /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     #[rustc_builtin_macro]
     #[macro_export]