diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2020-06-18 13:10:22 +0200 |
|---|---|---|
| committer | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2020-06-18 13:10:22 +0200 |
| commit | 1d08b1b0421cc287218196e5fdd144b3e82a482a (patch) | |
| tree | 50bc18626a8e068af4e124bc8c0aeab7f28aa876 | |
| parent | 59493917be3e87e1dfb44a9ccb66a9f9b17228e6 (diff) | |
| download | rust-1d08b1b0421cc287218196e5fdd144b3e82a482a.tar.gz rust-1d08b1b0421cc287218196e5fdd144b3e82a482a.zip | |
Clean up E0689 explanation
| -rw-r--r-- | src/librustc_error_codes/error_codes/E0689.md | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/librustc_error_codes/error_codes/E0689.md b/src/librustc_error_codes/error_codes/E0689.md index 26c2c15ccfa..a680a204211 100644 --- a/src/librustc_error_codes/error_codes/E0689.md +++ b/src/librustc_error_codes/error_codes/E0689.md @@ -1,13 +1,16 @@ -This error indicates that the numeric value for the method being passed exists -but the type of the numeric value or binding could not be identified. +A method was called on an ambiguous numeric type. -The error happens on numeric literals: +Erroneous code example: ```compile_fail,E0689 -2.0.neg(); +2.0.neg(); // error! ``` -and on numeric bindings without an identified concrete type: +This error indicates that the numeric value for the method being passed exists +but the type of the numeric value or binding could not be identified. + +The error happens on numeric literals and on numeric bindings without an +identified concrete type: ```compile_fail,E0689 let x = 2.0; @@ -19,8 +22,8 @@ Because of this, you must give the numeric literal or binding a type: ``` use std::ops::Neg; -let _ = 2.0_f32.neg(); +let _ = 2.0_f32.neg(); // ok! let x: f32 = 2.0; -let _ = x.neg(); -let _ = (2.0 as f32).neg(); +let _ = x.neg(); // ok! +let _ = (2.0 as f32).neg(); // ok! ``` |
