Rollup merge of #73472 - GuillaumeGomez:cleanup-e0689, r=Dylan-DPC

Clean up E0689 explanation

r? @Dylan-DPC
This commit is contained in:
Manish Goregaokar 2020-06-23 00:33:56 -07:00 committed by GitHub
commit 98aa34cb57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,13 +1,16 @@
A method was called on an ambiguous numeric type.
Erroneous code example:
```compile_fail,E0689
2.0.neg(); // error!
```
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:
```compile_fail,E0689
2.0.neg();
```
and on numeric bindings without an identified concrete type:
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!
```