You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
error[E0434]: can't capture dynamic environment in a fn item
--> sroriqa.rs:24:30
|
24 | const dimention: usize = lines.count();
| ^^^^^
|
= help: use the `|| { ... }` closure form instead
thread 'rustc' panicked at 'LocalTableInContext: key not found', libcore/option.rs:916:5
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 (75af15ee6 2018-03-20) running on x86_64-unknown-linux-gnu
Here is my code:
use std::fs::File;
use std::io::prelude::*;
use std::path::Path;
use std::error::Error;
fn main() {
let path = Path::new("input");
let display = path.display();
let mut file = match File::open(&path) {
Err(why) => panic!("couldn't open {}: {}", display, why.description()),
Ok(file) => file,
};
let mut contents = String::new();
match file.read_to_string(&mut contents) {
Err(why) => panic!("couldn't read {}: {}", display, why.description()),
Ok(_) => println!("\"{}\" contains:\n{}", display, contents),
};
// Files can end with empty string
// Remove it and all empty strings that can appear by accident to calculate correct dimension of matrix
let lines = contents.lines().filter(|x| !x.is_empty());
const dimention: usize = lines.count();
println!("Dimention: {:?}", dimention);
let lines: [str; dimention] = lines.collect();
for line in lines {
println!("Line: {}", line);
}
}
Always check type_dependent_defs
Directly indexing into `type_dependent_defs` has caused multiple ICEs in the past (#46771, #49241, etc.) and is almost certainly responsible for #51798 too. This PR ensures we always check `type_dependent_defs` first, which should prevent any more of these (or at least make them easier to track down).
I get this in the console:
Here is my code:
Meta
Backtrace:
The text was updated successfully, but these errors were encountered: