Skip to content

Commit

Permalink
Rollup merge of rust-lang#73472 - GuillaumeGomez:cleanup-e0689, r=Dyl…
Browse files Browse the repository at this point in the history
…an-DPC

Clean up E0689 explanation

r? @Dylan-DPC
  • Loading branch information
Manishearth authored Jun 21, 2020
2 parents fcea8a1 + 1d08b1b commit c1ca2d6
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/librustc_error_codes/error_codes/E0689.md
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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!
```

0 comments on commit c1ca2d6

Please sign in to comment.