-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Enforce closure args + return type are WF #123531
Conversation
rustbot has assigned @petrochenkov. Use |
oops, no assignee yet @bors try |
cbe150d
to
04b9db9
Compare
Enforce closure args + return type are WF I found this out when investigating rust-lang#123461 (comment). Turns out we don't register WF obligations for closure args and return types, leading to the ICE. I think this is a useful thing to check for, but I'd like to check what the fallout is. Worst case, I think we should enforce this across an edition boundary (and possibly eventually migrate this for all editions).
☀️ Try build successful - checks-actions |
@craterbot check |
👌 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
🚧 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
🎉 Experiment
|
Crater is clean, except for a couple of crates. Opened nkconnor/sharded#8 for the regression that affects one root crate and one dependent crate. Needs FCP. r? types |
I'm gonna FCP this. This PR makes sure that we check the WF of closure args and return types, since previously we were only checking the WF of the signature of item-like fns. This is currently done in hir typeck, because we do inference which is necessary to actually determine the type of such args/returns, but that's an implementation detail and it could be moved elsewhere. This check simply makes sure people write less sketchy code. I don't believe it fixes any soundness (though I wouldn't be surprised if that's not true); it just moves weird errors from the call site to the definition site. @rfcbot fcp merge |
Team member @compiler-errors has proposed to merge this. The next step is review by the rest of the tagged team members: No concerns currently listed. Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
The final comment period, with a disposition to merge, as per the review above, is now complete. As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed. This will be merged soon. |
d08cc4d
to
27abeea
Compare
@bors r=oli-obk |
This comment has been minimized.
This comment has been minimized.
@bors r- |
27abeea
to
870ed4b
Compare
@bors r=oli-obk |
☀️ Test successful - checks-actions |
Finished benchmarking commit (9e6c4fd): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 670.846s -> 670.761s (-0.01%) |
@compiler-errors given the results of #125195, do you want this PR in |
I think every accepted t-types FCP should be considered for relnotes by default. Will manually go through all of them and add them to the release notes once they are up, cc https://rust-lang.zulipchat.com/#narrow/stream/241545-t-release/topic/1.2E78/near/430858983 |
good point @lcnr thanks! |
I found this out when investigating #123461 (comment). Turns out we don't register WF obligations for closure args and return types, leading to the ICE.
I think this is a useful thing to check for, but I'd like to check what the fallout is.crater is complete.Worst case, I think we should enforce this across an edition boundary (and possibly eventually migrate this for all editions) -- this should be super easy to do, since this is a check in HIR wfcheck, so it can be made edition dependent.I believe the regressions are manageable enough to not necessitate edition-specific behavior.Fixes #123461