diff options
author | Mara Bos <m-ou.se@m-ou.se> | 2022-08-25 14:49:09 +0200 |
---|---|---|
committer | Mara Bos <m-ou.se@m-ou.se> | 2022-08-25 14:49:09 +0200 |
commit | 1b044da5bb87702a160537cf1137b8921b54ddd5 (patch) | |
tree | 273e2bf000b57b7922f06b67dc9bfc39c1992e30 /compiler/rustc_parse_format | |
parent | 4d45b0745ab227feb9000bc15713ade4b99241ea (diff) | |
download | rust-1b044da5bb87702a160537cf1137b8921b54ddd5.tar.gz |
Separate CountIsStar from CountIsParam in rustc_parse_format.
Diffstat (limited to 'compiler/rustc_parse_format')
-rw-r--r-- | compiler/rustc_parse_format/src/lib.rs | 4 | ||||
-rw-r--r-- | compiler/rustc_parse_format/src/tests.rs | 2 |
2 files changed, 4 insertions, 2 deletions
diff --git a/compiler/rustc_parse_format/src/lib.rs b/compiler/rustc_parse_format/src/lib.rs index b63a173cc29..a9e502016aa 100644 --- a/compiler/rustc_parse_format/src/lib.rs +++ b/compiler/rustc_parse_format/src/lib.rs @@ -167,6 +167,8 @@ pub enum Count<'a> { CountIsName(&'a str, InnerSpan), /// The count is specified by the argument at the given index. CountIsParam(usize), + /// The count is specified by a star (like in `{:.*}`) that refers to the argument at the given index. + CountIsStar(usize), /// The count is implied and cannot be explicitly specified. CountImplied, } @@ -618,7 +620,7 @@ impl<'a> Parser<'a> { // We can do this immediately as `position` is resolved later. let i = self.curarg; self.curarg += 1; - spec.precision = CountIsParam(i); + spec.precision = CountIsStar(i); } else { spec.precision = self.count(start + 1); } diff --git a/compiler/rustc_parse_format/src/tests.rs b/compiler/rustc_parse_format/src/tests.rs index 44ef0cd0eb5..2f8c229c68f 100644 --- a/compiler/rustc_parse_format/src/tests.rs +++ b/compiler/rustc_parse_format/src/tests.rs @@ -244,7 +244,7 @@ fn format_counts() { fill: None, align: AlignUnknown, flags: 0, - precision: CountIsParam(0), + precision: CountIsStar(0), precision_span: Some(InnerSpan { start: 3, end: 5 }), width: CountImplied, width_span: None, |