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

Indexing operations are not accurate on whether they panic #1

Open
estebank opened this issue Sep 1, 2023 · 1 comment
Open

Indexing operations are not accurate on whether they panic #1

estebank opened this issue Sep 1, 2023 · 1 comment

Comments

@estebank
Copy link
Owner

estebank commented Sep 1, 2023

rustc doesn't mark the internal APIs that it uses to determine the appropriate trait used by an indexing operation as public. For now, the dont_panic lint always treats indexing as a potentially panicking operation as a stop-gap.

@Erk-
Copy link

Erk- commented Nov 21, 2023

This does not seem to work with indexing that does not use usize as the index, for example it does not seem to catch the following panic:

fn main() {
    let mut map = std::collections::HashMap::new();
    map.insert("foo", "bar");
    map["baz"];
}

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

No branches or pull requests

2 participants