Skip to content

Commit e5751f7

Browse files
committed
---
yaml --- r: 188101 b: refs/heads/auto c: faf3bcd h: refs/heads/master i: 188099: a674bfc v: v3
1 parent 749e255 commit e5751f7

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1010
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1111
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1212
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
13-
refs/heads/auto: f0404c39f272868c1dedc7cda7b0b6dffcb5713d
13+
refs/heads/auto: faf3bcd72c85774805ae0e84d0458aa3e67b20e4
1414
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1515
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1616
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/src/librustc_trans/trans/adt.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -778,7 +778,9 @@ fn load_discr(bcx: Block, ity: IntType, ptr: ValueRef, min: Disr, max: Disr)
778778
assert!(bits <= 64);
779779
let bits = bits as uint;
780780
let mask = (-1u64 >> (64 - bits)) as Disr;
781-
if (max + 1) & mask == min & mask {
781+
// For a (max) discr of -1, max will be `-1 as usize`, which overflows.
782+
// However, that is fine here (it would still represent the full range),
783+
if (max.wrapping_add(1)) & mask == min & mask {
782784
// i.e., if the range is everything. The lo==hi case would be
783785
// rejected by the LLVM verifier (it would mean either an
784786
// empty set, which is impossible, or the entire range of the
@@ -787,7 +789,7 @@ fn load_discr(bcx: Block, ity: IntType, ptr: ValueRef, min: Disr, max: Disr)
787789
} else {
788790
// llvm::ConstantRange can deal with ranges that wrap around,
789791
// so an overflow on (max + 1) is fine.
790-
LoadRangeAssert(bcx, ptr, min, (max+1), /* signed: */ True)
792+
LoadRangeAssert(bcx, ptr, min, (max.wrapping_add(1)), /* signed: */ True)
791793
}
792794
}
793795

branches/auto/src/librustc_typeck/astconv.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,9 +205,9 @@ pub fn opt_ast_region_to_region<'tcx>(
205205

206206
if len == 2 && i == 0 {
207207
m.push_str(" or ");
208-
} else if i == len - 2 {
208+
} else if i + 2 == len {
209209
m.push_str(", or ");
210-
} else if i != len - 1 {
210+
} else if i + 1 != len {
211211
m.push_str(", ");
212212
}
213213
}

branches/auto/src/libsyntax/ext/deriving/encodable.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,6 @@ fn encodable_substructure(cx: &mut ExtCtxt, trait_span: Span,
181181
Struct(ref fields) => {
182182
let emit_struct_field = cx.ident_of("emit_struct_field");
183183
let mut stmts = Vec::new();
184-
let last = fields.len() - 1;
185184
for (i, &FieldInfo {
186185
name,
187186
ref self_,
@@ -204,6 +203,7 @@ fn encodable_substructure(cx: &mut ExtCtxt, trait_span: Span,
204203
lambda));
205204

206205
// last call doesn't need a try!
206+
let last = fields.len() - 1;
207207
let call = if i != last {
208208
cx.expr_try(span, call)
209209
} else {

0 commit comments

Comments
 (0)