Fix no_std build.

This commit is contained in:
Stephen Chung
2020-04-24 12:39:24 +08:00
parent a306979a9c
commit b6d839c8a9
20 changed files with 238 additions and 167 deletions

View File

@@ -6,6 +6,7 @@ use crate::parser::INT;
use crate::token::Position;
use crate::stdlib::{
boxed::Box,
error::Error,
fmt,
string::{String, ToString},
@@ -283,8 +284,8 @@ impl EvalAltResult {
/// Consume the current `EvalAltResult` and return a new one
/// with the specified `Position`.
pub(crate) fn set_position(mut self, new_position: Position) -> Self {
match &mut self {
pub(crate) fn set_position(mut err: Box<Self>, new_position: Position) -> Box<Self> {
match err.as_mut() {
#[cfg(not(feature = "no_std"))]
Self::ErrorReadingScriptFile(_, _) => (),
@@ -314,6 +315,6 @@ impl EvalAltResult {
| Self::Return(_, pos) => *pos = new_position,
}
self
err
}
}