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

typeck: suggest (x.field)(...) to call struct fields even when x is a reference #33785

Closed
wants to merge 1 commit into from

Conversation

birkenfeld
Copy link
Contributor

Fixes: #33784

I also removed the unnecessary span for the note.

Reviewers: is this the right way to get at the deref'd type(s)? I tried expr_ty_adjusted, but it claimed "no type for node expr self"...

@rust-highfive
Copy link
Contributor

r? @nikomatsakis

(rust_highfive has picked a reviewer for you, use r? to override)

@jonas-schievink
Copy link
Contributor

Maybe using a full autoderef loop is a better idea, since that will work in more scenarios (it looks through explicit Deref impls, while builtin_deref doesn't)

@birkenfeld
Copy link
Contributor Author

Can you point me to the right API to use for that?

@jonas-schievink
Copy link
Contributor

That'd be FnCtxt::autoderef. You can see the usage in FnCtxt::is_fn_ty.

@birkenfeld
Copy link
Contributor Author

Thanks! That was easier than I thought :)

@nikomatsakis
Copy link
Contributor

Looks good to me, but note tidy failures:

https://travis-ci.org/rust-lang/rust/builds/132089654#L1231

@birkenfeld
Copy link
Contributor Author

Damn, I have to get into the habit of running that locally. Fixed!

@nikomatsakis
Copy link
Contributor

Note the failure here:

https://travis-ci.org/rust-lang/rust/builds/132746890#L5411

It seems like the easiest fix would be to add another instance of E055, but a better choice might be to suppress this lookup if we had an autoderef overflow already.

@nikomatsakis
Copy link
Contributor

nikomatsakis commented Jun 27, 2016

@birkenfeld given the tidy travis failure, I'm going to close this PR just to help manage the queue, but feel free to re-open when it's fixed.

bors added a commit that referenced this pull request Aug 8, 2016
typeck: suggest (x.field)(...) to call struct fields even when x is a reference

Fixes: #33784

Note: This is a reopen of #33785.
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.

4 participants