From faf3bcd72c85774805ae0e84d0458aa3e67b20e4 Mon Sep 17 00:00:00 2001 From: "Felix S. Klock II" Date: Fri, 20 Feb 2015 13:10:54 +0100 Subject: Accommodate simple cases of arith-overflow in `rustc` related crates. --- src/libsyntax/ext/deriving/encodable.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/libsyntax') diff --git a/src/libsyntax/ext/deriving/encodable.rs b/src/libsyntax/ext/deriving/encodable.rs index 94b7d1b4d8c..17687534d75 100644 --- a/src/libsyntax/ext/deriving/encodable.rs +++ b/src/libsyntax/ext/deriving/encodable.rs @@ -181,7 +181,6 @@ fn encodable_substructure(cx: &mut ExtCtxt, trait_span: Span, Struct(ref fields) => { let emit_struct_field = cx.ident_of("emit_struct_field"); let mut stmts = Vec::new(); - let last = fields.len() - 1; for (i, &FieldInfo { name, ref self_, @@ -204,6 +203,7 @@ fn encodable_substructure(cx: &mut ExtCtxt, trait_span: Span, lambda)); // last call doesn't need a try! + let last = fields.len() - 1; let call = if i != last { cx.expr_try(span, call) } else { -- cgit 1.4.1-3-g733a5