Skip to content

Commit bf10370

Browse files
Move SVH structure to data structures
1 parent b73535f commit bf10370

File tree

14 files changed

+31
-16
lines changed

14 files changed

+31
-16
lines changed

src/librustc/hir/map/collector.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use super::*;
1212
use dep_graph::{DepGraph, DepKind, DepNodeIndex};
1313
use hir::def_id::{LOCAL_CRATE, CrateNum};
1414
use hir::intravisit::{Visitor, NestedVisitorMap};
15-
use hir::svh::Svh;
15+
use rustc_data_structures::svh::Svh;
1616
use ich::Fingerprint;
1717
use middle::cstore::CrateStore;
1818
use session::CrateDisambiguator;

src/librustc/hir/map/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ use hir::def_id::{CRATE_DEF_INDEX, DefId, LocalDefId, DefIndexAddressSpace};
2222
use middle::cstore::CrateStore;
2323

2424
use rustc_target::spec::abi::Abi;
25+
use rustc_data_structures::svh::Svh;
2526
use syntax::ast::{self, Name, NodeId, CRATE_NODE_ID};
2627
use syntax::codemap::Spanned;
2728
use syntax::ext::base::MacroKind;
2829
use syntax_pos::{Span, DUMMY_SP};
2930

3031
use hir::*;
3132
use hir::print::Nested;
32-
use hir::svh::Svh;
3333
use util::nodemap::FxHashMap;
3434

3535
use std::io;

src/librustc/hir/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ pub mod lowering;
7070
pub mod map;
7171
pub mod pat_util;
7272
pub mod print;
73-
pub mod svh;
7473

7574
/// A HirId uniquely identifies a node in the HIR of the current crate. It is
7675
/// composed of the `owner`, which is the DefIndex of the directly enclosing

src/librustc/middle/cstore.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
use hir::def_id::{CrateNum, DefId, LOCAL_CRATE};
2626
use hir::map as hir_map;
2727
use hir::map::definitions::{DefKey, DefPathTable};
28-
use hir::svh::Svh;
28+
use rustc_data_structures::svh::Svh;
2929
use ty::{self, TyCtxt};
3030
use session::{Session, CrateDisambiguator};
3131
use session::search_paths::PathKind;

src/librustc/ty/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use hir::{map as hir_map, FreevarMap, TraitMap};
1818
use hir::def::{Def, CtorKind, ExportMap};
1919
use hir::def_id::{CrateNum, DefId, LocalDefId, CRATE_DEF_INDEX, LOCAL_CRATE};
2020
use hir::map::DefPathData;
21-
use hir::svh::Svh;
21+
use rustc_data_structures::svh::Svh;
2222
use ich::Fingerprint;
2323
use ich::StableHashingContext;
2424
use infer::canonical::Canonical;

src/librustc/ty/query/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use errors::DiagnosticBuilder;
1313
use hir::def_id::{CrateNum, DefId, DefIndex};
1414
use hir::def::{Def, Export};
1515
use hir::{self, TraitCandidate, ItemLocalId, CodegenFnAttrs};
16-
use hir::svh::Svh;
16+
use rustc_data_structures::svh::Svh;
1717
use infer::canonical::{self, Canonical};
1818
use lint;
1919
use middle::borrowck::BorrowCheckResult;

src/librustc_codegen_utils/link.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
use rustc::session::config::{self, OutputFilenames, Input, OutputType};
1212
use rustc::session::Session;
1313
use rustc::middle::cstore::LinkMeta;
14-
use rustc::hir::svh::Svh;
14+
use rustc_data_structures::svh::Svh;
1515
use std::path::{Path, PathBuf};
1616
use syntax::{ast, attr};
1717
use syntax_pos::Span;

src/librustc_data_structures/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,15 @@ extern crate stable_deref_trait;
4646
extern crate rustc_rayon as rayon;
4747
extern crate rustc_rayon_core as rayon_core;
4848
extern crate rustc_hash;
49+
extern crate serialize;
4950

5051
// See librustc_cratesio_shim/Cargo.toml for a comment explaining this.
5152
#[allow(unused_extern_crates)]
5253
extern crate rustc_cratesio_shim;
5354

5455
pub use rustc_serialize::hex::ToHex;
5556

57+
pub mod svh;
5658
pub mod accumulate_vec;
5759
pub mod array_vec;
5860
pub mod base_n;

src/librustc/hir/svh.rs renamed to src/librustc_data_structures/svh.rs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ use std::fmt;
1919
use std::hash::{Hash, Hasher};
2020
use serialize::{Encodable, Decodable, Encoder, Decoder};
2121

22+
use stable_hasher;
23+
2224
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
2325
pub struct Svh {
2426
hash: u64,
@@ -67,6 +69,16 @@ impl Decodable for Svh {
6769
}
6870
}
6971

70-
impl_stable_hash_for!(struct Svh {
71-
hash
72-
});
72+
impl<T> stable_hasher::HashStable<T> for Svh {
73+
#[inline]
74+
fn hash_stable<W: stable_hasher::StableHasherResult>(
75+
&self,
76+
ctx: &mut T,
77+
hasher: &mut stable_hasher::StableHasher<W>
78+
) {
79+
let Svh {
80+
hash
81+
} = *self;
82+
hash.hash_stable(ctx, hasher);
83+
}
84+
}

src/librustc_incremental/persist/fs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,11 @@
114114
//! unsupported file system and emit a warning in that case. This is not yet
115115
//! implemented.
116116
117-
use rustc::hir::svh::Svh;
118117
use rustc::session::{Session, CrateDisambiguator};
119118
use rustc::util::fs as fs_util;
120119
use rustc_data_structures::{flock, base_n};
121120
use rustc_data_structures::fx::{FxHashSet, FxHashMap};
121+
use rustc_data_structures::svh::Svh;
122122

123123
use std::fs as std_fs;
124124
use std::io;

0 commit comments

Comments
 (0)