I'm looking around
librustc_expand/expand.rs but it looks like everything here is an
AstFragment, not part of the AST proper.
@ecstatic-morse so here's the idea I had:
This broke immediately because
PlaceHolderExpander expects all ids to be
DUMMY_NODE_ID. So I changed it to use
DUMMY_NODE_ID and now
lower_node_id_generic is panicking because it wants ids not to be dummies. Do you have any idea what's going on? I'm very confused.
// without dummy ids $ rustc +stage1 -Z unpretty=everybody_loops priv-in-pub.rs thread 'rustc' panicked at 'assertion failed: `(left == right)` left: `NodeId(28)`, right: `NodeId(4294967040)`', src/librustc_expand/placeholders.rs:326:17 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace // with dummy ids $ rustc +stage1 -Z unpretty=everybody_loops priv-in-pub.rs thread 'rustc' panicked at 'assertion failed: `(left != right)` left: `NodeId(4294967040)`, right: `NodeId(4294967040)`', src/librustc_ast_lowering/lib.rs:599:9
No. I think you have the right idea; we need to do the AST transformation for rustdoc before assigning DefIds, but I don't work on the frontend at all
lower_node_id_generic is assigning new
NodeId so it needs real node ids, not dummy ones
Sure, but why does
PlaceHolderExpander need dummies? Or I guess I'm not sure why it's being run at all on this code.
let me push to a branch real quick
I've never actually had to look at
librustc_expand so I probably won't be able to give good advises
I know that recently @Aaron Hill and @Vadim Petrochenkov worked on macros and defids
This is the relevant code, but I'm not sure what it's doing: https://github.com/jyn514/rust/blob/4933cb2090986866a041a9c11a4233ad0ec13bb3/src/librustc_expand/expand.rs#L516
maybe I could move this into
build_reduced_graph instead, just before it calls
nope, same error that it expected a dummy span
I'm getting annoyed enough I might make a PR switching from
HirId + DUMMY_NODE_ID to
I don't understand how that would help
I don't think you need to run everybody-loop before DefIds are generated, it's run at the right time.
It just needs to keep nodes having DefIds.
(That's what I can say without digging too much into the problem, and I don't really want to dig too much into this.)
This ended up not running
everybody_loops at all, see https://github.com/rust-lang/rust/pull/73566