@@ -150,7 +150,7 @@ pub struct field_ty {
150150
151151// Contains information needed to resolve types and (in the future) look up
152152// the types of AST nodes.
153- #[ deriving( Eq , Hash ) ]
153+ #[ deriving( Eq , Hash ) ]
154154pub struct creader_cache_key {
155155 cnum : CrateNum ,
156156 pos : uint ,
@@ -4926,13 +4926,11 @@ pub fn trait_method_of_method(tcx: ctxt,
49264926/// Creates a hash of the type `t` which will be the same no matter what crate
49274927/// context it's calculated within. This is used by the `type_id` intrinsic.
49284928pub fn hash_crate_independent ( tcx : ctxt , t : t , local_hash : ~str ) -> u64 {
4929- use std:: hash:: { sip, Hash } ;
4930-
4931- let mut hash = sip:: SipState :: new ( 0 , 0 ) ;
4932- macro_rules! byte( ( $b: expr) => { ( $b as u8 ) . hash( & mut hash) } ) ;
4933- macro_rules! hash( ( $e: expr) => { $e. hash( & mut hash) } ) ;
4929+ let mut state = sip:: SipState :: new ( 0 , 0 ) ;
4930+ macro_rules! byte( ( $b: expr) => { ( $b as u8 ) . hash( & mut state) } ) ;
4931+ macro_rules! hash( ( $e: expr) => { $e. hash( & mut state) } ) ;
49344932
4935- let region = |_hash : & mut sip:: SipState , r : Region | {
4933+ let region = |_state : & mut sip:: SipState , r : Region | {
49364934 match r {
49374935 ReStatic => { }
49384936
@@ -4946,27 +4944,27 @@ pub fn hash_crate_independent(tcx: ctxt, t: t, local_hash: ~str) -> u64 {
49464944 }
49474945 }
49484946 } ;
4949- let vstore = |hash : & mut sip:: SipState , v : vstore | {
4947+ let vstore = |state : & mut sip:: SipState , v : vstore | {
49504948 match v {
4951- vstore_fixed( _) => 0u8 . hash ( hash ) ,
4952- vstore_uniq => 1u8 . hash ( hash ) ,
4949+ vstore_fixed( _) => 0u8 . hash ( state ) ,
4950+ vstore_uniq => 1u8 . hash ( state ) ,
49534951 vstore_slice( r) => {
4954- 2u8 . hash ( hash ) ;
4955- region ( hash , r) ;
4952+ 2u8 . hash ( state ) ;
4953+ region ( state , r) ;
49564954 }
49574955 }
49584956 } ;
4959- let did = |hash : & mut sip:: SipState , did : DefId | {
4957+ let did = |state : & mut sip:: SipState , did : DefId | {
49604958 let h = if ast_util:: is_local ( did) {
49614959 local_hash. clone ( )
49624960 } else {
49634961 tcx. sess . cstore . get_crate_hash ( did. krate )
49644962 } ;
4965- h. as_bytes ( ) . hash ( hash ) ;
4966- did. node . hash ( hash ) ;
4963+ h. as_bytes ( ) . hash ( state ) ;
4964+ did. node . hash ( state ) ;
49674965 } ;
4968- let mt = |hash : & mut sip:: SipState , mt : mt | {
4969- mt. mutbl . hash ( hash ) ;
4966+ let mt = |state : & mut sip:: SipState , mt : mt | {
4967+ mt. mutbl . hash ( state ) ;
49704968 } ;
49714969 ty:: walk_ty ( t, |t| {
49724970 match ty:: get ( t) . sty {
@@ -5002,17 +5000,17 @@ pub fn hash_crate_independent(tcx: ctxt, t: t, local_hash: ~str) -> u64 {
50025000 }
50035001 ty_vec( m, v) => {
50045002 byte ! ( 11 ) ;
5005- mt ( & mut hash , m) ;
5006- vstore ( & mut hash , v) ;
5003+ mt ( & mut state , m) ;
5004+ vstore ( & mut state , v) ;
50075005 }
50085006 ty_ptr( m) => {
50095007 byte ! ( 12 ) ;
5010- mt ( & mut hash , m) ;
5008+ mt ( & mut state , m) ;
50115009 }
50125010 ty_rptr( r, m) => {
50135011 byte ! ( 13 ) ;
5014- region ( & mut hash , r) ;
5015- mt ( & mut hash , m) ;
5012+ region ( & mut state , r) ;
5013+ mt ( & mut state , m) ;
50165014 }
50175015 ty_bare_fn( ref b) => {
50185016 byte ! ( 14 ) ;
@@ -5025,24 +5023,24 @@ pub fn hash_crate_independent(tcx: ctxt, t: t, local_hash: ~str) -> u64 {
50255023 hash ! ( c. sigil) ;
50265024 hash ! ( c. onceness) ;
50275025 hash ! ( c. bounds) ;
5028- region ( & mut hash , c. region ) ;
5026+ region ( & mut state , c. region ) ;
50295027 }
50305028 ty_trait( d, _, store, m, bounds) => {
50315029 byte ! ( 17 ) ;
5032- did ( & mut hash , d) ;
5030+ did ( & mut state , d) ;
50335031 match store {
50345032 UniqTraitStore => byte ! ( 0 ) ,
50355033 RegionTraitStore ( r) => {
50365034 byte ! ( 1 )
5037- region ( & mut hash , r) ;
5035+ region ( & mut state , r) ;
50385036 }
50395037 }
50405038 hash ! ( m) ;
50415039 hash ! ( bounds) ;
50425040 }
50435041 ty_struct( d, _) => {
50445042 byte ! ( 18 ) ;
5045- did ( & mut hash , d) ;
5043+ did ( & mut state , d) ;
50465044 }
50475045 ty_tup( ref inner) => {
50485046 byte ! ( 19 ) ;
@@ -5051,22 +5049,22 @@ pub fn hash_crate_independent(tcx: ctxt, t: t, local_hash: ~str) -> u64 {
50515049 ty_param( p) => {
50525050 byte ! ( 20 ) ;
50535051 hash ! ( p. idx) ;
5054- did ( & mut hash , p. def_id ) ;
5052+ did ( & mut state , p. def_id ) ;
50555053 }
50565054 ty_self( d) => {
50575055 byte ! ( 21 ) ;
5058- did ( & mut hash , d) ;
5056+ did ( & mut state , d) ;
50595057 }
50605058 ty_infer( _) => unreachable ! ( ) ,
50615059 ty_err => byte ! ( 23 ) ,
50625060 ty_unboxed_vec( m) => {
50635061 byte ! ( 24 ) ;
5064- mt ( & mut hash , m) ;
5062+ mt ( & mut state , m) ;
50655063 }
50665064 }
50675065 } ) ;
50685066
5069- hash . result ( )
5067+ state . result ( )
50705068}
50715069
50725070impl Variance {
0 commit comments