diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2025-03-20 15:26:12 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-03-20 15:26:12 +0300 |
| commit | 904ec4daed54f715786c23ff5aaf7cb1a42de065 (patch) | |
| tree | 8f4687628d748d8a76559249ee05101a052e72f5 | |
| parent | 594eed922d29027fc4fd19d4d88a1c205a730ddb (diff) | |
| parent | 249e5b5a0302830eafb914bff5ff80033e065b62 (diff) | |
| download | rust-904ec4daed54f715786c23ff5aaf7cb1a42de065.tar.gz rust-904ec4daed54f715786c23ff5aaf7cb1a42de065.zip | |
Merge pull request #2199 from sagudev/patch-1
Fix rib example
| -rw-r--r-- | src/doc/rustc-dev-guide/src/name-resolution.md | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/doc/rustc-dev-guide/src/name-resolution.md b/src/doc/rustc-dev-guide/src/name-resolution.md index 2727b8142f2..719ebce8553 100644 --- a/src/doc/rustc-dev-guide/src/name-resolution.md +++ b/src/doc/rustc-dev-guide/src/name-resolution.md @@ -120,9 +120,9 @@ even though they should be visible by ordinary scoping rules. An example: fn do_something<T: Default>(val: T) { // <- New rib in both types and values (1) // `val` is accessible, as is the helper function // `T` is accessible - let helper = || { // New rib on `helper` (2) and another on the block (3) + let helper = || { // New rib on the block (2) // `val` is accessible here - }; // End of (3) + }; // End of (2), new rib on `helper` (3) // `val` is accessible, `helper` variable shadows `helper` function fn helper() { // <- New rib in both types and values (4) // `val` is not accessible here, (4) is not transparent for locals @@ -130,7 +130,7 @@ fn do_something<T: Default>(val: T) { // <- New rib in both types and values (1) } // End of (4) let val = T::default(); // New rib (5) // `val` is the variable, not the parameter here -} // End of (5), (2) and (1) +} // End of (5), (3) and (1) ``` Because the rules for different namespaces are a bit different, each namespace |
