Skip to content

Invalid documentation of borrowed references #154

Description

@lamvak

//let xr2 = &x; // Error - there is already a mutable ref, so we

Ignoring irrelevant grokking, the documentation claims only one mutable borrowed ptr can be taken and that a non mutable ptr cannot be borrowed if already a mutable borrowed ptr exists - both seem incorrect. See the output I'm getting (please ignore the irrelevant grokking) when running below:

https://github.com/lamvak/grokking-rust/blob/e01839a2d589f6a57c4058bbd37be8f908b0280b/first_rust_vs/src/main.rs#L23

C:\Users\lamva\Documents\GitHub\grokking-rust\first_rust_vs>cargo run
Finished dev profile [unoptimized + debuginfo] target(s) in 0.15s
Running target\debug\first_rust_vs.exe
Fib(1) = 1
Fib(5) = 8
Fib(10) = 89
from foo: 5
from foo: 5
from foo2: 5
from foo: 5
and the new val: 15

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions