-
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
Validate constants during const_eval_raw
#74949
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
r? @RalfJung |
Are you also going to do the renames we talked about? Where the "raw query" returns a One problem I realized for this is that consumers that want to work with |
Idk, should I do them in the same PR? These are pretty invasive to a lot of code, so mixing them with this PR may make it hard to distinguish functional from non-functional changes.
no, this would be exactly the site where we'd use
yes, I was not going to do this change in this PR, as it has its own complexity problems and I worry about the reviewability of such a huge change (I have a local branch working on this seperately). |
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.
Looks great overall. :) But I have a few comments and nits.
Mostly the return type of the |
☔ The latest upstream changes (presumably #75383) made this pull request unmergeable. Please resolve the merge conflicts. |
Add a function to `TyCtxt` for computing an `Allocation` for a `static` item's initializer r? @RalfJung miri-side: rust-lang/miri#1507 split out of rust-lang#74949 (comment) to make that PR leaner
The Miri-affecting change landed so I think this is unblocked. Btw I think the PR description needs updating. |
f759b9c
to
f0978b3
Compare
☔ The latest upstream changes (presumably #75797) made this pull request unmergeable. Please resolve the merge conflicts. |
f0978b3
to
1fc0ba6
Compare
@bors r=RalfJung |
📌 Commit 34785fc has been approved by |
☀️ Test successful - checks-actions, checks-azure |
Tested on commit rust-lang/rust@5e449b9. Direct link to PR: <rust-lang/rust#74949> 💔 miri on windows: test-pass → build-fail (cc @oli-obk @eddyb @RalfJung). 💔 miri on linux: test-pass → build-fail (cc @oli-obk @eddyb @RalfJung).
Looks like this introduced some perf regressions https://perf.rust-lang.org/compare.html?start=10b3595ba6a4c658c9dea105488fc562c815e434&end=5e449b9adff463455743291b0c1f76feec092992&stat=instructions:u |
Uff, 500% on the stress test is heavy.^^ I guess we'll have to revert? :( |
Note that it's just incremental getting worse on ~everything that I checked, so I suspect that probably we're invalidating caches more somewhere -- maybe fixable? But FWIW I am not too worried about incremental perf when the trade-off is worse code or poor checking. Though of course if we can avoid regressing it that would be good :) |
I'll investigate. |
lol found it: |
Fix PR: #77006 |
Hi! This PR showed up in the weekly perf triage report. It resulted in a very large regression in instruction counts of incremental builds (up to 515.8% on Looks like this is already fixed. Nice work all! |
…acrum Cache `eval_to_allocation_raw` on disk rust-lang#74949 (comment) regressed the performance on these queries, this PR gets the perf back.
This PR implements the groundwork for #72396
const_eval_raw
const_eval
query ICEs if used onstatic
itemsConstValue::Scalar
again (since they are just a reference to the actual promoted allocation in most cases).