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

Vec::insert docs are wrong about panic condition #47065

Closed
Arnavion opened this issue Dec 29, 2017 · 1 comment
Closed

Vec::insert docs are wrong about panic condition #47065

Arnavion opened this issue Dec 29, 2017 · 1 comment
Labels
A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools

Comments

@Arnavion
Copy link

Arnavion commented Dec 29, 2017

rust/src/liballoc/vec.rs

Lines 716 to 718 in f0e5c95

/// # Panics
///
/// Panics if `index` is out of bounds.

In fact, as the second example shows, index == len is allowed. The phrase "out of bounds" is used in the docs of other methods (remove and swap_remove) to mean 0 <= index < len so it should not be used to mean 0 <= index <= len here.

Suggest changing the wording to match Vec::split_off :

Panics if index > len.

@sfackler sfackler added the A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools label Dec 30, 2017
frewsxcv added a commit to frewsxcv/rust that referenced this issue Jan 2, 2018
@frewsxcv
Copy link
Member

frewsxcv commented Jan 2, 2018

thanks for pointing this out! i just opened a pull request #47121

frewsxcv added a commit to frewsxcv/rust that referenced this issue Jan 2, 2018
Fix panic condition docs for Vec::insert.

Fixes rust-lang#47065.
kennytm added a commit to kennytm/rust that referenced this issue Jan 3, 2018
Fix panic condition docs for Vec::insert.

Fixes rust-lang#47065.
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
Projects
None yet
Development

No branches or pull requests

3 participants