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

std::array's documentation mistakenly says it derefs to [T] #29993

Closed
niconii opened this issue Nov 23, 2015 · 5 comments
Closed

std::array's documentation mistakenly says it derefs to [T] #29993

niconii opened this issue Nov 23, 2015 · 5 comments
Labels
E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

Comments

@niconii
Copy link
Contributor

niconii commented Nov 23, 2015

The doc page for std::array says this:

Arrays dereference to slices ([T]), so their methods can be called on arrays.

However, though this is true of Vec<T>, arrays in fact coerce via CoerceUnsized, not via deref coercion.

@apasel422 apasel422 added A-docs E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. labels Nov 23, 2015
@bluss
Copy link
Member

bluss commented Nov 23, 2015

It's compiler built in either way, not related to the Deref or CoerceUnsized traits.

@Gankra
Copy link
Contributor

Gankra commented Nov 23, 2015

@nrc how would you describe the current situation

@nrc
Copy link
Member

nrc commented Nov 23, 2015

There is definitely no dereferencing going on, so "coerce" is more accurate. This uses the Unsize trait, not the CoerceUnsized one, but since all the impls of Unsize are magic, there is not much point in mentioning it. I'd just say the compiler coerces it and leave it at that.

@bluss
Copy link
Member

bluss commented Nov 23, 2015

and it's the same unsizing happening in both method resolution as with coercion?

@nrc
Copy link
Member

nrc commented Nov 23, 2015

@bluss yes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
Projects
None yet
Development

No branches or pull requests

5 participants