Document units for std::column

This commit is contained in:
Dylan MacKenzie 2021-12-27 15:35:01 -08:00
parent 9b45f04414
commit 3115d8413a

View File

@ -1062,6 +1062,18 @@ macro_rules! line {
/// 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]