Skip to content

Conversation

@tamird
Copy link
Contributor

@tamird tamird commented Nov 24, 2025

No description provided.

@tamird tamird force-pushed the cleanup-atomics branch 6 times, most recently from 09f7584 to 3a40345 Compare November 24, 2025 22:34
#[allow(dead_code, reason = "not used in all backends")]
mod error;
#[allow(dead_code, reason = "not used in all backends")]
mod lazy;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't unconditionally include lazy. It will cause breakage on platforms without AtomicUsize.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which platorms, please? Are they not included in CI?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting, well it used to be the riscv32imc platforms (which do not have atomics). However, for some reason lazy.rs is building, even on a target like riscv32imc-unknown-none-elf which definitely doesn't have atomics. I'll investigate furthur.

use core::mem::MaybeUninit;

mod backends;
#[allow(dead_code, reason = "not used in all backends")]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this, we only want #[allow(dead_code)] on certain methods in the error module.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are only two pub (crate) items on the error module and prior to this change they are both marked allow(dead_code). Which methods do you not want this on?

@tamird tamird force-pushed the cleanup-atomics branch 7 times, most recently from 320758f to d22e6e5 Compare November 24, 2025 23:47
Copy link
Member

@newpavlov newpavlov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not convinced that we should "simplify" the NetBSD backend by reusing the lazy module. The current code is fairly straightforward and self-contained, I don't see significant issues with it.

This PR also introduces a lot of other IMO unnecessary changes out of scope for the purpose declared in the PR title.

@tamird
Copy link
Contributor Author

tamird commented Nov 25, 2025

Sure, I can break it up into more PRs if you folks prefer. I was just looking for ways to make things a bit more neat. Anyway, I used a macro to introduce LazyPtr which I think works nicely now.

@tamird tamird requested a review from josephlr November 25, 2025 00:11
@tamird tamird changed the title Simplify atomics using LazyUsize Simplify atomics using lazy Nov 25, 2025
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.

3 participants