]> git.proxmox.com Git - rustc.git/blob - src/test/ui/associated-types/normalization-debruijn-3.rs
New upstream version 1.55.0+dfsg1
[rustc.git] / src / test / ui / associated-types / normalization-debruijn-3.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, Ready};
8 async fn read() {
9 let _ = connect(&()).await;
10 }
11 async fn connect<A: ToSocketAddr>(addr: A) {
12 let _ = addr.to_socket_addr().await;
13 }
14 pub trait ToSocketAddr {
15 type Future: Future<Output = ()>;
16 fn to_socket_addr(&self) -> Self::Future;
17 }
18 impl ToSocketAddr for &() {
19 type Future = Ready<()>;
20 fn to_socket_addr(&self) -> Self::Future {
21 unimplemented!()
22 }
23 }
24 struct Server;
25 impl Server {
26 fn and_then<F>(self, _fun: F) -> AndThen<F> {
27 unimplemented!()
28 }
29 }
30 struct AndThen<F> {
31 _marker: std::marker::PhantomData<F>,
32 }
33 pub async fn run<F>(_: F) {
34 }
35 fn main() {
36 let _ = async {
37 let server = Server;
38 let verification_route = server.and_then(read);
39 run(verification_route).await;
40 };
41 }