Repository navigation
Collect lang items on the AST instead of HIR #115178
Description
Lang items are collected on HIR in rustc_passes::lang_items.
However, AST -> HIR lowering may need to know of some lang items, for instance for loops of async desugaring.
Having lang items ready before lowering may simplify those code paths.
This requires re-implementing lang item collection on AST instead of HIR.
The simplest way is to make rustc_passes::lang_items::LanguageItemCollector a rustc_ast::Visitor, and have get_lang_items use it to visit the full crate. The AST is accessible using the second field of tcx.resolver_for_lowering(()).borrow().
A statement tcx.ensure_with_value().get_lang_items(LOCAL_CRATE) needs to be added at the top of rustc_ast_lowering::lower_to_hir to ensure that the computation is done before dropping the AST.
Once that is done, hir::QPath::LangItem and hir::GenericBound::LangItemTrait variants can be removed from HIR, replaced by actual resolutions of the lang items. (For particular cases, see how those variants are constructed and used.)
Please contact me on zulip for any question.
Activity
atsuzaki commentedon Aug 24, 2023
@rustbot claim
allaboutevemirolive commentedon Aug 28, 2023
@rustbot claim
RickleAndMortimer commentedon Sep 21, 2023
Is this still being worked on? I'd like to take a look as well if we still need assistance for this issue
22 remaining items
Auto merge of #146069 - camsteffen:range-desugar-span, r=SparrowLii
Auto merge of #148193 - camsteffen:remove-qpath-langitem, r=cjgillot
Auto merge of #148193 - camsteffen:remove-qpath-langitem, r=cjgillot
Auto merge of #146069 - camsteffen:range-desugar-span, r=SparrowLii
Auto merge of #148193 - camsteffen:remove-qpath-langitem, r=cjgillot
Auto merge of rust-lang#146069 - camsteffen:range-desugar-span, r=Spa…
Auto merge of rust-lang#148193 - camsteffen:remove-qpath-langitem, r=…
Auto merge of rust-lang#146069 - camsteffen:range-desugar-span, r=Spa…
Auto merge of rust-lang#148193 - camsteffen:remove-qpath-langitem, r=…
Auto merge of #146069 - camsteffen:range-desugar-span, r=SparrowLii
Auto merge of #148193 - camsteffen:remove-qpath-langitem, r=cjgillot
Auto merge of #146069 - camsteffen:range-desugar-span, r=SparrowLii
Auto merge of #148193 - camsteffen:remove-qpath-langitem, r=cjgillot
Auto merge of #146069 - camsteffen:range-desugar-span, r=SparrowLii
Auto merge of #148193 - camsteffen:remove-qpath-langitem, r=cjgillot