Support stable rust for compiling the runtime (#13580)

* Support stable rust for compiling the runtime

This pull request brings support for compiling the runtime with stable Rust. This requires at least
rust 1.68.0 to work on stable. The code is written in a way that it is backwards compatible and
should automatically work when someone compiles with 1.68.0+ stable.

* We always support nightlies!

* 🤦

* Sort by version

* Review feedback

* Review feedback

* Fix version parsing

* Apply suggestions from code review

Co-authored-by: Koute <koute@users.noreply.github.com>

---------

Co-authored-by: Koute <koute@users.noreply.github.com>
This commit is contained in:
Bastian Köcher
2023-03-29 09:17:50 +02:00
committed by GitHub
parent acec84cc1e
commit d338e9a114
8 changed files with 327 additions and 51 deletions
@@ -35,10 +35,13 @@ fn print_error_message(message: &str) -> String {
///
/// Returns the versioned cargo command on success.
pub(crate) fn check() -> Result<CargoCommandVersioned, String> {
let cargo_command = crate::get_nightly_cargo();
let cargo_command = crate::get_cargo_command();
if !cargo_command.is_nightly() {
return Err(print_error_message("Rust nightly not installed, please install it!"))
if !cargo_command.supports_substrate_wasm_env() {
return Err(print_error_message(
"Cannot compile the WASM runtime: no compatible Rust compiler found!\n\
Install at least Rust 1.68.0 or a recent nightly version.",
))
}
check_wasm_toolchain_installed(cargo_command)