]> git.lizzy.rs Git - rust.git/blob - tests/ui/type/wrong-call-return-type-due-to-generic-arg.stderr
Auto merge of #106696 - kylematsuda:early-binder, r=lcnr
[rust.git] / tests / ui / type / wrong-call-return-type-due-to-generic-arg.stderr
1 error[E0308]: mismatched types
2   --> $DIR/wrong-call-return-type-due-to-generic-arg.rs:18:28
3    |
4 LL |     let x = wrong_arg_type(0u16);
5    |             -------------- ^^^^ expected `u32`, found `u16`
6    |             |
7    |             arguments to this function are incorrect
8    |
9 note: function defined here
10   --> $DIR/wrong-call-return-type-due-to-generic-arg.rs:12:4
11    |
12 LL | fn wrong_arg_type(x: u32) -> u32 {
13    |    ^^^^^^^^^^^^^^ ------
14 help: change the type of the numeric literal from `u16` to `u32`
15    |
16 LL |     let x = wrong_arg_type(0u32);
17    |                             ~~~
18
19 error[E0308]: mismatched types
20   --> $DIR/wrong-call-return-type-due-to-generic-arg.rs:19:30
21    |
22 LL |     let x: u16 = function(0, 0u8);
23    |                  --------    ^^^ expected `bool`, found `u8`
24    |                  |
25    |                  arguments to this function are incorrect
26    |
27 note: function defined here
28   --> $DIR/wrong-call-return-type-due-to-generic-arg.rs:1:4
29    |
30 LL | fn function<T>(x: T, y: bool) -> T {
31    |    ^^^^^^^^          -------
32
33 error[E0308]: arguments to this function are incorrect
34   --> $DIR/wrong-call-return-type-due-to-generic-arg.rs:22:18
35    |
36 LL |     let x: u16 = function(0u32, 0u8);
37    |                  ^^^^^^^^ ----  --- expected `bool`, found `u8`
38    |                           |
39    |                           expected `u16`, found `u32`
40    |
41 help: the return type of this call is `u32` due to the type of the argument passed
42   --> $DIR/wrong-call-return-type-due-to-generic-arg.rs:22:18
43    |
44 LL |     let x: u16 = function(0u32, 0u8);
45    |                  ^^^^^^^^^----^^^^^^
46    |                           |
47    |                           this argument influences the return type of `function`
48 note: function defined here
49   --> $DIR/wrong-call-return-type-due-to-generic-arg.rs:1:4
50    |
51 LL | fn function<T>(x: T, y: bool) -> T {
52    |    ^^^^^^^^    ----  -------
53 help: change the type of the numeric literal from `u32` to `u16`
54    |
55 LL |     let x: u16 = function(0u16, 0u8);
56    |                            ~~~
57
58 error[E0308]: mismatched types
59   --> $DIR/wrong-call-return-type-due-to-generic-arg.rs:25:27
60    |
61 LL |     let x: u16 = function(0u32, true);
62    |                  -------- ^^^^ expected `u16`, found `u32`
63    |                  |
64    |                  arguments to this function are incorrect
65    |
66 help: the return type of this call is `u32` due to the type of the argument passed
67   --> $DIR/wrong-call-return-type-due-to-generic-arg.rs:25:18
68    |
69 LL |     let x: u16 = function(0u32, true);
70    |                  ^^^^^^^^^----^^^^^^^
71    |                           |
72    |                           this argument influences the return type of `function`
73 note: function defined here
74   --> $DIR/wrong-call-return-type-due-to-generic-arg.rs:1:4
75    |
76 LL | fn function<T>(x: T, y: bool) -> T {
77    |    ^^^^^^^^    ----
78 help: change the type of the numeric literal from `u32` to `u16`
79    |
80 LL |     let x: u16 = function(0u16, true);
81    |                            ~~~
82
83 error[E0308]: mismatched types
84   --> $DIR/wrong-call-return-type-due-to-generic-arg.rs:26:32
85    |
86 LL |     let x: u16 = (S {}).method(0u32);
87    |                         ------ ^^^^ expected `u16`, found `u32`
88    |                         |
89    |                         arguments to this method are incorrect
90    |
91 help: the return type of this call is `u32` due to the type of the argument passed
92   --> $DIR/wrong-call-return-type-due-to-generic-arg.rs:26:18
93    |
94 LL |     let x: u16 = (S {}).method(0u32);
95    |                  ^^^^^^^^^^^^^^----^
96    |                                |
97    |                                this argument influences the return type of `method`
98 note: associated function defined here
99   --> $DIR/wrong-call-return-type-due-to-generic-arg.rs:7:8
100    |
101 LL |     fn method<T>(&self, x: T) -> T {
102    |        ^^^^^^           ----
103 help: change the type of the numeric literal from `u32` to `u16`
104    |
105 LL |     let x: u16 = (S {}).method(0u16);
106    |                                 ~~~
107
108 error[E0308]: arguments to this function are incorrect
109   --> $DIR/wrong-call-return-type-due-to-generic-arg.rs:27:5
110    |
111 LL |     function(0u32, 8u8)
112    |     ^^^^^^^^ ----  --- expected `bool`, found `u8`
113    |              |
114    |              expected `()`, found `u32`
115    |
116 help: the return type of this call is `u32` due to the type of the argument passed
117   --> $DIR/wrong-call-return-type-due-to-generic-arg.rs:27:5
118    |
119 LL |     function(0u32, 8u8)
120    |     ^^^^^^^^^----^^^^^^
121    |              |
122    |              this argument influences the return type of `function`
123 note: function defined here
124   --> $DIR/wrong-call-return-type-due-to-generic-arg.rs:1:4
125    |
126 LL | fn function<T>(x: T, y: bool) -> T {
127    |    ^^^^^^^^    ----  -------
128
129 error: aborting due to 6 previous errors
130
131 For more information about this error, try `rustc --explain E0308`.