diff options
| author | bors <bors@rust-lang.org> | 2020-08-01 04:34:05 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-08-01 04:34:05 +0000 |
| commit | 18e2a891999e66d856ea13db879e93076de9e237 (patch) | |
| tree | 9c0d326940607e173861961b77c0b49378a13cd9 /src/rustllvm/CoverageMappingWrapper.cpp | |
| parent | 22e6099330cde0e7b1529774fe27874f8326de7a (diff) | |
| parent | c5114549d74f6092517af6ea630ec5a26317ae93 (diff) | |
| download | rust-18e2a891999e66d856ea13db879e93076de9e237.tar.gz rust-18e2a891999e66d856ea13db879e93076de9e237.zip | |
Auto merge of #74945 - dingxiangfei2009:promote-static-ref-deref, r=oli-obk
[mir] Special treatment for dereferencing a borrow to a static definition Fix #70584. As suggested by @oli-obk in this [comment](https://github.com/rust-lang/rust/issues/70584#issuecomment-626009260), one can chase the definition of the local variable being de-referenced and check if it is a true static variable. If that is the case, `validate_place` will admit the promotion. This is my first time to contribute to `rustc`, and I have two questions. 1. A generalization to some extent is applied to decide if the promotion is possible in the static context. In case that there are more projection operations preceding the de-referencing, `validate_place` recursively decent into inner projection operations. I have put thoughts into its correctness but I am not totally sure about it. 2. I have a hard time to find a good place for the test case. This patch has to do with MIR, but this test case would look out of place compared to other tests in `src/test/ui/mir` or `src/test/ui/borrowck` because it does not generate errors while others do. It is tentatively placed in `src/test/ui/statics` for now. Thank you for any comments and suggestions!
Diffstat (limited to 'src/rustllvm/CoverageMappingWrapper.cpp')
0 files changed, 0 insertions, 0 deletions
