Skip to content

Commit

Permalink
Rollup merge of #92335 - ecstatic-morse:std-column-unicode, r=Manishe…
Browse files Browse the repository at this point in the history
…arth

Document units for `std::column`

Fixes #92301.

r? ``@Manishearth`` (for the terminology and the Chinese)
  • Loading branch information
matthiaskrgr authored Dec 28, 2021
2 parents 98c61b6 + 3115d84 commit c9cc9e5
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions library/core/src/macros/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit c9cc9e5

Please sign in to comment.