Open
Description
Trying to build the following code:
trait WithLifetime<'a> {
type Type;
}
struct Foo;
enum FooRef {}
impl<'a> WithLifetime<'a> for FooRef {
type Type = &'a Foo;
}
fn wub<T, F>(f: F)
where T: for<'a> WithLifetime<'a>,
F: for<'a> FnOnce(&'a Foo) -> <T as WithLifetime<'a>>::Type
{
}
fn main() {
wub::<FooRef, _>(|foo| foo)
}
Gives the error:
foo.rs:20:28: 20:31 error: mismatched types:
expected `<FooRef as WithLifetime<'a>>::Type`,
found `&'a Foo`
(expected associated type,
found &-ptr) [E0308]
foo.rs:20 wub::<FooRef, _>(|foo| foo)
^~~
However <FooRef as WithLifetime<'a>>::Type
and &'a Foo
are the same type. And the compiler should be able to see that.
Metadata
Metadata
Assignees
Labels
Area: Trait systemArea: Type systemCategory: This is a bug.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.Relevant to the compiler team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.