-
Notifications
You must be signed in to change notification settings - Fork 13.4k
crater experiment: de-const-stabilize UnsafeCell::get and various as_ptr methods #129399
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
Conversation
r? @Noratrieb rustbot has assigned @Noratrieb. Use |
@bors try |
crater experiment: de-const-stabilize UnsafeCell::get and various as_ptr methods These should not have been stabilized before const_refs_to_cell. For now I mostly want to see whether any code out there actually uses these methods, since it shouldn't be possible to do anything useful with them... Cc `@rust-lang/wg-const-eval`
The job Click to see the possible cause of the failure (guessed by this bot)
|
Well, there's your crater :) regressed: root results (1 different result, 1003546 regressed crates in total) |
Yeah that's the portable-atomic crate itself also providing a I hope there's no way to actually call that function because |
I have done some ugly but functional use of |
☀️ Try build successful - checks-actions |
Alternatively you can use const_eval_select together with |
Turns out there is a way to call this: use std::cell::UnsafeCell;
const FOO2: () = {
let mut x = 42;
let y: &UnsafeCell<i32> = unsafe { std::mem::transmute(&x) };
y.get();
}; Writing to this is obviously UB, though.^^ It'd be fun to figure out whether this is actually done anywhere, but I don't see a reasonably easy way to do that so 🤷 |
These should not have been stabilized before const_refs_to_cell.
For now I mostly want to see whether any code out there actually uses these methods, since it shouldn't be possible to do anything useful with them...
Cc @rust-lang/wg-const-eval