Skip to content

Commit c587745

Browse files
committed
Tweak the type allocated for unique pointers
Seems to be more correctish... Issue #409
1 parent 777a536 commit c587745

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/comp/middle/trans_uniq.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import trans_common::*;
44
import trans_build::*;
55
import trans::{
66
trans_shared_malloc,
7-
type_of_or_i8,
7+
type_of_inner,
88
size_of,
99
move_val_if_temp,
1010
node_id_type,
@@ -54,7 +54,9 @@ fn alloc_uniq(cx: @block_ctxt, uniq_ty: ty::t)
5454
bcx = r.bcx;
5555
let llsz = r.val;
5656

57-
let llptrty = T_ptr(type_of_or_i8(bcx, contents_ty));
57+
let ccx = bcx_ccx(bcx);
58+
check non_ty_var(ccx, contents_ty);
59+
let llptrty = T_ptr(type_of_inner(ccx, bcx.sp, contents_ty));
5860

5961
r = trans_shared_malloc(bcx, llptrty, llsz);
6062
bcx = r.bcx;

src/test/run-pass/foreach-unique-drop.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// xfail-test
21

32
obj ob<K>(k: K) {
43
iter foo() -> ~{a: K} { put ~{a: k}; }

src/test/run-pass/generic-unique.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
// xfail-test
21

3-
fn box<T>(x: {x: T, y: T, z: T}) -> ~{x: T, y: T, z: T} { ret ~x; }
2+
fn box<@T>(x: {x: T, y: T, z: T}) -> ~{x: T, y: T, z: T} { ret ~x; }
43

54
fn main() {
65
let x: ~{x: int, y: int, z: int} = box::<int>({x: 1, y: 2, z: 3});

0 commit comments

Comments
 (0)