crater experiment: de-const-stabilize UnsafeCell::get and various as_ptr methods#129399
crater experiment: de-const-stabilize UnsafeCell::get and various as_ptr methods#129399RalfJung wants to merge 1 commit intorust-lang:masterfrom
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