diff options
| author | bors <bors@rust-lang.org> | 2024-02-06 21:43:11 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-02-06 21:43:11 +0000 |
| commit | 256b6fb19a2c018eaad4806d2369d1f6a71fc6ec (patch) | |
| tree | 228a703127a9a4f1d17e13c1dc2550a2077a3f7b /tests/ui/const-generics/condition-in-trait-const-arg.rs | |
| parent | 0d531351e848ad69a03c704d40985c9003847427 (diff) | |
| parent | 0184ca695bf10416211163008c3432d9d8144852 (diff) | |
| download | rust-256b6fb19a2c018eaad4806d2369d1f6a71fc6ec.tar.gz rust-256b6fb19a2c018eaad4806d2369d1f6a71fc6ec.zip | |
Auto merge of #117905 - RalfJung:no-const-mut, r=lcnr
revert stabilization of const_intrinsic_copy
`@rust-lang/wg-const-eval` I don't know what we were thinking when we approved https://github.com/rust-lang/rust/pull/97276... const-eval isn't supposed to be able to mutate anything yet! It's also near impossible to actually call `copy` in const on stable since `&mut` expressions are generally unstable. However, there's one exception...
```rust
static mut INT: i32 = unsafe {
let val = &mut [1]; // `&mut` on arrays is allowed in `static mut`
(val as *mut [i32; 1]).copy_from(&[42], 1);
val[0]
};
fn main() { unsafe {
dbg!(INT);
} }
```
Inside `static mut`, we accept some `&mut` since ~forever, to make `static mut FOO: &mut [T] = &mut [...];` work. We reject any attempt to actually write to that mutable reference though... except for the `copy` functions.
I think we should revert stabilizing these functions that take `*mut`, and then re-stabilize them together with `ptr.write` once mutable references are stable.
(This will likely fail on PowerPC until https://github.com/rust-lang/stdarch/pull/1497 lands. But we'll need a crater run first anyway.)
Diffstat (limited to 'tests/ui/const-generics/condition-in-trait-const-arg.rs')
0 files changed, 0 insertions, 0 deletions
