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;
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;
use hir::*;
use hir::print::Nested;
-use hir::svh::Svh;
use util::nodemap::FxHashMap;
use std::io;
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
+++ /dev/null
-// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-//! Calculation and management of a Strict Version Hash for crates
-//!
-//! The SVH is used for incremental compilation to track when HIR
-//! nodes have changed between compilations, and also to detect
-//! mismatches where we have two versions of the same crate that were
-//! compiled from distinct sources.
-
-use std::fmt;
-use std::hash::{Hash, Hasher};
-use serialize::{Encodable, Decodable, Encoder, Decoder};
-
-#[derive(Copy, Clone, PartialEq, Eq, Debug)]
-pub struct Svh {
- hash: u64,
-}
-
-impl Svh {
- /// Create a new `Svh` given the hash. If you actually want to
- /// compute the SVH from some HIR, you want the `calculate_svh`
- /// function found in `librustc_incremental`.
- pub fn new(hash: u64) -> Svh {
- Svh { hash: hash }
- }
-
- pub fn as_u64(&self) -> u64 {
- self.hash
- }
-
- pub fn to_string(&self) -> String {
- format!("{:016x}", self.hash)
- }
-}
-
-impl Hash for Svh {
- fn hash<H>(&self, state: &mut H) where H: Hasher {
- self.hash.to_le().hash(state);
- }
-}
-
-impl fmt::Display for Svh {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- f.pad(&self.to_string())
- }
-}
-
-impl Encodable for Svh {
- fn encode<S: Encoder>(&self, s: &mut S) -> Result<(), S::Error> {
- s.emit_u64(self.as_u64().to_le())
- }
-}
-
-impl Decodable for Svh {
- fn decode<D: Decoder>(d: &mut D) -> Result<Svh, D::Error> {
- d.read_u64()
- .map(u64::from_le)
- .map(Svh::new)
- }
-}
-
-impl_stable_hash_for!(struct Svh {
- hash
-});
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;
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;
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;
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;
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)]
pub use rustc_serialize::hex::ToHex;
+pub mod svh;
pub mod accumulate_vec;
pub mod array_vec;
pub mod base_n;
--- /dev/null
+// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! Calculation and management of a Strict Version Hash for crates
+//!
+//! The SVH is used for incremental compilation to track when HIR
+//! nodes have changed between compilations, and also to detect
+//! mismatches where we have two versions of the same crate that were
+//! compiled from distinct sources.
+
+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,
+}
+
+impl Svh {
+ /// Create a new `Svh` given the hash. If you actually want to
+ /// compute the SVH from some HIR, you want the `calculate_svh`
+ /// function found in `librustc_incremental`.
+ pub fn new(hash: u64) -> Svh {
+ Svh { hash: hash }
+ }
+
+ pub fn as_u64(&self) -> u64 {
+ self.hash
+ }
+
+ pub fn to_string(&self) -> String {
+ format!("{:016x}", self.hash)
+ }
+}
+
+impl Hash for Svh {
+ fn hash<H>(&self, state: &mut H) where H: Hasher {
+ self.hash.to_le().hash(state);
+ }
+}
+
+impl fmt::Display for Svh {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ f.pad(&self.to_string())
+ }
+}
+
+impl Encodable for Svh {
+ fn encode<S: Encoder>(&self, s: &mut S) -> Result<(), S::Error> {
+ s.emit_u64(self.as_u64().to_le())
+ }
+}
+
+impl Decodable for Svh {
+ fn decode<D: Decoder>(d: &mut D) -> Result<Svh, D::Error> {
+ d.read_u64()
+ .map(u64::from_le)
+ .map(Svh::new)
+ }
+}
+
+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);
+ }
+}
//! 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;
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;
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;
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
}
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};
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};
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,
#[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,
}