diff --git a/rust/flatbuffers/Cargo.toml b/rust/flatbuffers/Cargo.toml index 241ac2b99b8..6e189efe4fa 100644 --- a/rust/flatbuffers/Cargo.toml +++ b/rust/flatbuffers/Cargo.toml @@ -9,7 +9,7 @@ homepage = "https://google.github.io/flatbuffers/" repository = "https://github.com/google/flatbuffers" keywords = ["flatbuffers", "serialization", "zero-copy"] categories = ["encoding", "data-structures", "memory-management"] -rust = "1.51" +rust-version = "1.81" [features] default = ["std"] diff --git a/rust/flatbuffers/src/builder.rs b/rust/flatbuffers/src/builder.rs index a6e6818101f..2f07dd6e00c 100644 --- a/rust/flatbuffers/src/builder.rs +++ b/rust/flatbuffers/src/builder.rs @@ -14,7 +14,6 @@ * limitations under the License. */ -#[cfg(not(feature = "std"))] use alloc::{vec, vec::Vec}; use core::cmp::max; use core::convert::Infallible; diff --git a/rust/flatbuffers/src/lib.rs b/rust/flatbuffers/src/lib.rs index 9ed308024fb..67363cf605e 100644 --- a/rust/flatbuffers/src/lib.rs +++ b/rust/flatbuffers/src/lib.rs @@ -28,10 +28,6 @@ //! At this time, to generate Rust code, you will need the latest `master` version of `flatc`, available from here: //! (On OSX, you can install FlatBuffers from `HEAD` with the Homebrew package manager.) -#![cfg_attr(not(feature = "std"), no_std)] -#![cfg_attr(all(nightly, not(feature = "std")), feature(error_in_core))] - -#[cfg(not(feature = "std"))] extern crate alloc; mod array; diff --git a/rust/flatbuffers/src/verifier.rs b/rust/flatbuffers/src/verifier.rs index c4c55f587d0..bf1aef1d1f4 100644 --- a/rust/flatbuffers/src/verifier.rs +++ b/rust/flatbuffers/src/verifier.rs @@ -1,20 +1,11 @@ use crate::follow::Follow; use crate::{ForwardsUOffset, SOffsetT, SkipSizePrefix, UOffsetT, VOffsetT, Vector, SIZE_UOFFSET}; -#[cfg(not(feature = "std"))] +use alloc::borrow::Cow; use alloc::vec::Vec; +use core::error::Error; use core::ops::Range; use core::option::Option; -#[cfg(not(feature = "std"))] -use alloc::borrow::Cow; -#[cfg(feature = "std")] -use std::borrow::Cow; - -#[cfg(all(nightly, not(feature = "std")))] -use core::error::Error; -#[cfg(feature = "std")] -use std::error::Error; - /// Traces the location of data errors. Not populated for Dos detecting errors. /// Useful for MissingRequiredField and Utf8Error in particular, though /// the other errors should not be producible by correct flatbuffers implementations. @@ -86,7 +77,6 @@ pub enum InvalidFlatbuffer { DepthLimitReached, } -#[cfg(any(nightly, feature = "std"))] impl Error for InvalidFlatbuffer { fn source(&self) -> Option<&(dyn Error + 'static)> { if let InvalidFlatbuffer::Utf8Error { error: source, .. } = self {