]> git.lizzy.rs Git - rust.git/blob - tests/ui/generic-associated-types/issue-93874.rs
Rollup merge of #103702 - WaffleLapkin:lift-sized-bounds-from-pointer-methods-where...
[rust.git] / tests / ui / generic-associated-types / issue-93874.rs
1 // check-pass
2
3 pub trait Build {
4     type Output<O>;
5     fn build<O>(self, input: O) -> Self::Output<O>;
6 }
7
8 pub struct IdentityBuild;
9 impl Build for IdentityBuild {
10     type Output<O> = O;
11     fn build<O>(self, input: O) -> Self::Output<O> {
12         input
13     }
14 }
15
16 fn a() {
17     let _x: u8 = IdentityBuild.build(10);
18 }
19
20 fn b() {
21     let _x: Vec<u8> = IdentityBuild.build(Vec::new());
22 }
23
24 fn c() {
25     let mut f = IdentityBuild.build(|| ());
26     (f)();
27 }
28
29 pub fn main() {
30     a();
31     b();
32     c();
33 }