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

Require indices to be uint #13257

Merged
merged 2 commits into from
Apr 3, 2014
Merged

Require indices to be uint #13257

merged 2 commits into from
Apr 3, 2014

Conversation

alexcrichton
Copy link
Member

The details are outlined in the first commit.

Closes #10453

This commit tightens up the restriction on types used to index slices to require
exactly `uint` indices. Previously any integral type was accepted, but this
leads to a few subtle problems:

  * 64-bit indices don't make much sense on 32-bit systems
  * Signed indices for slices used as negative indexing isn't implemented

This was discussed at the recent work week, and also has some discussion on
issue rust-lang#10453.

Closes rust-lang#10453
bors added a commit that referenced this pull request Apr 2, 2014
The details are outlined in the first commit. 

Closes #10453
@bors bors closed this Apr 3, 2014
@bors bors merged commit 9a259f4 into rust-lang:master Apr 3, 2014
@alexcrichton alexcrichton deleted the index-uint branch April 3, 2014 18:48
matthiaskrgr pushed a commit to matthiaskrgr/rust that referenced this pull request Oct 11, 2022
…ykril

Ensure at least one trait bound in `TyKind::DynTy`

One would expect `TyKind::DynTy` to have at least one trait bound, but we may produce a dyn type with no trait bounds at all. This patch prevents it by returning `TyKind::Error` in such cases.

An "empty" dyn type would have caused panic during method resolution without rust-lang#13257. Although already fixed, I think an invariant to never produce such types would help prevent similar problems in the future.
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.

Hard-wired index operator for vectors implicitly converts integral types
2 participants