about summary refs log tree commit diff
path: root/src/test/auxiliary
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-09-16 02:45:49 -0700
committerbors <bors@rust-lang.org>2013-09-16 02:45:49 -0700
commitd87078be727f06581b0d1fc6642abcc3ea6aae31 (patch)
treefac0fec90d3a14c7314acc5cedf9aabdc05549ec /src/test/auxiliary
parent610c0cdf11ea350793fa9a7b9d0af96f8ed5ab94 (diff)
parent1da4488d8713a4190f110407470f57ddec42ec62 (diff)
downloadrust-d87078be727f06581b0d1fc6642abcc3ea6aae31.tar.gz
rust-d87078be727f06581b0d1fc6642abcc3ea6aae31.zip
auto merge of #9206 : alexcrichton/rust/issue-9188, r=catamorphism
While they may have the same name within various scopes, this changes static
names to use path_pretty_name to append some hash information at the end of the
symbol. We're then guaranteed that each static has a unique NodeId, so this
NodeId is as the "hash" of the pretty name.

Closes #9188
Diffstat (limited to 'src/test/auxiliary')
-rw-r--r--src/test/auxiliary/issue_9188.rs24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/test/auxiliary/issue_9188.rs b/src/test/auxiliary/issue_9188.rs
new file mode 100644
index 00000000000..5f5a8f02fd9
--- /dev/null
+++ b/src/test/auxiliary/issue_9188.rs
@@ -0,0 +1,24 @@
+// Copyright 2013 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.
+
+pub fn foo<T>() -> &'static int {
+    if false {
+        static a: int = 4;
+        return &a;
+    } else {
+        static a: int = 5;
+        return &a;
+    }
+}
+
+pub fn bar() -> &'static int {
+    foo::<int>()
+}
+