about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2015-06-10 10:05:39 +0000
committerbors <bors@rust-lang.org>2015-06-10 10:05:39 +0000
commit8025bc964c0f31726636811d97f9f46cd0d4c40f (patch)
tree7dafbb2d5850c0ce44a977765175afe422ea9a37
parent6c5834d81b7a5e262dc7a273d897f90ac00d5ad2 (diff)
parent96bc00f30e66e6b48f3f9ad34344fe56dea812dc (diff)
downloadrust-8025bc964c0f31726636811d97f9f46cd0d4c40f.tar.gz
rust-8025bc964c0f31726636811d97f9f46cd0d4c40f.zip
Auto merge of #26153 - dotdash:issue26127, r=luqmana
Fixes #26127
-rw-r--r--src/librustc_trans/trans/base.rs2
-rw-r--r--src/test/run-pass/issue26127.rs21
2 files changed, 22 insertions, 1 deletions
diff --git a/src/librustc_trans/trans/base.rs b/src/librustc_trans/trans/base.rs
index 390c0b035fd..8eb655ccb7a 100644
--- a/src/librustc_trans/trans/base.rs
+++ b/src/librustc_trans/trans/base.rs
@@ -1676,7 +1676,7 @@ pub fn trans_named_tuple_constructor<'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
             if !type_is_zero_size(ccx, result_ty) {
                 alloc_ty(bcx, result_ty, "constructor_result")
             } else {
-                C_undef(type_of::type_of(ccx, result_ty))
+                C_undef(type_of::type_of(ccx, result_ty).ptr_to())
             }
         }
     };
diff --git a/src/test/run-pass/issue26127.rs b/src/test/run-pass/issue26127.rs
new file mode 100644
index 00000000000..75cbcc83d61
--- /dev/null
+++ b/src/test/run-pass/issue26127.rs
@@ -0,0 +1,21 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+trait Tr { type T; }
+impl Tr for u8 { type T=(); }
+struct S<I: Tr>(I::T);
+
+fn foo<I: Tr>(i: I::T) {
+    S::<I>(i);
+}
+
+fn main() {
+    foo::<u8>(());
+}