1 error[E0308]: mismatched types
2 --> $DIR/wrong-call-return-type-due-to-generic-arg.rs:18:28
4 LL | let x = wrong_arg_type(0u16);
5 | -------------- ^^^^ expected `u32`, found `u16`
7 | arguments to this function are incorrect
9 note: function defined here
10 --> $DIR/wrong-call-return-type-due-to-generic-arg.rs:12:4
12 LL | fn wrong_arg_type(x: u32) -> u32 {
13 | ^^^^^^^^^^^^^^ ------
14 help: change the type of the numeric literal from `u16` to `u32`
16 LL | let x = wrong_arg_type(0u32);
19 error[E0308]: mismatched types
20 --> $DIR/wrong-call-return-type-due-to-generic-arg.rs:19:30
22 LL | let x: u16 = function(0, 0u8);
23 | -------- ^^^ expected `bool`, found `u8`
25 | arguments to this function are incorrect
27 note: function defined here
28 --> $DIR/wrong-call-return-type-due-to-generic-arg.rs:1:4
30 LL | fn function<T>(x: T, y: bool) -> T {
33 error[E0308]: arguments to this function are incorrect
34 --> $DIR/wrong-call-return-type-due-to-generic-arg.rs:22:18
36 LL | let x: u16 = function(0u32, 0u8);
37 | ^^^^^^^^ ---- --- expected `bool`, found `u8`
39 | expected `u16`, found `u32`
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
44 LL | let x: u16 = function(0u32, 0u8);
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
51 LL | fn function<T>(x: T, y: bool) -> T {
52 | ^^^^^^^^ ---- -------
53 help: change the type of the numeric literal from `u32` to `u16`
55 LL | let x: u16 = function(0u16, 0u8);
58 error[E0308]: mismatched types
59 --> $DIR/wrong-call-return-type-due-to-generic-arg.rs:25:27
61 LL | let x: u16 = function(0u32, true);
62 | -------- ^^^^ expected `u16`, found `u32`
64 | arguments to this function are incorrect
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
69 LL | let x: u16 = function(0u32, true);
70 | ^^^^^^^^^----^^^^^^^
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
76 LL | fn function<T>(x: T, y: bool) -> T {
78 help: change the type of the numeric literal from `u32` to `u16`
80 LL | let x: u16 = function(0u16, true);
83 error[E0308]: mismatched types
84 --> $DIR/wrong-call-return-type-due-to-generic-arg.rs:26:32
86 LL | let x: u16 = (S {}).method(0u32);
87 | ------ ^^^^ expected `u16`, found `u32`
89 | arguments to this method are incorrect
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
94 LL | let x: u16 = (S {}).method(0u32);
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
101 LL | fn method<T>(&self, x: T) -> T {
103 help: change the type of the numeric literal from `u32` to `u16`
105 LL | let x: u16 = (S {}).method(0u16);
108 error[E0308]: arguments to this function are incorrect
109 --> $DIR/wrong-call-return-type-due-to-generic-arg.rs:27:5
111 LL | function(0u32, 8u8)
112 | ^^^^^^^^ ---- --- expected `bool`, found `u8`
114 | expected `()`, found `u32`
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
119 LL | function(0u32, 8u8)
120 | ^^^^^^^^^----^^^^^^
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
126 LL | fn function<T>(x: T, y: bool) -> T {
127 | ^^^^^^^^ ---- -------
129 error: aborting due to 6 previous errors
131 For more information about this error, try `rustc --explain E0308`.