]> git.lizzy.rs Git - rust.git/blob - tests/ui/numbers-arithmetic/not-suggest-float-literal.rs
Rollup merge of #106644 - alexcrichton:update-wasi-toolchain, r=cuviper
[rust.git] / tests / ui / numbers-arithmetic / not-suggest-float-literal.rs
1 fn add_float_to_integer(x: u8) -> f32 {
2     x + 100.0 //~ ERROR cannot add `{float}` to `u8`
3 }
4
5 fn add_str_to_float(x: f64) -> f64 {
6     x + "foo" //~ ERROR cannot add `&str` to `f64`
7 }
8
9 fn add_lvar_to_float(x: f64) -> f64 {
10     let y = 3;
11     x + y //~ ERROR cannot add `{integer}` to `f64`
12 }
13
14 fn subtract_float_from_integer(x: u8) -> f32 {
15     x - 100.0 //~ ERROR cannot subtract `{float}` from `u8`
16 }
17
18 fn subtract_str_from_f64(x: f64) -> f64 {
19     x - "foo" //~ ERROR cannot subtract `&str` from `f64`
20 }
21
22 fn subtract_lvar_from_f64(x: f64) -> f64 {
23     let y = 3;
24     x - y //~ ERROR cannot subtract `{integer}` from `f64`
25 }
26
27 fn multiply_integer_by_float(x: u8) -> f32 {
28     x * 100.0 //~ ERROR cannot multiply `u8` by `{float}`
29 }
30
31 fn multiply_f64_by_str(x: f64) -> f64 {
32     x * "foo" //~ ERROR cannot multiply `f64` by `&str`
33 }
34
35 fn multiply_f64_by_lvar(x: f64) -> f64 {
36     let y = 3;
37     x * y //~ ERROR cannot multiply `f64` by `{integer}`
38 }
39
40 fn divide_integer_by_float(x: u8) -> u8 {
41     x / 100.0 //~ ERROR cannot divide `u8` by `{float}`
42 }
43
44 fn divide_f64_by_str(x: f64) -> f64 {
45     x / "foo" //~ ERROR cannot divide `f64` by `&str`
46 }
47
48 fn divide_f64_by_lvar(x: f64) -> f64 {
49     let y = 3;
50     x / y //~ ERROR cannot divide `f64` by `{integer}`
51 }
52
53 fn main() {}