-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix promotion in a const
when projections are present
#65728
Conversation
}; | ||
|
||
match promoted_place.base { | ||
PlaceBase::Local(local) if !promoted_place.is_indirect() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The "indirect" thing is irrelevant AFAIK, all you care about is the base.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
const
orstatic
, not in afn
orconst fn
, which is handled inpromote_consts.rs
.r? @eddyb