Skip to content

Commit 70192ab

Browse files
committed
accommodate new scoping rules in test/compile-fail.
1 parent 9fe8d86 commit 70192ab

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/test/compile-fail/borrowck-borrowed-uniq-rvalue.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@ extern crate collections;
1616
use std::collections::HashMap;
1717

1818
fn main() {
19+
let tmp;
1920
let mut buggy_map: HashMap<usize, &usize> = HashMap::new();
2021
buggy_map.insert(42, &*box 1); //~ ERROR borrowed value does not live long enough
2122

2223
// but it is ok if we use a temporary
23-
let tmp = box 2;
24+
tmp = box 2;
2425
buggy_map.insert(43, &*tmp);
2526
}

src/test/compile-fail/issue-18783.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,16 @@
1313
use std::cell::RefCell;
1414

1515
fn main() {
16-
let c = RefCell::new(vec![]);
1716
let mut y = 1us;
17+
let c = RefCell::new(vec![]);
1818
c.push(box || y = 0);
1919
c.push(box || y = 0);
2020
//~^ ERROR cannot borrow `y` as mutable more than once at a time
2121
}
2222

2323
fn ufcs() {
24-
let c = RefCell::new(vec![]);
2524
let mut y = 1us;
25+
let c = RefCell::new(vec![]);
2626

2727
Push::push(&c, box || y = 0);
2828
Push::push(&c, box || y = 0);

0 commit comments

Comments
 (0)