summaryrefslogtreecommitdiffstats
path: root/tests/ui/type/wrong-call-return-type-due-to-generic-arg.stderr
blob: 4d012cb156bb546287852f1c3ed668a7d445593c (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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
error[E0308]: mismatched types
  --> $DIR/wrong-call-return-type-due-to-generic-arg.rs:18:28
   |
LL |     let x = wrong_arg_type(0u16);
   |             -------------- ^^^^ expected `u32`, found `u16`
   |             |
   |             arguments to this function are incorrect
   |
note: function defined here
  --> $DIR/wrong-call-return-type-due-to-generic-arg.rs:12:4
   |
LL | fn wrong_arg_type(x: u32) -> u32 {
   |    ^^^^^^^^^^^^^^ ------
help: change the type of the numeric literal from `u16` to `u32`
   |
LL |     let x = wrong_arg_type(0u32);
   |                             ~~~

error[E0308]: mismatched types
  --> $DIR/wrong-call-return-type-due-to-generic-arg.rs:19:30
   |
LL |     let x: u16 = function(0, 0u8);
   |                  --------    ^^^ expected `bool`, found `u8`
   |                  |
   |                  arguments to this function are incorrect
   |
note: function defined here
  --> $DIR/wrong-call-return-type-due-to-generic-arg.rs:1:4
   |
LL | fn function<T>(x: T, y: bool) -> T {
   |    ^^^^^^^^          -------

error[E0308]: arguments to this function are incorrect
  --> $DIR/wrong-call-return-type-due-to-generic-arg.rs:22:18
   |
LL |     let x: u16 = function(0u32, 0u8);
   |                  ^^^^^^^^ ----  --- expected `bool`, found `u8`
   |                           |
   |                           expected `u16`, found `u32`
   |
help: the return type of this call is `u32` due to the type of the argument passed
  --> $DIR/wrong-call-return-type-due-to-generic-arg.rs:22:18
   |
LL |     let x: u16 = function(0u32, 0u8);
   |                  ^^^^^^^^^----^^^^^^
   |                           |
   |                           this argument influences the return type of `function`
note: function defined here
  --> $DIR/wrong-call-return-type-due-to-generic-arg.rs:1:4
   |
LL | fn function<T>(x: T, y: bool) -> T {
   |    ^^^^^^^^    ----  -------
help: change the type of the numeric literal from `u32` to `u16`
   |
LL |     let x: u16 = function(0u16, 0u8);
   |                            ~~~

error[E0308]: mismatched types
  --> $DIR/wrong-call-return-type-due-to-generic-arg.rs:25:27
   |
LL |     let x: u16 = function(0u32, true);
   |                  -------- ^^^^ expected `u16`, found `u32`
   |                  |
   |                  arguments to this function are incorrect
   |
help: the return type of this call is `u32` due to the type of the argument passed
  --> $DIR/wrong-call-return-type-due-to-generic-arg.rs:25:18
   |
LL |     let x: u16 = function(0u32, true);
   |                  ^^^^^^^^^----^^^^^^^
   |                           |
   |                           this argument influences the return type of `function`
note: function defined here
  --> $DIR/wrong-call-return-type-due-to-generic-arg.rs:1:4
   |
LL | fn function<T>(x: T, y: bool) -> T {
   |    ^^^^^^^^    ----
help: change the type of the numeric literal from `u32` to `u16`
   |
LL |     let x: u16 = function(0u16, true);
   |                            ~~~

error[E0308]: mismatched types
  --> $DIR/wrong-call-return-type-due-to-generic-arg.rs:26:32
   |
LL |     let x: u16 = (S {}).method(0u32);
   |                         ------ ^^^^ expected `u16`, found `u32`
   |                         |
   |                         arguments to this method are incorrect
   |
help: the return type of this call is `u32` due to the type of the argument passed
  --> $DIR/wrong-call-return-type-due-to-generic-arg.rs:26:18
   |
LL |     let x: u16 = (S {}).method(0u32);
   |                  ^^^^^^^^^^^^^^----^
   |                                |
   |                                this argument influences the return type of `method`
note: associated function defined here
  --> $DIR/wrong-call-return-type-due-to-generic-arg.rs:7:8
   |
LL |     fn method<T>(&self, x: T) -> T {
   |        ^^^^^^           ----
help: change the type of the numeric literal from `u32` to `u16`
   |
LL |     let x: u16 = (S {}).method(0u16);
   |                                 ~~~

error[E0308]: arguments to this function are incorrect
  --> $DIR/wrong-call-return-type-due-to-generic-arg.rs:27:5
   |
LL |     function(0u32, 8u8)
   |     ^^^^^^^^ ----  --- expected `bool`, found `u8`
   |              |
   |              expected `()`, found `u32`
   |
help: the return type of this call is `u32` due to the type of the argument passed
  --> $DIR/wrong-call-return-type-due-to-generic-arg.rs:27:5
   |
LL |     function(0u32, 8u8)
   |     ^^^^^^^^^----^^^^^^
   |              |
   |              this argument influences the return type of `function`
note: function defined here
  --> $DIR/wrong-call-return-type-due-to-generic-arg.rs:1:4
   |
LL | fn function<T>(x: T, y: bool) -> T {
   |    ^^^^^^^^    ----  -------

error: aborting due to 6 previous errors

For more information about this error, try `rustc --explain E0308`.