about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMark Rousskov <mark.simulacrum@gmail.com>2018-08-03 12:22:22 -0600
committerMark Rousskov <mark.simulacrum@gmail.com>2018-08-09 10:00:25 -0600
commitbf103700c6e2aa51e0531ab807b554c17ce9ba7d (patch)
treef124d81af68202044d3b30ce04258a0399c035da
parentb73535f1e9c46a698527fab51b1cc9fad3f53412 (diff)
downloadrust-bf103700c6e2aa51e0531ab807b554c17ce9ba7d.tar.gz
rust-bf103700c6e2aa51e0531ab807b554c17ce9ba7d.zip
Move SVH structure to data structures
-rw-r--r--src/librustc/hir/map/collector.rs2
-rw-r--r--src/librustc/hir/map/mod.rs2
-rw-r--r--src/librustc/hir/mod.rs1
-rw-r--r--src/librustc/middle/cstore.rs2
-rw-r--r--src/librustc/ty/mod.rs2
-rw-r--r--src/librustc/ty/query/mod.rs2
-rw-r--r--src/librustc_codegen_utils/link.rs2
-rw-r--r--src/librustc_data_structures/lib.rs2
-rw-r--r--src/librustc_data_structures/svh.rs (renamed from src/librustc/hir/svh.rs)18
-rw-r--r--src/librustc_incremental/persist/fs.rs2
-rw-r--r--src/librustc_metadata/creader.rs2
-rw-r--r--src/librustc_metadata/cstore_impl.rs3
-rw-r--r--src/librustc_metadata/locator.rs2
-rw-r--r--src/librustc_metadata/schema.rs5
14 files changed, 31 insertions, 16 deletions
diff --git a/src/librustc/hir/map/collector.rs b/src/librustc/hir/map/collector.rs
index 0150ba659c9..3934475bea9 100644
--- a/src/librustc/hir/map/collector.rs
+++ b/src/librustc/hir/map/collector.rs
@@ -12,7 +12,7 @@ use super::*;
 use dep_graph::{DepGraph, DepKind, DepNodeIndex};
 use hir::def_id::{LOCAL_CRATE, CrateNum};
 use hir::intravisit::{Visitor, NestedVisitorMap};
-use hir::svh::Svh;
+use rustc_data_structures::svh::Svh;
 use ich::Fingerprint;
 use middle::cstore::CrateStore;
 use session::CrateDisambiguator;
diff --git a/src/librustc/hir/map/mod.rs b/src/librustc/hir/map/mod.rs
index b05bcadf826..81897322b6f 100644
--- a/src/librustc/hir/map/mod.rs
+++ b/src/librustc/hir/map/mod.rs
@@ -22,6 +22,7 @@ use hir::def_id::{CRATE_DEF_INDEX, DefId, LocalDefId, DefIndexAddressSpace};
 use middle::cstore::CrateStore;
 
 use rustc_target::spec::abi::Abi;
+use rustc_data_structures::svh::Svh;
 use syntax::ast::{self, Name, NodeId, CRATE_NODE_ID};
 use syntax::codemap::Spanned;
 use syntax::ext::base::MacroKind;
@@ -29,7 +30,6 @@ use syntax_pos::{Span, DUMMY_SP};
 
 use hir::*;
 use hir::print::Nested;
-use hir::svh::Svh;
 use util::nodemap::FxHashMap;
 
 use std::io;
diff --git a/src/librustc/hir/mod.rs b/src/librustc/hir/mod.rs
index 0003790e6d5..521499e4766 100644
--- a/src/librustc/hir/mod.rs
+++ b/src/librustc/hir/mod.rs
@@ -70,7 +70,6 @@ pub mod lowering;
 pub mod map;
 pub mod pat_util;
 pub mod print;
-pub mod svh;
 
 /// A HirId uniquely identifies a node in the HIR of the current crate. It is
 /// composed of the `owner`, which is the DefIndex of the directly enclosing
diff --git a/src/librustc/middle/cstore.rs b/src/librustc/middle/cstore.rs
index 0e84104245d..b91a9644b21 100644
--- a/src/librustc/middle/cstore.rs
+++ b/src/librustc/middle/cstore.rs
@@ -25,7 +25,7 @@
 use hir::def_id::{CrateNum, DefId, LOCAL_CRATE};
 use hir::map as hir_map;
 use hir::map::definitions::{DefKey, DefPathTable};
-use hir::svh::Svh;
+use rustc_data_structures::svh::Svh;
 use ty::{self, TyCtxt};
 use session::{Session, CrateDisambiguator};
 use session::search_paths::PathKind;
diff --git a/src/librustc/ty/mod.rs b/src/librustc/ty/mod.rs
index 4fda3bdca3d..6c5713d233a 100644
--- a/src/librustc/ty/mod.rs
+++ b/src/librustc/ty/mod.rs
@@ -18,7 +18,7 @@ use hir::{map as hir_map, FreevarMap, TraitMap};
 use hir::def::{Def, CtorKind, ExportMap};
 use hir::def_id::{CrateNum, DefId, LocalDefId, CRATE_DEF_INDEX, LOCAL_CRATE};
 use hir::map::DefPathData;
-use hir::svh::Svh;
+use rustc_data_structures::svh::Svh;
 use ich::Fingerprint;
 use ich::StableHashingContext;
 use infer::canonical::Canonical;
diff --git a/src/librustc/ty/query/mod.rs b/src/librustc/ty/query/mod.rs
index 35080123d3e..ef22ebef9d7 100644
--- a/src/librustc/ty/query/mod.rs
+++ b/src/librustc/ty/query/mod.rs
@@ -13,7 +13,7 @@ use errors::DiagnosticBuilder;
 use hir::def_id::{CrateNum, DefId, DefIndex};
 use hir::def::{Def, Export};
 use hir::{self, TraitCandidate, ItemLocalId, CodegenFnAttrs};
-use hir::svh::Svh;
+use rustc_data_structures::svh::Svh;
 use infer::canonical::{self, Canonical};
 use lint;
 use middle::borrowck::BorrowCheckResult;
diff --git a/src/librustc_codegen_utils/link.rs b/src/librustc_codegen_utils/link.rs
index 73cffdf7d49..a0d88ccae0f 100644
--- a/src/librustc_codegen_utils/link.rs
+++ b/src/librustc_codegen_utils/link.rs
@@ -11,7 +11,7 @@
 use rustc::session::config::{self, OutputFilenames, Input, OutputType};
 use rustc::session::Session;
 use rustc::middle::cstore::LinkMeta;
-use rustc::hir::svh::Svh;
+use rustc_data_structures::svh::Svh;
 use std::path::{Path, PathBuf};
 use syntax::{ast, attr};
 use syntax_pos::Span;
diff --git a/src/librustc_data_structures/lib.rs b/src/librustc_data_structures/lib.rs
index dd90cf7ae19..b8c21afc386 100644
--- a/src/librustc_data_structures/lib.rs
+++ b/src/librustc_data_structures/lib.rs
@@ -46,6 +46,7 @@ extern crate stable_deref_trait;
 extern crate rustc_rayon as rayon;
 extern crate rustc_rayon_core as rayon_core;
 extern crate rustc_hash;
+extern crate serialize;
 
 // See librustc_cratesio_shim/Cargo.toml for a comment explaining this.
 #[allow(unused_extern_crates)]
@@ -53,6 +54,7 @@ extern crate rustc_cratesio_shim;
 
 pub use rustc_serialize::hex::ToHex;
 
+pub mod svh;
 pub mod accumulate_vec;
 pub mod array_vec;
 pub mod base_n;
diff --git a/src/librustc/hir/svh.rs b/src/librustc_data_structures/svh.rs
index a6cfcb710ed..94f132562b5 100644
--- a/src/librustc/hir/svh.rs
+++ b/src/librustc_data_structures/svh.rs
@@ -19,6 +19,8 @@ use std::fmt;
 use std::hash::{Hash, Hasher};
 use serialize::{Encodable, Decodable, Encoder, Decoder};
 
+use stable_hasher;
+
 #[derive(Copy, Clone, PartialEq, Eq, Debug)]
 pub struct Svh {
     hash: u64,
@@ -67,6 +69,16 @@ impl Decodable for Svh {
     }
 }
 
-impl_stable_hash_for!(struct Svh {
-    hash
-});
+impl<T> stable_hasher::HashStable<T> for Svh {
+    #[inline]
+    fn hash_stable<W: stable_hasher::StableHasherResult>(
+        &self,
+        ctx: &mut T,
+        hasher: &mut stable_hasher::StableHasher<W>
+    ) {
+        let Svh {
+            hash
+        } = *self;
+        hash.hash_stable(ctx, hasher);
+    }
+}
diff --git a/src/librustc_incremental/persist/fs.rs b/src/librustc_incremental/persist/fs.rs
index 795825f180c..65bc7f3f856 100644
--- a/src/librustc_incremental/persist/fs.rs
+++ b/src/librustc_incremental/persist/fs.rs
@@ -114,11 +114,11 @@
 //! unsupported file system and emit a warning in that case. This is not yet
 //! implemented.
 
-use rustc::hir::svh::Svh;
 use rustc::session::{Session, CrateDisambiguator};
 use rustc::util::fs as fs_util;
 use rustc_data_structures::{flock, base_n};
 use rustc_data_structures::fx::{FxHashSet, FxHashMap};
+use rustc_data_structures::svh::Svh;
 
 use std::fs as std_fs;
 use std::io;
diff --git a/src/librustc_metadata/creader.rs b/src/librustc_metadata/creader.rs
index 62c06aac1df..d3b70933e2c 100644
--- a/src/librustc_metadata/creader.rs
+++ b/src/librustc_metadata/creader.rs
@@ -16,7 +16,7 @@ use schema::CrateRoot;
 use rustc_data_structures::sync::{Lrc, RwLock, Lock};
 
 use rustc::hir::def_id::{CrateNum, CRATE_DEF_INDEX};
-use rustc::hir::svh::Svh;
+use rustc_data_structures::svh::Svh;
 use rustc::middle::allocator::AllocatorKind;
 use rustc::middle::cstore::DepKind;
 use rustc::mir::interpret::AllocDecodingState;
diff --git a/src/librustc_metadata/cstore_impl.rs b/src/librustc_metadata/cstore_impl.rs
index 060dddd5343..4926da3b880 100644
--- a/src/librustc_metadata/cstore_impl.rs
+++ b/src/librustc_metadata/cstore_impl.rs
@@ -30,6 +30,7 @@ use rustc::hir::map::{DefKey, DefPath, DefPathHash};
 use rustc::hir::map::blocks::FnLikeNode;
 use rustc::hir::map::definitions::DefPathTable;
 use rustc::util::nodemap::DefIdMap;
+use rustc_data_structures::svh::Svh;
 
 use std::any::Any;
 use rustc_data_structures::sync::Lrc;
@@ -515,7 +516,7 @@ impl CrateStore for cstore::CStore {
         self.get_crate_data(cnum).root.disambiguator
     }
 
-    fn crate_hash_untracked(&self, cnum: CrateNum) -> hir::svh::Svh
+    fn crate_hash_untracked(&self, cnum: CrateNum) -> Svh
     {
         self.get_crate_data(cnum).root.hash
     }
diff --git a/src/librustc_metadata/locator.rs b/src/librustc_metadata/locator.rs
index f68bcdd62c6..52777e5f6b9 100644
--- a/src/librustc_metadata/locator.rs
+++ b/src/librustc_metadata/locator.rs
@@ -226,7 +226,7 @@ use cstore::{MetadataRef, MetadataBlob};
 use creader::Library;
 use schema::{METADATA_HEADER, rustc_version};
 
-use rustc::hir::svh::Svh;
+use rustc_data_structures::svh::Svh;
 use rustc::middle::cstore::MetadataLoader;
 use rustc::session::{config, Session};
 use rustc::session::filesearch::{FileSearch, FileMatches, FileDoesntMatch};
diff --git a/src/librustc_metadata/schema.rs b/src/librustc_metadata/schema.rs
index 894c7cbf683..781652e1985 100644
--- a/src/librustc_metadata/schema.rs
+++ b/src/librustc_metadata/schema.rs
@@ -20,6 +20,7 @@ use rustc::mir;
 use rustc::session::CrateDisambiguator;
 use rustc::ty::{self, Ty, ReprOptions};
 use rustc_target::spec::{PanicStrategy, TargetTriple};
+use rustc_data_structures::svh::Svh;
 
 use rustc_serialize as serialize;
 use syntax::{ast, attr};
@@ -187,7 +188,7 @@ pub struct CrateRoot {
     pub name: Symbol,
     pub triple: TargetTriple,
     pub extra_filename: String,
-    pub hash: hir::svh::Svh,
+    pub hash: Svh,
     pub disambiguator: CrateDisambiguator,
     pub panic_strategy: PanicStrategy,
     pub edition: Edition,
@@ -223,7 +224,7 @@ pub struct CrateRoot {
 #[derive(RustcEncodable, RustcDecodable)]
 pub struct CrateDep {
     pub name: ast::Name,
-    pub hash: hir::svh::Svh,
+    pub hash: Svh,
     pub kind: DepKind,
     pub extra_filename: String,
 }