Closed
Description
The compiler panics when compiling the following code.
I tried this code:
main.rs:
fn main() {
rec(std::iter::empty::<()>(), 0);
}
fn rec(mut it: impl Iterator, n: u32) -> usize {
if n == 0 {
it.count()
} else {
rec(it.by_ref(), n - 1)
}
}
I ran:
$ rustc main.rs
Rustc panics:
thread 'rustc' panicked at 'assertion failed: !substs.needs_infer()', src/librustc/traits/specialize/mod.rs:122:5
note: run with `RUST_BACKTRACE=1` environment variable to display 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.39.0 (4560ea788 2019-11-04) running on x86_64-unknown-linux-gnu
Meta
$ rustc --version --verbose
rustc 1.39.0 (4560ea7 2019-11-04)
binary: rustc
commit-hash: 4560ea7
commit-date: 2019-11-04
host: x86_64-unknown-linux-gnu
release: 1.39.0
LLVM version: 9.0
Metadata
Metadata
Assignees
Labels
Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.Category: This is a bug.Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️High priorityRelevant to the compiler team, which will review and decide on the PR/issue.ICE tracked in rust-lang/glacier.