-
Notifications
You must be signed in to change notification settings - Fork 207
ringbuf: Remove unused #[used]
we weren't using
#2170
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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!
mkeeter
approved these changes
Jul 23, 2025
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This commit removes one more instance of the
#[used]
attribute inringbuf
that we don't actually need --- in the macro that generatescounted_ringbuf!
s when counters are enabled but the actual ringbuf isn't. I had somehow forgotten this in #2167, my bad!