Chapter 5.2 - Taking ownership VS taking reference
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 18.3k
- Forks
- 4.1k
- Avg merge
- 14m
- Merged PRs (30d)
- 1
Description
Hi, here in Chapter 5.2 I read that the dbg! macro takes ownership instead of taking reference
and its use is dbg!(&rect1).
However, this seems in contrast with what I read in Chapter 4.2, that for example the function calculate_length takes a reference instead of taking ownership (calculate_length(&s1)).
Am I misunderstanding how dbg! works or it is also taking a reference (and println! takes ownership instead)?
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.
Research direction
Start with the referenced passages in src/ch05-02-example-structs.md and src/ch04-02-references-and-borrowing.md, then check the relevant Rust documentation for dbg! and println!. Determine whether the wording creates a contradiction and update the chapter text so the ownership and borrowing behavior is explained consistently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100