-
Notifications
You must be signed in to change notification settings - Fork 412
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Supply crate metadata to rustc and uniqueify --extern'ed crates (#47)
* Unique-ify --extern crates by adding a path based hash * Wip * Minor cleanups: add test, add comment * Fix test (in a very unsatisfying way) * Fix the other test as well * Final nit fixes * use the same hash * More nits * Move conflicting_deps into test * Fix test * Remove unused fn
- Loading branch information
1 parent
cebb2a9
commit f3a46b1
Showing
9 changed files
with
112 additions
and
11 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
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,22 @@ | ||
package(default_visibility = ["//visibility:public"]) | ||
|
||
load( | ||
"//rust:rust.bzl", | ||
"rust_library", | ||
"rust_test", | ||
) | ||
|
||
rust_library( | ||
name = "conflicting_deps", | ||
srcs = ["src/lib.rs"], | ||
deps = [ | ||
"//test/conflicting_deps/first_crate:example_name_conflict" | ||
], | ||
) | ||
|
||
rust_test( | ||
name = "conflicting_deps_test", | ||
deps = [ | ||
":conflicting_deps", | ||
], | ||
) |
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,15 @@ | ||
package(default_visibility = ["//visibility:public"]) | ||
|
||
load( | ||
"//rust:rust.bzl", | ||
"rust_library", | ||
) | ||
|
||
rust_library( | ||
name = "example_name_conflict", | ||
srcs = ["src/lib.rs"], | ||
deps = [ | ||
"//test/conflicting_deps/first_crate/second_crate:example_name_conflict" | ||
], | ||
) | ||
|
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,12 @@ | ||
package(default_visibility = ["//visibility:public"]) | ||
|
||
load( | ||
"//rust:rust.bzl", | ||
"rust_library", | ||
) | ||
|
||
rust_library( | ||
name = "example_name_conflict", | ||
srcs = ["src/lib.rs"], | ||
deps = [], | ||
) |
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,5 @@ | ||
// This crate's name conflicts with its dependent but this should work OK. | ||
|
||
pub fn example_conflicting_symbol() -> String { | ||
"[from second_crate]".to_owned() | ||
} |
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,10 @@ | ||
// This crate's name conflicts with its dependency but this should work OK. | ||
|
||
extern crate example_name_conflict; | ||
|
||
pub fn example_conflicting_symbol() -> String { | ||
format!( | ||
"[from first_crate] -> {}", | ||
example_name_conflict::example_conflicting_symbol() | ||
) | ||
} |
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,22 @@ | ||
extern crate example_name_conflict; | ||
|
||
// This crate depends on a pair of dependencies (transitively) that have the same name. This should | ||
// work OK. | ||
|
||
pub fn example_conflicting_symbol() -> String { | ||
format!( | ||
"[from main lib] -> {}", | ||
example_name_conflict::example_conflicting_symbol() | ||
) | ||
} | ||
|
||
#[cfg(test)] | ||
mod tests { | ||
#[test] | ||
fn symbols_all_resolve_correctly() { | ||
assert_eq!( | ||
::example_conflicting_symbol(), | ||
"[from main lib] -> [from first_crate] -> [from second_crate]".to_owned() | ||
); | ||
} | ||
} |