Ownership and moves page lacks explanation
Nobody has claimed this yet.
Assessment
- Difficulty
- 1/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
- Issue type
- Documentation
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- rust
- Domain
- documentation
Research direction
Start with the Ownership and moves page linked in the issue and inspect its source. Clarify why the integer assignment is a copy and the boxed value assignment is a move, mention the Copy trait, and link to its documentation; done when the page explicitly explains both examples.
Written by the indexing model from the issue text.
Description
I would like to open a discussion about this page: Ownership and moves
The (paraphrased) code on the page says:
// _Stack_ allocated integer
let x = 5u32;
// *Copy* `x` into `y` - no resources are moved
let y = x;
// `a` is a pointer to a _heap_ allocated integer
let a = Box::new(5i32);
// *Move* `a` into `b`
let b = a;
The comment says // _Stack_ allocated integer. I thought that u32 is copied because it implements Trait std::marker::Copy, not because it happens to be on the stack. Am I unclear on the concept?
Copy vs. move is a super-important concept, and I think that there should be an explicit explanation here of WHY let y = x; is a copy and let b = a; is a move. That might mean one short paragraph mentioning Copy and why u32 implements by default it would be good. Also, a link to the trait Copy page. Even if this information is elsewhere in the book, I still think it still should be made explicitly clear here.
- Dominant language
- Handlebars
- Stars
- 8.1k
- Forks
- 1.6k
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from rust-lang/rust-by-example
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
rust-lang/rust-by-example#2031 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 62/100
rust-lang/rust-by-example#1846 · 1 comment · 4 reactions ·
-
Difficulty 1/5 Under an hour Newbie friendliness 65/100
rust-lang/rust-by-example#1581 ·
-
enhancement good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
rust-lang/rust-by-example#1256 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
rust-lang/rust-by-example#2023 ·
All issues in rust-lang/rust-by-example
Similar issues
-
user-reported
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Kong/developer.konghq.com#7316 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
HarperFast/skills#96 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
infinispan/infinispan#18150 ·
-
bug triage:deciding
Difficulty 1/5 Under an hour Newbie friendliness 88/100
open-telemetry/otel-arrow#4132 ·
-
Ecosystem: ClawMetry — the Qwen Code reader is now free and open source (follow-up to #9294 / #9338) Opencategory/integration priority/P3 scope/documentation status/ready-for-human type/feature-request
Difficulty 1/5 Under an hour Newbie friendliness 84/100