Skip to content

Commit 93a1a80

Browse files
committed
Move some impls.
`HashStableContext` impls should be in `hcx.rs`, and `HashStable` impls should be in `impls_syntax.rs`. This commit moves a few that are in the wrong file.
1 parent f729340 commit 93a1a80

File tree

2 files changed

+11
-14
lines changed

2 files changed

+11
-14
lines changed

compiler/rustc_query_system/src/ich/hcx.rs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
use rustc_ast as ast;
2-
use rustc_data_structures::stable_hasher::{HashStable, HashingControls, StableHasher};
1+
use rustc_data_structures::stable_hasher::HashingControls;
32
use rustc_hir::def_id::{DefId, LocalDefId};
43
use rustc_hir::definitions::DefPathHash;
54
use rustc_session::Session;
@@ -67,13 +66,6 @@ impl<'a> StableHashingContext<'a> {
6766
}
6867
}
6968

70-
impl<'a> HashStable<StableHashingContext<'a>> for ast::NodeId {
71-
#[inline]
72-
fn hash_stable(&self, _: &mut StableHashingContext<'a>, _: &mut StableHasher) {
73-
panic!("Node IDs should not appear in incremental state");
74-
}
75-
}
76-
7769
impl<'a> rustc_span::HashStableContext for StableHashingContext<'a> {
7870
#[inline]
7971
fn unstable_opts_incremental_ignore_spans(&self) -> bool {
@@ -108,4 +100,7 @@ impl<'a> rustc_span::HashStableContext for StableHashingContext<'a> {
108100
}
109101
}
110102

103+
impl<'a> rustc_abi::HashStableContext for StableHashingContext<'a> {}
104+
impl<'a> rustc_ast::HashStableContext for StableHashingContext<'a> {}
105+
impl<'a> rustc_hir::HashStableContext for StableHashingContext<'a> {}
111106
impl<'a> rustc_session::HashStableContext for StableHashingContext<'a> {}

compiler/rustc_query_system/src/ich/impls_syntax.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,18 @@
22
//! from various crates in no particular order.
33
44
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
5-
use rustc_hir::{self as hir, HashIgnoredAttrId};
65
use rustc_span::{SourceFile, Symbol, sym};
76
use smallvec::SmallVec;
7+
use {rustc_ast as ast, rustc_hir as hir};
88

99
use crate::ich::StableHashingContext;
1010

11-
impl<'ctx> rustc_abi::HashStableContext for StableHashingContext<'ctx> {}
12-
impl<'ctx> rustc_ast::HashStableContext for StableHashingContext<'ctx> {}
11+
impl<'a> HashStable<StableHashingContext<'a>> for ast::NodeId {
12+
#[inline]
13+
fn hash_stable(&self, _: &mut StableHashingContext<'a>, _: &mut StableHasher) {
14+
panic!("Node IDs should not appear in incremental state");
15+
}
16+
}
1317

1418
impl<'a> HashStable<StableHashingContext<'a>> for [hir::Attribute] {
1519
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
@@ -49,8 +53,6 @@ fn is_ignored_attr(name: Symbol) -> bool {
4953
IGNORED_ATTRIBUTES.contains(&name)
5054
}
5155

52-
impl<'ctx> rustc_hir::HashStableContext for StableHashingContext<'ctx> {}
53-
5456
impl<'a> HashStable<StableHashingContext<'a>> for SourceFile {
5557
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
5658
let SourceFile {

0 commit comments

Comments
 (0)