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

Remove unused adt-def insertion by constructor DefIndex #40696

Merged
merged 2 commits into from
Mar 23, 2017

Conversation

cramertj
Copy link
Member

It looks to me like ADT definitions weren't being looked up by constructor id, and a test run supports my theory.

In any case, I'm not sure it would have worked in its current configuration. If I understand correctly, the adt_def map entry from constructor id -> adt def would only be present after a successful call to queries::adt_def::get with the proper ADT DefIndex. Trying to look up an adt_def by the constructor index prior to a successful lookup by ADT index would fail since item.kind would be EntryKind::Fn (for the constructor function) and so would trigger the bug!.

r? @nikomatsakis

@cramertj
Copy link
Member Author

cc #40614

@petrochenkov
Copy link
Contributor

I can confirm, this is not necessary now.
This was added in 2cdd9f1, but things changed since then.

This "constructor insertion" was done in two places - librustc_metadata/decoder.rs and librustc_typeck/collect.rs, could you make sure both are removed?

@cramertj
Copy link
Member Author

cramertj commented Mar 21, 2017

@petrochenkov Was that the one you were thinking of?

@petrochenkov
Copy link
Contributor

@cramertj
Yep.

@bors r+

@bors
Copy link
Contributor

bors commented Mar 21, 2017

📌 Commit 239da92 has been approved by petrochenkov

@bors
Copy link
Contributor

bors commented Mar 21, 2017

🔒 Merge conflict

@bstrie bstrie force-pushed the remove-unused-adt-def-code branch from 239da92 to 873248d Compare March 21, 2017 20:29
@bstrie
Copy link
Contributor

bstrie commented Mar 21, 2017

I've rebased this branch due to a submodule conflict that invalidated many PRs.

@bors r=petrochenkov

@bors
Copy link
Contributor

bors commented Mar 21, 2017

📌 Commit 873248d has been approved by petrochenkov

frewsxcv added a commit to frewsxcv/rust that referenced this pull request Mar 23, 2017
…, r=petrochenkov

Remove unused adt-def insertion by constructor DefIndex

It looks to me like ADT definitions weren't being looked up by constructor id, and a test run supports my theory.

In any case, I'm not sure it would have worked in its current configuration. If I understand correctly, the `adt_def` map entry from constructor id -> adt def would only be present after a successful call to `queries::adt_def::get` with the proper ADT `DefIndex`. Trying to look up an adt_def by the constructor index prior to a successful lookup by ADT index would fail since `item.kind` would be `EntryKind::Fn` (for the constructor function) and so would trigger the `bug!`.

r? @nikomatsakis
bors added a commit that referenced this pull request Mar 23, 2017
Rollup of 6 pull requests

- Successful merges: #39891, #40518, #40542, #40617, #40678, #40696
- Failed merges:
@bors bors merged commit 873248d into rust-lang:master Mar 23, 2017
@cramertj cramertj deleted the remove-unused-adt-def-code branch March 23, 2017 08:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants