diff options
| author | bors <bors@rust-lang.org> | 2020-12-09 09:13:54 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-12-09 09:13:54 +0000 |
| commit | c0bfe3485f97f267cc8adec724f109c56dab5526 (patch) | |
| tree | 110ddab74de64d4acd4a0d416a6f4b0734a508ab /compiler/rustc_codegen_cranelift/src/optimize/code_layout.rs | |
| parent | db85512bd8d922e0785029eff41152b0f35690f1 (diff) | |
| parent | d057a93e6f43eb410b9c348a8fe590bdc4452ae6 (diff) | |
| download | rust-c0bfe3485f97f267cc8adec724f109c56dab5526.tar.gz rust-c0bfe3485f97f267cc8adec724f109c56dab5526.zip | |
Auto merge of #78363 - RalfJung:promotion, r=oli-obk
remove this weird special case from promotion
Promotion has a special case to ignore interior mutability under some specific circumstances. The purpose of this PR is to figure out what changes if we remove that. Since `Cell::new` and friends only get promoted inside `const`/`static` initializers these days, it actually is not easy to exploit this case: you need something like
```rust
const TEST_INTERIOR_MUT: () = {
// The "0." case is already ruled out by not permitting any interior mutability in `const`.
let _val: &'static _ = &(Cell::new(1), 2).1;
};
```
I assume something like `&Some(&(Cell::new(1), 2).1)` would hit the nested case inside `validate_rvalue`... though I am not sure why that would not just trigger nested promotion, first promoting the inner reference and then the outer one?
Fixes https://github.com/rust-lang/rust/issues/67534 (by simply rejecting that code^^)
r? `@oli-obk` (but for now this is not meant to be merged!)
Cc `@rust-lang/wg-const-eval`
Diffstat (limited to 'compiler/rustc_codegen_cranelift/src/optimize/code_layout.rs')
0 files changed, 0 insertions, 0 deletions
