about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2015-09-26 23:38:54 +0000
committerbors <bors@rust-lang.org>2015-09-26 23:38:54 +0000
commit7bf4c885fc74dd0218518ee933c99a61ead7696f (patch)
tree6b4eb9aa066a4bca53af0a80c25199a170c33874 /src/test
parent6f880eee792e974b18cbb129fd16928939589e7c (diff)
parent38f1c47d18761414cbe69e76b4d76c71afc24789 (diff)
Auto merge of #28646 - vadimcn:imps, r=alexcrichton
As discussed in the referenced issues, this PR makes rustc emit `__imp_<symbol>` stubs for all public static data to ensure smooth linking in on `-windows-msvc` targets.  
Resolves #26591, cc #27438
Diffstat (limited to 'src/test')
-rw-r--r--src/test/auxiliary/msvc-data-only-lib.rs15
-rw-r--r--src/test/run-pass/msvc-data-only.rs17
2 files changed, 32 insertions, 0 deletions
diff --git a/src/test/auxiliary/msvc-data-only-lib.rs b/src/test/auxiliary/msvc-data-only-lib.rs
new file mode 100644
index 00000000000..71fb9a51948
--- /dev/null
+++ b/src/test/auxiliary/msvc-data-only-lib.rs
@@ -0,0 +1,15 @@
+// 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.
+
+// no-prefer-dynamic
+
+#![crate_type = "rlib"]
+
+pub static FOO: i32 = 42;
diff --git a/src/test/run-pass/msvc-data-only.rs b/src/test/run-pass/msvc-data-only.rs
new file mode 100644
index 00000000000..ad6888c4d30
--- /dev/null
+++ b/src/test/run-pass/msvc-data-only.rs
@@ -0,0 +1,17 @@
+// 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.
+
+// aux-build:msvc-data-only-lib.rs
+
+extern crate msvc_data_only_lib;
+
+fn main() {
+    println!("The answer is {} !", msvc_data_only_lib::FOO);
+}