Skip to content

Commit a6c7ad7

Browse files
committed
error on empty precision
1 parent 8239a37 commit a6c7ad7

File tree

1 file changed

+10
-2
lines changed
  • compiler/rustc_parse_format/src

1 file changed

+10
-2
lines changed

compiler/rustc_parse_format/src/lib.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -696,8 +696,16 @@ impl<'a> Parser<'a> {
696696
} else {
697697
spec.precision = self.count(start + 1);
698698
}
699-
let end = self.current_pos();
700-
spec.precision_span = Some(self.span(start, end));
699+
if spec.precision == CountImplied {
700+
self.err(
701+
"expected numerical precision",
702+
"missing precision",
703+
self.span(start, end),
704+
);
705+
} else {
706+
let end = self.current_pos();
707+
spec.precision_span = Some(self.span(start, end));
708+
}
701709
}
702710

703711
let ty_span_start = self.current_pos();

0 commit comments

Comments
 (0)