152
leanrob
2y

Sometime I’m developing in Rust and I do something wrong.

Then I look at the terminal and it says...

“You did X, did you mean to do Y”

Then I do it and it works perfectly, and I’m like...

Why do I even have a job if the compiler is this good?

Comments
  • 24
    Your job is to write the code that doesn't work, LMAO 😂
  • 15
    @djlazz3 It seems I’m fucking awesome at my job then!!!

    I should ask for a raise I guess!
  • 13
    You're there to test the compiler.
  • 1
    I used to play with rust back in its nightly release, pre-beta days. Even then the compiler was a damn wizard. Haven't touched rust in a few years, so I imagine it's insane nowadays
  • 0
    True dat, I started learning Rust on the side for few weeks, the compiler correct your code 90% of the time. It's amazing!
  • 0
    What kind of corrections do you find is most beneficial in rust?
    I'm working on a thesis project that references rust a lot on how it visualise compiler messages and what it can correctify, so I'm most interested in what people find is most helpful.

    (which I guess also means what do people always fail to code right in the first place... 😅)
  • 0
    If only c++ compilers could do that.
  • 0
    Except for

    @highlight

    trait Value {

    const VAL: u32;

    }

    struct ArraySize;

    impl Value for ArraySize {

    const VAL: u32 = 42;

    }

    struct GenericArray<T, N: ArraySize> {

    arr: [T; N::VAL], // associated item VAL not found, did you mean to impl Value for ArraySize?

    }

    // Yes I did that, thanks for asking. Almost like I DID IMPL IT
  • 0
  • 0
    @12bitfloat

    This is what I get, IMHO, The error is pretty clear.
Add Comment