Closed
Description
Specifically this code:
trait Foo {
const N: usize;
}
fn main() {
struct MyFoo;
let n = 0;
impl Foo for MyFoo {
const N: usize = n;
}
}
results in the following error message:
$ rustc test.rs
error: internal compiler error: /checkout/src/librustc_typeck/check/mod.rs:1846: no type for local variable local n (id=15)
--> test.rs:11:26
|
11 | const N: usize = n;
| ^
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.21.0-nightly (97b01abf3 2017-08-31) running on x86_64-unknown-linux-gnu
thread 'rustc' panicked at 'Box<Any>', /checkout/src/librustc_errors/lib.rs:439:8
note: Run with `RUST_BACKTRACE=1` for a backtrace.
Expected behavior: While I can understand if this level of meta isn't possible, it should give a proper error message! :)