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

False positive missing_const_for_fn if there are #[start] and #[test] both are present #13946

Open
alex-semenyuk opened this issue Jan 5, 2025 · 0 comments
Labels
C-bug Category: Clippy is not doing the correct thing I-false-positive Issue: The lint was triggered on code it shouldn't have

Comments

@alex-semenyuk
Copy link
Member

alex-semenyuk commented Jan 5, 2025

Summary

False positive missing_const_for_fn if there are #[start] and #[test] both are present since the check is_entrypoint_fn doesn't filter for triggering on entrypoint in this case

if in_external_macro(cx.tcx.sess, span) || is_entrypoint_fn(cx, def_id.to_def_id()) {

Reproducer

I tried this code:
https://github.com/rust-lang/rust-clippy/pull/13945/files#diff-2848b9a3191892d7b27e3403ff872cfc21bdcace40abf2f47a90dfd210449f23

I expected to see this happen:
No trigger missing_const_for_fn for entrypoint

Instead, this happened:
Triggered missing_const_for_fn for entrypoint

Version

rustc 1.85.0-nightly (7c002ff9a 2024-12-25)

Additional Labels

@rustbot label +I-false-positive

@alex-semenyuk alex-semenyuk added the C-bug Category: Clippy is not doing the correct thing label Jan 5, 2025
@rustbot rustbot added the I-false-positive Issue: The lint was triggered on code it shouldn't have label Jan 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing I-false-positive Issue: The lint was triggered on code it shouldn't have
Projects
None yet
Development

No branches or pull requests

2 participants