From c5877450e605e842806140d3bdd93ca931fb60aa Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Sat, 24 Sep 2011 01:52:45 -0700 Subject: [PATCH] Tweak the type allocated for unique pointers Seems to be more correctish... Issue #409 --- src/comp/middle/trans_uniq.rs | 6 ++++-- src/test/run-pass/foreach-unique-drop.rs | 1 - src/test/run-pass/generic-unique.rs | 3 +-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/comp/middle/trans_uniq.rs b/src/comp/middle/trans_uniq.rs index 52efa7aec8ba..faa7c812054b 100644 --- a/src/comp/middle/trans_uniq.rs +++ b/src/comp/middle/trans_uniq.rs @@ -4,7 +4,7 @@ import trans_common::*; import trans_build::*; import trans::{ trans_shared_malloc, - type_of_or_i8, + type_of_inner, size_of, move_val_if_temp, node_id_type, @@ -54,7 +54,9 @@ fn alloc_uniq(cx: @block_ctxt, uniq_ty: ty::t) bcx = r.bcx; let llsz = r.val; - let llptrty = T_ptr(type_of_or_i8(bcx, contents_ty)); + let ccx = bcx_ccx(bcx); + check non_ty_var(ccx, contents_ty); + let llptrty = T_ptr(type_of_inner(ccx, bcx.sp, contents_ty)); r = trans_shared_malloc(bcx, llptrty, llsz); bcx = r.bcx; diff --git a/src/test/run-pass/foreach-unique-drop.rs b/src/test/run-pass/foreach-unique-drop.rs index aab919e3f798..fb2f901a7d79 100644 --- a/src/test/run-pass/foreach-unique-drop.rs +++ b/src/test/run-pass/foreach-unique-drop.rs @@ -1,4 +1,3 @@ -// xfail-test obj ob(k: K) { iter foo() -> ~{a: K} { put ~{a: k}; } diff --git a/src/test/run-pass/generic-unique.rs b/src/test/run-pass/generic-unique.rs index af7dda5bb970..805501eac8b8 100644 --- a/src/test/run-pass/generic-unique.rs +++ b/src/test/run-pass/generic-unique.rs @@ -1,6 +1,5 @@ -// xfail-test -fn box(x: {x: T, y: T, z: T}) -> ~{x: T, y: T, z: T} { ret ~x; } +fn box<@T>(x: {x: T, y: T, z: T}) -> ~{x: T, y: T, z: T} { ret ~x; } fn main() { let x: ~{x: int, y: int, z: int} = box::({x: 1, y: 2, z: 3});