From bbd7f5c85b4c9f547490786a1453eaaf20dd0696 Mon Sep 17 00:00:00 2001 From: Esteban Küber Date: Mon, 4 Nov 2019 10:57:41 -0800 Subject: Do not ICE whith a precision flag in formatting str and no format arguments --- src/libsyntax_ext/format.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/libsyntax_ext/format.rs') diff --git a/src/libsyntax_ext/format.rs b/src/libsyntax_ext/format.rs index 37310f46f7e..3c7f80aa399 100644 --- a/src/libsyntax_ext/format.rs +++ b/src/libsyntax_ext/format.rs @@ -374,10 +374,12 @@ impl<'a, 'b> Context<'a, 'b> { format!("are {} arguments", count) }, )); - e.span_label( - self.args[pos].span, - "this parameter corresponds to the precision flag", - ); + if let Some(arg) = self.args.get(pos) { + e.span_label( + arg.span, + "this parameter corresponds to the precision flag", + ); + } zero_based_note = true; } _ => {} -- cgit 1.4.1-3-g733a5