Closed
Description
#![feature(nll)]
use std::cell::RefCell;
fn main() {
let s = RefCell::new(Some(10));
if let Some(n) = *(s.borrow_mut()) {
println!("num: {}", n);
}
}
I thought the code should be compiled with nll feature ,
but got the following errors:
Compiling playground v0.0.1 (file:///playground)
thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', libcore/option.rs:335:21
note: Run with `RUST_BACKTRACE=1` for a backtrace.
error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
note: rustc 1.26.0-nightly (06fa27d7c 2018-04-01) running on x86_64-unknown-linux-gnu
note: compiler flags: -C codegen-units=1 -C debuginfo=2 --crate-type bin
note: some of the compiler flags provided by cargo are hidden
error: Could not compile `playground`.
To learn more, run the command again with --verbose.
the following code is good:
#![feature(nll)]
use std::cell::RefCell;
fn main() {
let s = RefCell::new(Some(10));
if let Some(n) = *(s.borrow_mut()) {
println!("num: {}", n);
}
;
}