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

Nightly feature let_chains bug #92145

Closed
Cryptex-github opened this issue Dec 21, 2021 · 3 comments
Closed

Nightly feature let_chains bug #92145

Cryptex-github opened this issue Dec 21, 2021 · 3 comments
Labels
C-bug Category: This is a bug. F-let_chains `#![feature(let_chains)]` requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@Cryptex-github
Copy link

Cryptex-github commented Dec 21, 2021

I tried this code:

#![feature(let_chains)]

fn main() {
    let opt = Some("foo bar");

    if true && let Some(x) = opt {
        println!("{}", x);
    }
}

I expected to see this happen: print foo bar to console

Instead, this happened:

error[E0381]: borrow of possibly-uninitialized variable: `x`
 --> src/main.rs:7:24
  |
7 |         println!("{}", x);
  |                        ^ use of possibly-uninitialized `x`
  |
  = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info)

Meta

rustc --version --verbose:

rustc 1.59.0-nightly (e95e084a1 2021-12-19)
binary: rustc
commit-hash: e95e084a14870a718c712936ab5a8f8cd0159485
commit-date: 2021-12-19
host: x86_64-unknown-linux-gnu
release: 1.59.0-nightly
LLVM version: 13.0.0
Backtrace

No backtrace available

@Cryptex-github Cryptex-github added the C-bug Category: This is a bug. label Dec 21, 2021
@Cryptex-github
Copy link
Author

@rustbot label +F-let_chains +T-compiler +requires-nightly

@rustbot rustbot added F-let_chains `#![feature(let_chains)]` requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jan 11, 2022
@c410-f3r
Copy link
Contributor

This issue can be closed

@Cryptex-github
Copy link
Author

This issue can be closed

Thanks for finish implementing it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. F-let_chains `#![feature(let_chains)]` requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants