]> git.lizzy.rs Git - rust.git/blob - src/librustc_error_codes/error_codes/E0689.md
Rollup merge of #62514 - stephaneyfx:box-ffi, r=nikomatsakis
[rust.git] / src / librustc_error_codes / error_codes / E0689.md
1 This error indicates that the numeric value for the method being passed exists
2 but the type of the numeric value or binding could not be identified.
3
4 The error happens on numeric literals:
5
6 ```compile_fail,E0689
7 2.0.neg();
8 ```
9
10 and on numeric bindings without an identified concrete type:
11
12 ```compile_fail,E0689
13 let x = 2.0;
14 x.neg();  // same error as above
15 ```
16
17 Because of this, you must give the numeric literal or binding a type:
18
19 ```
20 use std::ops::Neg;
21
22 let _ = 2.0_f32.neg();
23 let x: f32 = 2.0;
24 let _ = x.neg();
25 let _ = (2.0 as f32).neg();
26 ```