Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Bad code-section example

Open
#109 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
35/100
Issue type
Documentation
Clarity
Mostly clear
Activity status
Stale
Tech stack
rust
Domain
documentation

Research direction

The disputed Rust snippet is in the guide’s “Borrowing Pointers” section; start there and compile it with each commented line enabled to confirm the behavior. Update the example and explanatory comments so they agree with the observed compiler behavior, then verify the guide renders correctly.

Written by the indexing model from the issue text.

Description

Hey! I'm a beginner, but something worked and on the guide it said it shouldn't have worked.

On the "Borrowing Pointers" section, we've been given this code section:

fn foo() {
    let mut x = 5;            // type: i32
    {
        let y = &mut x;       // type: &mut i32
        //x = 4;              // Error - x has been borrowed
        //println!("{}", x);  // Error - requires borrowing x
    }
    x = 4;                    // OK - y no longer exists
}

First, on lines x = 4 and println!... the comment is a direct contradiction.
Second, uncommenting the println! does work. I'm not sure what that means though, but
something here is unclear.

EDIT: This is also true when uncommenting x = 4. I'm not really sure about the validity of this example.

Thank you!

Dominant language
Rust
Stars
3.9k
Forks
297
PR merge metrics
No merged PRs in 30d

Getting set up

We have not checked this project's setup files yet. Start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from nrc/r4cppp

All issues in nrc/r4cppp

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.