-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use version and hash in crate_map name
Related issue #2137
- Loading branch information
Showing
5 changed files
with
57 additions
and
6 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,6 @@ | ||
#[link(name = "crateresolve3", | ||
vers = "0.1")]; | ||
|
||
#[crate_type = "lib"]; | ||
|
||
fn f() -> int { 10 } |
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,6 @@ | ||
#[link(name = "crateresolve3", | ||
vers = "0.2")]; | ||
|
||
#[crate_type = "lib"]; | ||
|
||
fn g() -> int { 20 } |
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 @@ | ||
// xfail-fast | ||
// aux-build:crateresolve3-1.rs | ||
// aux-build:crateresolve3-2.rs | ||
|
||
// verify able to link with crates with same name but different versions | ||
// as long as no name collision on invoked functions. | ||
|
||
mod a { | ||
use crateresolve3(vers = "0.1"); | ||
fn f() { assert crateresolve3::f() == 10; } | ||
} | ||
|
||
mod b { | ||
use crateresolve3(vers = "0.2"); | ||
fn f() { assert crateresolve3::g() == 20; } | ||
} | ||
|
||
fn main() { | ||
a::f(); | ||
b::f(); | ||
} |
2f42b14
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.
Awesome!