Skip to content

save-analysis: handle type defs in struct patterns #22613

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

Merged
merged 1 commit into from
Feb 23, 2015

Conversation

nrc
Copy link
Member

@nrc nrc commented Feb 21, 2015

r? @huonw

@nrc
Copy link
Member Author

nrc commented Feb 22, 2015

rebased

ping @huonw for review

@huonw
Copy link
Member

huonw commented Feb 22, 2015

I'm struggling to understand the background for this patch. What's a code example that this change fixes/improves?

@nrc
Copy link
Member Author

nrc commented Feb 23, 2015

impl Foo for i32 {} In that case we fall into the first branch of the match, but looking up the type definition gives us None, this makes sure we register the fact that there is an impl of Foo in this case (as well as the trait reference).

@huonw
Copy link
Member

huonw commented Feb 23, 2015

That sounds like a case for #22691?

@nrc
Copy link
Member Author

nrc commented Feb 23, 2015

oh, right, sorry, got confused between the two.

The use case for this is something like:

struct Foo {
    a: i32,
}
type Bar = Foo;
fn baz(Bar { a }: Bar) {
}

Previously, this crashed in save-analysis. Now it works.

@huonw
Copy link
Member

huonw commented Feb 23, 2015

@bors r+ 6f9b rollup

bombless added a commit to bombless/rust that referenced this pull request Feb 23, 2015
Manishearth added a commit to Manishearth/rust that referenced this pull request Feb 23, 2015
@alexcrichton alexcrichton merged commit 6f9b91d into rust-lang:master Feb 23, 2015
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.

3 participants