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

Unchecked indexing/slicing methods should point towards their safe counterparts #39911

Closed
jonas-schievink opened this issue Feb 17, 2017 · 5 comments
Labels
A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

Comments

@jonas-schievink
Copy link
Contributor

The following unsafe unchecked indexing / slicing methods don't refer to the safe alternatives at all, misleading newbies into thinking that they are the preferred way of performing that operation. There should be a big disclaimer stating what their checked counterparts are and that they are preferred.

  • str::slice_unchecked / str::slice_mut_unchecked
  • [T]::get_unchecked / [T]::get_unchecked_mut
@Mark-Simulacrum
Copy link
Member

cc @rust-lang/docs, this feels like an E-easy issue to me, tagging as such -- we should add the links to the unchecked method documentations pointing to safe indexing (get, probably, where applicable as well as noting indexing with the Index trait). Does that sound good?

@Mark-Simulacrum Mark-Simulacrum added A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. labels May 23, 2017
@GuillaumeGomez
Copy link
Member

@Mark-Simulacrum: Yep, all good.

@citizen428
Copy link
Contributor

If no-one picks it up until then I'll try to get this done over the weekend.

@GuillaumeGomez
Copy link
Member

@citizen428: Sure, go ahead.

citizen428 added a commit to citizen428/rust that referenced this issue May 26, 2017
frewsxcv added a commit to frewsxcv/rust that referenced this issue May 26, 2017
…slicing, r=GuillaumeGomez

Update documentation for indexing/slicing methods

See rust-lang#39911

r? @steveklabnik
frewsxcv added a commit to frewsxcv/rust that referenced this issue May 26, 2017
…slicing, r=GuillaumeGomez

Update documentation for indexing/slicing methods

See rust-lang#39911

r? @steveklabnik
@citizen428
Copy link
Contributor

This has been merged, so the issue should be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools 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

4 participants