Skip to content

Commit a83de48

Browse files
committed
---
yaml --- r: 98173 b: refs/heads/master c: 76c9028 h: refs/heads/master i: 98171: a770c73 v: v3
1 parent f803b2f commit a83de48

File tree

3 files changed

+26
-2
lines changed

3 files changed

+26
-2
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: fd318300cf713f0e74f3a834f6c07970b85f17e4
2+
refs/heads/master: 76c90283ce9de476357abf9a5fed79e86a2f1f53
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: b6400f998497c3958f40997a71756ead344a776d
55
refs/heads/try: c274a6888410ce3e357e014568b43310ed787d36

trunk/src/librustc/middle/trans/intrinsic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ pub fn trans_intrinsic(ccx: @CrateContext,
317317
"uninit" => {
318318
// Do nothing, this is effectively a no-op
319319
let retty = substs.tys[0];
320-
if type_is_immediate(ccx, retty) && !ty::type_is_nil(retty) {
320+
if type_is_immediate(ccx, retty) && !type_is_voidish(ccx, retty) {
321321
unsafe {
322322
Ret(bcx, lib::llvm::llvm::LLVMGetUndef(type_of(ccx, retty).to_ref()));
323323
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// Test the uninit() construct returning various empty types.
12+
13+
use std::vec;
14+
use std::unstable::intrinsics;
15+
16+
#[deriving(Clone)]
17+
struct Foo;
18+
19+
fn main() {
20+
unsafe {
21+
let _x: Foo = intrinsics::uninit();
22+
let _x: [Foo, ..2] = intrinsics::uninit();
23+
}
24+
}

0 commit comments

Comments
 (0)