mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 02:51:08 +00:00
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:
@@ -9,6 +9,7 @@ repository = "https://github.com/paritytech/substrate/"
|
||||
description = "I/O for Substrate runtimes"
|
||||
documentation = "https://docs.rs/sp-io"
|
||||
readme = "README.md"
|
||||
build = "build.rs"
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
targets = ["x86_64-unknown-linux-gnu"]
|
||||
@@ -37,6 +38,9 @@ ed25519-dalek = { version = "1.0.1", default-features = false, optional = true }
|
||||
# Force the usage of ed25519, this is being used in `ed25519-dalek`.
|
||||
ed25519 = { version = "1.5.2", optional = true }
|
||||
|
||||
[build-dependencies]
|
||||
rustversion = "1.0.6"
|
||||
|
||||
[features]
|
||||
default = ["std"]
|
||||
std = [
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
// This file is part of Substrate.
|
||||
|
||||
// Copyright (C) Parity Technologies (UK) Ltd.
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#[rustversion::before(1.68)]
|
||||
fn main() {
|
||||
if !cfg!(feature = "std") {
|
||||
println!("cargo:rustc-cfg=enable_alloc_error_handler");
|
||||
}
|
||||
}
|
||||
|
||||
#[rustversion::since(1.68)]
|
||||
fn main() {}
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
#![warn(missing_docs)]
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
#![cfg_attr(not(feature = "std"), feature(alloc_error_handler))]
|
||||
#![cfg_attr(enable_alloc_error_handler, feature(alloc_error_handler))]
|
||||
#![cfg_attr(
|
||||
feature = "std",
|
||||
doc = "Substrate runtime standard library as compiled when linked with Rust's standard library."
|
||||
@@ -1643,7 +1643,7 @@ pub fn panic(info: &core::panic::PanicInfo) -> ! {
|
||||
}
|
||||
|
||||
/// A default OOM handler for WASM environment.
|
||||
#[cfg(all(not(feature = "disable_oom"), not(feature = "std")))]
|
||||
#[cfg(all(not(feature = "disable_oom"), enable_alloc_error_handler))]
|
||||
#[alloc_error_handler]
|
||||
pub fn oom(_: core::alloc::Layout) -> ! {
|
||||
#[cfg(feature = "improved_panic_error_reporting")]
|
||||
|
||||
Reference in New Issue
Block a user