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

Docs of impl Index for HashMap and BTreeMap should mention they panic for a non-existent key #47011

Closed
nodakai opened this issue Dec 26, 2017 · 1 comment
Labels
A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools C-enhancement Category: An issue proposing an enhancement or a PR with one.

Comments

@nodakai
Copy link
Contributor

nodakai commented Dec 26, 2017

It's true that you can expect this behavior from the method signature, but this is too important a detail to leave out.

What was the rustdoc syntax to document a particular impl of a trait?

@kennytm kennytm added C-enhancement Category: An issue proposing an enhancement or a PR with one. A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools labels Dec 26, 2017
@kennytm
Copy link
Member

kennytm commented Dec 26, 2017

You just write doc comments on the impl block as usual.

/// Doc comments
impl<Q, K, V> Index<Q> for BTreeMap<K, V> where /*something*/ {
    type Output = V;
    /// More doc comments
    fn index(&self, key: Q) -> &V { ... }
}

frewsxcv added a commit to frewsxcv/rust that referenced this issue Jan 29, 2018
kennytm added a commit to kennytm/rust that referenced this issue Jan 29, 2018
…tMisdreavus

Document that `Index` ops can panic on `HashMap` & `BTreeMap`.

Fixes rust-lang#47011.
kennytm added a commit to kennytm/rust that referenced this issue Jan 30, 2018
…tMisdreavus

Document that `Index` ops can panic on `HashMap` & `BTreeMap`.

Fixes rust-lang#47011.
cuviper pushed a commit to cuviper/rayon-hash that referenced this issue Feb 2, 2018
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-enhancement Category: An issue proposing an enhancement or a PR with one.
Projects
None yet
Development

No branches or pull requests

2 participants