Skip to content

Incorrect statement about unsized coercion in method lookup #819

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

Open
jameseb7 opened this issue May 25, 2020 · 2 comments
Open

Incorrect statement about unsized coercion in method lookup #819

jameseb7 opened this issue May 25, 2020 · 2 comments

Comments

@jameseb7
Copy link

When explaining method lookup, the reference says:

The first step is to build a list of candidate receiver types. Obtain these by repeatedly dereferencing the receiver expression's type, adding each type encountered to the list, then finally attempting an unsized coercion at the end, and adding the result type if that is successful.

However, general unsized coercions are not allowed for method call. In particular, this example shows unsized coercion to a trait object is not performed during method lookup. It seems it was mentioned when this paragraph of the reference was written that the unsized coercion is only performed for slices, but it does not seem to have been changed accordingly. It would be good if it could be fixed to reflect what actually happens during method lookup, and if we could clarify whether slices are truly a special case.

@QuineDot
Copy link

CC @matthewjasper @Havvy: The issue to be accurate about which unsizing coercions apply that you requested in PR #190 was never created, but this issue could serve as that. It continues to cause confusion. It is a counter-factual statement in the reference.

(Not sure if bots patrol these parts but let's try...)
@rustbot label +Bug +T-lang

@rustbot
Copy link
Collaborator

rustbot commented Nov 10, 2022

Error: Label T-lang can only be set by Rust team members

Please file an issue on GitHub at triagebot if there's a problem with this bot, or reach out on #t-infra on Zulip.

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

No branches or pull requests

3 participants