]> git.lizzy.rs Git - rust.git/blob - src/test/ui/associated-types/normalization-debruijn-2.rs
Rollup merge of #97317 - GuillaumeGomez:gui-settings-text-click, r=jsha
[rust.git] / src / test / ui / associated-types / normalization-debruijn-2.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),
11     Failure(E),
12 }
13 pub struct Request<'r> {
14     _marker: std::marker::PhantomData<&'r ()>,
15 }
16 pub trait FromRequest<'r>: Sized {
17     type Error;
18     fn from_request<'life0>(
19         request: &'r Request<'life0>,
20     ) -> Pin<Box<dyn Future<Output = Outcome<Self, Self::Error>>>>;
21 }
22 pub struct S<T> {
23     _marker: std::marker::PhantomData<T>,
24 }
25 impl<'r, T: FromRequest<'r>> S<T> {
26     pub async fn from_request(request: &'r Request<'_>) {
27         let _ = T::from_request(request).await;
28     }
29 }
30
31 fn main() {}