1da4488d87
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
25 lines
681 B
Rust
25 lines
681 B
Rust
// 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>()
|
|
}
|
|
|