-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #72446 - dtolnay:ord, r=petrochenkov
Impl Ord for proc_macro::LineColumn ```rust impl Ord for LineColumn {...} impl PartialOrd for LineColumn {...} ``` for https://doc.rust-lang.org/nightly/proc_macro/struct.LineColumn.html. The ordering is the natural one you would get by writing one line after another, where we compare line first, then compare columns within the same line.
- Loading branch information
Showing
2 changed files
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#![feature(proc_macro_span)] | ||
|
||
use proc_macro::LineColumn; | ||
|
||
#[test] | ||
fn test_line_column_ord() { | ||
let line0_column0 = LineColumn { line: 0, column: 0 }; | ||
let line0_column1 = LineColumn { line: 0, column: 1 }; | ||
let line1_column0 = LineColumn { line: 1, column: 0 }; | ||
assert!(line0_column0 < line0_column1); | ||
assert!(line0_column1 < line1_column0); | ||
} |