Skip to content

Commit bc6dd22

Browse files
committed
---
yaml --- r: 106582 b: refs/heads/try c: c3b9047 h: refs/heads/master v: v3
1 parent 7940994 commit bc6dd22

File tree

22 files changed

+51
-367
lines changed

22 files changed

+51
-367
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: b8ef9fd9c9f642ce7b8aed82782a1ed745d08d64
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: b8601a3d8b91ad3b653d143307611f2f5c75617e
5-
refs/heads/try: 062e950ae82e60a36833255b48b5e7b124179634
5+
refs/heads/try: c3b904704031047ef9e1f7906d3faee15778ffe5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/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/try/src/librustc/front/test.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,12 @@ fn mk_std(cx: &TestCtxt) -> ast::ViewItem {
313313
}
314314
}
315315

316+
#[cfg(stage0)]
317+
fn mk_test_module(_: &TestCtxt) -> @ast::Item {
318+
fail!("test disabled in this stage due to quasiquoter")
319+
}
320+
321+
#[cfg(not(stage0))]
316322
fn mk_test_module(cx: &TestCtxt) -> @ast::Item {
317323
// Link to test crate
318324
let view_items = vec!(mk_std(cx));
@@ -382,6 +388,12 @@ fn path_node_global(ids: ~[ast::Ident]) -> ast::Path {
382388
}
383389
}
384390

391+
#[cfg(stage0)]
392+
fn mk_tests(_: &TestCtxt) -> @ast::Item {
393+
fail!("tests disabled in this stage due to quasiquoter")
394+
}
395+
396+
#[cfg(not(stage0))]
385397
fn mk_tests(cx: &TestCtxt) -> @ast::Item {
386398
// The vector of test_descs for this crate
387399
let test_descs = mk_test_descs(cx);
@@ -423,6 +435,12 @@ fn mk_test_descs(cx: &TestCtxt) -> @ast::Expr {
423435
}
424436
}
425437

438+
#[cfg(stage0)]
439+
fn mk_test_desc_and_fn_rec(_: &TestCtxt, _: &Test) -> @ast::Expr {
440+
fail!("tests disabled in this stage due to quasiquoter")
441+
}
442+
443+
#[cfg(not(stage0))]
426444
fn mk_test_desc_and_fn_rec(cx: &TestCtxt, test: &Test) -> @ast::Expr {
427445
let span = test.span;
428446
let path = test.path.clone();

branches/try/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.block(arm.body, pats_exit); // 4
303+
let body_exit = self.expr(arm.body, pats_exit); // 4
304304
self.add_contained_edge(body_exit, expr_exit); // 5
305305
}
306306
expr_exit

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

Lines changed: 1 addition & 2 deletions
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_block(arm.body, body, loop_scopes);
537+
self.walk_expr(arm.body, body, loop_scopes);
538538
join_bits(&self.dfcx.oper, body, in_out);
539539
}
540540
}
@@ -915,4 +915,3 @@ fn bit_str(bit: uint) -> ~str {
915915
let lobits = 1 << (bit & 0xFF);
916916
format!("[{}:{}-{:02x}]", bit, byte, lobits)
917917
}
918-

branches/try/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_block(arm.body, succ);
1128+
self.propagate_through_expr(arm.body, succ);
11291129
let guard_succ =
11301130
self.propagate_through_opt_expr(arm.guard, body_succ);
11311131
let arm_succ =

branches/try/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_block(arm.body);
635+
self.consume_expr(arm.body);
636636
}
637637

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

branches/try/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_block(arm.body);
4251+
self.resolve_expr(arm.body);
42524252

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

branches/try/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 = controlflow::trans_block(bcx, arm_data.arm.body, dest);
1942+
bcx = expr::trans_into(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/try/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_block(cx, arm_ref.body, scope_stack, scope_map);
2668+
walk_expr(cx, arm_ref.body, scope_stack, scope_map);
26692669
})
26702670
}
26712671
}

0 commit comments

Comments
 (0)