From 3115d8413af8599972c43a301514a0ad0d601c43 Mon Sep 17 00:00:00 2001 From: Dylan MacKenzie Date: Mon, 27 Dec 2021 15:35:01 -0800 Subject: [PATCH] Document units for `std::column` --- library/core/src/macros/mod.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/library/core/src/macros/mod.rs b/library/core/src/macros/mod.rs index b18508186a618..c648cdab13206 100644 --- a/library/core/src/macros/mod.rs +++ b/library/core/src/macros/mod.rs @@ -1062,6 +1062,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]