Skip to content

Commit 90663cc

Browse files
committed
---
yaml --- r: 103478 b: refs/heads/auto c: 2145445 h: refs/heads/master v: v3
1 parent 8dee514 commit 90663cc

File tree

20 files changed

+172
-371
lines changed

20 files changed

+172
-371
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1313
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1414
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1515
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
16-
refs/heads/auto: dc18659160b56df7361f76c1c3f0e25303ca44bd
16+
refs/heads/auto: 21454452b2f796268bef01764230ec09aa3a6d8e
1717
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1818
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1919
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/src/libnum/bigint.rs

Lines changed: 0 additions & 233 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ use Integer;
2121
use std::cmp;
2222
use std::fmt;
2323
use std::from_str::FromStr;
24-
use std::num::CheckedDiv;
2524
use std::num::{Bitwise, ToPrimitive, FromPrimitive};
2625
use std::num::{Zero, One, ToStrRadix, FromStrRadix};
2726
use std::rand::Rng;
@@ -339,40 +338,6 @@ impl Neg<BigUint> for BigUint {
339338
fn neg(&self) -> BigUint { fail!() }
340339
}
341340

342-
impl CheckedAdd for BigUint {
343-
#[inline]
344-
fn checked_add(&self, v: &BigUint) -> Option<BigUint> {
345-
return Some(self.add(v));
346-
}
347-
}
348-
349-
impl CheckedSub for BigUint {
350-
#[inline]
351-
fn checked_sub(&self, v: &BigUint) -> Option<BigUint> {
352-
if *self < *v {
353-
return None;
354-
}
355-
return Some(self.sub(v));
356-
}
357-
}
358-
359-
impl CheckedMul for BigUint {
360-
#[inline]
361-
fn checked_mul(&self, v: &BigUint) -> Option<BigUint> {
362-
return Some(self.mul(v));
363-
}
364-
}
365-
366-
impl CheckedDiv for BigUint {
367-
#[inline]
368-
fn checked_div(&self, v: &BigUint) -> Option<BigUint> {
369-
if v.is_zero() {
370-
return None;
371-
}
372-
return Some(self.div(v));
373-
}
374-
}
375-
376341
impl Integer for BigUint {
377342
#[inline]
378343
fn div_rem(&self, other: &BigUint) -> (BigUint, BigUint) {
@@ -1088,38 +1053,6 @@ impl Neg<BigInt> for BigInt {
10881053
}
10891054
}
10901055

1091-
impl CheckedAdd for BigInt {
1092-
#[inline]
1093-
fn checked_add(&self, v: &BigInt) -> Option<BigInt> {
1094-
return Some(self.add(v));
1095-
}
1096-
}
1097-
1098-
impl CheckedSub for BigInt {
1099-
#[inline]
1100-
fn checked_sub(&self, v: &BigInt) -> Option<BigInt> {
1101-
return Some(self.sub(v));
1102-
}
1103-
}
1104-
1105-
impl CheckedMul for BigInt {
1106-
#[inline]
1107-
fn checked_mul(&self, v: &BigInt) -> Option<BigInt> {
1108-
return Some(self.mul(v));
1109-
}
1110-
}
1111-
1112-
impl CheckedDiv for BigInt {
1113-
#[inline]
1114-
fn checked_div(&self, v: &BigInt) -> Option<BigInt> {
1115-
if v.is_zero() {
1116-
return None;
1117-
}
1118-
return Some(self.div(v));
1119-
}
1120-
}
1121-
1122-
11231056
impl Integer for BigInt {
11241057
#[inline]
11251058
fn div_rem(&self, other: &BigInt) -> (BigInt, BigInt) {
@@ -1469,7 +1402,6 @@ mod biguint_tests {
14691402
use std::i64;
14701403
use std::num::{Zero, One, FromStrRadix, ToStrRadix};
14711404
use std::num::{ToPrimitive, FromPrimitive};
1472-
use std::num::CheckedDiv;
14731405
use std::rand::{task_rng};
14741406
use std::str;
14751407
use std::u64;
@@ -1890,82 +1822,6 @@ mod biguint_tests {
18901822
}
18911823
}
18921824

1893-
#[test]
1894-
fn test_checked_add() {
1895-
for elm in sum_triples.iter() {
1896-
let (aVec, bVec, cVec) = *elm;
1897-
let a = BigUint::from_slice(aVec);
1898-
let b = BigUint::from_slice(bVec);
1899-
let c = BigUint::from_slice(cVec);
1900-
1901-
assert!(a.checked_add(&b).unwrap() == c);
1902-
assert!(b.checked_add(&a).unwrap() == c);
1903-
}
1904-
}
1905-
1906-
#[test]
1907-
fn test_checked_sub() {
1908-
for elm in sum_triples.iter() {
1909-
let (aVec, bVec, cVec) = *elm;
1910-
let a = BigUint::from_slice(aVec);
1911-
let b = BigUint::from_slice(bVec);
1912-
let c = BigUint::from_slice(cVec);
1913-
1914-
assert!(c.checked_sub(&a).unwrap() == b);
1915-
assert!(c.checked_sub(&b).unwrap() == a);
1916-
1917-
if a > c {
1918-
assert!(a.checked_sub(&c).is_none());
1919-
}
1920-
if b > c {
1921-
assert!(b.checked_sub(&c).is_none());
1922-
}
1923-
}
1924-
}
1925-
1926-
#[test]
1927-
fn test_checked_mul() {
1928-
for elm in mul_triples.iter() {
1929-
let (aVec, bVec, cVec) = *elm;
1930-
let a = BigUint::from_slice(aVec);
1931-
let b = BigUint::from_slice(bVec);
1932-
let c = BigUint::from_slice(cVec);
1933-
1934-
assert!(a.checked_mul(&b).unwrap() == c);
1935-
assert!(b.checked_mul(&a).unwrap() == c);
1936-
}
1937-
1938-
for elm in div_rem_quadruples.iter() {
1939-
let (aVec, bVec, cVec, dVec) = *elm;
1940-
let a = BigUint::from_slice(aVec);
1941-
let b = BigUint::from_slice(bVec);
1942-
let c = BigUint::from_slice(cVec);
1943-
let d = BigUint::from_slice(dVec);
1944-
1945-
assert!(a == b.checked_mul(&c).unwrap() + d);
1946-
assert!(a == c.checked_mul(&b).unwrap() + d);
1947-
}
1948-
}
1949-
1950-
#[test]
1951-
fn test_checked_div() {
1952-
for elm in mul_triples.iter() {
1953-
let (aVec, bVec, cVec) = *elm;
1954-
let a = BigUint::from_slice(aVec);
1955-
let b = BigUint::from_slice(bVec);
1956-
let c = BigUint::from_slice(cVec);
1957-
1958-
if !a.is_zero() {
1959-
assert!(c.checked_div(&a).unwrap() == b);
1960-
}
1961-
if !b.is_zero() {
1962-
assert!(c.checked_div(&b).unwrap() == a);
1963-
}
1964-
1965-
assert!(c.checked_div(&Zero::zero()).is_none());
1966-
}
1967-
}
1968-
19691825
#[test]
19701826
fn test_gcd() {
19711827
fn check(a: uint, b: uint, c: uint) {
@@ -2202,7 +2058,6 @@ mod bigint_tests {
22022058

22032059
use std::cmp::{Less, Equal, Greater};
22042060
use std::i64;
2205-
use std::num::CheckedDiv;
22062061
use std::num::{Zero, One, FromStrRadix, ToStrRadix};
22072062
use std::num::{ToPrimitive, FromPrimitive};
22082063
use std::rand::{task_rng};
@@ -2544,94 +2399,6 @@ mod bigint_tests {
25442399
}
25452400
}
25462401

2547-
#[test]
2548-
fn test_checked_add() {
2549-
for elm in sum_triples.iter() {
2550-
let (aVec, bVec, cVec) = *elm;
2551-
let a = BigInt::from_slice(Plus, aVec);
2552-
let b = BigInt::from_slice(Plus, bVec);
2553-
let c = BigInt::from_slice(Plus, cVec);
2554-
2555-
assert!(a.checked_add(&b).unwrap() == c);
2556-
assert!(b.checked_add(&a).unwrap() == c);
2557-
assert!(c.checked_add(&(-a)).unwrap() == b);
2558-
assert!(c.checked_add(&(-b)).unwrap() == a);
2559-
assert!(a.checked_add(&(-c)).unwrap() == (-b));
2560-
assert!(b.checked_add(&(-c)).unwrap() == (-a));
2561-
assert!((-a).checked_add(&(-b)).unwrap() == (-c))
2562-
assert!(a.checked_add(&(-a)).unwrap() == Zero::zero());
2563-
}
2564-
}
2565-
2566-
#[test]
2567-
fn test_checked_sub() {
2568-
for elm in sum_triples.iter() {
2569-
let (aVec, bVec, cVec) = *elm;
2570-
let a = BigInt::from_slice(Plus, aVec);
2571-
let b = BigInt::from_slice(Plus, bVec);
2572-
let c = BigInt::from_slice(Plus, cVec);
2573-
2574-
assert!(c.checked_sub(&a).unwrap() == b);
2575-
assert!(c.checked_sub(&b).unwrap() == a);
2576-
assert!((-b).checked_sub(&a).unwrap() == (-c))
2577-
assert!((-a).checked_sub(&b).unwrap() == (-c))
2578-
assert!(b.checked_sub(&(-a)).unwrap() == c);
2579-
assert!(a.checked_sub(&(-b)).unwrap() == c);
2580-
assert!((-c).checked_sub(&(-a)).unwrap() == (-b));
2581-
assert!(a.checked_sub(&a).unwrap() == Zero::zero());
2582-
}
2583-
}
2584-
2585-
#[test]
2586-
fn test_checked_mul() {
2587-
for elm in mul_triples.iter() {
2588-
let (aVec, bVec, cVec) = *elm;
2589-
let a = BigInt::from_slice(Plus, aVec);
2590-
let b = BigInt::from_slice(Plus, bVec);
2591-
let c = BigInt::from_slice(Plus, cVec);
2592-
2593-
assert!(a.checked_mul(&b).unwrap() == c);
2594-
assert!(b.checked_mul(&a).unwrap() == c);
2595-
2596-
assert!((-a).checked_mul(&b).unwrap() == -c);
2597-
assert!((-b).checked_mul(&a).unwrap() == -c);
2598-
}
2599-
2600-
for elm in div_rem_quadruples.iter() {
2601-
let (aVec, bVec, cVec, dVec) = *elm;
2602-
let a = BigInt::from_slice(Plus, aVec);
2603-
let b = BigInt::from_slice(Plus, bVec);
2604-
let c = BigInt::from_slice(Plus, cVec);
2605-
let d = BigInt::from_slice(Plus, dVec);
2606-
2607-
assert!(a == b.checked_mul(&c).unwrap() + d);
2608-
assert!(a == c.checked_mul(&b).unwrap() + d);
2609-
}
2610-
}
2611-
#[test]
2612-
fn test_checked_div() {
2613-
for elm in mul_triples.iter() {
2614-
let (aVec, bVec, cVec) = *elm;
2615-
let a = BigInt::from_slice(Plus, aVec);
2616-
let b = BigInt::from_slice(Plus, bVec);
2617-
let c = BigInt::from_slice(Plus, cVec);
2618-
2619-
if !a.is_zero() {
2620-
assert!(c.checked_div(&a).unwrap() == b);
2621-
assert!((-c).checked_div(&(-a)).unwrap() == b);
2622-
assert!((-c).checked_div(&a).unwrap() == -b);
2623-
}
2624-
if !b.is_zero() {
2625-
assert!(c.checked_div(&b).unwrap() == a);
2626-
assert!((-c).checked_div(&(-b)).unwrap() == a);
2627-
assert!((-c).checked_div(&b).unwrap() == -a);
2628-
}
2629-
2630-
assert!(c.checked_div(&Zero::zero()).is_none());
2631-
assert!((-c).checked_div(&Zero::zero()).is_none());
2632-
}
2633-
}
2634-
26352402
#[test]
26362403
fn test_gcd() {
26372404
fn check(a: int, b: int, c: int) {

branches/auto/src/librustc/middle/cfg/construct.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ impl CFGBuilder {
300300
guard_exit = self.opt_expr(arm.guard, guard_exit); // 2
301301
let pats_exit = self.pats_any(arm.pats.as_slice(),
302302
guard_exit); // 3
303-
let body_exit = self.expr(arm.body, pats_exit); // 4
303+
let body_exit = self.block(arm.body, pats_exit); // 4
304304
self.add_contained_edge(body_exit, expr_exit); // 5
305305
}
306306
expr_exit

branches/auto/src/librustc/middle/dataflow.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ impl<'a, O:DataFlowOperator> PropagationContext<'a, O> {
534534
self.walk_pat_alternatives(arm.pats.as_slice(),
535535
body,
536536
loop_scopes);
537-
self.walk_expr(arm.body, body, loop_scopes);
537+
self.walk_block(arm.body, body, loop_scopes);
538538
join_bits(&self.dfcx.oper, body, in_out);
539539
}
540540
}
@@ -915,3 +915,4 @@ fn bit_str(bit: uint) -> ~str {
915915
let lobits = 1 << (bit & 0xFF);
916916
format!("[{}:{}-{:02x}]", bit, byte, lobits)
917917
}
918+

branches/auto/src/librustc/middle/liveness.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1125,7 +1125,7 @@ impl Liveness {
11251125
let mut first_merge = true;
11261126
for arm in arms.iter() {
11271127
let body_succ =
1128-
self.propagate_through_expr(arm.body, succ);
1128+
self.propagate_through_block(arm.body, succ);
11291129
let guard_succ =
11301130
self.propagate_through_opt_expr(arm.guard, body_succ);
11311131
let arm_succ =

branches/auto/src/librustc/middle/moves.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,7 @@ impl VisitContext {
632632
self.consume_expr(*guard);
633633
}
634634

635-
self.consume_expr(arm.body);
635+
self.consume_block(arm.body);
636636
}
637637

638638
pub fn use_pat(&mut self, pat: @Pat) {

branches/auto/src/librustc/middle/resolve.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4248,7 +4248,7 @@ impl Resolver {
42484248
self.check_consistent_bindings(arm);
42494249

42504250
visit::walk_expr_opt(self, arm.guard, ());
4251-
self.resolve_expr(arm.body);
4251+
self.resolve_block(arm.body);
42524252

42534253
let mut value_ribs = self.value_ribs.borrow_mut();
42544254
value_ribs.get().pop();

branches/auto/src/librustc/middle/trans/_match.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1939,7 +1939,7 @@ fn trans_match_inner<'a>(scope_cx: &'a Block<'a>,
19391939
let cleanup_scope = fcx.push_custom_cleanup_scope();
19401940
bcx = insert_lllocals(bcx, arm_data.bindings_map,
19411941
cleanup::CustomScope(cleanup_scope));
1942-
bcx = expr::trans_into(bcx, arm_data.arm.body, dest);
1942+
bcx = controlflow::trans_block(bcx, arm_data.arm.body, dest);
19431943
bcx = fcx.pop_and_trans_custom_cleanup_scope(bcx, cleanup_scope);
19441944
arm_cxs.push(bcx);
19451945
}

branches/auto/src/librustc/middle/trans/debuginfo.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2665,7 +2665,7 @@ fn populate_scope_map(cx: &CrateContext,
26652665
walk_expr(cx, *guard_exp, scope_stack, scope_map)
26662666
}
26672667

2668-
walk_expr(cx, arm_ref.body, scope_stack, scope_map);
2668+
walk_block(cx, arm_ref.body, scope_stack, scope_map);
26692669
})
26702670
}
26712671
}

branches/auto/src/librustc/middle/trans/intrinsic.rs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -376,17 +376,14 @@ pub fn trans_intrinsic(ccx: @CrateContext,
376376
ast_map::NodeExpr(e) => e.span,
377377
_ => fail!("transmute has non-expr arg"),
378378
};
379-
let pluralize = |n| if 1 == n { "" } else { "s" };
380379
ccx.sess.span_fatal(sp,
381-
format!("transmute called on types with \
382-
different sizes: {} ({} bit{}) to \
383-
{} ({} bit{})",
384-
ty_to_str(ccx.tcx, in_type),
385-
in_type_size,
386-
pluralize(in_type_size),
387-
ty_to_str(ccx.tcx, out_type),
388-
out_type_size,
389-
pluralize(out_type_size)));
380+
format!("transmute called on types with different sizes: \
381+
{intype} ({insize, plural, =1{# bit} other{# bits}}) to \
382+
{outtype} ({outsize, plural, =1{# bit} other{# bits}})",
383+
intype = ty_to_str(ccx.tcx, in_type),
384+
insize = in_type_size as uint,
385+
outtype = ty_to_str(ccx.tcx, out_type),
386+
outsize = out_type_size as uint));
390387
}
391388

392389
if !return_type_is_void(ccx, out_type) {

0 commit comments

Comments
 (0)