Skip to content

Commit c9cc9e5

Browse files
authored
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)
2 parents 98c61b6 + 3115d84 commit c9cc9e5

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
@@ -1065,6 +1065,18 @@ pub(crate) mod builtin {
10651065
/// let current_col = column!();
10661066
/// println!("defined on column: {}", current_col);
10671067
/// ```
1068+
///
1069+
/// `column!` counts Unicode code points, not bytes or graphemes. As a result, the first two
1070+
/// invocations return the same value, but the third does not.
1071+
///
1072+
/// ```
1073+
/// let a = ("foobar", column!()).1;
1074+
/// let b = ("人之初性本善", column!()).1;
1075+
/// let c = ("f̅o̅o̅b̅a̅r̅", column!()).1; // Uses combining overline (U+0305)
1076+
///
1077+
/// assert_eq!(a, b);
1078+
/// assert_ne!(b, c);
1079+
/// ```
10681080
#[stable(feature = "rust1", since = "1.0.0")]
10691081
#[rustc_builtin_macro]
10701082
#[macro_export]

0 commit comments

Comments
 (0)