Skip to content

Commit 3115d84

Browse files
Document units for std::column
1 parent 9b45f04 commit 3115d84

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

library/core/src/macros/mod.rs

+12
Original file line numberDiff line numberDiff line change
@@ -1062,6 +1062,18 @@ pub(crate) mod builtin {
10621062
/// let current_col = column!();
10631063
/// println!("defined on column: {}", current_col);
10641064
/// ```
1065+
///
1066+
/// `column!` counts Unicode code points, not bytes or graphemes. As a result, the first two
1067+
/// invocations return the same value, but the third does not.
1068+
///
1069+
/// ```
1070+
/// let a = ("foobar", column!()).1;
1071+
/// let b = ("人之初性本善", column!()).1;
1072+
/// let c = ("f̅o̅o̅b̅a̅r̅", column!()).1; // Uses combining overline (U+0305)
1073+
///
1074+
/// assert_eq!(a, b);
1075+
/// assert_ne!(b, c);
1076+
/// ```
10651077
#[stable(feature = "rust1", since = "1.0.0")]
10661078
#[rustc_builtin_macro]
10671079
#[macro_export]

0 commit comments

Comments
 (0)