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

missing_panics_doc shouldn't be triggered in constant environments #12760

Closed
c410-f3r opened this issue May 3, 2024 · 0 comments · Fixed by #12790
Closed

missing_panics_doc shouldn't be triggered in constant environments #12760

c410-f3r opened this issue May 3, 2024 · 0 comments · Fixed by #12790

Comments

@c410-f3r
Copy link
Contributor

c410-f3r commented May 3, 2024

IFAICT, documentation around panic! is about runtime behavior. rustc will automatically point to the panic message at compile-time when working with constants.

#![deny(clippy::missing_panics_doc)]

pub fn foo<const N: usize>() {
    const {
        if N == 0 {
            panic!();
        }
    }
}

pub fn main() {
    foo::<0>();
}
c410-f3r added a commit to c410-f3r/rust-clippy that referenced this issue May 11, 2024
@c410-f3r c410-f3r mentioned this issue May 11, 2024
bors added a commit that referenced this issue May 15, 2024
Fix #12760

Fix #12760

```
changelog: [missing_panics_doc]: Ignore panics in compile time
```
@bors bors closed this as completed in 12ec009 May 15, 2024
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

Successfully merging a pull request may close this issue.

1 participant