StefanoD · GitHub

This yields with rust 1.9

let result = -0.25 % 2;

following error message:

:7:18: 7:27 error: the trait bound _: std::ops::Rem<_> is not satisfied [E0277]
:7 let result = -0.25 % 2;
^~~~~~~~~
:7:18: 7:27 help: see the detailed explanation for E0277
:7:18: 7:27 help: the following implementations were found:
:7:18: 7:27 help:
:7:18: 7:27 help: <&'a f64 as std::ops::Rem>
:7:18: 7:27 help: <f64 as std::ops::Rem<&'a f64>>
:7:18: 7:27 help: <&'b f64 as std::ops::Rem<&'a f64>>
:7:18: 7:27 help: and 54 others
error: aborting due to previous error

This is the fix:

let result = -0.25 % 2.0;

This is a really compilicated error message for the fact, that calucating with different types are not allowed.

Read the original on github.com ↗