• [^] # Re: Un peu déçu par Rust

    Posté par . En réponse au journal Un print(1 + "3a"), ça nous inspire comment ?. Évalué à 5.

    Avec un rustc plus récent:

    fn main(){
    println!("{}",1+"3a");
    }
    $ rustc --version
    rustc 1.15.1 (021bd294c 2017年02月08日)
    
    error[E0277]: the trait bound `{integer}: std::ops::Add<&str>` is not satisfied
     --> main.rs:2:20
     |
    2 | println!("{}", 1 + "3a");
     | ^^^^^^^^ the trait `std::ops::Add<&str>` is not implemented for `{integer}`
     |
     = help: the following implementations were found:
     = help: <u32 as std::ops::Add>
     = help: <&'a u32 as std::ops::Add<u32>>
     = help: <u32 as std::ops::Add<&'a u32>>
     = help: <&'b u32 as std::ops::Add<&'a u32>>
     = help: and 90 others
    error: aborting due to previous error
    

    Et le message d"erreur vient avec des couleurs qui rendent la lecture très agréable.