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
Copy file name to clipboardExpand all lines: src/items/extern-crates.md
+4-5
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-1
Original file line number
Diff line number
Diff line change
@@ -45,7 +45,7 @@
45
45
A _function_ consists of a [block] (that's the _body_ of the function),
46
46
along with a name, a set of parameters, and an output type.
47
47
Other than a name, all these are optional.
48
-
Functions are declared with the keyword `fn`.
48
+
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.
49
49
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.
50
50
If the output type is not explicitly stated, it is the [unit type].
Copy file name to clipboardExpand all lines: src/items/generics.md
+4-7
Original file line number
Diff line number
Diff line change
@@ -48,12 +48,8 @@ referred to with path syntax.
48
48
49
49
### Const generics
50
50
51
-
*Const generic parameters* allow items to be generic over constant values. The
52
-
const identifier introduces a name for the constant parameter, and all
53
-
instances of the item must be instantiated with a value of the given type.
54
-
55
-
<!-- TODO: update above to say "introduces a name in the [value namespace]"
56
-
once namespaces are added. -->
51
+
*Const generic parameters* allow items to be generic over constant values.
52
+
The const identifier introduces a name in the [value namespace] for the constant parameter, and all instances of the item must be instantiated with a value of the given type.
57
53
58
54
The only allowed types of const parameters are `u8`, `u16`, `u32`, `u64`, `u128`, `usize`,
59
55
`i8`, `i16`, `i32`, `i64`, `i128`, `isize`, `char` and `bool`.
The trait declaration defines a 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. Associated types are defined in the type namespace. Associated constants and associated functions are defined in the value namespace.
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