When building a Rust target with Rust library dependencies, an `--extern` argument is now specified to avoid ambiguity between the dependency library, and any crates of the same name in `rustc`'s private sysroot. Includes an illustrative test case.pull/3136/head
parent
2f21e1ffc0
commit
3332f33649
6 changed files with 24 additions and 0 deletions
@ -0,0 +1,6 @@ |
|||||||
|
## Rust compiler-private library disambiguation |
||||||
|
|
||||||
|
When building a Rust target with Rust library dependencies, an |
||||||
|
`--extern` argument is now specified to avoid ambiguity between the |
||||||
|
dependency library, and any crates of the same name in `rustc`'s |
||||||
|
private sysroot. |
@ -0,0 +1,2 @@ |
|||||||
|
usr/bin/prog?exe |
||||||
|
usr/lib/librand.rlib |
@ -0,0 +1,5 @@ |
|||||||
|
project('rust private crate collision', 'rust') |
||||||
|
|
||||||
|
l = static_library('rand', 'rand.rs', install : true) |
||||||
|
e = executable('prog', 'prog.rs', link_with : l, install : true) |
||||||
|
test('linktest', e) |
@ -0,0 +1,3 @@ |
|||||||
|
extern crate rand; |
||||||
|
|
||||||
|
fn main() { println!("printing: {}", rand::explore()); } |
@ -0,0 +1,4 @@ |
|||||||
|
// use a name that collides with one of the rustc_private libraries
|
||||||
|
#![crate_name = "rand"] |
||||||
|
|
||||||
|
pub fn explore() -> &'static str { "librarystring" } |
Loading…
Reference in new issue