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

Use a different DefId for the Def::Variant and Def::VariantCtor #59131

Closed
dlrobertson opened this issue Mar 12, 2019 · 2 comments
Closed

Use a different DefId for the Def::Variant and Def::VariantCtor #59131

dlrobertson opened this issue Mar 12, 2019 · 2 comments
Labels
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

@dlrobertson
Copy link
Contributor

dlrobertson commented Mar 12, 2019

The enum variant (Dev::Variant) and the enum variants constructor (Def::VariantCtor) share the same DefId making it impossible for tcx.describe_def to resolve a DefId to a VariantCtor.

This issue originates from the discussion here.

Note: tcx.describe_def has not moved away from NodeId. It may be best for the fix to wait until it is.
CC: #59036

@jonas-schievink jonas-schievink added 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. labels Mar 12, 2019
@davidtwco
Copy link
Member

I think this can be closed. #59382 resolved this by separating the DefId used for a variant and its constructor. describe_def (now def_kind) can now return a Def::VariantCtor (now DefKind::Ctor) and the code from the original PR that raised this now uses DefKind::Ctor instead of DefKind::Variant as the review suggested.

@dlrobertson
Copy link
Contributor Author

That is awesome! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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

No branches or pull requests

4 participants