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

Properly convert and translate unit structs into MIR #30551

Merged
merged 1 commit into from
Dec 25, 2015

Conversation

nagisa
Copy link
Member

@nagisa nagisa commented Dec 24, 2015

Fixes #30514

i also went ahead and removed the redundant ItemKinds.

r? @nikomatsakis (this is an easy one I guess)

@nagisa
Copy link
Member Author

nagisa commented Dec 24, 2015

struct Droppable;
fn mir() {
    Droppable
}

results in

foo

@luqmana
Copy link
Member

luqmana commented Dec 25, 2015

LGTM! @bors: r+

@bors
Copy link
Contributor

bors commented Dec 25, 2015

📌 Commit 75e8f4a has been approved by luqmana

Manishearth added a commit to Manishearth/rust that referenced this pull request Dec 25, 2015
Fixes rust-lang#30514

i also went ahead and removed the redundant `ItemKind`s.

r? @nikomatsakis (this is an easy one I guess)
bors added a commit that referenced this pull request Dec 25, 2015
@bors bors merged commit 75e8f4a into rust-lang:master Dec 25, 2015
ty::TyBareFn(..) => (def_id, ItemKind::Function),
// This is a special case: a unit struct which is used as a value. We return a
// completely different ExprKind here to account for this special case.
ty::TyStruct(adt_def, substs) => return ExprKind::Adt {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can't you have the same problem with unit variants (e.g. Option::None)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, I now feel kinda stupid not having noticed it myself 😃.

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