blob: 94acdccfcf25449259a37f5671f5aeb958c0846d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
// This is a non-regression test for issue #114907 where an ICE happened because of missing
// `UniverseInfo`s accessed during diagnostics.
//
// A couple notes:
// - the `FnOnce` bounds need an arg that is a reference
// - a custom `Drop` is needed somewhere in the type that `accept` returns, to create universes
// during liveness and dropck outlives computation
// check-fail
trait Role {
type Inner;
}
struct HandshakeCallback<C>(C);
impl<C: FnOnce(&())> Role for HandshakeCallback<C> {
type Inner = ();
}
struct Handshake<R: Role> {
_inner: Option<R::Inner>,
}
impl<R: Role> Drop for Handshake<R> {
fn drop(&mut self) {}
}
fn accept<C: FnOnce(&())>(_: C) -> Handshake<HandshakeCallback<C>> {
todo!()
}
fn main() {
let callback = |_| {};
accept(callback);
//~^ ERROR mismatched types
//~| ERROR mismatched types
//~| ERROR implementation of `FnOnce` is not general enough
//~| ERROR implementation of `FnOnce` is not general enough
//~| ERROR higher-ranked subtype error
//~| ERROR higher-ranked subtype error
}
|