rust/src/test/ui/issues/issue-57843.stderr
Niko Matsakis 4db6a9b82f 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-15 14:38:26 +01:00

13 lines
420 B
Plaintext

error[E0308]: mismatched types
--> $DIR/issue-57843.rs:23:9
|
LL | Foo(Box::new(|_| ())); //~ ERROR mismatched types
| ^^^^^^^^^^^^^^^^ one type is more general than the other
|
= note: expected type `std::ops::FnOnce<(&'a bool,)>`
found type `std::ops::FnOnce<(&bool,)>`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0308`.