Skip to content

Commit 64e6072

Browse files
committed
WIP,UNTIDY: debugging x test -v tests/incremental/static_stable_hash/issue-49301.rs
1 parent 2c15b50 commit 64e6072

File tree

5 files changed

+25
-11
lines changed

5 files changed

+25
-11
lines changed

compiler/rustc_ast/src/tokenstream.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,13 +139,19 @@ impl fmt::Debug for LazyAttrTokenStream {
139139

140140
impl<S: SpanEncoder> Encodable<S> for LazyAttrTokenStream {
141141
fn encode(&self, _s: &mut S) {
142-
panic!("Attempted to encode LazyAttrTokenStream");
142+
eprintln!("ENCODING {self:?}");
143+
self.to_attr_token_stream().encode(_s);
144+
// panic!("Attempted to encode {self:?}");
143145
}
144146
}
145147

146148
impl<D: SpanDecoder> Decodable<D> for LazyAttrTokenStream {
147149
fn decode(_d: &mut D) -> Self {
148-
panic!("Attempted to decode LazyAttrTokenStream");
150+
let ats = AttrTokenStream::decode(_d);
151+
let res = LazyAttrTokenStream::new(ats);
152+
eprintln!("DECODED {res:?}");
153+
res
154+
// panic!("Attempted to decode LazyAttrTokenStream");
149155
}
150156
}
151157

compiler/rustc_expand/src/expand.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,8 @@ pub fn expand_legacy_bang<'tcx>(
400400
tcx: TyCtxt<'tcx>,
401401
key: (LocalExpnId, LocalExpnId),
402402
) -> Result<(&'tcx TokenStream, usize), (Span, ErrorGuaranteed)> {
403-
let (invoc_id, current_expansion) = key;
403+
let (invoc_id, current_expansion) = dbg!(key);
404+
dbg!(invoc_id.to_expn_id().expn_hash(), current_expansion.to_expn_id().expn_hash());
404405
let map = tcx.macro_map.borrow();
405406
let (arg, span, expander) = map.get(&invoc_id).as_ref().unwrap();
406407
expander

compiler/rustc_middle/src/arena.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ macro_rules! arena_types {
119119
[decode] specialization_graph: rustc_middle::traits::specialization_graph::Graph,
120120
[] crate_inherent_impls: rustc_middle::ty::CrateInherentImpls,
121121
[] hir_owner_nodes: rustc_hir::OwnerNodes<'tcx>,
122-
[] expand_legacy_bang: rustc_ast::tokenstream::TokenStream,
122+
[decode] expand_legacy_bang: rustc_ast::tokenstream::TokenStream,
123123
]);
124124
)
125125
}

compiler/rustc_middle/src/ty/codec.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -335,13 +335,15 @@ impl<'tcx, D: TyDecoder<I = TyCtxt<'tcx>>> RefDecodable<'tcx, D> for ty::List<Ty
335335
}
336336
}
337337

338-
impl<'tcx, D: TyDecoder<I = TyCtxt<'tcx>>> RefDecodable<'tcx, D>
339-
for rustc_ast::tokenstream::TokenStream
340-
{
341-
fn decode(_decoder: &mut D) -> &'tcx Self {
342-
todo!("felix foobar next")
343-
}
344-
}
338+
// impl<'tcx, D: TyDecoder<I = TyCtxt<'tcx>>> RefDecodable<'tcx, D>
339+
// for rustc_ast::tokenstream::TokenStream
340+
// {
341+
// fn decode(_decoder: &mut D) -> &'tcx Self {
342+
// // use rustc_ast::HasTokens;
343+
// // _decoder.interner().tokens_mut().unwrap().as_ref();
344+
// todo!("felix foobar next")
345+
// }
346+
// }
345347

346348
impl<'tcx, D: TyDecoder<I = TyCtxt<'tcx>>> RefDecodable<'tcx, D>
347349
for ty::List<ty::PolyExistentialPredicate<'tcx>>

compiler/rustc_resolve/src/macros.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,11 @@ impl<'a, 'tcx> ResolverExpand for Resolver<'a, 'tcx> {
539539
invoc_id: LocalExpnId,
540540
current_expansion: LocalExpnId,
541541
) -> Result<(TokenStream, usize), (Span, ErrorGuaranteed)> {
542+
dbg!((
543+
"resolver",
544+
invoc_id.to_expn_id().expn_hash(),
545+
current_expansion.to_expn_id().expn_hash()
546+
));
542547
self.tcx()
543548
.expand_legacy_bang((invoc_id, current_expansion))
544549
.map(|(tts, i)| (tts.clone(), i))

0 commit comments

Comments
 (0)