diff options
| author | Patrick Walton <[email protected]> | 2011-04-19 16:40:18 -0700 |
|---|---|---|
| committer | Patrick Walton <[email protected]> | 2011-04-19 16:41:08 -0700 |
| commit | 5475c0009ca594e86ddb4c122a88e63261299e8f (patch) | |
| tree | 2ff3872a9cd1df5c581addbdd8d1a90cd8e245c3 /src/comp | |
| parent | Un-XFAIL a few recently passing tests. (diff) | |
| download | rust-5475c0009ca594e86ddb4c122a88e63261299e8f.tar.xz rust-5475c0009ca594e86ddb4c122a88e63261299e8f.zip | |
rustc: Use marijnh's stringifier for type hash and equality, since it's not sensitive to cnames
Diffstat (limited to 'src/comp')
| -rw-r--r-- | src/comp/middle/ty.rs | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/comp/middle/ty.rs b/src/comp/middle/ty.rs index a25c0057..707cfbf2 100644 --- a/src/comp/middle/ty.rs +++ b/src/comp/middle/ty.rs @@ -12,6 +12,7 @@ import driver.session; import front.ast; import front.ast.mutability; import front.creader; +import middle.metadata; import util.common; import util.common.new_def_hash; import util.common.span; @@ -656,15 +657,21 @@ fn plain_tup_ty(vec[@t] elem_tys) -> @t { ret plain_ty(ty_tup(mts)); } +fn def_to_str(ast.def_id did) -> str { + ret #fmt("%d:%d", did._0, did._1); +} + fn hash_ty(&@t ty) -> uint { - ret _str.hash(ty_to_str(ty)); + auto f = def_to_str; + ret _str.hash(metadata.ty_str(ty, f)); } fn eq_ty(&@t a, &@t b) -> bool { // FIXME: this is gross, but I think it's safe, and I don't think writing // a giant function to handle all the cases is necessary when structural // equality will someday save the day. - ret _str.eq(ty_to_str(a), ty_to_str(b)); + auto f = def_to_str; + ret _str.eq(metadata.ty_str(a, f), metadata.ty_str(b, f)); } fn ann_to_type(&ast.ann ann) -> @t { |