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

DOC: slicing with begin = end? #75412

Closed
mgeier opened this issue Aug 11, 2020 · 1 comment · Fixed by #75499
Closed

DOC: slicing with begin = end? #75412

mgeier opened this issue Aug 11, 2020 · 1 comment · Fixed by #75499
Labels
A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools C-bug Category: This is a bug. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

Comments

@mgeier
Copy link
Contributor

mgeier commented Aug 11, 2020

https://doc.rust-lang.org/std/slice/trait.SliceIndex.html#impl-SliceIndex%3Cstr%3E mentions "Panics [...] if begin > end, or if end > len", which I think is correct.

However, https://doc.rust-lang.org/std/slice/trait.SliceIndex.html#impl-SliceIndex%3Cstr%3E-1 mentions "Panics [...] if begin >= len", which I think is wrong, isn't it?

Shouldn't this be "Panics [...] if begin > len"?

The current stable compiler doesn't seem to create a panicking program when I use "begin = len".

The documentation for slice slicing doesn't mention anything at all: https://doc.rust-lang.org/std/slice/trait.SliceIndex.html#impl-SliceIndex%3C%5BT%5D%3E-2.

It would be great to have the (correct) description there as well.

I think this has already been fixed in #32099 and #32183 (more than 4 years ago), but it seems to have gotten lost again since then?

Or am I missing something?

@JohnTitor
Copy link
Member

You're right, I guess it's a copy/paste error from RangeToInclusive in #57604? We're happy to see a PR to fix it :)

@JohnTitor JohnTitor added C-bug Category: This is a bug. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools labels Aug 13, 2020
tmandry added a commit to tmandry/rust that referenced this issue Aug 18, 2020
…-75412, r=Dylan-DPC

Fix documentation error

This should fix rust-lang#75412. Just a quick >= to > sign replacement.
tmandry added a commit to tmandry/rust that referenced this issue Aug 18, 2020
…-75412, r=Dylan-DPC

Fix documentation error

This should fix rust-lang#75412. Just a quick >= to > sign replacement.
tmandry added a commit to tmandry/rust that referenced this issue Aug 19, 2020
…-75412, r=Dylan-DPC

Fix documentation error

This should fix rust-lang#75412. Just a quick >= to > sign replacement.
tmandry added a commit to tmandry/rust that referenced this issue Aug 19, 2020
…-75412, r=Dylan-DPC

Fix documentation error

This should fix rust-lang#75412. Just a quick >= to > sign replacement.
tmandry added a commit to tmandry/rust that referenced this issue Aug 19, 2020
…-75412, r=Dylan-DPC

Fix documentation error

This should fix rust-lang#75412. Just a quick >= to > sign replacement.
@bors bors closed this as completed in ac264b5 Aug 19, 2020
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 C-bug Category: This is a bug. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants