blob: dd5af3e344cabd1ffeb8dae4edc204b5883c48d9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
fn foo(a: usize, b: usize) -> usize { a }
fn bar() -> usize { 42 }
struct S(usize, usize);
enum E {
A(usize),
B { a: usize },
}
struct V();
trait T {
fn baz(x: usize, y: usize) -> usize { x }
fn bat(x: usize) -> usize { 42 }
fn bax(x: usize) -> usize { 42 }
fn bach(x: usize) -> usize;
fn ban(&self) -> usize { 42 }
fn bal(&self) -> usize;
}
struct X;
impl T for X {
fn bach(x: usize) -> usize { 42 }
fn bal(&self) -> usize { 42 }
}
fn main() {
let _: usize = foo; //~ ERROR mismatched types
let _: S = S; //~ ERROR mismatched types
let _: usize = bar; //~ ERROR mismatched types
let _: V = V; //~ ERROR mismatched types
let _: usize = T::baz; //~ ERROR mismatched types
let _: usize = T::bat; //~ ERROR mismatched types
let _: E = E::A; //~ ERROR mismatched types
let _: E = E::B; //~ ERROR expected value, found struct variant `E::B`
let _: usize = X::baz; //~ ERROR mismatched types
let _: usize = X::bat; //~ ERROR mismatched types
let _: usize = X::bax; //~ ERROR mismatched types
let _: usize = X::bach; //~ ERROR mismatched types
let _: usize = X::ban; //~ ERROR mismatched types
let _: usize = X::bal; //~ ERROR mismatched types
let _: usize = X.ban; //~ ERROR attempted to take value of method
let _: usize = X.bal; //~ ERROR attempted to take value of method
let closure = || 42;
let _: usize = closure; //~ ERROR mismatched types
}
|