Skip to content

Commit fcb055e

Browse files
committed
forgotten tests for #3217, #2977, #3067
1 parent 4b1d83c commit fcb055e

File tree

3 files changed

+33
-0
lines changed

3 files changed

+33
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
struct defer {
2+
x: &[&str];
3+
new(x: &[&str]) { self.x = x; }
4+
drop { #error["%?", self.x]; }
5+
}
6+
7+
fn main() {
8+
let _x = defer(~["Goodbye", "world!"]); //~ ERROR illegal borrow
9+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//buggy.rs
2+
use std;
3+
import std::map::hashmap;
4+
import std::map;
5+
6+
fn main() {
7+
let buggy_map :hashmap<uint, &uint> = hashmap::<uint, &uint>(uint::hash, uint::eq);
8+
buggy_map.insert(42, ~1); //~ ERROR illegal borrow
9+
10+
// but it is ok if we use a temporary
11+
let tmp = ~2;
12+
buggy_map.insert(43, tmp);
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
fn main() {
2+
let msg;
3+
match some(~"Hello") { //~ ERROR illegal borrow
4+
some(ref m) => {
5+
msg = m;
6+
},
7+
none => { fail }
8+
}
9+
io::println(*msg);
10+
}
11+

0 commit comments

Comments
 (0)