Skip to content
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

Associated lang items #70718

Closed
ecstatic-morse opened this issue Apr 2, 2020 · 1 comment · Fixed by #72559
Closed

Associated lang items #70718

ecstatic-morse opened this issue Apr 2, 2020 · 1 comment · Fixed by #72559
Assignees
Labels
A-associated-items Area: Associated items (types, constants & functions) A-lang-item Area: Language items C-cleanup Category: PRs that clean code up or issues documenting cleanup. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@ecstatic-morse
Copy link
Contributor

Some associated items have a special meaning in the compiler, for example, Fn::Output and Future::Output. However, these associated types are often looked up by name, or worse by definition order. We should be using the lang item machinery for them.

@ecstatic-morse ecstatic-morse added C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. A-lang-item Area: Language items labels Apr 2, 2020
@ecstatic-morse ecstatic-morse self-assigned this Apr 2, 2020
@jonas-schievink jonas-schievink added C-cleanup Category: PRs that clean code up or issues documenting cleanup. and removed C-enhancement Category: An issue proposing an enhancement or a PR with one. labels Apr 2, 2020
@lcnr
Copy link
Contributor

lcnr commented Apr 7, 2020

relevant for #70705

@jonas-schievink jonas-schievink added the A-associated-items Area: Associated items (types, constants & functions) label Apr 7, 2020
bors added a commit to rust-lang-ci/rust that referenced this issue Jun 25, 2020
…=oli-obk

Implement associated lang items

Fixes rust-lang#70718

This commit allows making associated items (e.g. associated functions
and types) into lang items via the `#[lang]` attribute. This allows such
items to be accessed directly, rather than by iterating over the parent
item's associated items.

I've added `FnOnce::Output` as a lang item, and updated one old usage to
use the new lang item. The remaining uses can be updated separately.
@bors bors closed this as completed in a13d467 Jun 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-associated-items Area: Associated items (types, constants & functions) A-lang-item Area: Language items C-cleanup Category: PRs that clean code up or issues documenting cleanup. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants