aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIan McIntyre <me@mciantyre.dev>2025-06-14 10:16:12 -0400
committerIan McIntyre <me@mciantyre.dev>2025-09-16 07:47:23 -0400
commit9728ac5305cfe259115858f0bc49985a0ad7cec4 (patch)
tree16294fb24be29ebedd3099b063348c0520000db4 /src
parentce97696bcd4515b5b2556163aa50c1b4723e7c0f (diff)
Adopt Rust 2024 edition
I'm considering this a breaking change. I'll try to introduce new sections that rely on the user's `unsafe` keyword for linker placement. Rust 2024 has different opinions on format, and clippy has new thoughts. Let's adopt them.
Diffstat (limited to 'src')
-rw-r--r--src/host.rs26
-rw-r--r--src/target.rs10
2 files changed, 15 insertions, 21 deletions
diff --git a/src/host.rs b/src/host.rs
index ba299dd..2598d50 100644
--- a/src/host.rs
+++ b/src/host.rs
@@ -639,12 +639,12 @@ impl RuntimeBuilder {
fn check_configurations(&self) -> Result<(), String> {
if self.family.flexram_bank_count() < self.flexram_banks.bank_count() {
return Err(format!(
- "Chip {:?} only has {} total FlexRAM banks. Cannot allocate {:?}, a total of {} banks",
- self.family,
- self.family.flexram_bank_count(),
- self.flexram_banks,
- self.flexram_banks.bank_count()
- ));
+ "Chip {:?} only has {} total FlexRAM banks. Cannot allocate {:?}, a total of {} banks",
+ self.family,
+ self.family.flexram_bank_count(),
+ self.flexram_banks,
+ self.flexram_banks.bank_count()
+ ));
}
if self.flexram_banks.ocram < self.family.bootrom_ocram_banks() {
return Err(format!(
@@ -653,13 +653,13 @@ impl RuntimeBuilder {
self.family.bootrom_ocram_banks()
));
}
- if let Some(flash_opts) = &self.flash_opts {
- if !flash_opts.flexspi.supported_for_family(self.family) {
- return Err(format!(
- "Chip {:?} does not support {:?}",
- self.family, flash_opts.flexspi
- ));
- }
+ if let Some(flash_opts) = &self.flash_opts
+ && !flash_opts.flexspi.supported_for_family(self.family)
+ {
+ return Err(format!(
+ "Chip {:?} does not support {:?}",
+ self.family, flash_opts.flexspi
+ ));
}
fn prevent_flash(name: &str, memory: Memory) -> Result<(), String> {
diff --git a/src/target.rs b/src/target.rs
index 98072e0..d0e2223 100644
--- a/src/target.rs
+++ b/src/target.rs
@@ -135,14 +135,8 @@ __pre_init:
/// The returned pointer is guaranteed to be 4-byte aligned.
#[inline]
pub fn heap_end() -> *mut u32 {
- extern "C" {
+ unsafe extern "C" {
static mut __eheap: c_void;
}
-
- // It used to be unsafe. Keeping it unsafe is backwards
- // compatible.
- #[allow(unused_unsafe)]
- unsafe {
- core::ptr::addr_of_mut!(__eheap) as _
- }
+ &raw mut __eheap as _
}