Skip to content

Commit 56c39ae

Browse files
committed
fixes for new rules for lifetimes and destructors.
note that some of these cases may actually be fixes to latent bugs, in some sense (depending on what our guarantees are about e.g. what a hashmap should be allowed to access in its own destructor).
1 parent c5dde23 commit 56c39ae

File tree

6 files changed

+13
-8
lines changed

6 files changed

+13
-8
lines changed

src/libregex/vm.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,10 @@ impl<'r, 't> Nfa<'r, 't> {
120120
};
121121
let mut matched = false;
122122
let ninsts = self.prog.insts.len();
123-
let mut clist = &mut Threads::new(self.which, ninsts, ncaps);
124-
let mut nlist = &mut Threads::new(self.which, ninsts, ncaps);
123+
let mut cthread = Threads::new(self.which, ninsts, ncaps);
124+
let mut nthread = Threads::new(self.which, ninsts, ncaps);
125+
let mut clist = &mut cthread;
126+
let mut nlist = &mut nthread;
125127

126128
let mut groups: Vec<_> = repeat(None).take(ncaps * 2).collect();
127129

src/test/auxiliary/issue-2631-a.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,6 @@ pub type header_map = HashMap<String, Rc<RefCell<Vec<Rc<String>>>>>;
1919

2020
// the unused ty param is necessary so this gets monomorphized
2121
pub fn request<T>(req: &header_map) {
22-
let _x = req["METHOD".to_string()].clone().borrow().clone()[0].clone();
22+
let data = req["METHOD".to_string()].clone();
23+
let _x = data.borrow().clone()[0].clone();
2324
}

src/test/run-pass/issue-13304.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ fn parent() {
3737
}
3838

3939
fn child() {
40-
for line in io::stdin().lock().lines() {
40+
let mut stdin = io::stdin();
41+
for line in stdin.lock().lines() {
4142
println!("{}", line.unwrap());
42-
}
43+
};
4344
}

src/test/run-pass/issue-14456.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ fn main() {
2727
fn child() {
2828
io::stdout().write_line("foo").unwrap();
2929
io::stderr().write_line("bar").unwrap();
30-
assert_eq!(io::stdin().lock().read_line().err().unwrap().kind, io::EndOfFile);
30+
let mut stdin = io::stdin();
31+
assert_eq!(stdin.lock().read_line().err().unwrap().kind, io::EndOfFile);
3132
}
3233

3334
fn test() {

src/test/run-pass/issue-3026.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ extern crate collections;
1717
use std::collections::HashMap;
1818

1919
pub fn main() {
20-
let mut buggy_map: HashMap<uint, &uint> = HashMap::new();
2120
let x = box 1;
21+
let mut buggy_map: HashMap<uint, &uint> = HashMap::new();
2222
buggy_map.insert(42, &*x);
2323
}

src/test/run-pass/multidispatch-conditional-impl-not-considered.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,5 @@ impl Bar {
2929

3030
fn main() {
3131
let b = RefCell::new(Bar);
32-
b.borrow().foo()
32+
b.borrow().foo();
3333
}

0 commit comments

Comments
 (0)