File tree 1 file changed +51
-0
lines changed
1 file changed +51
-0
lines changed Original file line number Diff line number Diff line change
1
+ // build-pass
2
+ // The ICE didn't happen with `cargo check` but `cargo build`.
3
+
4
+ use std::marker::PhantomData;
5
+
6
+ trait Owned<'a> {
7
+ type Reader;
8
+ }
9
+
10
+ impl<'a> Owned<'a> for () {
11
+ type Reader = ();
12
+ }
13
+
14
+ trait Handler {
15
+ fn handle(&self);
16
+ }
17
+
18
+ struct CtxHandlerWithoutState<M, F> {
19
+ message_type: PhantomData<M>,
20
+ _function: F,
21
+ }
22
+
23
+ impl<M, F> CtxHandlerWithoutState<M, F> {
24
+ pub fn new(_function: F) -> Self {
25
+ Self {
26
+ message_type: PhantomData,
27
+ _function,
28
+ }
29
+ }
30
+ }
31
+
32
+ impl<'a, M, F> Handler for CtxHandlerWithoutState<M, F>
33
+ where
34
+ F: Fn(<M as Owned<'a>>::Reader),
35
+ M: Owned<'a>,
36
+ {
37
+ fn handle(&self) {}
38
+ }
39
+
40
+ fn e_to_i<M: for<'a> Owned<'a>>(_: <M as Owned<'_>>::Reader) {}
41
+
42
+ fn send_external_to_internal<M>()
43
+ where
44
+ M: for<'a> Owned<'a>,
45
+ {
46
+ let _: Box<dyn Handler> = Box::new(CtxHandlerWithoutState::<M, _>::new(e_to_i::<M>));
47
+ }
48
+
49
+ fn main() {
50
+ send_external_to_internal::<()>()
51
+ }
You can’t perform that action at this time.
0 commit comments