-
- Notifications
You must be signed in to change notification settings - Fork 14.2k
Open
Labels
C-bugCategory: This is a bug.Category: This is a bug.I-prioritizeIssue: Indicates that prioritization has been requested for this issue.Issue: Indicates that prioritization has been requested for this issue.L-unused_assignmentsLint: unused_assignmentsLint: unused_assignmentsT-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.regression-untriagedUntriaged performance or correctness regression.Untriaged performance or correctness regression.
Description
Code
I tried this code:
fn lock() -> impl Drop { struct Handle; impl Drop for Handle { fn drop(&mut self) { } } Handle } fn bar(_f: impl FnMut(bool)) { } pub fn foo() { let mut _handle = None; bar(move |l| { if l { _handle = Some(lock()); } else { _handle = None; } }) }I expected to see this happen: no lints
Instead, this happened: a warning unused_assignments for each assign of _handle
Version it worked on
It most recently worked on: 1.91.1
Version with regression
rustc --version --verbose:
rustc 1.92.0 (ded5c06cf 2025-12-08) binary: rustc commit-hash: ded5c06cf21d2b93bffd5d884aa6e96934ee4234 commit-date: 2025-12-08 host: x86_64-pc-windows-msvc release: 1.92.0 LLVM version: 21.1.3 Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.I-prioritizeIssue: Indicates that prioritization has been requested for this issue.Issue: Indicates that prioritization has been requested for this issue.L-unused_assignmentsLint: unused_assignmentsLint: unused_assignmentsT-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.regression-untriagedUntriaged performance or correctness regression.Untriaged performance or correctness regression.