Skip to content

Commit 9c3b1a1

Browse files
committed
---
yaml --- r: 158646 b: refs/heads/master c: 932eec7 h: refs/heads/master v: v3
1 parent 444a508 commit 9c3b1a1

File tree

5 files changed

+52
-4
lines changed

5 files changed

+52
-4
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: f7c1771fd18672a148979d334bf732d15a2c4023
2+
refs/heads/master: 932eec7d702cf2cf55554e2431c3cb0fecd19014
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 1b2ad7831f1745bf4a4709a1fa1772afb47c933c
55
refs/heads/try: f58aad6dce273570fb130b4df008ef9acd5a5be2

trunk/src/librustc/middle/cfg/construct.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -448,8 +448,8 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
448448
}
449449

450450
ast::ExprStruct(_, ref fields, ref base) => {
451-
let base_exit = self.opt_expr(base, pred);
452-
self.straightline(expr, base_exit, fields.iter().map(|f| &*f.expr))
451+
let field_cfg = self.straightline(expr, pred, fields.iter().map(|f| &*f.expr));
452+
self.opt_expr(base, field_cfg)
453453
}
454454

455455
ast::ExprRepeat(ref elem, ref count) => {

trunk/src/librustc/middle/expr_use_visitor.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -672,6 +672,10 @@ impl<'d,'t,'tcx,TYPER:mc::Typer<'tcx>> ExprUseVisitor<'d,'t,TYPER> {
672672
}
673673
}
674674

675+
// walk the with expression so that complex expressions
676+
// are properly handled.
677+
self.walk_expr(with_expr);
678+
675679
fn contains_field_named(field: &ty::field,
676680
fields: &Vec<ast::Field>)
677681
-> bool

trunk/src/libstd/num/strconv.rs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ pub fn from_str_radix_float<T: Float>(src: &str, radix: uint) -> Option<T> {
451451
};
452452

453453
// The significand to accumulate
454-
let mut sig = if is_positive { _0 } else { -_1 };
454+
let mut sig = if is_positive { _0 } else { -_0 };
455455
// Necessary to detect overflow
456456
let mut prev_sig = sig;
457457
let mut cs = src.chars().enumerate();
@@ -647,6 +647,22 @@ mod test {
647647
let fe : Option<f32> = from_str_radix_float("1e40", 10);
648648
assert_eq!(fe, Some(Float::infinity()))
649649
}
650+
651+
#[test]
652+
fn test_from_str_radix_float() {
653+
let x1 : Option<f64> = from_str_radix_float("-123.456", 10);
654+
assert_eq!(x1, Some(-123.456));
655+
let x2 : Option<f32> = from_str_radix_float("123.456", 10);
656+
assert_eq!(x2, Some(123.456));
657+
let x3 : Option<f32> = from_str_radix_float("-0.0", 10);
658+
assert_eq!(x3, Some(-0.0));
659+
let x4 : Option<f32> = from_str_radix_float("0.0", 10);
660+
assert_eq!(x4, Some(0.0));
661+
let x4 : Option<f32> = from_str_radix_float("1.0", 10);
662+
assert_eq!(x4, Some(1.0));
663+
let x5 : Option<f32> = from_str_radix_float("-1.0", 10);
664+
assert_eq!(x5, Some(-1.0));
665+
}
650666
}
651667

652668
#[cfg(test)]
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
struct Mine{
12+
test: String,
13+
other_val: int
14+
}
15+
16+
impl Mine{
17+
fn make_string_bar(mut self) -> Mine{
18+
self.test = "Bar".to_string();
19+
self
20+
}
21+
}
22+
23+
fn main(){
24+
let start = Mine{test:"Foo".to_string(), other_val:0};
25+
let end = Mine{other_val:1, ..start.make_string_bar()};
26+
println!("{}", start.test); //~ ERROR use of moved value: `start.test`
27+
}
28+

0 commit comments

Comments
 (0)