error: internal compiler error: fictitious type ty_param(middle::ty::ParamTy{space: TypeSpace, idx: 0u, def_id: syntax::ast::DefId{krate: 0u32, node: 44u32}}) in sizing_type_of()
note: the compiler hit an unexpected failure path. this is a bug.
note: we would appreciate a bug report: http://doc.rust-lang.org/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
task 'rustc' failed at 'Box<Any>', /home/rustbuild/src/rust-buildbot/slave/nightly-linux/build/src/libsyntax/diagnostic.rs:163
Testcase:
#![feature(overloaded_calls)]
use std::ops::FnMut;
pub struct Cumsum {
v: int
}
impl FnMut<(int, ), int> for Cumsum
{
fn call_mut(&mut self, (arg, ): (int, )) -> int {
self.v += arg;
self.v
}
}
struct User<F> {
f: F
}
impl<T: Add<T, T>, F: FnMut<(T, ), T>> User<F>
{
fn next(&mut self, x: T) -> T {
(self.f)(x)
}
}
fn main()
{
let mut user = User{f: Cumsum{v: 0}};
let first = user.next(1);
}
Encountered ICE when trying to implement something like
std::iter::Map
using aF: FnMut
bound for the mapping function.ICE in middle/trans/type_of.rs
Testcase:
Backtrace
cc @pcwalton