Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define a MSRV, use that toolchain by default. #22

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/Cargo.lock
/nightly/target
/target
6 changes: 6 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,14 @@ edition = "2021"
license = "Apache-2.0 OR MIT"
name = "libtock"
repository = "https://www.github.com/tock/libtock-rs"
rust-version.workspace = true
version = "0.1.0"

[workspace.package]
# This must be kept in sync with rust-toolchain.toml; please see that file for
# more information.
rust-version = "1.70"

[dependencies]
libtock_adc = { path = "apis/adc"}
libtock_air_quality = { path = "apis/air_quality" }
Expand Down
24 changes: 6 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,7 @@ endif

.PHONY: setup
setup: setup-qemu
rustup install stable
cargo +stable install elf2tab
cargo miri setup
rustup target add --toolchain stable thumbv7em-none-eabi
cargo install elf2tab

# Sets up QEMU in the tock/ directory. We use Tock's QEMU which may contain
# patches to better support boards that Tock supports.
Expand Down Expand Up @@ -108,28 +105,19 @@ EXCLUDE_STD := --exclude libtock_unittest --exclude print_sizes \
--exclude runner --exclude syscalls_tests \
--exclude libtock_build_scripts

# Currently, all of our crates should build with a stable toolchain. This
# verifies our crates don't depend on unstable features by using cargo check. We
# specify a different target directory so this doesn't flush the cargo cache of
# the primary toolchain.
.PHONY: test-stable
test-stable:
cargo +stable check --target-dir=target/stable --workspace \
$(EXCLUDE_RUNTIME)
LIBTOCK_PLATFORM=nrf52 cargo +stable check $(EXCLUDE_STD) \
--target=thumbv7em-none-eabi --target-dir=target/stable --workspace

.PHONY: test
test: examples test-stable
test: examples
cargo test $(EXCLUDE_RUNTIME) --workspace
LIBTOCK_PLATFORM=nrf52 cargo fmt --all -- --check
cargo clippy --all-targets $(EXCLUDE_RUNTIME) --workspace
LIBTOCK_PLATFORM=nrf52 cargo clippy $(EXCLUDE_STD) \
--target=thumbv7em-none-eabi --workspace
LIBTOCK_PLATFORM=hifive1 cargo clippy $(EXCLUDE_STD) \
--target=riscv32imac-unknown-none-elf --workspace
MIRIFLAGS="-Zmiri-strict-provenance -Zmiri-symbolic-alignment-check" \
cargo miri test $(EXCLUDE_MIRI) --workspace
cd nightly && \
MIRIFLAGS="-Zmiri-strict-provenance -Zmiri-symbolic-alignment-check" \
cargo miri test $(EXCLUDE_MIRI) --manifest-path=../Cargo.toml \
--target-dir=target --workspace
echo '[ SUCCESS ] libtock-rs tests pass'

# Helper functions to define make targets to build for specific (flash, ram,
Expand Down
4 changes: 4 additions & 0 deletions nightly/rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# This is the nightly Rust toolchain used by `make test`.
[toolchain]
channel = "nightly-2023-08-22"
components = ["miri"]
9 changes: 0 additions & 9 deletions rust-toolchain

This file was deleted.

13 changes: 13 additions & 0 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[toolchain]
# This is libtock-rs' Minimum Supported Rust Version (MSRV).
#
# Update policy: Update this if doing so allows you to use a Rust feature that
# you'd like to use. When you do so, update this to the first Rust version that
# includes that feature. Whenever this value is updated, the rust-version field
# in Cargo.toml must be updated as well.
channel = "1.70"
components = ["clippy", "rustfmt"]
targets = ["thumbv6m-none-eabi",
"thumbv7em-none-eabi",
"riscv32imac-unknown-none-elf",
"riscv32imc-unknown-none-elf"]