Closed
Description
The compiler is only able to resolve the type with a UFCS syntax that doesn't seem to add any information.
Could be related to #22165.
#![feature(core)]
use std::ptr;
pub trait Wrapper {
type Inner;
}
pub trait IsA<T> {}
pub trait Fudge<P> {
fn fudge(&self) -> P;
}
impl <PAR: Wrapper, CHI: IsA<PAR>> Fudge<*mut <PAR as Wrapper>::Inner> for CHI {
fn fudge(&self) -> *mut <PAR as Wrapper>::Inner {
ptr::null_mut()
}
}
pub struct Envelope<T> (*mut T);
impl <T> Wrapper for Envelope<T> {
type Inner = T;
}
pub struct WidgetInner;
type Widget = Envelope<WidgetInner>;
pub fn fudge<W: IsA<Widget>>(widget: &W) {
// OK
let _x = Fudge::<_>::fudge(widget);
// error: type annotations required: cannot resolve `<_ as Wrapper>::Inner == WidgetInner` [E0284]
let _y = widget.fudge();
}
fn main() {}
Error message:
<anon>:34:21: 34:28 error: type annotations required: cannot resolve `<_ as Wrapper>::Inner == WidgetInner` [E0284]
<anon>:34 let _y = widget.fudge();
^~~~~~~