Skip to content

Simplify comments in smart_pointers4.rs - #2444

Open
Minding000 wants to merge 1 commit into
rust-lang:mainfrom
Minding000:simplify-cow-hints
Open

Simplify comments in smart_pointers4.rs#2444
Minding000 wants to merge 1 commit into
rust-lang:mainfrom
Minding000:simplify-cow-hints

Conversation

@Minding000

Copy link
Copy Markdown

Issue

When learning about COW, the explanatory comments through me off a lot!

no mutation occurs [...] and thus also no clone.

There is no clone either way! (when ownership is transferred like in the test this comment is on)

But the result is still owned because it was never borrowed or mutated.

So if it were to be mutated it would no longer be owned?

Changes

  • Moved "because -1 is not positive" explanations to the easier tests above
  • Made it clear that the data is not cloned, the state of the COW does not change and the original data is referenced when ownership is moved.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant