Closed
Description
trait Trait {
fn f(self);
}
impl<T> Trait for fn(&T) {
fn f(self) {
println!("f");
}
}
fn main() {
let a: fn(_) = |_: &u8| {};
a.f();
}
Prior to #56105, the error message was:
error[E0599]: no method named `f` found for type `fn(&u8)` in the current scope
--> src/main.rs:13:7
|
13 | a.f();
| ^
|
= note: a is a function, perhaps you wish to call it
= help: items from traits can only be used if the trait is implemented and in scope
= note: the following trait defines an item `f`, perhaps you need to implement it:
candidate #1: `Trait`
i.e. the trait is implemented only for for<'a> fn(&'a u8)
and not for a concrete fn(&'x u8)
.
The new error message is:
error[E0308]: mismatched types
--> src/main.rs:13:7
|
13 | a.f();
| ^ one type is more general than the other
|
= note: expected type `Trait`
found type `Trait`
I don't know what this message is trying to say.
Mentioning @nikomatsakis and @scalexm who worked on universes.