Skip to content

Commit 3f3b2d6

Browse files
committed
Rename col! to column!.
This macro is very rarely used, so there is no need (and it is better) for it to avoid the abbreviation. Closes rust-lang/rfcs#467. [breaking-change]
1 parent 803aacd commit 3f3b2d6

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

src/libstd/macros.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -552,17 +552,17 @@ pub mod builtin {
552552
/// A macro which expands to the column number on which it was invoked.
553553
///
554554
/// The expanded expression has type `uint`, and the returned column is not
555-
/// the invocation of the `col!()` macro itself, but rather the first macro
556-
/// invocation leading up to the invocation of the `col!()` macro.
555+
/// the invocation of the `column!()` macro itself, but rather the first macro
556+
/// invocation leading up to the invocation of the `column!()` macro.
557557
///
558558
/// # Example
559559
///
560560
/// ```
561-
/// let current_col = col!();
561+
/// let current_col = column!();
562562
/// println!("defined on column: {}", current_col);
563563
/// ```
564564
#[macro_export]
565-
macro_rules! col( () => ({ /* compiler built-in */ }) )
565+
macro_rules! column( () => ({ /* compiler built-in */ }) )
566566

567567
/// A macro which expands to the file name from which it was invoked.
568568
///

src/libsyntax/ext/base.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -414,9 +414,9 @@ fn initial_syntax_expander_table(ecfg: &expand::ExpansionConfig) -> SyntaxEnv {
414414
syntax_expanders.insert(intern("line"),
415415
builtin_normal_expander(
416416
ext::source_util::expand_line));
417-
syntax_expanders.insert(intern("col"),
417+
syntax_expanders.insert(intern("column"),
418418
builtin_normal_expander(
419-
ext::source_util::expand_col));
419+
ext::source_util::expand_column));
420420
syntax_expanders.insert(intern("file"),
421421
builtin_normal_expander(
422422
ext::source_util::expand_file));

src/libsyntax/ext/source_util.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ pub fn expand_line(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
3838
base::MacExpr::new(cx.expr_uint(topmost, loc.line))
3939
}
4040

41-
/* col!(): expands to the current column number */
42-
pub fn expand_col(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
41+
/* column!(): expands to the current column number */
42+
pub fn expand_column(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
4343
-> Box<base::MacResult+'static> {
44-
base::check_zero_tts(cx, sp, tts, "col!");
44+
base::check_zero_tts(cx, sp, tts, "column!");
4545

4646
let topmost = cx.original_span_in_file();
4747
let loc = cx.codemap().lookup_char_pos(topmost.lo);

src/test/run-pass/syntax-extension-source-utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ macro_rules! indirect_line( () => ( line!() ) )
2525

2626
pub fn main() {
2727
assert_eq!(line!(), 27);
28-
//assert!((col!() == 11));
28+
//assert!((column!() == 11));
2929
assert_eq!(indirect_line!(), 29);
3030
assert!((file!().ends_with("syntax-extension-source-utils.rs")));
3131
assert_eq!(stringify!((2*3) + 5).to_string(), "( 2 * 3 ) + 5".to_string());

0 commit comments

Comments
 (0)