Skip to content

Commit

Permalink
Merge pull request #619 from Dirbaio/remove-nightly-checks
Browse files Browse the repository at this point in the history
Remove nightly checks.
  • Loading branch information
MabezDev authored Jul 26, 2024
2 parents d31dfde + f593acb commit 5055422
Show file tree
Hide file tree
Showing 16 changed files with 35 additions and 134 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/clippy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
- uses: dtolnay/rust-toolchain@stable
with:
# embedded-hal-async needs nightly.
# Use a pinned version to avoid spontaneous breakages (new clippy lints are added often)
toolchain: nightly-2023-10-14
components: clippy
- run: cargo clippy --all-features -- --deny=warnings
2 changes: 1 addition & 1 deletion .github/workflows/rustdoc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ jobs:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2023-10-14
toolchain: nightly-2024-07-26
# tokio/net required to workaround https://github.com/tokio-rs/tokio/issues/6165
- run: RUSTDOCFLAGS="--deny=warnings --cfg=docsrs" cargo doc --all-features --features tokio/net
3 changes: 1 addition & 2 deletions .github/workflows/rustfmt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: nightly
components: rustfmt
- run: cargo fmt --check
18 changes: 0 additions & 18 deletions embedded-hal-async/build.rs

This file was deleted.

6 changes: 0 additions & 6 deletions embedded-hal-async/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
#![doc = include_str!("../README.md")]
#![warn(missing_docs)]
#![no_std]
// disable warning for already-stabilized features.
// Needed to pass CI, because we deny warnings.
// We don't immediately remove them to not immediately break older nightlies.
// When all features are stable, we'll remove them.
#![cfg_attr(nightly, allow(stable_features, unknown_lints))]
#![cfg_attr(nightly, feature(async_fn_in_trait, impl_trait_projections))]
#![allow(async_fn_in_trait)]

pub mod delay;
Expand Down
18 changes: 0 additions & 18 deletions embedded-hal-bus/build.rs

This file was deleted.

9 changes: 0 additions & 9 deletions embedded-hal-bus/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,6 @@
#![warn(missing_docs)]
#![cfg_attr(not(feature = "std"), no_std)]
#![cfg_attr(docsrs, feature(doc_cfg))]
// disable warning for already-stabilized features.
// Needed to pass CI, because we deny warnings.
// We don't immediately remove them to not immediately break older nightlies.
// When all features are stable, we'll remove them.
#![cfg_attr(all(feature = "async", nightly), allow(stable_features))]
#![cfg_attr(
all(feature = "async", nightly),
feature(async_fn_in_trait, impl_trait_projections)
)]

// needed to prevent defmt macros from breaking, since they emit code that does `defmt::blahblah`.
#[cfg(feature = "defmt-03")]
Expand Down
6 changes: 3 additions & 3 deletions embedded-hal-nb/src/spi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ pub use embedded_hal::spi::{
/// - Due to how full duplex SPI works each `read` call must be preceded by a `write` call.
///
/// - `read` calls only return the data received with the last `write` call.
/// Previously received data is discarded
/// Previously received data is discarded
///
/// - Data is only guaranteed to be clocked out when the `read` call succeeds.
/// The slave select line shouldn't be released before that.
/// The slave select line shouldn't be released before that.
///
/// - Some SPIs can work with 8-bit *and* 16-bit words. You can overload this trait with different
/// `Word` types to allow operation in both modes.
/// `Word` types to allow operation in both modes.
pub trait FullDuplex<Word: Copy = u8>: ErrorType {
/// Reads the word stored in the shift register
///
Expand Down
34 changes: 17 additions & 17 deletions embedded-hal/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,37 +37,37 @@ or a console to operate either on hardware serial ports or on virtual ones like
The HAL

- Must *erase* device specific details. Neither register, register blocks, nor magic values should
appear in the API.
appear in the API.

- Must be generic *within* a device and *across* devices. The API to use a serial interface must
be the same regardless of whether the implementation uses the USART1 or UART4 peripheral of a
device or the UART0 peripheral of another device.
be the same regardless of whether the implementation uses the USART1 or UART4 peripheral of a
device or the UART0 peripheral of another device.

- Where possible must *not* be tied to a specific asynchronous model. The API should be usable
in blocking mode, with the `futures` model, with an async/await model or with a callback model.
(cf. the [`nb`](https://docs.rs/nb) crate)
in blocking mode, with the `futures` model, with an async/await model or with a callback model.
(cf. the [`nb`](https://docs.rs/nb) crate)

- Must be minimal, and thus easy to implement and zero cost, yet highly composable. People that
want higher level abstraction should *prefer to use this HAL* rather than *re-implement*
register manipulation code.
want higher level abstraction should *prefer to use this HAL* rather than *re-implement*
register manipulation code.

- Serve as a foundation for building an ecosystem of platform-agnostic drivers. Here driver
means a library crate that lets a target platform interface an external device like a digital
sensor or a wireless transceiver. The advantage of this system is that by writing the driver as
a generic library on top of `embedded-hal` driver authors can support any number of target
platforms (e.g. Cortex-M microcontrollers, AVR microcontrollers, embedded Linux, etc.). The
advantage for application developers is that by adopting `embedded-hal` they can unlock all
these drivers for their platform.
means a library crate that lets a target platform interface an external device like a digital
sensor or a wireless transceiver. The advantage of this system is that by writing the driver as
a generic library on top of `embedded-hal` driver authors can support any number of target
platforms (e.g. Cortex-M microcontrollers, AVR microcontrollers, embedded Linux, etc.). The
advantage for application developers is that by adopting `embedded-hal` they can unlock all
these drivers for their platform.

- Trait methods must be fallible so that they can be used in any possible situation.
Nevertheless, HAL implementations can additionally provide infallible versions of the same methods
if they can never fail in their platform. This way, generic code can use the fallible abstractions
provided here but platform-specific code can avoid fallibility-related boilerplate if possible.
Nevertheless, HAL implementations can additionally provide infallible versions of the same methods
if they can never fail in their platform. This way, generic code can use the fallible abstractions
provided here but platform-specific code can avoid fallibility-related boilerplate if possible.

## Out of scope

- Initialization and configuration stuff like "ensure this serial interface and that SPI
interface are not using the same pins". The HAL will focus on *doing I/O*.
interface are not using the same pins". The HAL will focus on *doing I/O*.

## Platform agnostic drivers

Expand Down
18 changes: 0 additions & 18 deletions embedded-io-adapters/build.rs

This file was deleted.

5 changes: 5 additions & 0 deletions embedded-io-adapters/src/futures_03.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
//! Adapters to/from `futures::io` traits.
// MSRV is 1.60 if you don't enable async, 1.80 if you do.
// Cargo.toml has 1.60, which makes Clippy complain that `poll_fn` was introduced
// in 1.64. So, just silence it for this file.
#![allow(clippy::incompatible_msrv)]

use core::future::poll_fn;
use core::pin::Pin;

Expand Down
12 changes: 0 additions & 12 deletions embedded-io-adapters/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,6 @@
#![cfg_attr(docsrs, feature(doc_cfg))]
#![warn(missing_docs)]
#![doc = include_str!("../README.md")]
// disable warning for already-stabilized features.
// Needed to pass CI, because we deny warnings.
// We don't immediately remove them to not immediately break older nightlies.
// When all features are stable, we'll remove them.
#![cfg_attr(
all(any(feature = "tokio-1", feature = "futures-03"), nightly),
allow(stable_features)
)]
#![cfg_attr(
all(any(feature = "tokio-1", feature = "futures-03"), nightly),
feature(async_fn_in_trait, impl_trait_projections)
)]

#[cfg(feature = "std")]
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
Expand Down
5 changes: 5 additions & 0 deletions embedded-io-adapters/src/tokio_1.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
//! Adapters to/from `tokio::io` traits.
// MSRV is 1.60 if you don't enable async, 1.80 if you do.
// Cargo.toml has 1.60, which makes Clippy complain that `poll_fn` was introduced
// in 1.64. So, just silence it for this file.
#![allow(clippy::incompatible_msrv)]

use core::future::poll_fn;
use core::pin::Pin;
use core::task::Poll;
Expand Down
18 changes: 0 additions & 18 deletions embedded-io-async/build.rs

This file was deleted.

6 changes: 0 additions & 6 deletions embedded-io-async/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@
#![cfg_attr(docsrs, feature(doc_cfg))]
#![warn(missing_docs)]
#![doc = include_str!("../README.md")]
// disable warning for already-stabilized features.
// Needed to pass CI, because we deny warnings.
// We don't immediately remove them to not immediately break older nightlies.
// When all features are stable, we'll remove them.
#![cfg_attr(nightly, allow(stable_features, unknown_lints))]
#![cfg_attr(nightly, feature(async_fn_in_trait, impl_trait_projections))]
#![allow(async_fn_in_trait)]

#[cfg(feature = "alloc")]
Expand Down
4 changes: 2 additions & 2 deletions embedded-io/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ targets.
## Differences with `std::io`

- `Error` is an associated type. This allows each implementor to return its own error type,
while avoiding `dyn` or `Box`. This is consistent with how errors are handled in [`embedded-hal`](https://github.com/rust-embedded/embedded-hal/).
while avoiding `dyn` or `Box`. This is consistent with how errors are handled in [`embedded-hal`](https://github.com/rust-embedded/embedded-hal/).
- In `std::io`, the `Read`/`Write` traits might be blocking or non-blocking (i.e. returning `WouldBlock` errors) depending on the file descriptor's mode, which is only known at run-time. This allows passing a non-blocking stream to code that expects a blocking
stream, causing unexpected errors. To solve this, `embedded-io` specifies `Read`/`Write` are always blocking, and adds new `ReadReady`/`WriteReady` traits to allow using streams in a non-blocking way.
stream, causing unexpected errors. To solve this, `embedded-io` specifies `Read`/`Write` are always blocking, and adds new `ReadReady`/`WriteReady` traits to allow using streams in a non-blocking way.

## Optional Cargo features

Expand Down

0 comments on commit 5055422

Please sign in to comment.