Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid documentation of borrowed references #154

Open
lamvak opened this issue Dec 20, 2024 · 0 comments
Open

Invalid documentation of borrowed references #154

lamvak opened this issue Dec 20, 2024 · 0 comments

Comments

@lamvak
Copy link

lamvak commented Dec 20, 2024

//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

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

No branches or pull requests

1 participant