shift bindings to accommodate new lifetime/dtor rules.

(My fix to for-loops (21984) did not deal with similar problems in
if-let expressions, so those binding shifts stay.)
This commit is contained in:
Felix S. Klock II 2015-01-12 17:23:40 +01:00
parent 5936278ed6
commit bdb9f3e266
11 changed files with 27 additions and 12 deletions

View file

@ -19,5 +19,6 @@ pub type header_map = HashMap<String, Rc<RefCell<Vec<Rc<String>>>>>;
// the unused ty param is necessary so this gets monomorphized
pub fn request<T>(req: &header_map) {
let _x = req["METHOD".to_string()].clone().borrow().clone()[0].clone();
let data = req["METHOD".to_string()].clone();
let _x = data.borrow().clone()[0].clone();
}

View file

@ -295,7 +295,9 @@ fn main() {
let fd = std::old_io::File::open(&Path::new("shootout-k-nucleotide.data"));
get_sequence(&mut std::old_io::BufferedReader::new(fd), ">THREE")
} else {
get_sequence(&mut *std::old_io::stdin().lock(), ">THREE")
let mut stdin = std::old_io::stdin();
let mut stdin = stdin.lock();
get_sequence(&mut *stdin, ">THREE")
};
let input = Arc::new(input);

View file

@ -274,7 +274,9 @@ fn main() {
let mut sudoku = if use_default {
Sudoku::from_vec(&DEFAULT_SUDOKU)
} else {
Sudoku::read(&mut *old_io::stdin().lock())
let mut stdin = old_io::stdin();
let mut stdin = stdin.lock();
Sudoku::read(&mut *stdin)
};
sudoku.solve();
sudoku.write(&mut old_io::stdout());

View file

@ -37,7 +37,8 @@ fn parent() {
}
fn child() {
for line in old_io::stdin().lock().lines() {
let mut stdin = old_io::stdin();
for line in stdin.lock().lines() {
println!("{}", line.unwrap());
}
}

View file

@ -27,7 +27,8 @@ fn main() {
fn child() {
old_io::stdout().write_line("foo").unwrap();
old_io::stderr().write_line("bar").unwrap();
assert_eq!(old_io::stdin().lock().read_line().err().unwrap().kind, old_io::EndOfFile);
let mut stdin = old_io::stdin();
assert_eq!(stdin.lock().read_line().err().unwrap().kind, old_io::EndOfFile);
}
fn test() {

View file

@ -29,5 +29,5 @@ impl Bar {
fn main() {
let b = RefCell::new(Bar);
b.borrow().foo()
b.borrow().foo();
}

View file

@ -22,8 +22,9 @@ struct Point {
}
pub fn main() {
let box_5 = box 5u;
assert_eq!(Rc::new(5u).to_uint(), Some(5));
assert_eq!((box &box &Rc::new(box box &box 5u)).to_uint(), Some(5));
assert_eq!((box &box &Rc::new(box box &box_5)).to_uint(), Some(5));
let point = Rc::new(Point {x: 2, y: 4});
assert_eq!(point.x, 2);
assert_eq!(point.y, 4);