]> git.lizzy.rs Git - rust.git/blob - tests/incremental/issue-86753.rs
Optimize `TyKind::eq`.
[rust.git] / tests / incremental / issue-86753.rs
1 // edition:2018
2 // revisions: rpass1
3
4
5 // Regression test for #86753. The `type_implements_trait` query (since moved to a method)
6 // was encountering an ICE during incremental testing when hashing its arguments.
7 #![warn(rust_2021_compatibility)]
8
9 use std::future::Future;
10 use std::pin::Pin;
11 use std::task::{Poll, Context};
12
13 struct LocalSet {}
14 struct RunUntil<'a, F> {
15     _local_set: &'a LocalSet,
16     _future: F,
17 }
18 impl<'a, F> RunUntil<'a, F> {
19     fn project<'pin>(self: Pin<&'pin mut Self>) -> Projection<'pin, 'a, F> {
20         unimplemented!()
21     }
22 }
23
24 struct Projection<'pin, 'a, F>
25 where
26     RunUntil<'a, F>: 'pin,
27 {
28     pub local_set: &'pin mut &'a LocalSet,
29     pub future: Pin<&'pin mut F>,
30 }
31
32 impl LocalSet {
33     fn with<T>(&self, _f: impl FnOnce() -> T) -> T {
34         unimplemented!()
35     }
36 }
37 impl<T: Future> Future for RunUntil<'_, T> {
38     type Output = T::Output;
39     fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
40         let me = self.project();
41         me.local_set.with(|| {
42             let _ = cx.waker();
43             let f = me.future;
44             let _ = f.poll(cx);
45             Poll::Pending
46         })
47     }
48 }
49
50 fn main() {}