-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Collect lang items on the AST instead of HIR #115178
Labels
A-ast
Area: AST
A-lang-item
Area: Language items
C-cleanup
Category: PRs that clean code up or issues documenting cleanup.
E-help-wanted
Call for participation: Help is requested to fix this issue.
E-medium
Call for participation: Medium difficulty. Experience needed to fix: Intermediate.
E-mentor
Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Comments
cjgillot
added
C-cleanup
Category: PRs that clean code up or issues documenting cleanup.
E-mentor
Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
E-help-wanted
Call for participation: Help is requested to fix this issue.
E-medium
Call for participation: Medium difficulty. Experience needed to fix: Intermediate.
labels
Aug 24, 2023
rustbot
added
the
needs-triage
This issue may need triage. Remove it if it has been sufficiently triaged.
label
Aug 24, 2023
@rustbot claim |
@rustbot claim |
Noratrieb
added
A-lang-item
Area: Language items
and removed
needs-triage
This issue may need triage. Remove it if it has been sufficiently triaged.
labels
Aug 29, 2023
Is this still being worked on? I'd like to take a look as well if we still need assistance for this issue |
workingjubilee
added a commit
to workingjubilee/rustc
that referenced
this issue
Dec 15, 2023
…cjgillot Collect lang items from AST, get rid of `GenericBound::LangItemTrait` r? `@cjgillot` cc rust-lang#115178 Looking forward, the work to remove `QPath::LangItem` will also be significantly more difficult, but I plan on doing it as well. Specifically, we have to change: 1. A lot of `rustc_ast_lowering` for things like expr `..` 2. A lot of astconv, since we actually instantiate lang and non-lang paths quite differently. 3. A ton of diagnostics and clippy lints that are special-cased via `QPath::LangItem` Meanwhile, it was pretty easy to remove `GenericBound::LangItemTrait`, so I just did that here.
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this issue
Dec 16, 2023
Rollup merge of rust-lang#118396 - compiler-errors:ast-lang-items, r=cjgillot Collect lang items from AST, get rid of `GenericBound::LangItemTrait` r? `@cjgillot` cc rust-lang#115178 Looking forward, the work to remove `QPath::LangItem` will also be significantly more difficult, but I plan on doing it as well. Specifically, we have to change: 1. A lot of `rustc_ast_lowering` for things like expr `..` 2. A lot of astconv, since we actually instantiate lang and non-lang paths quite differently. 3. A ton of diagnostics and clippy lints that are special-cased via `QPath::LangItem` Meanwhile, it was pretty easy to remove `GenericBound::LangItemTrait`, so I just did that here.
compiler-errors
added a commit
to compiler-errors/rust
that referenced
this issue
Dec 26, 2023
…petrochenkov Make some non-diagnostic-affecting `QPath::LangItem` into regular `QPath`s The rest of 'em affect diagnostics, so leave them alone... for now. cc rust-lang#115178
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this issue
Dec 26, 2023
Rollup merge of rust-lang#119240 - compiler-errors:lang-item-more, r=petrochenkov Make some non-diagnostic-affecting `QPath::LangItem` into regular `QPath`s The rest of 'em affect diagnostics, so leave them alone... for now. cc rust-lang#115178
flip1995
pushed a commit
to flip1995/rust
that referenced
this issue
Dec 28, 2023
…petrochenkov Make some non-diagnostic-affecting `QPath::LangItem` into regular `QPath`s The rest of 'em affect diagnostics, so leave them alone... for now. cc rust-lang#115178
@rustbot claim |
@compiler-errors no worries - there are plenty of fish in the sea. Glad it got fixed. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-ast
Area: AST
A-lang-item
Area: Language items
C-cleanup
Category: PRs that clean code up or issues documenting cleanup.
E-help-wanted
Call for participation: Help is requested to fix this issue.
E-medium
Call for participation: Medium difficulty. Experience needed to fix: Intermediate.
E-mentor
Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
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
arustc_ast::Visitor
, and haveget_lang_items
use it to visit the full crate. The AST is accessible using the second field oftcx.resolver_for_lowering(()).borrow()
.A statement
tcx.ensure_with_value().get_lang_items(LOCAL_CRATE)
needs to be added at the top ofrustc_ast_lowering::lower_to_hir
to ensure that the computation is done before dropping the AST.Once that is done,
hir::QPath::LangItem
andhir::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.
The text was updated successfully, but these errors were encountered: