about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2016-11-04 16:49:30 -0700
committerAlex Crichton <alex@alexcrichton.com>2016-11-05 10:50:23 -0700
commitb4aee37224f60c60f0f49b4e613ee6081fb52355 (patch)
tree2d610c01f0c134b204475ae95dddf192397a7746 /src/test
parentee90485e248acf469a134db8605764ebeaf80225 (diff)
parentdc138b3156677f81f9be2afbf80465a0be8179c8 (diff)
Rollup merge of #37557 - TimNN:fix-36954, r=eddyb
Use DefId's in const eval for cross-crate const fn's

Fixes #36954.

r? @eddyb

cc @raphaelcohn
Diffstat (limited to 'src/test')
-rw-r--r--src/test/run-pass/auxiliary/issue-36954.rs18
-rw-r--r--src/test/run-pass/issue-36954.rs17
2 files changed, 35 insertions, 0 deletions
diff --git a/src/test/run-pass/auxiliary/issue-36954.rs b/src/test/run-pass/auxiliary/issue-36954.rs
new file mode 100644
index 00000000000..832ee1d7c1b
--- /dev/null
+++ b/src/test/run-pass/auxiliary/issue-36954.rs
@@ -0,0 +1,18 @@
+// 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.
+
+#![feature(const_fn)]
+#![crate_type = "lib"]
+
+const fn foo(i: i32) -> i32 {
+    i
+}
+
+pub const FOO: i32 = foo(1);
diff --git a/src/test/run-pass/issue-36954.rs b/src/test/run-pass/issue-36954.rs
new file mode 100644
index 00000000000..f8330ba99b7
--- /dev/null
+++ b/src/test/run-pass/issue-36954.rs
@@ -0,0 +1,17 @@
+// 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-36954.rs
+
+extern crate issue_36954 as lib;
+
+fn main() {
+    let _ = lib::FOO;
+}