-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)C-bugCategory: This is a bug.Category: This is a bug.L-double_negationsLint: double_negationsLint: double_negationsL-false-positiveLint: False positive (should not have fired).Lint: False positive (should not have fired).T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
I tried this code:
macro_rules! neg {
($value: expr) => { -$value }
}
fn test() {
let value = 1;
let _ = neg!(-value);
}
I expected to see this happen: No double_negations warnings
Instead, this happened: double_negations warning
Meta
rustc --version --verbose
:
1.90.0-nightly
(2025-07-14 a001497644bc229f1abc)
(Playgournd)
Metadata
Metadata
Assignees
Labels
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)C-bugCategory: This is a bug.Category: This is a bug.L-double_negationsLint: double_negationsLint: double_negationsL-false-positiveLint: False positive (should not have fired).Lint: False positive (should not have fired).T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.