]> git.lizzy.rs Git - rust.git/blob - tests/ui/associated-types/normalization-debruijn-1.rs
Auto merge of #106399 - estebank:type-err-span-label, r=nagisa
[rust.git] / tests / ui / associated-types / normalization-debruijn-1.rs
1 // build-pass
2 // edition:2018
3
4 // Regression test to ensure we handle debruijn indices correctly in projection
5 // normalization under binders. Found in crater run for #85499
6
7 use std::future::Future;
8 use std::pin::Pin;
9 pub enum Outcome<S, E> {
10     Success((S, E)),
11 }
12 pub struct Request<'r> {
13     _marker: std::marker::PhantomData<&'r ()>,
14 }
15 pub trait FromRequest<'r>: Sized {
16     type Error;
17     fn from_request<'life0>(
18         request: &'r Request<'life0>,
19     ) -> Pin<Box<dyn Future<Output = Outcome<Self, Self::Error>>>>;
20 }
21 impl<'r, T: FromRequest<'r>> FromRequest<'r> for Option<T> {
22     type Error = ();
23     fn from_request<'life0>(
24         request: &'r Request<'life0>,
25     ) -> Pin<Box<dyn Future<Output = Outcome<Self, Self::Error>>>> {
26         Box::pin(async move {
27             let request = request;
28             match T::from_request(request).await {
29                 _ => todo!(),
30             }
31         });
32         todo!()
33     }
34 }
35
36 fn main() {}