Commit a5fb10c7 authored by AdminXVII's avatar AdminXVII Committed by Michael Aaron Murphy

chore(*): update dependencies and switch to rust 1.36.0

parent 1ded346f
This diff is collapsed.
......@@ -49,10 +49,6 @@ harness = false
name = "statement"
harness = false
[[bench]]
name = "builtins"
harness = false
[[example]]
name = "window"
required-features = ["piston"]
......@@ -75,21 +71,20 @@ ion-ranges = { version = "0.1", path = "members/ranges" }
scopes = { version = "0.1", path = "members/scopes-rs" }
types-rs = { version = "0.1", path = "members/types-rs" }
builtins-proc = { version = "0.1", path = "members/builtins-proc" }
hashbrown = "0.6"
itertools = "0.8"
lexical = "3.0"
lexical = "4.0"
object-pool = "0.3.1"
auto_enums = "0.5.5"
auto_enums = "0.6"
structopt = "0.3"
atty = "0.2"
permutate = "0.3"
xdg = "2.1"
nix = "0.15"
nix = { git = "https://github.com/AdminXVII/nix", branch = "add-redox-support" }
# window example
piston-ai_behavior = { version = "0.31", optional = true }
piston_window = { version = "0.103", optional = true }
piston2d-sprite = { version = "0.57", optional = true }
piston_window = { version = "0.105", optional = true }
piston2d-sprite = { version = "0.58", optional = true }
[target."cfg(all(unix, not(target_os = \"redox\")))".dependencies]
users = "0.9"
......
prefix ?= usr/local
BINARY = $(prefix)/bin/ion
RELEASE = debug
TOOLCHAIN ?= 1.35.0
TOOLCHAIN ?= 1.36.0
GIT_REVISION=git_revision.txt
SRC=Cargo.toml Cargo.lock $(shell find src members -type f -wholename '*src/*.rs')
......
......@@ -45,7 +45,7 @@ See the [examples folder](https://gitlab.redox-os.org/redox-os/ion/tree/master/e
## Pop!\_OS / Ubuntu
The following PPA supports the 18.04 (bionic) and 19.04 (disco) releases. Bionic builds were made using the Pop\_OS PPA's rustc 1.35.0 package.
The following PPA supports the 18.04 (bionic) and 19.04 (disco) releases. Bionic builds were made using the Pop\_OS PPA's rustc 1.36.0 package.
```
sudo add-apt-repository ppa:mmstick76/ion-shell
......@@ -54,13 +54,13 @@ sudo add-apt-repository ppa:mmstick76/ion-shell
# Developer set up
Those who are developing software with Rust should install the [Rustup toolchain manager](https://rustup.rs/).
After installing rustup, run `rustup override set 1.35.0` to set your Rust toolchain to the version that Ion is
After installing rustup, run `rustup override set 1.36.0` to set your Rust toolchain to the version that Ion is
targeting at the moment. To build for Redox OS, `rustup override set nightly` is required to build the Redox
dependencies.
# Build dependencies
Please ensure that both cargo and rustc 1.35.0 or higher is installed for your system.
Please ensure that both cargo and rustc 1.36.0 or higher is installed for your system.
Release tarballs have not been made yet due to Ion being incomplete in a few remaining areas.
# Compile instructions for distribution
......
use criterion::*;
use std::collections::HashMap;
const BUILTINS: &str = include_str!("builtins.txt");
const CALLS: &str = include_str!("calls.txt");
fn dummy() {}
const FNS: &'static [fn(); 100] = &[dummy; 100];
fn criterion_benchmark(c: &mut Criterion) {
let builtins = BUILTINS.lines().collect::<Vec<_>>();
let mut hashmap = HashMap::<&str, &dyn Fn()>::new();
let mut hashbrown = hashbrown::HashMap::<&str, &dyn Fn()>::new();
for builtin in &builtins {
hashmap.insert(builtin, &dummy);
hashbrown.insert(builtin, &dummy);
}
c.bench(
"builtins",
ParameterizedBenchmark::new(
"hashmap",
move |b, calls| {
b.iter(|| {
for call in calls {
hashmap.get(call).map(|builtin| builtin());
}
})
},
vec![CALLS.lines().collect::<Vec<_>>()],
)
.with_function("hashbrown", move |b, calls| {
b.iter(|| {
for call in calls {
hashbrown.get(call).map(|builtin| builtin());
}
})
})
.with_function("slice", move |b, calls| {
b.iter(|| {
for call in calls {
builtins
.binary_search(&call)
.ok()
.map(|pos| unsafe { FNS.get_unchecked(pos)() });
}
})
}),
);
}
criterion_group!(benches, criterion_benchmark);
criterion_main!(benches);
alias
bg
bool
calc
cd
contains
dirs
disown
drop
echo
ends-with
eq
eval
exec
exists
exit
false
fg
fn
help
history
is
isatty
jobs
matches
popd
pushd
random
read
set
source
starts-with
status
suspend
test
true
type
unalias
wait
which
......@@ -5,15 +5,24 @@ use itertools::Itertools;
const TEXT: &[u8] = include_bytes!("test.ion");
fn criterion_benchmark(c: &mut Criterion) {
let mut group = c.benchmark_group("statement-splitter-Throughput");
for stmt in TEXT.iter().cloned().batching(|lines| Terminator::new(lines).terminate()) {
group.throughput(Throughput::Bytes(stmt.len() as u64));
group.bench_with_input(BenchmarkId::new("statement", stmt.len()), &stmt, |b, stmt| {
b.iter(|| StatementSplitter::new(stmt).collect::<Vec<_>>())
});
}
let stmts = TEXT
.iter()
.copied()
.batching(|lines| Terminator::new(lines).terminate())
.collect::<Vec<_>>();
c.bench(
"statement-splitter-throughput",
ParameterizedBenchmark::new(
"statement",
|b, script| {
b.iter(|| {
script.iter().flat_map(|cmd| StatementSplitter::new(cmd)).collect::<Vec<_>>()
})
},
vec![stmts],
)
.throughput(|script| Throughput::Bytes(script.len() as u64)),
);
}
criterion_group!(benches, criterion_benchmark);
......
......@@ -11,4 +11,3 @@ keywords = ["scopes", "variables"]
categories = ["data-structures", "memory-management"]
[dependencies]
hashbrown = "0.6"
use hashbrown::HashMap;
use std::{
borrow::Borrow,
collections::HashMap,
hash::Hash,
ops::{Deref, DerefMut},
};
......
......@@ -11,7 +11,6 @@ readme = "README.md"
categories = ["parsing"]
[dependencies]
lexical = "3.0"
hashbrown = "0.6"
lexical = "4.0"
small = { git = "https://gitlab.redox-os.org/redox-os/small", features = ["std"] }
itertools = "0.8"
use super::Value;
use hashbrown::HashMap as HashbrownMap;
use small;
use std::{
collections::BTreeMap as StdBTreeMap,
collections::{BTreeMap as StdBTreeMap, HashMap as StdHashMap},
iter::FromIterator,
ops::{Deref, DerefMut},
};
pub type Array<T> = Vec<Value<T>>;
pub type HashMap<T> = HashbrownMap<Str, Value<T>>;
pub type HashMap<T> = StdHashMap<Str, Value<T>>;
pub type BTreeMap<T> = StdBTreeMap<Str, Value<T>>;
pub type Str = small::String;
......
......@@ -438,5 +438,5 @@ where
fn word_divide(buf: &Buffer) -> Vec<(usize, usize)> {
// -> impl Iterator<Item = (usize, usize)> + 'a
WordDivide { iter: buf.chars().cloned().enumerate(), count: 0, word_start: None }.collect() // TODO: return iterator directly :D
WordDivide { iter: buf.chars().copied().enumerate(), count: 0, word_start: None }.collect() // TODO: return iterator directly :D
}
......@@ -39,11 +39,11 @@ use crate::{
types,
};
use builtins_proc::builtin;
use hashbrown::HashMap;
use itertools::Itertools;
use liner::{Completer, Context};
use std::{
borrow::Cow,
collections::HashMap,
io::{self, BufRead},
path::{Path, PathBuf},
};
......@@ -134,10 +134,10 @@ impl<'a> BuiltinMap<'a> {
pub fn contains(&self, func: &str) -> bool { self.fcts.get(&func).is_some() }
/// Get the list of builtins included
pub fn keys(&self) -> impl Iterator<Item = &str> { self.fcts.keys().cloned() }
pub fn keys(&self) -> impl Iterator<Item = &str> { self.fcts.keys().copied() }
/// Get the provided help for a given builtin
pub fn get_help(&self, func: &str) -> Option<&str> { self.help.get(func).cloned() }
pub fn get_help(&self, func: &str) -> Option<&str> { self.help.get(func).copied() }
/// Get the function of a given builtin
pub fn get(&self, func: &str) -> Option<BuiltinFunction<'a>> { self.fcts.get(func).cloned() }
......
......@@ -17,7 +17,7 @@ pub fn expand<'a>(
#[auto_enum(Iterator)]
match expanders.len() {
0 => ::std::iter::empty(),
1 => SingleBraceExpand { elements: expanders[0].iter().cloned(), tokens, loop_count: 0 },
1 => SingleBraceExpand { elements: expanders[0].iter().copied(), tokens, loop_count: 0 },
_ => MultipleBraceExpand::new(tokens, expanders),
}
}
......
......@@ -150,7 +150,7 @@ impl<'a> Iterator for ArgumentSplitter<'a> {
let start = self.read;
let mut levels = Levels::default();
let mut bytes = data.iter().skip(self.read).cloned();
let mut bytes = data.iter().skip(self.read).copied();
while let Some(character) = bytes.next() {
match character {
// Skip the next byte.
......
......@@ -110,7 +110,7 @@ impl fmt::Display for Colors {
"\x1b[{}m",
self.attributes
.iter()
.cloned()
.copied()
.chain(foreground.as_ref().map(AsRef::as_ref))
.chain(background.as_ref().map(AsRef::as_ref))
.format(";")
......
......@@ -83,17 +83,13 @@ impl DirectoryStack {
// pushd -<num>
pub fn rotate_right(&mut self, num: usize) -> Result<(), DirStackError> {
let len = self.dirs.len();
self.rotate_left(len - (num % len))
self.dirs.rotate_right(num);
self.set_current_dir_by_index(0)
}
// pushd +<num>
pub fn rotate_left(&mut self, num: usize) -> Result<(), DirStackError> {
for _ in 0..num {
if let Some(popped_front) = self.dirs.pop_front() {
self.dirs.push_back(popped_front);
}
}
self.dirs.rotate_left(num);
self.set_current_dir_by_index(0)
}
......
......@@ -47,6 +47,7 @@ use nix::{
unistd::Pid,
};
use std::{
convert::TryFrom,
fs::File,
mem,
ops::{Deref, DerefMut},
......@@ -166,7 +167,7 @@ impl<'a> Shell<'a> {
/// Install signal handlers necessary for the shell to work
fn install_signal_handler() {
extern "C" fn handler(signal: i32) {
let signal = signal::Signal::from_c_int(signal).unwrap();
let signal = signal::Signal::try_from(signal).unwrap();
let signal = match signal {
signal::Signal::SIGINT => signals::SIGINT,
signal::Signal::SIGHUP => signals::SIGHUP,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment