]> git.lizzy.rs Git - rust.git/blob - src/test/ui/mismatched_types/abridged.rs
Rollup merge of #41249 - GuillaumeGomez:rustdoc-render, r=steveklabnik,frewsxcv
[rust.git] / src / test / ui / mismatched_types / abridged.rs
1 // Copyright 2017 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 enum Bar {
12     Qux,
13     Zar,
14 }
15
16 struct Foo {
17     bar: usize,
18 }
19
20 struct X<T1, T2> {
21     x: T1,
22     y: T2,
23 }
24
25 fn a() -> Foo {
26     Some(Foo { bar: 1 })
27 }
28
29 fn a2() -> Foo {
30     Ok(Foo { bar: 1})
31 }
32
33 fn b() -> Option<Foo> {
34     Foo { bar: 1 }
35 }
36
37 fn c() -> Result<Foo, Bar> {
38     Foo { bar: 1 }
39 }
40
41 fn d() -> X<X<String, String>, String> {
42     X {
43         x: X {
44             x: "".to_string(),
45             y: 2,
46         },
47         y: 3,
48     }
49 }
50
51 fn e() -> X<X<String, String>, String> {
52     X {
53         x: X {
54             x: "".to_string(),
55             y: 2,
56         },
57         y: "".to_string(),
58     }
59 }
60
61 fn main() {}