-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a short discussion of shadowing and ownership in ch. 04
Fixes #4001.
- Loading branch information
1 parent
09239f3
commit 937528c
Showing
4 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
6 changes: 6 additions & 0 deletions
6
listings/ch04-understanding-ownership/no-listing-04b-shadowing/Cargo.lock
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
6 changes: 6 additions & 0 deletions
6
listings/ch04-understanding-ownership/no-listing-04b-shadowing/Cargo.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[package] | ||
name = "ownership" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
[dependencies] |
8 changes: 8 additions & 0 deletions
8
listings/ch04-understanding-ownership/no-listing-04b-shadowing/src/main.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
fn main() { | ||
// ANCHOR: here | ||
let s = String::from("hello"); | ||
let s = String::from("ahoy"); | ||
|
||
println!("{s}, world!"); | ||
// ANCHOR_END: here | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters