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

@nrcnrc commented Feb 21, 2015

Copy link
Copy Markdown
Member

@nrc

nrc commented Feb 22, 2015

Copy link
Copy Markdown
MemberAuthor

rebased

ping @huonw for review

@huonw

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
MemberAuthor

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
Copy Markdown
Contributor

That sounds like a case for #22691?

@nrc

nrc commented Feb 23, 2015

Copy link
Copy Markdown
MemberAuthor

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
Copy Markdown
Contributor

@bors r+ 6f9b rollup

bombless added a commit to bombless/rust that referenced this pull request Feb 23, 2015
@bomblessbombless mentioned 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:masterFeb 23, 2015
Kobzol pushed a commit to Kobzol/rust that referenced this pull request Jul 4, 2026
…uct-nested-pat-panic
fix: avoid panic in `convert_tuple_struct_to_named_struct` on nested pattern usage
Sign up for freeto 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

@nrc@huonw@alexcrichton