Skip to content

Commit 3702434

Browse files
garethgareth
authored andcommitted
---
yaml --- r: 56941 b: refs/heads/try c: caffe12 h: refs/heads/master i: 56939: 601d017 v: v3
1 parent 0bc2133 commit 3702434

File tree

3 files changed

+27
-26
lines changed

3 files changed

+27
-26
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: c081ffbd1e845687202a975ea2e698b623e5722f
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 79a2b2eafc3c766cecec8a5f76317693bae9ed17
5-
refs/heads/try: 07e087bf310e7e7911bf05efa36a2cdb57855a4e
5+
refs/heads/try: caffe127c78617b4c5eea8adaae17f20a816b651
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/libcore/run.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ mod tests {
520520
use run;
521521

522522
// Regression test for memory leaks
523-
#[ignore(cfg(windows))] // FIXME (#2626)
523+
#[test]
524524
fn test_leaks() {
525525
run::run_program("echo", []);
526526
run::start_program("echo", []);

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

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -371,31 +371,32 @@ pub fn eval_const_expr_partial(tcx: middle::ty::ctxt, e: @expr)
371371
expr_cast(base, _) => {
372372
let ety = ty::expr_ty(tcx, e);
373373
let base = eval_const_expr_partial(tcx, base);
374-
match /*bad*/copy base {
375-
Err(_) => base,
376-
Ok(val) => {
377-
match ty::get(ety).sty {
378-
ty::ty_float(_) => match val {
379-
const_uint(u) => Ok(const_float(u as f64)),
380-
const_int(i) => Ok(const_float(i as f64)),
381-
const_float(_) => base,
382-
_ => Err(~"Can't cast float to str"),
383-
},
384-
ty::ty_uint(_) => match val {
385-
const_uint(_) => base,
386-
const_int(i) => Ok(const_uint(i as u64)),
387-
const_float(f) => Ok(const_uint(f as u64)),
388-
_ => Err(~"Can't cast str to uint"),
389-
},
390-
ty::ty_int(_) | ty::ty_bool => match val {
391-
const_uint(u) => Ok(const_int(u as i64)),
392-
const_int(_) => base,
393-
const_float(f) => Ok(const_int(f as i64)),
394-
_ => Err(~"Can't cast str to int"),
395-
},
396-
_ => Err(~"Can't cast this type")
397-
}
374+
match ty::get(ety).sty {
375+
ty::ty_float(_) => {
376+
match base {
377+
Ok(const_uint(u)) => Ok(const_float(u as f64)),
378+
Ok(const_int(i)) => Ok(const_float(i as f64)),
379+
Ok(const_float(_)) => base,
380+
_ => Err(~"Can't cast float to str")
381+
}
382+
}
383+
ty::ty_uint(_) => {
384+
match base {
385+
Ok(const_uint(_)) => base,
386+
Ok(const_int(i)) => Ok(const_uint(i as u64)),
387+
Ok(const_float(f)) => Ok(const_uint(f as u64)),
388+
_ => Err(~"Can't cast str to uint")
398389
}
390+
}
391+
ty::ty_int(_) | ty::ty_bool => {
392+
match base {
393+
Ok(const_uint(u)) => Ok(const_int(u as i64)),
394+
Ok(const_int(_)) => base,
395+
Ok(const_float(f)) => Ok(const_int(f as i64)),
396+
_ => Err(~"Can't cast str to int")
397+
}
398+
}
399+
_ => Err(~"Can't cast this type")
399400
}
400401
}
401402
expr_path(_) => {

0 commit comments

Comments
 (0)