Skip to content

Extend documentation for Ty::to_opt_closure_kind method #121083

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Feb 14, 2024

Conversation

GuillaumeGomez
Copy link
Member

This API was... surprising to use. With a little extra documentation, the weirdness can be reduced quite a lot. :)

r? @compiler-errors

@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 Feb 14, 2024
@rust-log-analyzer

This comment has been minimized.

@GuillaumeGomez GuillaumeGomez force-pushed the doc-to_opt_closure_kind branch from be8acf1 to 6d18764 Compare February 14, 2024 14:03
@@ -2362,6 +2362,19 @@ impl<'tcx> Ty<'tcx> {
/// to represent the closure kind, because it has not yet been
/// inferred. Once upvar inference (in `rustc_hir_analysis/src/check/upvar.rs`)
/// is complete, that type variable will be unified.
///
/// To be noted that you can use [`ClosureArgs::kind()`] or [`CoroutineClosureArgs::kind()`]
/// to get the same information, which you can get by calling [`GenericArgs::as_closure()`].
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or as_coroutine_closure -- depends on the type

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding it. 👍

@GuillaumeGomez GuillaumeGomez force-pushed the doc-to_opt_closure_kind branch from 6d18764 to 9ef9f73 Compare February 14, 2024 14:24
@compiler-errors
Copy link
Member

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Feb 14, 2024

📌 Commit 9ef9f73 has been approved by compiler-errors

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 Feb 14, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 14, 2024
…llaumeGomez

Rollup of 6 pull requests

Successful merges:

 - rust-lang#120893 (Move some tests)
 - rust-lang#120966 (Remove importing suggestions when there is a shadowed typo candidate)
 - rust-lang#121035 (Format `async` trait bounds in rustfmt)
 - rust-lang#121075 (Fix false positive with if let and ranges)
 - rust-lang#121083 (Extend documentation for `Ty::to_opt_closure_kind` method)
 - rust-lang#121084 (Make sure `tcx.create_def` also depends on the forever red node, instead of just `tcx.at(span).create_def`)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit c2ae07d into rust-lang:master Feb 14, 2024
@rustbot rustbot added this to the 1.78.0 milestone Feb 14, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Feb 14, 2024
Rollup merge of rust-lang#121083 - GuillaumeGomez:doc-to_opt_closure_kind, r=compiler-errors

Extend documentation for `Ty::to_opt_closure_kind` method

This API was... surprising to use. With a little extra documentation, the weirdness can be reduced quite a lot. :)

r? `@compiler-errors`
@GuillaumeGomez GuillaumeGomez deleted the doc-to_opt_closure_kind branch February 15, 2024 10:01
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants