Description
I'm trying to create static or constant from matching the env::home_dir:
use std::env;
static home: String = match env::home_dir() {
Some(ref p) => p.to_str().unwrap().to_owned(),
None => "./".to_string(),
};
But I'm getting a compiler bug:
src/main.rs:15:8: 15:13 error: internal compiler error: no enclosing scope found for scope: CodeExtent(346/Misc(20))
src/main.rs:15 Some(ref p) => p.to_str().unwrap().to_owned(),
^~~~~
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: run withRUST_BACKTRACE=1
for a backtrace
thread 'rustc' panicked at 'Box', ../src/libsyntax/diagnostic.rs:175
I know that my code is broken but compiller should not crush anyway.
rustc 1.6.0 (c30b771 2016-01-19)
binary: rustc
commit-hash: c30b771
commit-date: 2016-01-19
host: x86_64-unknown-linux-gnu
release: 1.6.0