-
Notifications
You must be signed in to change notification settings - Fork 59
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
What are the validity invariants for AtomicBool
?
#208
Comments
Are there any public logs for the Zulip group? |
You can log in to zulip with a GitHub account. |
It does expose you email address to others though. |
Well if you put anything that's not 0/1 there then this will be UB: https://doc.rust-lang.org/src/core/sync/atomic.rs.html#351 |
@elichai Yes, the application I'm looking at doesn't provide mutable access, just |
Right now, But what is the motivation here? Why not just use |
Possibly the same answer as with a lot of code: "I didn't write that part over there, I'm just trying to interface with it." Or possibly, "I might expose this to C and I need to know if C will be able to make my data explode" |
I have a trait that says it's okay to take a |
I just woke up so maybe I'm missing some critical information, but if you can take an |
@asajeffrey well it's certainly not safe to have an Right now, in terms of language UB |
To expand on what "library-UB" means: the standard library makes no guarantees about how So yes, for a particular toolchain version, you can breach the standard library privacy boundary, inspects how I think this status quo is fine. |
I agree with @gnzlbg. Closing the issue then, unless someone thinks this should be added to a FAQ like I suggested here. |
The validity invariant for
bool
is that it must be0x01
or0x00
. DoesAtomicBool
have the same requirement, or is it allowed to contain anyu8
? Under the hood, it's anAtomicU8
, so the current implementation doesn't have the requirement of being a validbool
, but is this part of its contract?The text was updated successfully, but these errors were encountered: