Rust compiler update to support Rust 2018 edition


#1

I tried submitting a bot where the 2018 edition is enabled in the Cargo.toml file just like this:

[package]
name = "my_bot"
version = "0.1.0"
edition = "2018"

[dependencies]
lazy_static = "1.2.0"

only to get this error:

error: Edition 2018 is unstable and only available for nightly builds of rustc. To learn more, run the command again with --verbose.

The 2018 edition is now available for the latest stable release of the compiler. Therefore it would be cool if halite could update to it. The 2018 edition comes with great improvements to the borrow checker which now recognizes a lot more code as safe which makes it easier to write code.

Maybe halite could even update the compiler to the latest version of rust nightly which would allow people to use unstable features of Rust. It is however more likely to crash while compiling. However I’ve never had problem compiling with it for the first compilation. For me it always crashes while doing incremental compilation which would not affect halite.io since we only compile the bot once. The people who aren’t using any unstable features would then most likely not be affected by the use of the nightly compiler.

I am personally not sure if halite should update to a nightly compiler since it could (even though it never happened to me) prevent people who aren’t using unstable features to compile their code.

I am however certain that we should update to a new version stable of the rust compiler to take advantage of the great 2018 edition.


#2

Hi @ZakCodes, we hear you on the Rust upgrade. However, as it’s now fairly close to finals, we’d like to avoid causing trouble for existing Rust bots. We’d like to avoid the nightly compiler for similar reasons.

If it’s too much trouble to compile on the version of Rust we have, you could build + link your bot statically locally for Linux-x64, then upload the binary with a Python wrapper script to invoke it (others have had to do this for Java). You can create a file named LANGUAGE, containing the text “Rust”, in the root of your upload to make sure your bot still shows as Rust on the leaderboard.


#3

I was able to make it work on the older version of the compiler
I understand that you shouldn’t cause any problems with the finals
Thanks for the solution though, I might try it next year if I have to!