diff options
| author | bors <bors@rust-lang.org> | 2020-09-08 05:13:42 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-09-08 05:13:42 +0000 |
| commit | e82584a77d019bd5ee4254b5870270b1493763a6 (patch) | |
| tree | b604a20d6fd8c1fae5f042ea0d686e91374410d2 /compiler/rustc_llvm/llvm-wrapper/ArchiveWrapper.cpp | |
| parent | fa79db83f6c48c032bb149fc32999f64187c6f93 (diff) | |
| parent | 28ddda76b730960cdfd35f188345af0299e29517 (diff) | |
| download | rust-e82584a77d019bd5ee4254b5870270b1493763a6.tar.gz rust-e82584a77d019bd5ee4254b5870270b1493763a6.zip | |
Auto merge of #75585 - RalfJung:demotion, r=oli-obk
Do not promote &mut of a non-ZST ever
Since ~pre-1.0~ 1.36, we have accepted code like this:
```rust
static mut TEST: &'static mut [i32] = {
let x = &mut [1,2,3];
x
};
```
I tracked it back to https://github.com/rust-lang/rust/pull/21744, but unfortunately could not find any discussion or RFC that would explain why we thought this was a good idea. And it's not, it breaks all sorts of things -- see https://github.com/rust-lang/rust/issues/75556.
To fix https://github.com/rust-lang/rust/issues/75556, we have to stop promoting non-ZST mutable references no matter the context, which is what this PR does. It's a breaking change.
Notice that this still works, since it does not rely on promotion:
```rust
static mut TEST: &'static mut [i32] = &mut [0,1,2];
```
Cc `@rust-lang/wg-const-eval`
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/ArchiveWrapper.cpp')
0 files changed, 0 insertions, 0 deletions
