Skip to content

Suggest returning a reference for unsized place from a closure#152162

Open
chenyukang wants to merge 1 commit intorust-lang:mainfrom
chenyukang:yukang-fix-152064-unsized-closure-return
Open

Suggest returning a reference for unsized place from a closure#152162
chenyukang wants to merge 1 commit intorust-lang:mainfrom
chenyukang:yukang-fix-152064-unsized-closure-return

Conversation

@chenyukang
Copy link
Copy Markdown
Member

@chenyukang chenyukang commented Feb 5, 2026

Fixes #152064

There are 3 similar note:
the size for values of type str cannot be known at compilation time
for different spans, maybe need more work to remove some of them.

This PR only adds a suggestion for using a reference.

@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 5, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Feb 5, 2026

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

@rust-log-analyzer

This comment has been minimized.

@chenyukang chenyukang marked this pull request as draft February 5, 2026 11:20
@rustbot rustbot 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-review Status: Awaiting review from the assignee but also interested parties. labels Feb 5, 2026
@chenyukang chenyukang force-pushed the yukang-fix-152064-unsized-closure-return branch from 882fe19 to cb75047 Compare February 5, 2026 11:40
@rustbot rustbot added the T-clippy Relevant to the Clippy team. label Feb 5, 2026
@rust-log-analyzer

This comment has been minimized.

@MostAwesomeDude
Copy link
Copy Markdown

I haven't tested this, but from reading your patch, it looks like this will be very helpful to the next newbie after me. Thank you so much for picking this up!

@chenyukang chenyukang marked this pull request as ready for review March 26, 2026 07:40
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Mar 26, 2026

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 26, 2026
@rustbot

This comment has been minimized.

@chenyukang chenyukang marked this pull request as draft March 26, 2026 07:44
@rustbot rustbot 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-review Status: Awaiting review from the assignee but also interested parties. labels Mar 26, 2026
@chenyukang chenyukang force-pushed the yukang-fix-152064-unsized-closure-return branch from cb75047 to b4469fc Compare March 26, 2026 08:07
@rust-log-analyzer

This comment has been minimized.

@chenyukang chenyukang force-pushed the yukang-fix-152064-unsized-closure-return branch from b4469fc to d153f44 Compare March 26, 2026 10:39
@rust-log-analyzer

This comment has been minimized.

@chenyukang chenyukang force-pushed the yukang-fix-152064-unsized-closure-return branch from d153f44 to f34db2f Compare March 26, 2026 12:03
@chenyukang chenyukang marked this pull request as ready for review March 29, 2026 09:48
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 29, 2026
@petrochenkov
Copy link
Copy Markdown
Contributor

@bors r+

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors bot commented Apr 7, 2026

📌 Commit f34db2f has been approved by petrochenkov

It is now in the queue for this repository.

@rust-bors rust-bors bot 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 7, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Apr 7, 2026
…ed-closure-return, r=petrochenkov

Suggest returning a reference for unsized place from a closure

Fixes rust-lang#152064

There are 3 similar note:
`the size for values of type str cannot be known at compilation time`
for different spans, maybe need more work to remove some of them.

This PR only adds a suggestion for using a reference.
@JonathanBrouwer
Copy link
Copy Markdown
Contributor

@bors r-
#154952 (comment)

@rust-bors rust-bors bot 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 7, 2026
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors bot commented Apr 7, 2026

This pull request was unapproved.

This PR was contained in a rollup (#154952), which was unapproved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-clippy Relevant to the Clippy team. 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.

When returning an unsized place from a closure, should suggest returning a reference to it instead

6 participants