-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Guarantee that statics have unique names
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
- Loading branch information
1 parent
7c8f503
commit 1da4488
Showing
4 changed files
with
49 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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>() | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// 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. | ||
|
||
// aux-build:issue_9188.rs | ||
// xfail-fast windows doesn't like aux-build | ||
|
||
extern mod issue_9188; | ||
|
||
fn main() { | ||
let a = issue_9188::bar(); | ||
let b = issue_9188::foo::<int>(); | ||
assert_eq!(*a, *b); | ||
} | ||
|
1da4488
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
saw approval from catamorphism
at alexcrichton@1da4488
1da4488
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
merging alexcrichton/rust/issue-9188 = 1da4488 into auto
1da4488
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alexcrichton/rust/issue-9188 = 1da4488 merged ok, testing candidate = e85a65f1
1da4488
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some tests failed:
failure: http://buildbot.rust-lang.org/builders/auto-mac-32-opt/builds/1493
exception: http://buildbot.rust-lang.org/builders/auto-mac-64-opt/builds/1496
exception: http://buildbot.rust-lang.org/builders/auto-mac-64-nopt-c/builds/602
exception: http://buildbot.rust-lang.org/builders/auto-mac-64-nopt-t/builds/602
1da4488
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
saw approval from catamorphism
at alexcrichton@1da4488
1da4488
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
merging alexcrichton/rust/issue-9188 = 1da4488 into auto
1da4488
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alexcrichton/rust/issue-9188 = 1da4488 merged ok, testing candidate = d572d60d
1da4488
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some tests failed:
failure: http://buildbot.rust-lang.org/builders/auto-linux-32-nopt-t/builds/605
exception: http://buildbot.rust-lang.org/builders/auto-mac-32-opt/builds/1495
exception: http://buildbot.rust-lang.org/builders/auto-mac-64-opt/builds/1498
exception: http://buildbot.rust-lang.org/builders/auto-mac-64-nopt-c/builds/604
exception: http://buildbot.rust-lang.org/builders/auto-mac-64-nopt-t/builds/604
exception: http://buildbot.rust-lang.org/builders/auto-linux-32-opt/builds/1514
exception: http://buildbot.rust-lang.org/builders/auto-linux-32-nopt-c/builds/605
exception: http://buildbot.rust-lang.org/builders/auto-linux-64-opt/builds/1514
exception: http://buildbot.rust-lang.org/builders/auto-linux-64-nopt-c/builds/605
exception: http://buildbot.rust-lang.org/builders/auto-linux-64-nopt-t/builds/605
exception: http://buildbot.rust-lang.org/builders/auto-win-32-opt/builds/1499
exception: http://buildbot.rust-lang.org/builders/auto-win-32-nopt-c/builds/604
exception: http://buildbot.rust-lang.org/builders/auto-win-32-nopt-t/builds/605
exception: http://buildbot.rust-lang.org/builders/auto-bsd-64-opt/builds/1283
1da4488
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
saw approval from catamorphism
at alexcrichton@1da4488
1da4488
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
merging alexcrichton/rust/issue-9188 = 1da4488 into auto
1da4488
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alexcrichton/rust/issue-9188 = 1da4488 merged ok, testing candidate = d87078b
1da4488
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all tests pass:
success: http://buildbot.rust-lang.org/builders/auto-mac-32-opt/builds/1501
success: http://buildbot.rust-lang.org/builders/auto-mac-64-opt/builds/1504
success: http://buildbot.rust-lang.org/builders/auto-mac-64-nopt-c/builds/610
success: http://buildbot.rust-lang.org/builders/auto-mac-64-nopt-t/builds/610
success: http://buildbot.rust-lang.org/builders/auto-linux-32-opt/builds/1520
success: http://buildbot.rust-lang.org/builders/auto-linux-32-nopt-c/builds/611
success: http://buildbot.rust-lang.org/builders/auto-linux-32-nopt-t/builds/611
success: http://buildbot.rust-lang.org/builders/auto-linux-64-opt/builds/1520
success: http://buildbot.rust-lang.org/builders/auto-linux-64-nopt-c/builds/611
success: http://buildbot.rust-lang.org/builders/auto-linux-64-nopt-t/builds/611
success: http://buildbot.rust-lang.org/builders/auto-linux-64-x-android/builds/692
success: http://buildbot.rust-lang.org/builders/auto-win-32-opt/builds/1505
success: http://buildbot.rust-lang.org/builders/auto-win-32-nopt-c/builds/610
success: http://buildbot.rust-lang.org/builders/auto-win-32-nopt-t/builds/611
success: http://buildbot.rust-lang.org/builders/auto-bsd-64-opt/builds/1289
1da4488
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fast-forwarding master to auto = d87078b