diff options
| author | Dario Nieuwenhuis <[email protected]> | 2024-07-25 14:09:24 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-07-25 14:09:24 +0000 |
| commit | 43b878708d6d15e97112d7f6fa8c88086cb38c85 (patch) | |
| tree | e31b0d20672194e7c3c3f190835d10e46f200dd5 | |
| parent | 8b4bb625be86e7c199a14ceffbed7ad87b99a8db (diff) | |
| parent | 2d678d695637ed1023fd80fea482d60a288e4343 (diff) | |
Merge pull request #3209 from embassy-rs/rust180
Update to Rust 1.80, make check-cfg unconditional.
| -rwxr-xr-x | ci.sh | 6 | ||||
| -rw-r--r-- | embassy-executor/build_common.rs | 21 | ||||
| -rw-r--r-- | embassy-hal-internal/build_common.rs | 21 | ||||
| -rw-r--r-- | embassy-rp/src/i2c.rs | 18 | ||||
| -rw-r--r-- | embassy-stm32/build_common.rs | 21 | ||||
| -rw-r--r-- | embassy-stm32/src/adc/mod.rs | 1 | ||||
| -rw-r--r-- | embassy-stm32/src/opamp.rs | 2 | ||||
| -rw-r--r-- | embassy-stm32/src/ospi/mod.rs | 17 | ||||
| -rw-r--r-- | embassy-stm32/src/spi/mod.rs | 1 | ||||
| -rw-r--r-- | embassy-sync/build_common.rs | 21 | ||||
| -rw-r--r-- | embassy-usb/src/msos.rs | 2 | ||||
| -rw-r--r-- | rust-toolchain.toml | 2 |
12 files changed, 22 insertions, 111 deletions
| @@ -10,12 +10,6 @@ if ! command -v cargo-batch &> /dev/null; then | |||
| 10 | exit 1 | 10 | exit 1 |
| 11 | fi | 11 | fi |
| 12 | 12 | ||
| 13 | # check-cfg is stable on rustc 1.79 but not cargo 1.79. | ||
| 14 | # however, our cargo-batch is currently based on cargo 1.80, which does support check-cfg. | ||
| 15 | # so, force build.rs scripts to emit check-cfg commands. | ||
| 16 | # when 1.80 hits stable we can make build.rs unconditionally emit check-cfg and remove all this. | ||
| 17 | export EMBASSY_FORCE_CHECK_CFG=1 | ||
| 18 | |||
| 19 | export RUSTFLAGS=-Dwarnings | 13 | export RUSTFLAGS=-Dwarnings |
| 20 | export DEFMT_LOG=trace,embassy_hal_internal=debug,embassy_net_esp_hosted=debug,cyw43=info,cyw43_pio=info,smoltcp=info | 14 | export DEFMT_LOG=trace,embassy_hal_internal=debug,embassy_net_esp_hosted=debug,cyw43=info,cyw43_pio=info,smoltcp=info |
| 21 | if [[ -z "${CARGO_TARGET_DIR}" ]]; then | 15 | if [[ -z "${CARGO_TARGET_DIR}" ]]; then |
diff --git a/embassy-executor/build_common.rs b/embassy-executor/build_common.rs index 0487eb3c5..4f24e6d37 100644 --- a/embassy-executor/build_common.rs +++ b/embassy-executor/build_common.rs | |||
| @@ -8,8 +8,6 @@ | |||
| 8 | 8 | ||
| 9 | use std::collections::HashSet; | 9 | use std::collections::HashSet; |
| 10 | use std::env; | 10 | use std::env; |
| 11 | use std::ffi::OsString; | ||
| 12 | use std::process::Command; | ||
| 13 | 11 | ||
| 14 | /// Helper for emitting cargo instruction for enabling configs (`cargo:rustc-cfg=X`) and declaring | 12 | /// Helper for emitting cargo instruction for enabling configs (`cargo:rustc-cfg=X`) and declaring |
| 15 | /// them (`cargo:rust-check-cfg=cfg(X)`). | 13 | /// them (`cargo:rust-check-cfg=cfg(X)`). |
| @@ -17,7 +15,6 @@ use std::process::Command; | |||
| 17 | pub struct CfgSet { | 15 | pub struct CfgSet { |
| 18 | enabled: HashSet<String>, | 16 | enabled: HashSet<String>, |
| 19 | declared: HashSet<String>, | 17 | declared: HashSet<String>, |
| 20 | emit_declared: bool, | ||
| 21 | } | 18 | } |
| 22 | 19 | ||
| 23 | impl CfgSet { | 20 | impl CfgSet { |
| @@ -25,7 +22,6 @@ impl CfgSet { | |||
| 25 | Self { | 22 | Self { |
| 26 | enabled: HashSet::new(), | 23 | enabled: HashSet::new(), |
| 27 | declared: HashSet::new(), | 24 | declared: HashSet::new(), |
| 28 | emit_declared: is_rustc_nightly(), | ||
| 29 | } | 25 | } |
| 30 | } | 26 | } |
| 31 | 27 | ||
| @@ -49,7 +45,7 @@ impl CfgSet { | |||
| 49 | /// | 45 | /// |
| 50 | /// This enables rustc to check that the configs in `#[cfg(...)]` attributes are valid. | 46 | /// This enables rustc to check that the configs in `#[cfg(...)]` attributes are valid. |
| 51 | pub fn declare(&mut self, cfg: impl AsRef<str>) { | 47 | pub fn declare(&mut self, cfg: impl AsRef<str>) { |
| 52 | if self.declared.insert(cfg.as_ref().to_owned()) && self.emit_declared { | 48 | if self.declared.insert(cfg.as_ref().to_owned()) { |
| 53 | println!("cargo:rustc-check-cfg=cfg({})", cfg.as_ref()); | 49 | println!("cargo:rustc-check-cfg=cfg({})", cfg.as_ref()); |
| 54 | } | 50 | } |
| 55 | } | 51 | } |
| @@ -69,21 +65,6 @@ impl CfgSet { | |||
| 69 | } | 65 | } |
| 70 | } | 66 | } |
| 71 | 67 | ||
| 72 | fn is_rustc_nightly() -> bool { | ||
| 73 | if env::var_os("EMBASSY_FORCE_CHECK_CFG").is_some() { | ||
| 74 | return true; | ||
| 75 | } | ||
| 76 | |||
| 77 | let rustc = env::var_os("RUSTC").unwrap_or_else(|| OsString::from("rustc")); | ||
| 78 | |||
| 79 | let output = Command::new(rustc) | ||
| 80 | .arg("--version") | ||
| 81 | .output() | ||
| 82 | .expect("failed to run `rustc --version`"); | ||
| 83 | |||
| 84 | String::from_utf8_lossy(&output.stdout).contains("nightly") | ||
| 85 | } | ||
| 86 | |||
| 87 | /// Sets configs that describe the target platform. | 68 | /// Sets configs that describe the target platform. |
| 88 | pub fn set_target_cfgs(cfgs: &mut CfgSet) { | 69 | pub fn set_target_cfgs(cfgs: &mut CfgSet) { |
| 89 | let target = env::var("TARGET").unwrap(); | 70 | let target = env::var("TARGET").unwrap(); |
diff --git a/embassy-hal-internal/build_common.rs b/embassy-hal-internal/build_common.rs index 0487eb3c5..4f24e6d37 100644 --- a/embassy-hal-internal/build_common.rs +++ b/embassy-hal-internal/build_common.rs | |||
| @@ -8,8 +8,6 @@ | |||
| 8 | 8 | ||
| 9 | use std::collections::HashSet; | 9 | use std::collections::HashSet; |
| 10 | use std::env; | 10 | use std::env; |
| 11 | use std::ffi::OsString; | ||
| 12 | use std::process::Command; | ||
| 13 | 11 | ||
| 14 | /// Helper for emitting cargo instruction for enabling configs (`cargo:rustc-cfg=X`) and declaring | 12 | /// Helper for emitting cargo instruction for enabling configs (`cargo:rustc-cfg=X`) and declaring |
| 15 | /// them (`cargo:rust-check-cfg=cfg(X)`). | 13 | /// them (`cargo:rust-check-cfg=cfg(X)`). |
| @@ -17,7 +15,6 @@ use std::process::Command; | |||
| 17 | pub struct CfgSet { | 15 | pub struct CfgSet { |
| 18 | enabled: HashSet<String>, | 16 | enabled: HashSet<String>, |
| 19 | declared: HashSet<String>, | 17 | declared: HashSet<String>, |
| 20 | emit_declared: bool, | ||
| 21 | } | 18 | } |
| 22 | 19 | ||
| 23 | impl CfgSet { | 20 | impl CfgSet { |
| @@ -25,7 +22,6 @@ impl CfgSet { | |||
| 25 | Self { | 22 | Self { |
| 26 | enabled: HashSet::new(), | 23 | enabled: HashSet::new(), |
| 27 | declared: HashSet::new(), | 24 | declared: HashSet::new(), |
| 28 | emit_declared: is_rustc_nightly(), | ||
| 29 | } | 25 | } |
| 30 | } | 26 | } |
| 31 | 27 | ||
| @@ -49,7 +45,7 @@ impl CfgSet { | |||
| 49 | /// | 45 | /// |
| 50 | /// This enables rustc to check that the configs in `#[cfg(...)]` attributes are valid. | 46 | /// This enables rustc to check that the configs in `#[cfg(...)]` attributes are valid. |
| 51 | pub fn declare(&mut self, cfg: impl AsRef<str>) { | 47 | pub fn declare(&mut self, cfg: impl AsRef<str>) { |
| 52 | if self.declared.insert(cfg.as_ref().to_owned()) && self.emit_declared { | 48 | if self.declared.insert(cfg.as_ref().to_owned()) { |
| 53 | println!("cargo:rustc-check-cfg=cfg({})", cfg.as_ref()); | 49 | println!("cargo:rustc-check-cfg=cfg({})", cfg.as_ref()); |
| 54 | } | 50 | } |
| 55 | } | 51 | } |
| @@ -69,21 +65,6 @@ impl CfgSet { | |||
| 69 | } | 65 | } |
| 70 | } | 66 | } |
| 71 | 67 | ||
| 72 | fn is_rustc_nightly() -> bool { | ||
| 73 | if env::var_os("EMBASSY_FORCE_CHECK_CFG").is_some() { | ||
| 74 | return true; | ||
| 75 | } | ||
| 76 | |||
| 77 | let rustc = env::var_os("RUSTC").unwrap_or_else(|| OsString::from("rustc")); | ||
| 78 | |||
| 79 | let output = Command::new(rustc) | ||
| 80 | .arg("--version") | ||
| 81 | .output() | ||
| 82 | .expect("failed to run `rustc --version`"); | ||
| 83 | |||
| 84 | String::from_utf8_lossy(&output.stdout).contains("nightly") | ||
| 85 | } | ||
| 86 | |||
| 87 | /// Sets configs that describe the target platform. | 68 | /// Sets configs that describe the target platform. |
| 88 | pub fn set_target_cfgs(cfgs: &mut CfgSet) { | 69 | pub fn set_target_cfgs(cfgs: &mut CfgSet) { |
| 89 | let target = env::var("TARGET").unwrap(); | 70 | let target = env::var("TARGET").unwrap(); |
diff --git a/embassy-rp/src/i2c.rs b/embassy-rp/src/i2c.rs index 10d3c86b3..ac2b1bc5a 100644 --- a/embassy-rp/src/i2c.rs +++ b/embassy-rp/src/i2c.rs | |||
| @@ -312,13 +312,13 @@ impl<'d, T: Instance> I2c<'d, T, Async> { | |||
| 312 | } | 312 | } |
| 313 | } | 313 | } |
| 314 | 314 | ||
| 315 | /// Read from address into buffer using DMA. | 315 | /// Read from address into buffer asynchronously. |
| 316 | pub async fn read_async(&mut self, addr: impl Into<u16>, buffer: &mut [u8]) -> Result<(), Error> { | 316 | pub async fn read_async(&mut self, addr: impl Into<u16>, buffer: &mut [u8]) -> Result<(), Error> { |
| 317 | Self::setup(addr.into())?; | 317 | Self::setup(addr.into())?; |
| 318 | self.read_async_internal(buffer, true, true).await | 318 | self.read_async_internal(buffer, true, true).await |
| 319 | } | 319 | } |
| 320 | 320 | ||
| 321 | /// Write to address from buffer using DMA. | 321 | /// Write to address from buffer asynchronously. |
| 322 | pub async fn write_async( | 322 | pub async fn write_async( |
| 323 | &mut self, | 323 | &mut self, |
| 324 | addr: impl Into<u16>, | 324 | addr: impl Into<u16>, |
| @@ -328,7 +328,7 @@ impl<'d, T: Instance> I2c<'d, T, Async> { | |||
| 328 | self.write_async_internal(bytes, true).await | 328 | self.write_async_internal(bytes, true).await |
| 329 | } | 329 | } |
| 330 | 330 | ||
| 331 | /// Write to address from bytes and read from address into buffer using DMA. | 331 | /// Write to address from bytes and read from address into buffer asynchronously. |
| 332 | pub async fn write_read_async( | 332 | pub async fn write_read_async( |
| 333 | &mut self, | 333 | &mut self, |
| 334 | addr: impl Into<u16>, | 334 | addr: impl Into<u16>, |
| @@ -779,9 +779,6 @@ pub fn i2c_reserved_addr(addr: u16) -> bool { | |||
| 779 | } | 779 | } |
| 780 | 780 | ||
| 781 | pub(crate) trait SealedInstance { | 781 | pub(crate) trait SealedInstance { |
| 782 | const TX_DREQ: u8; | ||
| 783 | const RX_DREQ: u8; | ||
| 784 | |||
| 785 | fn regs() -> crate::pac::i2c::I2c; | 782 | fn regs() -> crate::pac::i2c::I2c; |
| 786 | fn reset() -> crate::pac::resets::regs::Peripherals; | 783 | fn reset() -> crate::pac::resets::regs::Peripherals; |
| 787 | fn waker() -> &'static AtomicWaker; | 784 | fn waker() -> &'static AtomicWaker; |
| @@ -816,11 +813,8 @@ pub trait Instance: SealedInstance { | |||
| 816 | } | 813 | } |
| 817 | 814 | ||
| 818 | macro_rules! impl_instance { | 815 | macro_rules! impl_instance { |
| 819 | ($type:ident, $irq:ident, $reset:ident, $tx_dreq:expr, $rx_dreq:expr) => { | 816 | ($type:ident, $irq:ident, $reset:ident) => { |
| 820 | impl SealedInstance for peripherals::$type { | 817 | impl SealedInstance for peripherals::$type { |
| 821 | const TX_DREQ: u8 = $tx_dreq; | ||
| 822 | const RX_DREQ: u8 = $rx_dreq; | ||
| 823 | |||
| 824 | #[inline] | 818 | #[inline] |
| 825 | fn regs() -> pac::i2c::I2c { | 819 | fn regs() -> pac::i2c::I2c { |
| 826 | pac::$type | 820 | pac::$type |
| @@ -846,8 +840,8 @@ macro_rules! impl_instance { | |||
| 846 | }; | 840 | }; |
| 847 | } | 841 | } |
| 848 | 842 | ||
| 849 | impl_instance!(I2C0, I2C0_IRQ, set_i2c0, 32, 33); | 843 | impl_instance!(I2C0, I2C0_IRQ, set_i2c0); |
| 850 | impl_instance!(I2C1, I2C1_IRQ, set_i2c1, 34, 35); | 844 | impl_instance!(I2C1, I2C1_IRQ, set_i2c1); |
| 851 | 845 | ||
| 852 | /// SDA pin. | 846 | /// SDA pin. |
| 853 | pub trait SdaPin<T: Instance>: crate::gpio::Pin {} | 847 | pub trait SdaPin<T: Instance>: crate::gpio::Pin {} |
diff --git a/embassy-stm32/build_common.rs b/embassy-stm32/build_common.rs index 0487eb3c5..4f24e6d37 100644 --- a/embassy-stm32/build_common.rs +++ b/embassy-stm32/build_common.rs | |||
| @@ -8,8 +8,6 @@ | |||
| 8 | 8 | ||
| 9 | use std::collections::HashSet; | 9 | use std::collections::HashSet; |
| 10 | use std::env; | 10 | use std::env; |
| 11 | use std::ffi::OsString; | ||
| 12 | use std::process::Command; | ||
| 13 | 11 | ||
| 14 | /// Helper for emitting cargo instruction for enabling configs (`cargo:rustc-cfg=X`) and declaring | 12 | /// Helper for emitting cargo instruction for enabling configs (`cargo:rustc-cfg=X`) and declaring |
| 15 | /// them (`cargo:rust-check-cfg=cfg(X)`). | 13 | /// them (`cargo:rust-check-cfg=cfg(X)`). |
| @@ -17,7 +15,6 @@ use std::process::Command; | |||
| 17 | pub struct CfgSet { | 15 | pub struct CfgSet { |
| 18 | enabled: HashSet<String>, | 16 | enabled: HashSet<String>, |
| 19 | declared: HashSet<String>, | 17 | declared: HashSet<String>, |
| 20 | emit_declared: bool, | ||
| 21 | } | 18 | } |
| 22 | 19 | ||
| 23 | impl CfgSet { | 20 | impl CfgSet { |
| @@ -25,7 +22,6 @@ impl CfgSet { | |||
| 25 | Self { | 22 | Self { |
| 26 | enabled: HashSet::new(), | 23 | enabled: HashSet::new(), |
| 27 | declared: HashSet::new(), | 24 | declared: HashSet::new(), |
| 28 | emit_declared: is_rustc_nightly(), | ||
| 29 | } | 25 | } |
| 30 | } | 26 | } |
| 31 | 27 | ||
| @@ -49,7 +45,7 @@ impl CfgSet { | |||
| 49 | /// | 45 | /// |
| 50 | /// This enables rustc to check that the configs in `#[cfg(...)]` attributes are valid. | 46 | /// This enables rustc to check that the configs in `#[cfg(...)]` attributes are valid. |
| 51 | pub fn declare(&mut self, cfg: impl AsRef<str>) { | 47 | pub fn declare(&mut self, cfg: impl AsRef<str>) { |
| 52 | if self.declared.insert(cfg.as_ref().to_owned()) && self.emit_declared { | 48 | if self.declared.insert(cfg.as_ref().to_owned()) { |
| 53 | println!("cargo:rustc-check-cfg=cfg({})", cfg.as_ref()); | 49 | println!("cargo:rustc-check-cfg=cfg({})", cfg.as_ref()); |
| 54 | } | 50 | } |
| 55 | } | 51 | } |
| @@ -69,21 +65,6 @@ impl CfgSet { | |||
| 69 | } | 65 | } |
| 70 | } | 66 | } |
| 71 | 67 | ||
| 72 | fn is_rustc_nightly() -> bool { | ||
| 73 | if env::var_os("EMBASSY_FORCE_CHECK_CFG").is_some() { | ||
| 74 | return true; | ||
| 75 | } | ||
| 76 | |||
| 77 | let rustc = env::var_os("RUSTC").unwrap_or_else(|| OsString::from("rustc")); | ||
| 78 | |||
| 79 | let output = Command::new(rustc) | ||
| 80 | .arg("--version") | ||
| 81 | .output() | ||
| 82 | .expect("failed to run `rustc --version`"); | ||
| 83 | |||
| 84 | String::from_utf8_lossy(&output.stdout).contains("nightly") | ||
| 85 | } | ||
| 86 | |||
| 87 | /// Sets configs that describe the target platform. | 68 | /// Sets configs that describe the target platform. |
| 88 | pub fn set_target_cfgs(cfgs: &mut CfgSet) { | 69 | pub fn set_target_cfgs(cfgs: &mut CfgSet) { |
| 89 | let target = env::var("TARGET").unwrap(); | 70 | let target = env::var("TARGET").unwrap(); |
diff --git a/embassy-stm32/src/adc/mod.rs b/embassy-stm32/src/adc/mod.rs index 7a7d7cd8e..26b729f70 100644 --- a/embassy-stm32/src/adc/mod.rs +++ b/embassy-stm32/src/adc/mod.rs | |||
| @@ -2,6 +2,7 @@ | |||
| 2 | 2 | ||
| 3 | #![macro_use] | 3 | #![macro_use] |
| 4 | #![allow(missing_docs)] // TODO | 4 | #![allow(missing_docs)] // TODO |
| 5 | #![cfg_attr(adc_f3_v2, allow(unused))] | ||
| 5 | 6 | ||
| 6 | #[cfg(not(adc_f3_v2))] | 7 | #[cfg(not(adc_f3_v2))] |
| 7 | #[cfg_attr(adc_f1, path = "f1.rs")] | 8 | #[cfg_attr(adc_f1, path = "f1.rs")] |
diff --git a/embassy-stm32/src/opamp.rs b/embassy-stm32/src/opamp.rs index ca94a573d..789176b3d 100644 --- a/embassy-stm32/src/opamp.rs +++ b/embassy-stm32/src/opamp.rs | |||
| @@ -45,6 +45,7 @@ pub struct OpAmpOutput<'d, T: Instance> { | |||
| 45 | /// OpAmp internal outputs, wired directly to ADC inputs. | 45 | /// OpAmp internal outputs, wired directly to ADC inputs. |
| 46 | /// | 46 | /// |
| 47 | /// This struct can be used as an ADC input. | 47 | /// This struct can be used as an ADC input. |
| 48 | #[cfg(opamp_g4)] | ||
| 48 | pub struct OpAmpInternalOutput<'d, T: Instance> { | 49 | pub struct OpAmpInternalOutput<'d, T: Instance> { |
| 49 | _inner: &'d OpAmp<'d, T>, | 50 | _inner: &'d OpAmp<'d, T>, |
| 50 | } | 51 | } |
| @@ -184,6 +185,7 @@ impl<'d, T: Instance> Drop for OpAmpOutput<'d, T> { | |||
| 184 | } | 185 | } |
| 185 | } | 186 | } |
| 186 | 187 | ||
| 188 | #[cfg(opamp_g4)] | ||
| 187 | impl<'d, T: Instance> Drop for OpAmpInternalOutput<'d, T> { | 189 | impl<'d, T: Instance> Drop for OpAmpInternalOutput<'d, T> { |
| 188 | fn drop(&mut self) { | 190 | fn drop(&mut self) { |
| 189 | T::regs().csr().modify(|w| { | 191 | T::regs().csr().modify(|w| { |
diff --git a/embassy-stm32/src/ospi/mod.rs b/embassy-stm32/src/ospi/mod.rs index f6eb0d17c..289bfa672 100644 --- a/embassy-stm32/src/ospi/mod.rs +++ b/embassy-stm32/src/ospi/mod.rs | |||
| @@ -1060,10 +1060,6 @@ pub(crate) trait SealedInstance { | |||
| 1060 | const REGS: Regs; | 1060 | const REGS: Regs; |
| 1061 | } | 1061 | } |
| 1062 | 1062 | ||
| 1063 | trait SealedWord { | ||
| 1064 | const CONFIG: u8; | ||
| 1065 | } | ||
| 1066 | |||
| 1067 | /// OSPI instance trait. | 1063 | /// OSPI instance trait. |
| 1068 | #[allow(private_bounds)] | 1064 | #[allow(private_bounds)] |
| 1069 | pub trait Instance: Peripheral<P = Self> + SealedInstance + RccPeripheral {} | 1065 | pub trait Instance: Peripheral<P = Self> + SealedInstance + RccPeripheral {} |
| @@ -1110,17 +1106,14 @@ impl<'d, T: Instance, M: PeriMode> GetConfig for Ospi<'d, T, M> { | |||
| 1110 | 1106 | ||
| 1111 | /// Word sizes usable for OSPI. | 1107 | /// Word sizes usable for OSPI. |
| 1112 | #[allow(private_bounds)] | 1108 | #[allow(private_bounds)] |
| 1113 | pub trait Word: word::Word + SealedWord {} | 1109 | pub trait Word: word::Word {} |
| 1114 | 1110 | ||
| 1115 | macro_rules! impl_word { | 1111 | macro_rules! impl_word { |
| 1116 | ($T:ty, $config:expr) => { | 1112 | ($T:ty) => { |
| 1117 | impl SealedWord for $T { | ||
| 1118 | const CONFIG: u8 = $config; | ||
| 1119 | } | ||
| 1120 | impl Word for $T {} | 1113 | impl Word for $T {} |
| 1121 | }; | 1114 | }; |
| 1122 | } | 1115 | } |
| 1123 | 1116 | ||
| 1124 | impl_word!(u8, 8); | 1117 | impl_word!(u8); |
| 1125 | impl_word!(u16, 16); | 1118 | impl_word!(u16); |
| 1126 | impl_word!(u32, 32); | 1119 | impl_word!(u32); |
diff --git a/embassy-stm32/src/spi/mod.rs b/embassy-stm32/src/spi/mod.rs index 656676d9f..20718147a 100644 --- a/embassy-stm32/src/spi/mod.rs +++ b/embassy-stm32/src/spi/mod.rs | |||
| @@ -1282,6 +1282,7 @@ pub(crate) struct Info { | |||
| 1282 | struct State {} | 1282 | struct State {} |
| 1283 | 1283 | ||
| 1284 | impl State { | 1284 | impl State { |
| 1285 | #[allow(unused)] | ||
| 1285 | const fn new() -> Self { | 1286 | const fn new() -> Self { |
| 1286 | Self {} | 1287 | Self {} |
| 1287 | } | 1288 | } |
diff --git a/embassy-sync/build_common.rs b/embassy-sync/build_common.rs index 0487eb3c5..4f24e6d37 100644 --- a/embassy-sync/build_common.rs +++ b/embassy-sync/build_common.rs | |||
| @@ -8,8 +8,6 @@ | |||
| 8 | 8 | ||
| 9 | use std::collections::HashSet; | 9 | use std::collections::HashSet; |
| 10 | use std::env; | 10 | use std::env; |
| 11 | use std::ffi::OsString; | ||
| 12 | use std::process::Command; | ||
| 13 | 11 | ||
| 14 | /// Helper for emitting cargo instruction for enabling configs (`cargo:rustc-cfg=X`) and declaring | 12 | /// Helper for emitting cargo instruction for enabling configs (`cargo:rustc-cfg=X`) and declaring |
| 15 | /// them (`cargo:rust-check-cfg=cfg(X)`). | 13 | /// them (`cargo:rust-check-cfg=cfg(X)`). |
| @@ -17,7 +15,6 @@ use std::process::Command; | |||
| 17 | pub struct CfgSet { | 15 | pub struct CfgSet { |
| 18 | enabled: HashSet<String>, | 16 | enabled: HashSet<String>, |
| 19 | declared: HashSet<String>, | 17 | declared: HashSet<String>, |
| 20 | emit_declared: bool, | ||
| 21 | } | 18 | } |
| 22 | 19 | ||
| 23 | impl CfgSet { | 20 | impl CfgSet { |
| @@ -25,7 +22,6 @@ impl CfgSet { | |||
| 25 | Self { | 22 | Self { |
| 26 | enabled: HashSet::new(), | 23 | enabled: HashSet::new(), |
| 27 | declared: HashSet::new(), | 24 | declared: HashSet::new(), |
| 28 | emit_declared: is_rustc_nightly(), | ||
| 29 | } | 25 | } |
| 30 | } | 26 | } |
| 31 | 27 | ||
| @@ -49,7 +45,7 @@ impl CfgSet { | |||
| 49 | /// | 45 | /// |
| 50 | /// This enables rustc to check that the configs in `#[cfg(...)]` attributes are valid. | 46 | /// This enables rustc to check that the configs in `#[cfg(...)]` attributes are valid. |
| 51 | pub fn declare(&mut self, cfg: impl AsRef<str>) { | 47 | pub fn declare(&mut self, cfg: impl AsRef<str>) { |
| 52 | if self.declared.insert(cfg.as_ref().to_owned()) && self.emit_declared { | 48 | if self.declared.insert(cfg.as_ref().to_owned()) { |
| 53 | println!("cargo:rustc-check-cfg=cfg({})", cfg.as_ref()); | 49 | println!("cargo:rustc-check-cfg=cfg({})", cfg.as_ref()); |
| 54 | } | 50 | } |
| 55 | } | 51 | } |
| @@ -69,21 +65,6 @@ impl CfgSet { | |||
| 69 | } | 65 | } |
| 70 | } | 66 | } |
| 71 | 67 | ||
| 72 | fn is_rustc_nightly() -> bool { | ||
| 73 | if env::var_os("EMBASSY_FORCE_CHECK_CFG").is_some() { | ||
| 74 | return true; | ||
| 75 | } | ||
| 76 | |||
| 77 | let rustc = env::var_os("RUSTC").unwrap_or_else(|| OsString::from("rustc")); | ||
| 78 | |||
| 79 | let output = Command::new(rustc) | ||
| 80 | .arg("--version") | ||
| 81 | .output() | ||
| 82 | .expect("failed to run `rustc --version`"); | ||
| 83 | |||
| 84 | String::from_utf8_lossy(&output.stdout).contains("nightly") | ||
| 85 | } | ||
| 86 | |||
| 87 | /// Sets configs that describe the target platform. | 68 | /// Sets configs that describe the target platform. |
| 88 | pub fn set_target_cfgs(cfgs: &mut CfgSet) { | 69 | pub fn set_target_cfgs(cfgs: &mut CfgSet) { |
| 89 | let target = env::var("TARGET").unwrap(); | 70 | let target = env::var("TARGET").unwrap(); |
diff --git a/embassy-usb/src/msos.rs b/embassy-usb/src/msos.rs index 25936d084..9f4e1a57b 100644 --- a/embassy-usb/src/msos.rs +++ b/embassy-usb/src/msos.rs | |||
| @@ -278,6 +278,7 @@ pub enum DescriptorType { | |||
| 278 | 278 | ||
| 279 | /// Table 5. Descriptor set information structure. | 279 | /// Table 5. Descriptor set information structure. |
| 280 | #[allow(non_snake_case)] | 280 | #[allow(non_snake_case)] |
| 281 | #[allow(unused)] | ||
| 281 | #[repr(C, packed(1))] | 282 | #[repr(C, packed(1))] |
| 282 | pub struct DescriptorSetInformation { | 283 | pub struct DescriptorSetInformation { |
| 283 | dwWindowsVersion: u32, | 284 | dwWindowsVersion: u32, |
| @@ -288,6 +289,7 @@ pub struct DescriptorSetInformation { | |||
| 288 | 289 | ||
| 289 | /// Table 4. Microsoft OS 2.0 platform capability descriptor header. | 290 | /// Table 4. Microsoft OS 2.0 platform capability descriptor header. |
| 290 | #[allow(non_snake_case)] | 291 | #[allow(non_snake_case)] |
| 292 | #[allow(unused)] | ||
| 291 | #[repr(C, packed(1))] | 293 | #[repr(C, packed(1))] |
| 292 | pub struct PlatformDescriptor { | 294 | pub struct PlatformDescriptor { |
| 293 | bLength: u8, | 295 | bLength: u8, |
diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 037fc5c6a..ce9040a70 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | [toolchain] | 1 | [toolchain] |
| 2 | channel = "1.79" | 2 | channel = "1.80" |
| 3 | components = [ "rust-src", "rustfmt", "llvm-tools" ] | 3 | components = [ "rust-src", "rustfmt", "llvm-tools" ] |
| 4 | targets = [ | 4 | targets = [ |
| 5 | "thumbv7em-none-eabi", | 5 | "thumbv7em-none-eabi", |
