Skip to content

Conversation

hawkw
Copy link
Member

@hawkw hawkw commented Jul 23, 2025

This commit removes one more instance of the #[used] attribute in ringbuf that we don't actually need --- in the macro that generates counted_ringbuf!s when counters are enabled but the actual ringbuf isn't. I had somehow forgotten this in #2167, my bad!

This commit removes one more instance of the `#[used]` attribute in
`ringbuf` that we don't actually need --- in the macro that generates
`counted_ringbuf!`s when counters are enabled but the actual ringbuf
isn't. I had somehow forgotten this in #2167, my bad!
@hawkw hawkw requested review from cbiffle and mkeeter July 23, 2025 17:37
@hawkw hawkw enabled auto-merge (squash) July 23, 2025 19:54
@hawkw hawkw merged commit 7584e1d into master Jul 23, 2025
135 checks passed
@hawkw hawkw deleted the eliza/i-forgor branch July 23, 2025 20:03
hawkw added a commit that referenced this pull request Aug 13, 2025
Currently, Hubris' Rust toolchain is pinned to `nightly-2024-09-17`,
which is from 10 months ago. This is kind of unfortunate, especially
because that nightly is too old to support the Rust 2024 edition, which
means we cannot update our dependencies on any crates where the latest
version is built with Rust 2024.

Beyond just updating the toolchain, there were some noteworthy changes:

- Naked functions are now stable (yay!), but the attribute changed to
  `#[unsafe(naked)]`. Inline assembly in naked functions must now use
  `core::arch::naked_asm!` rather than normal `asm!`. As far as I can
  tell, the only difference between this and regular `asm!` is that it
  does not support `options(noreturn)`, as I believe the `naked_asm!`
  block kind of implies at least some of the codegen differences for
  `noreturn`.
- New warnings on creation of temporary shared references to mutable
  statics showed up in `stm32h7-update-server`, where we were using
  `[T]::as_ptr()` on zero-sized slices in mutable statics that were used
  to get linker-generated addresses. `[T]::as_ptr()` takes an `&self`
  receiver, so this was generating a temporary shared reference to the
  mutable static. I changed this to use `&raw const`, which takes the
  address of the static without creating a shared reference.
- There was a substantial regression in flash and RAM usage on the new
  toolchain due to [a change in the behavior of the `#[used]`
  attribute][1] which revealed [an underlying issue where ringbufs were
  not zero initialized][2]. These issues were resolved separately in
  #2167, #2168, #2170, and oxidecomputer/idolatry#65.

In addition, there were a variety of unremarkable linting changes,
including slightly better dead code detection (which detected some new
dead code), and some annoying clippy nonsense.

Note that this branch requires oxidecomputer/idolatry#65, which updates
`idol` to generate code that doesn't emit warnings with the new
toolchain, and fixes some of the flash/RAM size regression in code
generated by `idol`.

Fixes #2165

[1]: #2165 (comment)
[2]: #2165 (comment)
rusty1968 pushed a commit to rusty1968/hubris that referenced this pull request Sep 15, 2025
This commit removes one more instance of the `#[used]` attribute in
`ringbuf` that we don't actually need --- in the macro that generates
`counted_ringbuf!`s when counters are enabled but the actual ringbuf
isn't. I had somehow forgotten this in oxidecomputer#2167, my bad!
rusty1968 pushed a commit to rusty1968/hubris that referenced this pull request Sep 17, 2025
Currently, Hubris' Rust toolchain is pinned to `nightly-2024-09-17`,
which is from 10 months ago. This is kind of unfortunate, especially
because that nightly is too old to support the Rust 2024 edition, which
means we cannot update our dependencies on any crates where the latest
version is built with Rust 2024.

Beyond just updating the toolchain, there were some noteworthy changes:

- Naked functions are now stable (yay!), but the attribute changed to
  `#[unsafe(naked)]`. Inline assembly in naked functions must now use
  `core::arch::naked_asm!` rather than normal `asm!`. As far as I can
  tell, the only difference between this and regular `asm!` is that it
  does not support `options(noreturn)`, as I believe the `naked_asm!`
  block kind of implies at least some of the codegen differences for
  `noreturn`.
- New warnings on creation of temporary shared references to mutable
  statics showed up in `stm32h7-update-server`, where we were using
  `[T]::as_ptr()` on zero-sized slices in mutable statics that were used
  to get linker-generated addresses. `[T]::as_ptr()` takes an `&self`
  receiver, so this was generating a temporary shared reference to the
  mutable static. I changed this to use `&raw const`, which takes the
  address of the static without creating a shared reference.
- There was a substantial regression in flash and RAM usage on the new
  toolchain due to [a change in the behavior of the `#[used]`
  attribute][1] which revealed [an underlying issue where ringbufs were
  not zero initialized][2]. These issues were resolved separately in
  oxidecomputer#2167, oxidecomputer#2168, oxidecomputer#2170, and oxidecomputer/idolatry#65.

In addition, there were a variety of unremarkable linting changes,
including slightly better dead code detection (which detected some new
dead code), and some annoying clippy nonsense.

Note that this branch requires oxidecomputer/idolatry#65, which updates
`idol` to generate code that doesn't emit warnings with the new
toolchain, and fixes some of the flash/RAM size regression in code
generated by `idol`.

Fixes oxidecomputer#2165

[1]: oxidecomputer#2165 (comment)
[2]: oxidecomputer#2165 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants