]> git.lizzy.rs Git - rust.git/blob - src/test/ui/suggestions/fn-or-tuple-struct-without-args.rs
Rollup merge of #90420 - GuillaumeGomez:rustdoc-internals-feature, r=camelid
[rust.git] / src / test / ui / suggestions / fn-or-tuple-struct-without-args.rs
1 fn foo(a: usize, b: usize) -> usize { a }
2
3 fn bar() -> usize { 42 }
4
5 struct S(usize, usize);
6 enum E {
7     A(usize),
8     B { a: usize },
9 }
10 struct V();
11
12 trait T {
13     fn baz(x: usize, y: usize) -> usize { x }
14     fn bat(x: usize) -> usize { 42 }
15     fn bax(x: usize) -> usize { 42 }
16     fn bach(x: usize) -> usize;
17     fn ban(&self) -> usize { 42 }
18     fn bal(&self) -> usize;
19 }
20
21 struct X;
22
23 impl T for X {
24     fn bach(x: usize) -> usize { 42 }
25     fn bal(&self) -> usize { 42 }
26 }
27
28 fn main() {
29     let _: usize = foo; //~ ERROR mismatched types
30     let _: S = S; //~ ERROR mismatched types
31     let _: usize = bar; //~ ERROR mismatched types
32     let _: V = V; //~ ERROR mismatched types
33     let _: usize = T::baz; //~ ERROR mismatched types
34     let _: usize = T::bat; //~ ERROR mismatched types
35     let _: E = E::A; //~ ERROR mismatched types
36     let _: E = E::B; //~ ERROR expected value, found struct variant `E::B`
37     let _: usize = X::baz; //~ ERROR mismatched types
38     let _: usize = X::bat; //~ ERROR mismatched types
39     let _: usize = X::bax; //~ ERROR mismatched types
40     let _: usize = X::bach; //~ ERROR mismatched types
41     let _: usize = X::ban; //~ ERROR mismatched types
42     let _: usize = X::bal; //~ ERROR mismatched types
43     let _: usize = X.ban; //~ ERROR attempted to take value of method
44     let _: usize = X.bal; //~ ERROR attempted to take value of method
45     let closure = || 42;
46     let _: usize = closure; //~ ERROR mismatched types
47 }