Use no-std-compat to build no-std.

This commit is contained in:
Stephen Chung
2021-04-17 15:15:54 +08:00
parent 2f2b7403cb
commit 01f0cc028b
48 changed files with 293 additions and 293 deletions

View File

@@ -9,17 +9,6 @@ use crate::engine::{Precedence, KEYWORD_THIS, OP_CONTAINS};
use crate::module::NamespaceRef;
use crate::optimize::optimize_into_ast;
use crate::optimize::OptimizationLevel;
use crate::stdlib::{
boxed::Box,
collections::BTreeMap,
format,
hash::{Hash, Hasher},
iter::empty,
num::{NonZeroU8, NonZeroUsize},
string::ToString,
vec,
vec::Vec,
};
use crate::syntax::{CustomSyntax, MARKER_BLOCK, MARKER_EXPR, MARKER_IDENT};
use crate::token::{
is_keyword_function, is_valid_identifier, Token, TokenStream, TokenizerControl,
@@ -29,6 +18,14 @@ use crate::{
calc_fn_hash, Dynamic, Engine, Identifier, LexError, ParseError, ParseErrorType, Position,
Scope, Shared, StaticVec, AST,
};
#[cfg(feature = "no_std")]
use std::prelude::v1::*;
use std::{
collections::BTreeMap,
hash::{Hash, Hasher},
iter::empty,
num::{NonZeroU8, NonZeroUsize},
};
#[cfg(not(feature = "no_float"))]
use crate::FLOAT;
@@ -2501,7 +2498,7 @@ fn parse_stmt(
#[cfg(not(feature = "no_function"))]
#[cfg(feature = "metadata")]
let comments = {
let mut comments: StaticVec<crate::stdlib::string::String> = Default::default();
let mut comments: StaticVec<std::string::String> = Default::default();
let mut comments_pos = Position::NONE;
// Handle doc-comments.
@@ -2756,7 +2753,7 @@ fn parse_fn(
mut settings: ParseSettings,
#[cfg(not(feature = "no_function"))]
#[cfg(feature = "metadata")]
comments: StaticVec<crate::stdlib::string::String>,
comments: StaticVec<std::string::String>,
) -> Result<ScriptFnDef, ParseError> {
#[cfg(not(feature = "unchecked"))]
settings.ensure_level_within_max_limit(state.max_expr_depth)?;