diff options
| author | Steve Klabnik <steve@steveklabnik.com> | 2015-12-09 00:01:17 -0500 |
|---|---|---|
| committer | Steve Klabnik <steve@steveklabnik.com> | 2015-12-09 00:01:17 -0500 |
| commit | ac2cb1fb7d6ce8934ef5dae7e97306db8fc553e0 (patch) | |
| tree | 2abd62186481b2b2957a473477a38c95515b84f9 /src/doc/reference.md | |
| parent | 24a163344a7b94c746cb76aa35d67da7926420b9 (diff) | |
| parent | c8b7e24b142d5599f6f5eaefb0e98e7403b9b975 (diff) | |
| download | rust-ac2cb1fb7d6ce8934ef5dae7e97306db8fc553e0.tar.gz rust-ac2cb1fb7d6ce8934ef5dae7e97306db8fc553e0.zip | |
Rollup merge of #30224 - matklad:super-docs, r=steveklabnik
Make clear that `super` may be included in the path several times. r? @steveklabnik
Diffstat (limited to 'src/doc/reference.md')
| -rw-r--r-- | src/doc/reference.md | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/doc/reference.md b/src/doc/reference.md index 98074f09441..0262ff5a71a 100644 --- a/src/doc/reference.md +++ b/src/doc/reference.md @@ -515,6 +515,25 @@ fn bar() { # fn main() {} ``` +Additionally keyword `super` may be repeated several times after the first +`super` or `self` to refer to ancestor modules. + +```rust +mod a { + fn foo() {} + + mod b { + mod c { + fn foo() { + super::super::foo(); // call a's foo function + self::super::super::foo(); // call a's foo function + } + } + } +} +# fn main() {} +``` + # Syntax extensions A number of minor features of Rust are not central enough to have their own |
