Skip to content

Commit aa56c4c

Browse files
committed
---
yaml --- r: 39679 b: refs/heads/incoming c: 6c18c75 h: refs/heads/master i: 39677: 5b76186 39675: cc4c7c7 39671: 2f5cb18 39663: 82d0870 39647: cccb807 39615: ffe62f5 39551: e179219 39423: 1928368 v: v3
1 parent b848341 commit aa56c4c

File tree

4 files changed

+5
-31
lines changed

4 files changed

+5
-31
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: 3d5418789064fdb463e872a4e651af1c628a3650
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: a810c03263670238bccd64cabb12a23a46e3a278
9-
refs/heads/incoming: 3e7ab3a443a3c49d457226e7842a7256fe07933b
9+
refs/heads/incoming: 6c18c75f2d1d9c491f288724d355c11d3788d123
1010
refs/heads/dist-snap: 22efa39382d41b084fde1719df7ae8ce5697d8c9
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/incoming/src/librustc/middle/trans/consts.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,7 @@ fn const_expr(cx: @crate_ctxt, e: @ast::expr) -> ValueRef {
398398
// forbids paths that don't map to C-like enum variants.
399399
let ety = ty::expr_ty(cx.tcx, e);
400400
let llty = type_of::type_of(cx, ety);
401+
let llstructtys = lib::llvm::struct_element_types(llty);
401402

402403
// Can't use `discrims` from the crate context here because
403404
// those discriminants have an extra level of indirection,
@@ -421,14 +422,8 @@ fn const_expr(cx: @crate_ctxt, e: @ast::expr) -> ValueRef {
421422
lldiscrim = found_lldiscrim;
422423
}
423424
}
424-
let fields = if ty::enum_is_univariant(cx.tcx, enum_did) {
425-
~[lldiscrim]
426-
} else {
427-
let llstructtys = lib::llvm::struct_element_types(llty);
428-
~[lldiscrim, C_null(llstructtys[1])]
429-
};
430425

431-
C_named_struct(llty, fields)
426+
C_named_struct(llty, ~[ lldiscrim, C_null(llstructtys[1]) ])
432427
}
433428
Some(ast::def_struct(_)) => {
434429
let ety = ty::expr_ty(cx.tcx, e);

branches/incoming/src/rt/rust_upcall.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,7 @@ upcall_s_exchange_malloc(s_exchange_malloc_args *args) {
158158
LOG_UPCALL_ENTRY(task);
159159

160160
size_t total_size = get_box_size(args->size, args->td->align);
161-
// FIXME--does this have to be calloc? (Issue #2682)
162-
void *p = task->kernel->calloc(total_size, "exchange malloc");
161+
void *p = task->kernel->malloc(total_size, "exchange malloc");
163162

164163
rust_opaque_box *header = static_cast<rust_opaque_box*>(p);
165164
header->ref_count = -1; // This is not ref counted
@@ -234,8 +233,7 @@ upcall_s_malloc(s_malloc_args *args) {
234233
LOG_UPCALL_ENTRY(task);
235234
LOG(task, mem, "upcall malloc(0x%" PRIxPTR ")", args->td);
236235

237-
// FIXME--does this have to be calloc? (Issue #2682)
238-
rust_opaque_box *box = task->boxed.calloc(args->td, args->size);
236+
rust_opaque_box *box = task->boxed.malloc(args->td, args->size);
239237
void *body = box_body(box);
240238

241239
debug::maybe_track_origin(task, box);

branches/incoming/src/test/run-pass/const-nullary-univariant-enum.rs

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)