2021-02-09 22:59:32 +00:00
|
|
|
error: implementation of `FnOnce` is not general enough
|
|
|
|
--> $DIR/issue-57843.rs:25:9
|
make generalization code create new variables in correct universe
In our type inference system, when we "generalize" a type T to become
a suitable value for a type variable V, we sometimes wind up creating
new inference variables. So, for example, if we are making V be some
subtype of `&'X u32`, then we might instantiate V with `&'Y u32`.
This generalized type is then related `&'Y u32 <: &'X u32`, resulting
in a region constriant `'Y: 'X`. Previously, however, we were making
these fresh variables like `'Y` in the "current universe", but they
should be created in the universe of V. Moreover, we sometimes cheat
in an invariant context and avoid creating fresh variables if we know
the result must be equal -- we can only do that when the universes
work out.
2019-02-01 15:41:08 +00:00
|
|
|
|
|
2019-03-09 12:03:44 +00:00
|
|
|
LL | Foo(Box::new(|_| ()));
|
2021-02-09 22:59:32 +00:00
|
|
|
| ^^^^^^^^^^^^^^^^ implementation of `FnOnce` is not general enough
|
make generalization code create new variables in correct universe
In our type inference system, when we "generalize" a type T to become
a suitable value for a type variable V, we sometimes wind up creating
new inference variables. So, for example, if we are making V be some
subtype of `&'X u32`, then we might instantiate V with `&'Y u32`.
This generalized type is then related `&'Y u32 <: &'X u32`, resulting
in a region constriant `'Y: 'X`. Previously, however, we were making
these fresh variables like `'Y` in the "current universe", but they
should be created in the universe of V. Moreover, we sometimes cheat
in an invariant context and avoid creating fresh variables if we know
the result must be equal -- we can only do that when the universes
work out.
2019-02-01 15:41:08 +00:00
|
|
|
|
|
2021-02-09 23:00:33 +00:00
|
|
|
= note: closure with signature `fn(&'2 bool)` must implement `FnOnce<(&'1 bool,)>`, for any lifetime `'1`...
|
2021-02-09 22:59:32 +00:00
|
|
|
= note: ...but it actually implements `FnOnce<(&'2 bool,)>`, for some specific lifetime `'2`
|
make generalization code create new variables in correct universe
In our type inference system, when we "generalize" a type T to become
a suitable value for a type variable V, we sometimes wind up creating
new inference variables. So, for example, if we are making V be some
subtype of `&'X u32`, then we might instantiate V with `&'Y u32`.
This generalized type is then related `&'Y u32 <: &'X u32`, resulting
in a region constriant `'Y: 'X`. Previously, however, we were making
these fresh variables like `'Y` in the "current universe", but they
should be created in the universe of V. Moreover, we sometimes cheat
in an invariant context and avoid creating fresh variables if we know
the result must be equal -- we can only do that when the universes
work out.
2019-02-01 15:41:08 +00:00
|
|
|
|
|
|
|
error: aborting due to previous error
|
|
|
|
|