Skip to content
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

Merged
merged 3 commits into from
Apr 25, 2024

Conversation

compiler-errors
Copy link
Member

@compiler-errors compiler-errors commented Apr 6, 2024

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

@rustbot
Copy link
Collaborator

rustbot commented Apr 6, 2024

r? @petrochenkov

rustbot has assigned @petrochenkov.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Apr 6, 2024
@compiler-errors
Copy link
Member Author

oops, no assignee yet

@bors try

@bors
Copy link
Contributor

bors commented Apr 6, 2024

⌛ Testing commit 04b9db9 with merge 18fb860...

bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 6, 2024
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).
@bors
Copy link
Contributor

bors commented Apr 6, 2024

☀️ Try build successful - checks-actions
Build commit: 18fb860 (18fb860b8a8e7ca508746882328061d0fe352543)

@compiler-errors
Copy link
Member Author

@craterbot check

@craterbot
Copy link
Collaborator

👌 Experiment pr-123531 created and queued.
🤖 Automatically detected try build 18fb860
🔍 You can check out the queue and this experiment's details.

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot craterbot added S-waiting-on-crater Status: Waiting on a crater run to be completed. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 6, 2024
@craterbot
Copy link
Collaborator

🚧 Experiment pr-123531 is now running

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot
Copy link
Collaborator

🎉 Experiment pr-123531 is completed!
📊 4 regressed and 1 fixed (434664 total)
📰 Open the full report.

⚠️ If you notice any spurious failure please add them to the blacklist!
ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot craterbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-crater Status: Waiting on a crater run to be completed. labels Apr 7, 2024
@compiler-errors
Copy link
Member Author

compiler-errors commented Apr 8, 2024

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

@rustbot rustbot added the T-types Relevant to the types team, which will review and decide on the PR/issue. label Apr 8, 2024
@compiler-errors compiler-errors added the needs-fcp This change is insta-stable, so needs a completed FCP to proceed. label Apr 8, 2024
@compiler-errors compiler-errors removed the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Apr 10, 2024
@compiler-errors
Copy link
Member Author

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

@rfcbot
Copy link

rfcbot commented Apr 10, 2024

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.

@rfcbot rfcbot added proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. labels Apr 10, 2024
@rfcbot
Copy link

rfcbot commented Apr 25, 2024

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.

@compiler-errors
Copy link
Member Author

@bors r=oli-obk

@bors
Copy link
Contributor

bors commented Apr 25, 2024

📌 Commit 27abeea has been approved by oli-obk

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 25, 2024
@rust-log-analyzer

This comment has been minimized.

@compiler-errors
Copy link
Member Author

@bors r-

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Apr 25, 2024
@compiler-errors
Copy link
Member Author

@bors r=oli-obk

@bors
Copy link
Contributor

bors commented Apr 25, 2024

📌 Commit 870ed4b has been approved by oli-obk

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Apr 25, 2024
@bors
Copy link
Contributor

bors commented Apr 25, 2024

⌛ Testing commit 870ed4b with merge 9e6c4fd...

@bors
Copy link
Contributor

bors commented Apr 25, 2024

☀️ Test successful - checks-actions
Approved by: oli-obk
Pushing 9e6c4fd to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Apr 25, 2024
@bors bors merged commit 9e6c4fd into rust-lang:master Apr 25, 2024
11 checks passed
@rustbot rustbot added this to the 1.79.0 milestone Apr 25, 2024
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (9e6c4fd): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results

This 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.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-3.0% [-3.0%, -3.0%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -3.0% [-3.0%, -3.0%] 1

Cycles

This benchmark run did not return any relevant results for this metric.

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 670.846s -> 670.761s (-0.01%)
Artifact size: 316.00 MiB -> 315.95 MiB (-0.01%)

@apiraino apiraino removed the to-announce Announce this issue on triage meeting label Apr 29, 2024
@apiraino
Copy link
Contributor

apiraino commented May 21, 2024

@compiler-errors given the results of #125195, do you want this PR in relnotes? Thanks

@lcnr
Copy link
Contributor

lcnr commented May 21, 2024

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

@apiraino
Copy link
Contributor

good point @lcnr thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this PR / Issue. merged-by-bors This PR was explicitly merged by bors. needs-fcp This change is insta-stable, so needs a completed FCP to proceed. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-types Relevant to the types team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ICE: argument to transmute has inference variables