Skip to content

Commit

Permalink
Update to Rust 1.40.0 (nightly-2019-10-14) (#206)
Browse files Browse the repository at this point in the history
* Updated getopts, qp-trie, and core_io to latest versions.

* Smoltcp receive buffers are now mutable.

* Fix warnings about stabilized features

* Fix makefile to auto-install required rust toolchain, apparently the 'rust-toolchain' file doesn't do that automatically.
  • Loading branch information
kevinaboos committed Oct 18, 2019
1 parent a624852 commit 692b72f
Show file tree
Hide file tree
Showing 40 changed files with 100 additions and 103 deletions.
96 changes: 48 additions & 48 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ qp-trie = { git = "https://github.com/theseus-os/qp-trie-rs" }
downcast-rs = { git = "https://github.com/theseus-os/downcast-rs" }
### use the latest version of core_io that supports the latest nightly Rust compiler
core_io = { git = "https://github.com/theseus-os/rust-core_io" }
### use the latest version of smoltcp from github; the one on crates.io is out of date
smoltcp = { git = "https://github.com/m-labs/smoltcp" }


### These profiles fix the new rustc behavior of splitting one crate into many object files.
Expand Down
9 changes: 6 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ all: iso
IS_WSL = $(shell grep -s 'Microsoft' /proc/version)



## Tool names/locations for cross-compiling on a Mac OS / macOS host (Darwin).
UNAME = $(shell uname -s)
ifeq ($(UNAME),Darwin)
Expand All @@ -34,14 +35,16 @@ GRUB_MKRESCUE = $(GRUB_CROSS)grub-mkrescue
###################################################################################################
### For ensuring that the host computer has the proper version of the Rust compiler
###################################################################################################

RUSTC_VERSION := $(shell cat rust-toolchain)
check_rustc:
ifdef RUSTUP_TOOLCHAIN
@echo -e 'Warning: You are overriding the Rust toolchain manually via RUSTUP_TOOLCHAIN.'
@echo -e 'This may lead to unwanted warnings and errors during compilation.\n'
endif
@rustup component add rust-src || (\
echo -e "\nError: rustup is not installed on this system.";\
## Building Theseus requires the 'rust-src' component. If we can't install that, install the required rust toolchain and retry.
## If it still doesn't work, issue an error, since 'rustup' is probably missing.
@rustup component add rust-src || (rustup toolchain install $(RUSTC_VERSION) && rustup component add rust-src) || (\
echo -e "\nError: 'rustup' isn't installed.";\
echo -e "Please install rustup and try again.\n";\
exit 1)

Expand Down
2 changes: 1 addition & 1 deletion applications/cat/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ authors = ["Kevin Boos <kevinaboos@gmail.com>"]
build = "../../build.rs"

[dependencies]
getopts = { git = "https://github.com/kevinaboos/getopts" }
getopts = "0.2.21"
core_io = "0.1"


Expand Down
2 changes: 1 addition & 1 deletion applications/cd/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = "0.1.0"
authors = ["Christine Wang <chrissywang54@gmail.com>"]

[dependencies]
getopts = { git = "https://github.com/kevinaboos/getopts" }
getopts = "0.2.21"

[dependencies.log]
default-features = false
Expand Down
2 changes: 1 addition & 1 deletion applications/cpu/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ authors = ["Christine Wang <chrissywang54@gmail.com>"]
build = "../../build.rs"

[dependencies]
getopts = "0.2.18"
getopts = "0.2.21"

[dependencies.terminal_print]
path = "../terminal_print"
Expand Down
2 changes: 1 addition & 1 deletion applications/deps/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description = "Allows a developer to explore dependencies in Theseus's crate man
build = "../../build.rs"

[dependencies]
getopts = "0.2.18"
getopts = "0.2.21"
spin = "0.4.10"

[dependencies.itertools]
Expand Down
1 change: 0 additions & 1 deletion applications/deps/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ extern crate spin;
use alloc::{
string::{String},
vec::Vec,
slice::SliceConcatExt,
};
use spin::Once;
use getopts::{Matches, Options};
Expand Down
2 changes: 1 addition & 1 deletion applications/example/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ authors = ["Kevin Boos <kevinaboos@gmail.com>"]
build = "../../build.rs"

[dependencies]
getopts = "0.2.18"
getopts = "0.2.21"

[dependencies.terminal_print]
path = "../terminal_print"
2 changes: 1 addition & 1 deletion applications/kill/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ authors = ["Christine Wang <chrissywang54@gmail.com>"]
build = "../../build.rs"

[dependencies]
getopts = "0.2.18"
getopts = "0.2.21"

[dependencies.debugit]
path = "../../libs/debugit"
Expand Down
2 changes: 1 addition & 1 deletion applications/less/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ authors = ["Zhiyao Ma <zm16@pku.edu.cn>"]
build = "../../build.rs"

[dependencies]
getopts = { git = "https://github.com/kevinaboos/getopts" }
getopts = "0.2.21"
spin = "0.4.10"
core_io = "0.1"

Expand Down
2 changes: 1 addition & 1 deletion applications/ls/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = "0.1.0"
authors = ["Christine Wang <chrissywang54@gmail.com>"]

[dependencies]
getopts = { git = "https://github.com/kevinaboos/getopts" }
getopts = "0.2.21"

[dependencies.log]
default-features = false
Expand Down
2 changes: 1 addition & 1 deletion applications/mkdir/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = "0.1.0"
authors = ["Christine Wang <chrissywang54@gmail.com>"]

[dependencies]
getopts = { git = "https://github.com/kevinaboos/getopts" }
getopts = "0.2.21"

[dependencies.terminal_print]
path = "../terminal_print"
Expand Down
2 changes: 1 addition & 1 deletion applications/mm_eval/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ authors = ["Kevin Boos <kevinaboos@gmail.com>"]
build = "../../build.rs"

[dependencies]
getopts = "0.2.18"
getopts = "0.2.21"
cfg-if = "0.1.6"

[dependencies.log]
Expand Down
2 changes: 1 addition & 1 deletion applications/ns/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description = "An app for interacting with crate namespaces"
build = "../../build.rs"

[dependencies]
getopts = "0.2.18"
getopts = "0.2.21"

[dependencies.terminal_print]
path = "../terminal_print"
Expand Down
10 changes: 5 additions & 5 deletions applications/ping/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ description = "pings an IPv4 address and returns ping statistics"
authors = ["Barry Shiberu <berketshiberu@gmail.com>"]
build = "../../build.rs"

[dependencies.terminal_print]
path = "../terminal_print"

[dependencies]
byteorder = { version = "1.0", default-features = false }
getopts = "0.2.18"
getopts = "0.2.21"

[dependencies.terminal_print]
path = "../terminal_print"


[dependencies.log]
Expand Down Expand Up @@ -40,7 +40,7 @@ path = "../../kernel/ota_update_client"
version = "0.5.0"
default-features = false
features = [
"alloc",
"alloc", "ethernet",
# "log", "verbose",
"proto-ipv4", "proto-igmp", "proto-ipv6", "proto-dhcpv4",
"socket-raw", "socket-udp", "socket-tcp", "socket-icmp"
Expand Down
2 changes: 1 addition & 1 deletion applications/pmu_sample_start/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ authors = ["Aryan Sefidi <aryansefidi@gmail.com>"]
build = "../../build.rs"

[dependencies]
getopts = "0.2.18"
getopts = "0.2.21"

[dependencies.pmu_x86]
path = "../../kernel/pmu_x86"
Expand Down
2 changes: 1 addition & 1 deletion applications/pmu_sample_stop/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ authors = ["Aryan Sefidi <aryansefidi@gmail.com>"]
build = "../../build.rs"

[dependencies]
getopts = "0.2.18"
getopts = "0.2.21"

[dependencies.pmu_x86]
path = "../../kernel/pmu_x86"
Expand Down
2 changes: 1 addition & 1 deletion applications/ps/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ authors = ["Christine Wang <chrissywang54@gmail.com>"]
build = "../../build.rs"

[dependencies]
getopts = "0.2.18"
getopts = "0.2.21"

[dependencies.terminal_print]
path = "../terminal_print"
Expand Down
2 changes: 1 addition & 1 deletion applications/pwd/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = "0.1.0"
authors = ["Christine Wang <chrissywang54@gmail.com>"]

[dependencies]
getopts = { git = "https://github.com/kevinaboos/getopts" }
getopts = "0.2.21"

[dependencies.terminal_print]
path = "../terminal_print"
Expand Down
2 changes: 1 addition & 1 deletion applications/rm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build = "../../build.rs"
description = "removes the directory from the virtual filesystem"

[dependencies]
getopts = { git = "https://github.com/kevinaboos/getopts" }
getopts = "0.2.21"

[dependencies.terminal_print]
path = "../terminal_print"
Expand Down
2 changes: 1 addition & 1 deletion applications/rq_eval/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ authors = ["Kevin Boos <kevinaboos@gmail.com>"]
build = "../../build.rs"

[dependencies]
getopts = "0.2.18"
getopts = "0.2.21"


[dependencies.log]
Expand Down
2 changes: 1 addition & 1 deletion applications/swap/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ authors = ["Kevin Boos <kevinaboos@gmail.com>"]
build = "../../build.rs"

[dependencies]
getopts = "0.2.18"
getopts = "0.2.21"

[dependencies.itertools]
version = "0.7.9"
Expand Down
1 change: 0 additions & 1 deletion applications/swap/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ use alloc::{
string::{String, ToString},
vec::Vec,
sync::Arc,
slice::SliceConcatExt,
};
use getopts::{Options, Matches};
use mod_mgmt::{NamespaceDir, SwapRequest};
Expand Down
6 changes: 3 additions & 3 deletions applications/upd/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description = "Front-end application to communicate with Theseus update server"
build = "../../build.rs"

[dependencies]
getopts = "0.2.18"
getopts = "0.2.21"
spin = "0.4.10"

[dependencies.itertools]
Expand Down Expand Up @@ -47,8 +47,8 @@ path = "../../kernel/network_manager"
version = "0.5.0"
default-features = false
features = [
"alloc",
"alloc", "ethernet",
# "log", "verbose",
"proto-ipv4", "proto-igmp", "proto-ipv6", "proto-dhcpv4",
"socket-raw", "socket-udp", "socket-tcp", "socket-icmp",
]
]
1 change: 0 additions & 1 deletion applications/upd/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ use alloc::{
string::{String, ToString},
vec::Vec,
collections::BTreeSet,
slice::SliceConcatExt,
};
use spin::Once;
use getopts::{Matches, Options};
Expand Down
2 changes: 1 addition & 1 deletion kernel/apic/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ path = "../memory"
path = "../kernel_config"

[dependencies.raw-cpuid]
version = "6.1.0"
version = "7.0.3"
features = [ "use_arch" ]

[features]
Expand Down
2 changes: 1 addition & 1 deletion kernel/ethernet_smoltcp_device/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ version = "1.2.0"
version = "0.5.0"
default-features = false
features = [
"alloc",
"alloc", "ethernet",
# "log", "verbose",
"proto-ipv4", "proto-igmp", "proto-ipv6", "proto-dhcpv4",
"socket-raw", "socket-udp", "socket-tcp", "socket-icmp",
Expand Down
14 changes: 7 additions & 7 deletions kernel/ethernet_smoltcp_device/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use smoltcp::{
};
use network_interface_card::NetworkInterfaceCard;
use nic_buffers::{TransmitBuffer, ReceivedFrame};
use owning_ref::BoxRef;
use owning_ref::BoxRefMut;
use network_manager::NetworkInterface;
use core::str::FromStr;

Expand Down Expand Up @@ -193,8 +193,8 @@ impl<'d, N: NetworkInterfaceCard + 'static> smoltcp::phy::Device<'d> for Etherne
}

let first_buf_len = received_frame.0[0].length;
let rxbuf_byte_slice = BoxRef::new(Box::new(received_frame))
.try_map(|rxframe| rxframe.0[0].as_slice::<u8>(0, first_buf_len as usize))
let rxbuf_byte_slice = BoxRefMut::new(Box::new(received_frame))
.try_map_mut(|rxframe| rxframe.0[0].as_slice_mut::<u8>(0, first_buf_len as usize))
.map_err(|e| {
error!("EthernetDevice::receive(): couldn't convert receive buffer of length {} into byte slice, error {:?}", first_buf_len, e);
e
Expand Down Expand Up @@ -268,12 +268,12 @@ impl<N: NetworkInterfaceCard + 'static> smoltcp::phy::TxToken for TxToken<N> {

/// The receive token type used by smoltcp,
/// which contains only a `ReceivedFrame` to be consumed later.
pub struct RxToken(BoxRef<ReceivedFrame, [u8]>);
pub struct RxToken(BoxRefMut<ReceivedFrame, [u8]>);

impl smoltcp::phy::RxToken for RxToken {
fn consume<R, F>(self, _timestamp: Instant, f: F) -> smoltcp::Result<R>
where F: FnOnce(&[u8]) -> smoltcp::Result<R>
fn consume<R, F>(mut self, _timestamp: Instant, f: F) -> smoltcp::Result<R>
where F: FnOnce(&mut [u8]) -> smoltcp::Result<R>
{
f(self.0.as_ref())
f(self.0.as_mut())
}
}
1 change: 0 additions & 1 deletion kernel/frame_buffer_compositor/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
//! The compositor minimizes the updated parts of a framebuffer and clears the blank parts. Even if the cache is lost or the updated blocks information is `None`, it guarantees the result is the same.

#![no_std]
#![feature(const_vec_new)]

extern crate alloc;
extern crate compositor;
Expand Down
2 changes: 1 addition & 1 deletion kernel/http_client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ path = "../../libs/percent_encoding"
version = "0.5.0"
default-features = false
features = [
"alloc",
"alloc", "ethernet",
# "log", "verbose",
"proto-ipv4", "proto-igmp", "proto-ipv6", "proto-dhcpv4",
"socket-raw", "socket-udp", "socket-tcp", "socket-icmp",
Expand Down
2 changes: 0 additions & 2 deletions kernel/mod_mgmt/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#![no_std]
#![feature(rustc_private)]
#![feature(slice_concat_ext)]
#![feature(const_fn)]

#[macro_use] extern crate alloc;
Expand Down Expand Up @@ -33,7 +32,6 @@ use alloc::{
collections::{BTreeMap, btree_map, BTreeSet},
string::{String, ToString},
sync::{Arc, Weak},
slice::SliceConcatExt,
};
use spin::{Mutex, Once};

Expand Down
2 changes: 1 addition & 1 deletion kernel/network_manager/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ path = "../e1000"
version = "0.5.0"
default-features = false
features = [
"alloc",
"alloc", "ethernet",
# "log", "verbose",
"proto-ipv4", "proto-igmp", "proto-ipv6", "proto-dhcpv4",
"socket-raw", "socket-udp", "socket-tcp", "socket-icmp",
Expand Down
2 changes: 1 addition & 1 deletion kernel/ota_update_client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ default-features = false
version = "0.5.0"
default-features = false
features = [
"alloc",
"alloc", "ethernet",
# "log", "verbose",
"proto-ipv4", "proto-igmp", "proto-ipv6", "proto-dhcpv4",
"socket-raw", "socket-udp", "socket-tcp", "socket-icmp",
Expand Down
2 changes: 1 addition & 1 deletion kernel/pmu_x86/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ path = "../pit_clock"
path = "../../libs/port_io"

[dependencies.raw-cpuid]
version = "6.1.0"
version = "7.0.3"
features = [ "use_arch" ]

[dependencies.task]
Expand Down
2 changes: 1 addition & 1 deletion kernel/smoltcp_helper/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ path = "../hpet"
version = "0.5.0"
default-features = false
features = [
"alloc",
"alloc", "ethernet",
# "log", "verbose",
"proto-ipv4", "proto-igmp", "proto-ipv6", "proto-dhcpv4",
"socket-raw", "socket-udp", "socket-tcp", "socket-icmp",
Expand Down
Loading

0 comments on commit 692b72f

Please sign in to comment.