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

Tracking issue for FixedSizeArray trait #27778

Open
alexcrichton opened this Issue Aug 13, 2015 · 9 comments

Comments

Projects
None yet
7 participants
@alexcrichton
Member

alexcrichton commented Aug 13, 2015

This is a tracking issue for the unstable fixed_size_array feature in the standard library. This is likely to be deprecated and removed in favor of generic integers one day, and in the meantime there are not many consumers of it.

@eefriedman

This comment has been minimized.

Contributor

eefriedman commented Aug 13, 2015

Note that the fixed_size_array feature specifically covers the FixedSizeArray trait. There's some other code in core::array, but it's all implicitly stable.

@bluss

This comment has been minimized.

Contributor

bluss commented Aug 13, 2015

The FixedSizeArray trait would be great, except for many uses the ranges of sizes it's implemented for simply isn't what you need, and there is no way to expand it. Thus it is mostly useless in the current form.

@SimonSapin

This comment has been minimized.

Contributor

SimonSapin commented Aug 13, 2015

Could the compiler magically have an "infinite" (generated on demand) number of impls of FixedSizeArray?

If that happens and the type parameter is made into an associated type (and maybe an associated const for the size is added), then most of the other impls that currently only go up to N=32 could be made generic impl<A: FixedSizeArray> … for A.

@bluss

This comment has been minimized.

Contributor

bluss commented Aug 13, 2015

If/when the issue of using associated consts like consts is resolved, that is, allow [i32; A::LEN] to compile; then an infinite number of FixedSizeArray impls would give us the same thing as generic integer parameters.

This suggests to me that completing associated constants is basically the same problem as allowing generic integer parameters.

@oli-obk

This comment has been minimized.

Contributor

oli-obk commented Aug 13, 2015

for now FixedSizeArray could be moved to a crate since it doesn't use any compiler magic anyway

@SimonSapin

This comment has been minimized.

Contributor

SimonSapin commented Aug 13, 2015

@steveklabnik

This comment has been minimized.

Member

steveklabnik commented Nov 30, 2016

Triage: no changes

@SimonSapin

This comment has been minimized.

Contributor

SimonSapin commented Feb 21, 2017

Something did change in #28088: this trait is now implemented for all sizes:

unsafe impl<T, A: Unsize<[T]>> FixedSizeArray<T> for A

The Unsize trait is also unstable: #27732

@SimonSapin

This comment has been minimized.

Contributor

SimonSapin commented Feb 21, 2017

I wrote rust-lang/rfcs#1915 about extending and stabilizing this trait.

@Mark-Simulacrum Mark-Simulacrum changed the title from Tracking issue for core::array to Tracking issue for FixedSizeArray Jan 16, 2018

@Mark-Simulacrum Mark-Simulacrum changed the title from Tracking issue for FixedSizeArray to Tracking issue for FixedSizeArray trait Jan 16, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment