Skip to content

Improve diagnostic for Cow::to_owned() usage.#146058

Closed
xonx4l wants to merge 3 commits into
rust-lang:masterfrom
xonx4l:patch-8
Closed

Improve diagnostic for Cow::to_owned() usage.#146058
xonx4l wants to merge 3 commits into
rust-lang:masterfrom
xonx4l:patch-8

Conversation

@xonx4l

@xonx4l xonx4l commented Aug 31, 2025

Copy link
Copy Markdown
Contributor

Fixes #144792

Guide users from Cow::to_owned() to Cow::into_owned() on lifetime error.
Improve diagnostic help for Cow to owned conversions.

@rustbot

rustbot commented Aug 31, 2025

Copy link
Copy Markdown
Collaborator

r? @jackh726

rustbot has assigned @jackh726.
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 Aug 31, 2025
@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job tidy failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)

@Noratrieb

Copy link
Copy Markdown
Member

This has the same code as #144925 except with a few changes that break the build, and it has no attribute to that whatsoever. What was the idea behind this PR?

@Noratrieb Noratrieb closed this Sep 1, 2025
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 1, 2025
@xonx4l

xonx4l commented Sep 3, 2025

Copy link
Copy Markdown
Contributor Author

I wanted to introduce nothing new. It's just a pr with the suggested changes on #144925.

@Noratrieb

Copy link
Copy Markdown
Member

When you take code from somewhere else, you always need to indicate where you got it from and credit it appropriately, you can't just make it look like its your own. You didn't even include a note to the previous PR in the PR description, but ideally you would preserve the authorship of the commit itself so the original author shows up as the author of the commit.

@xonx4l

xonx4l commented Sep 4, 2025

Copy link
Copy Markdown
Contributor Author

I really didn't know about the credit part . In future I will make sure to give full credit. Thanks for educating about this part of open source .

@Noratrieb

Copy link
Copy Markdown
Member

👍 thanks. While it's of course important in open source, it really applies to anything, not just open source.

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

Labels

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.

Bad diagnostic with Cow and to_owned where into_owned was meant

5 participants