Merge remote branch 'upstream/master'
This commit is contained in:
commit
ec9c4fdde7
@ -2274,6 +2274,31 @@ fn make_free_glue(&@block_ctxt cx, ValueRef v0, &ty::t t) {
|
||||
rslt.bcx.build.RetVoid();
|
||||
}
|
||||
|
||||
fn maybe_free_ivec_heap_part(&@block_ctxt cx, ValueRef v0, ty::t unit_ty)
|
||||
-> result {
|
||||
auto llunitty = type_of_or_i8(cx, unit_ty);
|
||||
|
||||
auto stack_len = cx.build.Load(cx.build.InBoundsGEP(v0, [C_int(0),
|
||||
C_uint(abi::ivec_elt_len)]));
|
||||
auto maybe_on_heap_cx = new_sub_block_ctxt(cx, "maybe_on_heap");
|
||||
auto next_cx = new_sub_block_ctxt(cx, "next");
|
||||
auto maybe_on_heap = cx.build.ICmp(lib::llvm::LLVMIntEQ, stack_len,
|
||||
C_int(0));
|
||||
cx.build.CondBr(maybe_on_heap, maybe_on_heap_cx.llbb, next_cx.llbb);
|
||||
|
||||
// Might be on the heap. Load the heap pointer and free it. (It's ok to
|
||||
// free a null pointer.)
|
||||
auto stub_ptr = maybe_on_heap_cx.build.PointerCast(v0,
|
||||
T_ptr(T_ivec_heap(llunitty)));
|
||||
auto heap_ptr = maybe_on_heap_cx.build.Load(
|
||||
maybe_on_heap_cx.build.InBoundsGEP(stub_ptr,
|
||||
[C_int(0), C_uint(abi::ivec_heap_stub_elt_ptr)]));
|
||||
auto after_free_cx = trans_non_gc_free(maybe_on_heap_cx, heap_ptr).bcx;
|
||||
after_free_cx.build.Br(next_cx.llbb);
|
||||
|
||||
ret res(next_cx, C_nil());
|
||||
}
|
||||
|
||||
fn make_drop_glue(&@block_ctxt cx, ValueRef v0, &ty::t t) {
|
||||
// NB: v0 is an *alias* of type t here, not a direct value.
|
||||
auto rslt;
|
||||
@ -2286,6 +2311,11 @@ fn make_drop_glue(&@block_ctxt cx, ValueRef v0, &ty::t t) {
|
||||
rslt = decr_refcnt_maybe_free(cx, v0, v0, t);
|
||||
}
|
||||
|
||||
case (ty::ty_ivec(?tm)) {
|
||||
rslt = iter_structural_ty(cx, v0, t, drop_ty);
|
||||
rslt = maybe_free_ivec_heap_part(rslt.bcx, v0, tm.ty);
|
||||
}
|
||||
|
||||
case (ty::ty_box(_)) {
|
||||
rslt = decr_refcnt_maybe_free(cx, v0, v0, t);
|
||||
}
|
||||
@ -5885,7 +5915,7 @@ fn trans_ivec(@block_ctxt bcx, &vec[@ast::expr] args, &ast::ann ann)
|
||||
llfirsteltptr = C_null(T_ptr(llunitty));
|
||||
} else {
|
||||
auto llheapsz = bcx.build.Add(llsize_of(llheapty), lllen);
|
||||
rslt = trans_raw_malloc(bcx, llheapty, llheapsz);
|
||||
rslt = trans_raw_malloc(bcx, T_ptr(llheapty), llheapsz);
|
||||
bcx = rslt.bcx;
|
||||
auto llheapptr = rslt.val;
|
||||
|
||||
|
@ -527,7 +527,17 @@ mod collect {
|
||||
fn ty_of_arg(@ctxt cx, &ast::arg a) -> ty::arg {
|
||||
auto ty_mode = ast_mode_to_mode(a.mode);
|
||||
auto f = bind getter(cx, _);
|
||||
ret rec(mode=ty_mode, ty=ast_ty_to_ty(cx.tcx, f, a.ty));
|
||||
auto tt = ast_ty_to_ty(cx.tcx, f, a.ty);
|
||||
if (ty::type_has_dynamic_size(cx.tcx, tt)) {
|
||||
alt (ty_mode) {
|
||||
case (mo_val) {
|
||||
cx.tcx.sess.span_err(a.ty.span,
|
||||
"Dynamically sized arguments must be passed by alias");
|
||||
}
|
||||
case (_) { }
|
||||
}
|
||||
}
|
||||
ret rec(mode=ty_mode, ty=tt);
|
||||
}
|
||||
|
||||
fn ty_of_method(@ctxt cx, &@ast::method m) -> ty::method {
|
||||
|
@ -1,6 +1,4 @@
|
||||
// -*- rust -*-
|
||||
// xfail-stage0
|
||||
|
||||
// error-pattern: mismatched types
|
||||
|
||||
fn f(&int x) { log_err x; }
|
||||
|
@ -1,5 +1,4 @@
|
||||
// -*- rust -*-
|
||||
// xfail-stage0
|
||||
// Tests that a function with a ! annotation always actually fails
|
||||
// error-pattern: some control paths may return
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
// -*- rust -*-
|
||||
// xfail-stage0
|
||||
// Tests that a function with a ! annotation always actually fails
|
||||
// error-pattern: some control paths may return
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
// -*- rust -*-
|
||||
// xfail-stage0
|
||||
// Tests that a function with a ! annotation always actually fails
|
||||
// error-pattern: may return to the caller
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
// xfail-stage0
|
||||
// error-pattern: unresolved name: a
|
||||
|
||||
mod m1 {
|
||||
|
@ -1,4 +1,3 @@
|
||||
// xfail-stage0
|
||||
// error-pattern: unresolved import: vec
|
||||
import vec;
|
||||
|
||||
|
@ -1,7 +1,3 @@
|
||||
// xfail-stage0
|
||||
// xfail-stage1
|
||||
// xfail-stage2
|
||||
|
||||
// error-pattern: expecting
|
||||
|
||||
fn main() {
|
||||
|
@ -1,7 +1,4 @@
|
||||
// xfail-stage0
|
||||
// xfail-stage1
|
||||
// xfail-stage2
|
||||
// error-pattern: non-type context
|
||||
// error-pattern: unresolved name: base
|
||||
type base =
|
||||
obj {
|
||||
fn foo();
|
||||
|
@ -1,8 +1,4 @@
|
||||
// xfail-stage0
|
||||
// xfail-stage1
|
||||
// xfail-stage2
|
||||
|
||||
// error-pattern: is not a mod
|
||||
// error-pattern: base type for expr_field
|
||||
|
||||
obj x() {
|
||||
fn hello() {
|
||||
|
@ -1,7 +1,4 @@
|
||||
// xfail-stage0
|
||||
// xfail-stage1
|
||||
// xfail-stage2
|
||||
// error-pattern: does nothing
|
||||
// error-pattern: unresolved name: this_does_nothing_what_the
|
||||
fn main() {
|
||||
log "doing";
|
||||
this_does_nothing_what_the;
|
||||
|
@ -1,5 +1,3 @@
|
||||
// xfail-stage0
|
||||
|
||||
// error-pattern: duplicate value name: x
|
||||
|
||||
fn main() {
|
||||
|
@ -1,4 +1,3 @@
|
||||
// xfail-stage0
|
||||
// error-pattern: unresolved import
|
||||
|
||||
import m::unexported;
|
||||
|
@ -1,4 +1,3 @@
|
||||
// xfail-stage0
|
||||
// error-pattern:format string
|
||||
|
||||
fn main() {
|
||||
|
@ -12,7 +12,7 @@ fn bitv_to_str(fn_info enclosing, bitv::t v) -> str {
|
||||
// error is that the value type in the hash map is var_info, not a tuple
|
||||
for each (@tup(uint, tup(uint, uint)) p in enclosing.vars.items()) {
|
||||
if (bitv::get(v, p._1._0)) {
|
||||
s += "foo"; // " " + p._1._1 + " " + "[" + p._0 + "]";
|
||||
s += "foo";
|
||||
}
|
||||
}
|
||||
ret s;
|
||||
|
@ -1,4 +1,3 @@
|
||||
// xfail-stage0
|
||||
// error-pattern: unresolved import: baz
|
||||
import zed::bar;
|
||||
import zed::baz;
|
||||
|
@ -1,4 +1,3 @@
|
||||
// xfail-stage0
|
||||
// error-pattern: unresolved modulename
|
||||
import main::bar;
|
||||
|
||||
|
@ -1,9 +1,6 @@
|
||||
// xfail-stage0
|
||||
// xfail-stage1
|
||||
// xfail-stage2
|
||||
// -*- rust -*-
|
||||
|
||||
// error-pattern: infinite recursive type definition
|
||||
// xfail-stage0
|
||||
// error-pattern: illegal recursive type
|
||||
|
||||
type x = vec[x];
|
||||
|
||||
|
@ -1,9 +1,6 @@
|
||||
// xfail-stage0
|
||||
// xfail-stage1
|
||||
// xfail-stage2
|
||||
// -*- rust -*-
|
||||
|
||||
// error-pattern: name
|
||||
// xfail-stage0
|
||||
// error-pattern: Dynamically sized arguments must be passed by alias
|
||||
|
||||
mod foo {
|
||||
fn bar[T](T f) -> int { ret 17; }
|
||||
|
@ -1,4 +1,3 @@
|
||||
// xfail-stage0
|
||||
// error-pattern: return
|
||||
|
||||
fn f() -> int {
|
||||
|
@ -1,4 +1,3 @@
|
||||
// xfail-stage0
|
||||
// error-pattern: return
|
||||
|
||||
fn f() -> int {
|
||||
|
@ -1,5 +1,3 @@
|
||||
// xfail-stage0
|
||||
|
||||
// error-pattern:cannot determine a type
|
||||
fn main() -> () {
|
||||
auto foo = [];
|
||||
|
Loading…
x
Reference in New Issue
Block a user