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

Shadowing vs Freezing #1834

Open
block0xhash opened this issue Apr 8, 2024 · 1 comment
Open

Shadowing vs Freezing #1834

block0xhash opened this issue Apr 8, 2024 · 1 comment

Comments

@block0xhash
Copy link

This example on Freezing should possibly be updated and moved to section 4.2 that talks of shadowing.
https://doc.rust-lang.org/stable/rust-by-example/variable_bindings/freeze.html

There is no "data freezing" going on based on the mutability state of the variables.

however as explained here #1516 its variable shadowing.

@outlandishlizard
Copy link

outlandishlizard commented Mar 22, 2025

I'm trying to learn rust at the moment and was really confused by this example!

I'm possibly not the best person to write the fixed text since I'm a newbie, but gave it a shot in https://github.com/outlandishlizard/rust-by-example/blob/d8fce5ac365fb5d9e1e6d80efb6e56e01ba6ea83/src/variable_bindings/freeze.md

One question I have is whether we should retain the name of freeze.md at all-- I'd lean towards not doing so and calling it something like shadowing_and_mutability.md instead?

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

2 participants