News for hackers. Stuff that matters.
Re:What Rust Can Do That Other Languages Can't by satbyy on Monday February 06, 2017 @04:22AM (#13577871)
Just hit 'Run' here: http://rextester.com/BDGO47890

You can see the program crash

Re:What Rust Can Do That Other Languages Can't by rubber_duck on Monday February 06, 2017 @06:55AM (#13578615)
Nice, but the example crashes because you take a reference to uninitialized vector, if you initialize it and grow the vector I found that it will either keep "working fine" if you don't expect the data to change or randomly give garbage data - depending on compiler/stdlib - especially since the time when the buffer grows is implementation defined.

Here is a better example : http://rextester.com/MAJDQ8375

On VC++ it will return : Reference is 0 but value is 9

On clang it will return : Reference is 32579632 but value is 9

So let's say I wasn't mutating the 0 index, VC example would work fine at runtime and then clang would suddenly start giving garbage results. This has caused me week of debugging in a big code base.

Re:What Rust Can Do That Other Languages Can't by satbyy on Monday February 06, 2017 @09:22AM (#13579603)
Thanks for the catch!