Repository: rust
Issue: Specialized `FnOnce` impl compiles failed with a lengthy error message
Labels: C-enhancement,A-diagnostics,T-compiler,A-specialization,requires-nightly,F-specialization,F-unboxed_closures

Playground Rustc version:
```
1.34.0-nightly 2019-02-27 7e001e5c6c7c090b4141
```
Code:
```rust
#![feature(unboxed_closures, fn_traits, specialization)]

use std::ops::{Deref, FnOnce};

struct Foo<T> {
    val: T,
}

default impl<'a, T> FnOnce<()> for &'a Foo<T> {
    type Output = &'a T;
    
    extern "rust-call" fn call_once(self, _args: ()) -> Self::Output {
        &self.val
    }
}

impl<'a, T: 'a, U: 'a> FnOnce<()> for &'a Foo<T> where T: Deref<Target = U> {
    type Output = &'a U;
    
    extern "rust-call" fn call_once(self, _args: ()) -> Self::Output {
        self.val.deref()
    }
}

fn main() {}
```
Error message:
```
   Compiling playground v0.0.1 (/playground)
error[E0275]: overflow evaluating the requirement `&Foo<_>: std::ops::FnOnce<()>`
  |
  = help: consider adding a `#![recursion_limit="128"]` attribute to your crate
  = note: required because of the requirements on the impl of `std::ops::FnOnce<()>` for `&Foo<_>`
  = note: required because of the requirements on the impl of `std::ops::FnOnce<()>` for `&Foo<_>`
  = note: required because of the requirements on the impl of `std::ops::FnOnce<()>` for `&Foo<_>`
  = note: required because of the requirements on the impl of `std::ops::FnOnce<()>` for `&Foo<_>`
  = note: required because of the requirements on the impl of `std::ops::FnOnce<()>` for `&Foo<_>`
  = note: required because of the requirements on the impl of `std::ops::FnOnce<()>` for `&Foo<_>`
  = note: required because of the requirements on the impl of `std::ops::FnOnce<()>` for `&Foo<_>`
  = note: required because of the requirements on the impl of `std::ops::FnOnce<()>` for `&Foo<_>`
  = note: required because of the requirements on the impl of `std::ops::FnOnce<()>` for `&Foo<_>`
  = note: required because of the requirements on the impl of `std::ops::FnOnce<()>` for `&Foo<_>`
  = note: required because of the requirements on the impl of `std::ops::FnOnce<()>` for `&Foo<_>`
  = note: required because of the requirements on the impl of `std::ops::FnOnce<()>` for `&Foo<_>`
  = note: required because of the requirements on the impl of `std::ops::FnOnce<()>` for `&Foo<_>`
  = note: required because of the requirements on the impl of `std::ops::FnOnce<()>` for `&Foo<_>`
  = note: required because of the requirements on the impl of `std::ops::FnOnce<()>` for `&Foo<_>`
  = note: required because of the requirements on the impl of `std::ops::FnOnce<()>` for `&Foo<_>`
  = note: required because of the requirements on the impl of `std::ops::FnOnce<()>` for `&Foo<_>`
  = note: required because of the requirements on the impl of `std::ops::FnOnce<()>` for `&Foo<_>`
  = note: required because of the requirements on the impl of `std::ops::FnOnce<()>` for `&Foo<_>`
  = note: required because of the requirements on the impl of `std::ops::FnOnce<()>` for `&Foo<_>`
  = note: required because of the requirements on the impl of `std::ops::FnOnce<()>` for `&Foo<_>`
  = note: required because of the requirements on the impl of `std::ops::FnOnce<()>` for `&Foo<_>`
  = note: required because of the requirements on the impl of `std::ops::FnOnce<()>` for `&Foo<_>`
  = note: required because of the requirements on the impl of `std::ops::FnOnce<()>` for `&Foo<_>`
  = note: required because of the requirements on the impl of `std::ops::FnOnce<()>` for `&Foo<_>`
  = note: required because of the requirements on the impl of `std::ops::FnOnce<()>` for `&Foo<_>`
  = note: required because of the requirements on the impl of `std::ops::FnOnce<()>` for `&Foo<_>`
  = note: required because of the requirements on the impl of `std::ops::FnOnce<()>` for `&Foo<_>`
  = note: required because of the requirements on the impl of `std::ops::FnOnce<()>` for `&Foo<_>`
  = note: required because of the requirements on the impl of `std::ops::FnOnce<()>` for `&Foo<_>`
  = note: required because of the requirements on the impl of `std::ops::FnOnce<()>` for `&Foo<_>`
  = note: required because of the requirements on the impl of `std::ops::FnOnce<()>` for `&Foo<_>`
  = note: required because of the requirements on the impl of `std::ops::FnOnce<()>` for `&Foo<_>`
  = note: required because of the requirements on the impl of `std::ops::FnOnce<()>` for `&Foo<_>`
  = note: required because of the requirements on the impl of `std::ops::FnOnce<()>` for `&Foo<_>`
  = note: required because of the requirements on the impl of `std::ops::FnOnce<()>` for `&Foo<_>`
  = note: required because of the requirements on the impl of `std::ops::FnOnce<()>` for `&Foo<_>`
  = note: required because of the requirements on the impl of `std::ops::FnOnce<()>` for `&Foo<_>`
  = note: required because of the requirements on the impl of `std::ops::FnOnce<()>` for `&Foo<_>`
  = note: required because of the requirements on the impl of `std::ops::FnOnce<()>` for `&Foo<_>`
  = note: required because of the requirements on the impl of `std::ops::FnOnce<()>` for `&Foo<_>`
  = note: required because of the requirements on the impl of `std::ops::FnOnce<()>` for `&Foo<_>`
  = note: required because of the requirements on the impl of `std::ops::FnOnce<()>` for `&Foo<_>`
  = note: required because of the requirements on the impl of `std::ops::FnOnce<()>` for `&Foo<_>`
  = note: required because of the requirements on the impl of `std::ops::FnOnce<()>` for `&Foo<_>`
  = note: required because of the requirements on the impl of `std::ops::FnOnce<()>` for `&Foo<_>`
  = note: required because of the requirements on the impl of `std::ops::FnOnce<()>` for `&Foo<_>`
  = note: required because of the requirements on the impl of `std::ops::FnOnce<()>` for `&Foo<_>`
  = note: required because of the requirements on the impl of `std::ops::FnOnce<()>` for `&Foo<_>`
  = note: required because of the requirements on the impl of `std::ops::FnOnce<()>` for `&Foo<_>`
  = note: required because of the requirements on the impl of `std::ops::FnOnce<()>` for `&Foo<_>`
  = note: required because of the requirements on the impl of `std::ops::FnOnce<()>` for `&Foo<_>`
  = note: required because of the requirements on the impl of `std::ops::FnOnce<()>` for `&Foo<_>`
  = note: required because of the requirements on the impl of `std::ops::FnOnce<()>` for `&Foo<_>`
  = note: required because of the requirements on the impl of `std::ops::FnOnce<()>` for `&Foo<_>`
  = note: required because of the requirements on the impl of `std::ops::FnOnce<()>` for `&Foo<_>`
  = note: required because of the requirements on the impl of `std::ops::FnOnce<()>` for `&Foo<_>`
  = note: required because of the requirements on the impl of `std::ops::FnOnce<()>` for `&Foo<_>`
  = note: required because of the requirements on the impl of `std::ops::FnOnce<()>` for `&Foo<_>`
  = note: required because of the requirements on the impl of `std::ops::FnOnce<()>` for `&Foo<_>`
  = note: required because of the requirements on the impl of `std::ops::FnOnce<()>` for `&Foo<_>`
  = note: required because of the requirements on the impl of `std::ops::FnOnce<()>` for `&Foo<_>`
  = note: required because of the requirements on the impl of `std::ops::FnOnce<()>` for `&Foo<_>`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0275`.
error: Could not compile `playground`.

To learn more, run the command again with --verbose.
```