-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Move various checks to typeck so them failing causes the typeck result to get tainted #96046
Conversation
Some changes occured to the CTFE / Miri engine cc @rust-lang/miri Some changes occured to the CTFE / Miri engine cc @rust-lang/miri |
r? @jackh726 (rust-highfive has picked a reviewer for you, use r? to override) |
@@ -148,8 +148,6 @@ pub enum InvalidProgramInfo<'tcx> { | |||
/// (which unfortunately typeck does not reject). | |||
/// Not using `FnAbiError` as that contains a nested `LayoutError`. | |||
FnAbiAdjustForForeignAbi(call::AdjustForForeignAbiError), | |||
/// An invalid transmute happened. | |||
TransmuteSizeDiff(Ty<'tcx>, Ty<'tcx>), |
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.
That's great. :D So does this also fix #79047 ?
What about SizeOfUnsizedType
, which seems similar to me?
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.
similar, but when I looked into it it was a different beast that I'll tackle 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.
That's great. :D So does this also fix #79047 ?
yes, the corresponding test has been updated
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.
We might want to keep the issue open for SizeOfUnsizedType
though. Do we have a nice example of that (or an existing separate issue)?
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 think I saw an example when I removed that variant ^^ but I don't remember where
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.
What about SizeOfUnsizedType, which seems similar to me?
I have opened #97477 for this.
☔ The latest upstream changes (presumably #94468) made this pull request unmergeable. Please resolve the merge conflicts. |
This looks fine to me, but I'm not really familiar with this code, so maybe @RalfJung wants to give the final say? |
typeck is outside my purview, sorry -- I can't really help with this PR, other than that I like the end-to-end effect of turning that one check in the interpreter into an assertion. |
Rerolling the reviewer dice r? rust-lang/compiler |
r? rust-lang/compiler |
☔ The latest upstream changes (presumably #96531) made this pull request unmergeable. Please resolve the merge conflicts. |
r? rust-lang/compiler I won't be able to get to reviewing things for the upcoming next couple weeks. |
☔ The latest upstream changes (presumably #96825) made this pull request unmergeable. Please resolve the merge conflicts. |
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 can't really review the typeck algorithm, but left a few questions where comments could be appropriate.
fcx.check_transmutes(); | ||
} | ||
|
||
fcx.check_asms(); |
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.
Why the difference between check_transmutes
and check_asms
?
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 wanted to replicate the previous diagnostics. For transmute that meant not to check if there were other errors already happening, as that would just cause useless errors in the transmute checks
@@ -274,6 +274,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> { | |||
error: &SelectionError<'tcx>, | |||
fallback_has_occurred: bool, | |||
) { | |||
self.set_tainted_by_errors(); |
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.
Does this change anything?
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.
yes. It avoids ICEs and bogus errors in CTFE.
… const eval can avoid running at all
@bors r+ |
📌 Commit 6ba8da6 has been approved by |
⌛ Testing commit 6ba8da6 with merge d3e7c4b8bb35907bab7d8714b84b21e7bc39fda0... |
This comment has been minimized.
This comment has been minimized.
💔 Test failed - checks-actions |
@bors r=cjgillot |
📌 Commit 4332c2f has been approved by |
☀️ Test successful - checks-actions |
Finished benchmarking commit (56fd680): comparison url. Instruction count
Max RSS (memory usage)Results
CyclesResults
If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. @rustbot label: -perf-regression Footnotes |
Fixes #69487
fixes #79047
cc @RalfJung this gets rid of the
Transmute
invalid program error variant