You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is just a first pass to specifying how each thing introduces
a name, and where it is introduced. This is missing `use` and `Self`.
(And a few things I don't feel like need elaboration, like loop labels,
but those can be added if desired.)
Copy file name to clipboardExpand all lines: src/items/extern-crates.md
+4-5Lines changed: 4 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,11 +11,9 @@
11
11
> `as` ( [IDENTIFIER] | `_` )
12
12
13
13
An _`extern crate` declaration_ specifies a dependency on an external crate.
14
-
The external crate is then bound into the declaring scope as the [identifier]
15
-
provided in the `extern crate` declaration. Additionally, if the `extern
16
-
crate` appears in the crate root, then the crate name is also added to the
17
-
[extern prelude], making it automatically in scope in all modules. The `as`
18
-
clause can be used to bind the imported crate to a different name.
14
+
The external crate is then bound into the declaring scope as the given [identifier] in the [type namespace].
15
+
Additionally, if the `extern crate` appears in the crate root, then the crate name is also added to the [extern prelude], making it automatically in scope in all modules.
16
+
The `as` clause can be used to bind the imported crate to a different name.
19
17
20
18
The external crate is resolved to a specific `soname` at compile time, and a
21
19
runtime linkage requirement to that `soname` is passed to the linker for
@@ -74,6 +72,7 @@ crate to access only its macros.
Copy file name to clipboardExpand all lines: src/items/functions.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -44,7 +44,7 @@
44
44
45
45
A _function_ consists of a [block], along with a name, a set of parameters, and an output type.
46
46
Other than a name, all these are optional.
47
-
Functions are declared with the keyword `fn`.
47
+
Functions are declared with the keyword `fn` which defines the given name in the [value namespace] of the module or block where it is located.
48
48
Functions may declare a set of *input*[*variables*][variables] as parameters, through which the caller passes arguments into the function, and the *output*[*type*][type] of the value the function will return to its caller on completion.
49
49
If the output type is not explicitly stated, it is the [unit type].
The trait declaration defines the trait in the [type namespace] of the module or block where it is located.
21
+
Associated items are defined as members of the trait within their respective namespaces: type namespace for associated types, and value namespace for constants and functions.
22
+
20
23
All traits define an implicit type parameter `Self` that refers to "the type
21
24
that is implementing this interface". Traits may also contain additional type
22
25
parameters. These type parameters, including `Self`, may be constrained by
0 commit comments