-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
C-bugCategory: This is a bug.Category: This is a bug.F-let_chains`#![feature(let_chains)]``#![feature(let_chains)]`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
rustc --version --verbose
:
rustc 1.58.0-nightly (495322d77 2021-11-08)
binary: rustc
commit-hash: 495322d776fd6f679cd8cd4ca02b8fa834da654b
commit-date: 2021-11-08
host: x86_64-pc-windows-msvc
release: 1.58.0-nightly
LLVM version: 13.0.0
Code:
// #![feature(let_chains)]
if let SelectScope::Fields(fields) = self.scope && self.constraint.is_none() {
/* snip */
if let Some(field) = fields
.iter()
.find(|name| {
table_columns_iter
.find(|ref_multi| ref_multi.key() == *name)
.is_none()
})
/* snip */
Error Output:
error[E0381]: borrow of possibly-uninitialized variable: `fields`
--> src\ql\select.rs:108:34
|
108 | if let Some(field) = fields
| __________________________________^
109 | | .iter()
| |_______________________^ use of possibly-uninitialized `fields`
For more information about this error, try `rustc --explain E0381`.
Is it me, or is the error being a bit confusing, that shouldn't fields
be already initialized due to the if let
, being only assigned to if the value is indeed SelectScope::Fields(<field vector>)
(or am I misunderstanding things)? Thanks.
jplatte
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.F-let_chains`#![feature(let_chains)]``#![feature(let_chains)]`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.