rust/tests/ui/macros/issue-26322.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

31 lines
592 B
Rust
Raw Normal View History

// run-pass
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
2015-06-16 18:49:01 +00:00
macro_rules! columnline {
() => (
(column!(), line!())
)
}
macro_rules! indirectcolumnline {
() => (
(||{ columnline!() })()
)
}
fn main() {
let closure = || {
columnline!()
};
let iflet = if let Some(_) = Some(0) {
columnline!()
} else { (0, 0) };
let cl = columnline!();
2018-12-25 15:56:47 +00:00
assert_eq!(closure(), (9, 19));
assert_eq!(iflet, (9, 22));
assert_eq!(cl, (14, 24));
2015-06-16 18:49:01 +00:00
let indirect = indirectcolumnline!();
2018-12-25 15:56:47 +00:00
assert_eq!(indirect, (20, 28));
2015-06-16 18:49:01 +00:00
}