Skip to content

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

Merged
alexcrichton merged 1 commit into
rust-lang:masterfrom
nrc:fix-save-alias
Feb 23, 2015
Merged

save-analysis: handle type defs in struct patterns#22613
alexcrichton merged 1 commit into
rust-lang:masterfrom
nrc:fix-save-alias

Conversation

@nrc

@nrc nrc commented Feb 21, 2015

Copy link
Copy Markdown
Member

r? @huonw

@nrc

nrc commented Feb 22, 2015

Copy link
Copy Markdown
Member Author

rebased

ping @huonw for review

@huonw

huonw commented Feb 22, 2015

Copy link
Copy Markdown
Contributor

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

@nrc

nrc commented Feb 23, 2015

Copy link
Copy Markdown
Member Author

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

huonw commented Feb 23, 2015

Copy link
Copy Markdown
Contributor

That sounds like a case for #22691?

@nrc

nrc commented Feb 23, 2015

Copy link
Copy Markdown
Member Author

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

huonw commented Feb 23, 2015

Copy link
Copy Markdown
Contributor

@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