rustc: Hash the CMH into symbol names

This commit is contained in:
Brian Anderson 2012-04-07 17:50:49 -07:00
parent 0094ffd99b
commit a6e748a1d9
4 changed files with 28 additions and 2 deletions

View File

@ -420,8 +420,7 @@ fn symbol_hash(tcx: ty::ctxt, sha: sha1, t: ty::t, link_meta: link_meta) ->
sha.reset();
sha.input_str(link_meta.name);
sha.input_str("-");
// FIXME: This wants to be link_meta.meta_hash
sha.input_str(link_meta.name);
sha.input_str(link_meta.extras_hash);
sha.input_str("-");
sha.input_str(encoder::encoded_ty(tcx, t));
let hash = truncated_sha1_result(sha);

View File

@ -0,0 +1,7 @@
#[link(name = "crateresolve6",
vers = "0.1",
calories = "100")];
#[crate_type = "lib"];
fn f() -> int { 100 }

View File

@ -0,0 +1,7 @@
#[link(name = "crateresolve6",
vers = "0.1",
calories = "200")];
#[crate_type = "lib"];
fn f() -> int { 200 }

View File

@ -0,0 +1,13 @@
// xfail-fast
// aux-build:crateresolve6-1.rs
// aux-build:crateresolve6-2.rs
// error-pattern:mismatched types
// These both have the same version but differ in other metadata
use cr6_1 (name = "crateresolve6", vers = "0.1", calories="100");
use cr6_2 (name = "crateresolve6", vers = "0.1", calories="200");
fn main() {
assert cr6_1::f() == 100;
assert cr6_2::f() == 200;
}