@@ -51,13 +51,14 @@ use rustc_hir::definitions::{DefKey, DefPathData, Definitions};
5151use rustc_hir:: intravisit;
5252use rustc_hir:: { ConstArg , GenericArg , InferKind , ParamName } ;
5353use rustc_index:: vec:: { Idx , IndexVec } ;
54+ use rustc_query_system:: ich:: StableHashingContext ;
5455use rustc_session:: lint:: builtin:: BARE_TRAIT_OBJECTS ;
5556use rustc_session:: lint:: { BuiltinLintDiagnostics , LintBuffer } ;
5657use rustc_session:: utils:: { FlattenNonterminals , NtToTokenstream } ;
5758use rustc_session:: Session ;
5859use rustc_span:: edition:: Edition ;
5960use rustc_span:: hygiene:: ExpnId ;
60- use rustc_span:: source_map:: { respan, CachingSourceMapView , DesugaringKind } ;
61+ use rustc_span:: source_map:: { respan, DesugaringKind } ;
6162use rustc_span:: symbol:: { kw, sym, Ident , Symbol } ;
6263use rustc_span:: { Span , DUMMY_SP } ;
6364
@@ -179,6 +180,8 @@ pub trait ResolverAstLowering {
179180 /// This should only return `None` during testing.
180181 fn definitions ( & mut self ) -> & mut Definitions ;
181182
183+ fn create_stable_hashing_context ( & self ) -> StableHashingContext < ' _ > ;
184+
182185 fn lint_buffer ( & mut self ) -> & mut LintBuffer ;
183186
184187 fn next_node_id ( & mut self ) -> NodeId ;
@@ -201,37 +204,6 @@ pub trait ResolverAstLowering {
201204 ) -> LocalDefId ;
202205}
203206
204- struct LoweringHasher < ' a > {
205- source_map : CachingSourceMapView < ' a > ,
206- resolver : & ' a dyn ResolverAstLowering ,
207- }
208-
209- impl < ' a > rustc_span:: HashStableContext for LoweringHasher < ' a > {
210- #[ inline]
211- fn hash_spans ( & self ) -> bool {
212- true
213- }
214-
215- #[ inline]
216- fn def_span ( & self , id : LocalDefId ) -> Span {
217- self . resolver . def_span ( id)
218- }
219-
220- #[ inline]
221- fn def_path_hash ( & self , def_id : DefId ) -> DefPathHash {
222- self . resolver . def_path_hash ( def_id)
223- }
224-
225- #[ inline]
226- fn span_data_to_lines_and_cols (
227- & mut self ,
228- span : & rustc_span:: SpanData ,
229- ) -> Option < ( Lrc < rustc_span:: SourceFile > , usize , rustc_span:: BytePos , usize , rustc_span:: BytePos ) >
230- {
231- self . source_map . span_data_to_lines_and_cols ( span)
232- }
233- }
234-
235207/// Context of `impl Trait` in code, which determines whether it is allowed in an HIR subtree,
236208/// and if so, what meaning it has.
237209#[ derive( Debug ) ]
@@ -440,13 +412,6 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
440412 self . arena . alloc ( krate)
441413 }
442414
443- fn create_stable_hashing_context ( & self ) -> LoweringHasher < ' _ > {
444- LoweringHasher {
445- source_map : CachingSourceMapView :: new ( self . sess . source_map ( ) ) ,
446- resolver : self . resolver ,
447- }
448- }
449-
450415 fn with_hir_id_owner (
451416 & mut self ,
452417 owner : NodeId ,
@@ -566,7 +531,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
566531 allow_internal_unstable,
567532 reason,
568533 self . sess . edition ( ) ,
569- self . create_stable_hashing_context ( ) ,
534+ self . resolver . create_stable_hashing_context ( ) ,
570535 )
571536 }
572537
0 commit comments