Fix promotion in a const when projections are present#65728
Fix promotion in a const when projections are present#65728bors merged 3 commits intorust-lang:masterfrom
const when projections are present#65728Conversation
There was a problem hiding this comment.
The "indirect" thing is irrelevant AFAIK, all you care about is the base.
There was a problem hiding this comment.
I guess we never promote the result of a deref projection, so that guard will never take effect. I could make this a bug or just remove it.
There was a problem hiding this comment.
I've made this an assert for now so it will fail loudly on the test suite if my assumptions are wrong. Probably want to make this a debug_assert or remove it entirely before merging.
There was a problem hiding this comment.
You can just remove it IMO. We really need to stop using "delete StorageDead" for faux promotion, I dislike it more by the minute.
There was a problem hiding this comment.
The assertion has been removed in the latest force push.
3c4e28d to
4eb2936
Compare
|
☔ The latest upstream changes (presumably #65804) made this pull request unmergeable. Please resolve the merge conflicts. |
4eb2936 to
ab93041
Compare
|
☔ The latest upstream changes (presumably #63812) made this pull request unmergeable. Please resolve the merge conflicts. |
|
Ping from triage - the PR has sat idle for a week - thanks. |
ab93041 to
7f613c4
Compare
Previously, this worked in `fn`s but not `const`s or `static`s.
7f613c4 to
420457e
Compare
|
@bors r+ |
|
📌 Commit 420457e has been approved by |
Fix promotion in a `const` when projections are present Resolves #65727. This marks the entire local as "needs promotion" when only a projection of that local appears in a promotable context. This should only affect promotion in a `const` or `static`, not in a `fn` or `const fn`, which is handled in `promote_consts.rs`. r? @eddyb
|
☀️ Test successful - checks-azure |
Resolves #65727.
This marks the entire local as "needs promotion" when only a projection of that local appears in a promotable context. This should only affect promotion in a
constorstatic, not in afnorconst fn, which is handled inpromote_consts.rs.r? @eddyb