]> git.lizzy.rs Git - rust.git/blob - src/test/ui/issue-53568.rs
6b479f7517244d7de62da6b28e86cc79220e4962
[rust.git] / src / test / ui / issue-53568.rs
1 // Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 // Regression test for an NLL-related ICE (#53568) -- we failed to
12 // resolve inference variables in "custom type-ops".
13 //
14 // compile-pass
15
16 #![feature(nll)]
17 #![allow(dead_code)]
18
19 trait Future {
20     type Item;
21 }
22
23 impl<F, T> Future for F
24 where F: Fn() -> T
25 {
26     type Item = T;
27 }
28
29 trait Connect {}
30
31 struct Connector<H> {
32     handler: H,
33 }
34
35 impl<H, T> Connect for Connector<H>
36 where
37     T: 'static,
38     H: Future<Item = T>
39 {
40 }
41
42 struct Client<C> {
43     connector: C,
44 }
45
46 fn build<C>(_connector: C) -> Client<C> {
47     unimplemented!()
48 }
49
50 fn client<H>(handler: H) -> Client<impl Connect>
51 where H: Fn() + Copy
52 {
53     let connector = Connector {
54         handler,
55     };
56     let client = build(connector);
57     client
58 }
59
60 fn main() { }
61