about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorAriel Ben-Yehuda <ariel.byd@gmail.com>2017-02-23 19:03:30 +0200
committerAriel Ben-Yehuda <ariel.byd@gmail.com>2017-02-23 20:03:18 +0200
commit4e2c993bd3d894107e5165fc54f2f63f865f0d13 (patch)
treec032cf54e0b27776dc91350bcad2a0c8b53ae7d0 /src/test
parent306035c21741928bef75b8915d2195cce400b70a (diff)
downloadrust-4e2c993bd3d894107e5165fc54f2f63f865f0d13.tar.gz
rust-4e2c993bd3d894107e5165fc54f2f63f865f0d13.zip
trans: don't ICE when trying to create ADT trans-items
ADTs are translated in-place from rustc_trans::callee, so no trans-items
are needed.

This fix will be superseded by the shimmir branch, but I prefer not to
backport that to beta.

Fixes #39823.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/run-pass/auxiliary/issue_39823.rs17
-rw-r--r--src/test/run-pass/issue-39823.rs34
2 files changed, 51 insertions, 0 deletions
diff --git a/src/test/run-pass/auxiliary/issue_39823.rs b/src/test/run-pass/auxiliary/issue_39823.rs
new file mode 100644
index 00000000000..5342601ac14
--- /dev/null
+++ b/src/test/run-pass/auxiliary/issue_39823.rs
@@ -0,0 +1,17 @@
+// Copyright 2017 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.
+
+#![crate_type="rlib"]
+
+#[derive(Debug, PartialEq)]
+pub struct RemoteC(pub u32);
+
+#[derive(Debug, PartialEq)]
+pub struct RemoteG<T>(pub T);
diff --git a/src/test/run-pass/issue-39823.rs b/src/test/run-pass/issue-39823.rs
new file mode 100644
index 00000000000..061a55b03b2
--- /dev/null
+++ b/src/test/run-pass/issue-39823.rs
@@ -0,0 +1,34 @@
+// Copyright 2016 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.
+
+// aux-build:issue_39823.rs
+
+extern crate issue_39823;
+use issue_39823::{RemoteC, RemoteG};
+
+#[derive(Debug, PartialEq)]
+struct LocalC(u32);
+
+#[derive(Debug, PartialEq)]
+struct LocalG<T>(T);
+
+fn main() {
+    let virtual_localc : &Fn(_) -> LocalC = &LocalC;
+    assert_eq!(virtual_localc(1), LocalC(1));
+
+    let virtual_localg : &Fn(_) -> LocalG<u32> = &LocalG;
+    assert_eq!(virtual_localg(1), LocalG(1));
+
+    let virtual_remotec : &Fn(_) -> RemoteC = &RemoteC;
+    assert_eq!(virtual_remotec(1), RemoteC(1));
+
+    let virtual_remoteg : &Fn(_) -> RemoteG<u32> = &RemoteG;
+    assert_eq!(virtual_remoteg(1), RemoteG(1));
+}