-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HIR lowering relies on AST node IDs #30809
Comments
cc #20541 |
I think the ids issue and the lang items issue are orthogonal. We should definitely find a way to use lang items for the HIR lowering. I would like to remove node ids from the AST and just use them in the HIR. The current situation is mostly because it was easier to implement. Reproducible lowering may be unnecessary. However, ids do make it easy to identify an AST node, we'd want to be sure that we don't this (and that it is not useful for tools or syntax extensions). So lets not just rip them out and see what happens. |
@nrc currently we can identify AST nodes by referential equality (i.e. pointers). |
The range desugaring does not use the lang items. Hence I did not add lang items for inclusive ranges. This cleanup commit removes the old unused ones as well. Whether the desugaring _should_ use lang items is another question: see rust-lang#30809. But if we decide on a strategy there we can add back these lang items, and new ones for inclusive ranges. For stage0 we need to keep the attributes as the lang items still exist even if they are never used. This is surprisingly not a breaking change. Unused #[lang] attributes do not even trigger a lint (see rust-lang#30881).
The range desugaring does not use the lang items. Hence I did not add lang items for inclusive ranges. This cleanup commit removes the old unused ones as well. Whether the desugaring _should_ use lang items is another question: see rust-lang#30809. But if we decide on a strategy there we can add back these lang items, and new ones for inclusive ranges. For stage0 we need to keep the attributes as the lang items still exist even if they are never used. This is surprisingly not a breaking change. Unused #[lang] attributes do not even trigger a lint (see rust-lang#30881).
The range desugaring does not use the lang items. Hence I did not add lang items for inclusive ranges. This cleanup commit removes the old unused ones as well. Whether the desugaring _should_ use lang items is another question: see rust-lang#30809. But if we decide on a strategy there we can add back these lang items, and new ones for inclusive ranges. For stage0 we need to keep the attributes as the lang items still exist even if they are never used. This is surprisingly not a breaking change. Unused #[lang] attributes do not even trigger a lint (see rust-lang#30881).
Is this still true? |
The "reproductible" lowering is gone but they IDs are still very much reused. |
Now that we use HirIds everywhere, this is fixed, right? |
Can this be closed? |
cc @nrc
cc @eddyb
So I was looking at how desugarings work in HIR lowering. Notably, lang items are collected after lowering but it is sometimes desirable to refer to them. @eddyb suggested a side table mapping HIR node IDs to prospective lang items, which would be cross-referenced with the real lang items once they are collected. But this relies on IDs being known during lowering. Currently they are, because they are copied from the AST IDs, but @eddyb was saying that the AST shouldn't have IDs at all. Currently it is needed because lowering needs to be reproducible, but... why? Are these IDs going away, or are they here to stay and usable for this lang item scheme?
The text was updated successfully, but these errors were encountered: