Closed
Description
#![feature(unboxed_closures)]
use std::ops::Fn;
struct Foo(u32);
impl Fn(u32) -> Foo for fn(u32) -> Foo {
extern "rust-call" fn call(&self, args: (u32,)) -> Foo { let (u,) = args; self(u) }
}
fn main() {
let x = Foo.call((42,));
println!("{}", x);
}
<anon>:7:1: 9:2 error: internal compiler error: coherence failed to report ambiguity: cannot locate the impl of the trait `core::ops::Fn(u32) -> Foo` for the type `fn(u32) -> Foo`
<anon>:7 impl Fn(u32) -> Foo for fn(u32) -> Foo {
<anon>:8 extern "rust-call" fn call(&self, args: (u32,)) -> Foo { let (u,) = args; self(u) }
<anon>:9 }
note: the compiler unexpectedly panicked. 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
thread 'rustc' panicked at 'Box<Any>', /build/rust-git/src/rust/src/libsyntax/diagnostic.rs:123