Skip to content

Commit

Permalink
Minor review edits.
Browse files Browse the repository at this point in the history
  • Loading branch information
ehuss committed Nov 3, 2018
1 parent 5c6449c commit 91b928b
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 23 deletions.
2 changes: 1 addition & 1 deletion src/paths.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ fn bar() {

### `Self`

`Self` with a capital "S" is used to refer to the implementing type within
`Self`, with a capital "S", is used to refer to the implementing type within
[traits] and [implementations].

`Self` can only be used as the first segment, without a preceding `::`.
Expand Down
2 changes: 1 addition & 1 deletion src/types-redirect.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
var fragments = {
"#boolean-type": "types/boolean.html",
"#numeric-types": "types/numeric.html",
"#machine-types": "types/numeric.html#machine-types",
"#machine-types": "types/numeric.html",
"#machine-dependent-integer-types": "types/numeric.html#machine-dependent-integer-types",
"#textual-types": "types/textual.html",
"#never-type": "types/never.html",
Expand Down
5 changes: 2 additions & 3 deletions src/types.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ The list of types is:
* [Boolean]`true` or `false`
* [Numeric] — integer and float
* [Textual]`char` and `str`
* [Never]`!` — a type with no value
* [Never]`!` — a type with no values
* Sequence types:
* [Tuple]
* [Array]
Expand All @@ -35,7 +35,6 @@ The list of types is:
* [Trait objects]
* [Impl trait]


## Type expressions

> **<sup>Syntax</sup>**\
Expand Down Expand Up @@ -90,7 +89,7 @@ require this disambiguation use the [_TypeNoBounds_] rule instead of

```rust
# use std::any::Any;
type T<'a> = &'a(Any + Send);
type T<'a> = &'a (dyn Any + Send);
```

### Inferred type
Expand Down
6 changes: 2 additions & 4 deletions src/types/array.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@
> &nbsp;&nbsp; `[` [_Type_] `;` [_Expression_] `]`
An array is a fixed-size sequence of `N` elements of type `T`. The array type
is written as `[T; N]`.

An array can be allocated on either the stack or the heap. The size is an
expression that evaluates to a [`usize`].
is written as `[T; N]`. The size is an expression that evaluates to a
[`usize`].

Examples:

Expand Down
7 changes: 4 additions & 3 deletions src/types/function-pointer.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@ Function pointer types, written using the `fn` keyword, refer to a function
whose identity is not necessarily known at compile-time. They can be created
via a coercion from both [function items] and non-capturing [closures].

A function pointer type consists of a possibly-empty set of function-type
modifiers (such as `unsafe` or `extern`), a sequence of input types and an
output type.
The `unsafe` qualifier indicates that the type's value is an [unsafe
function], and the `extern` qualifier indicates it is an [extern function].

Variadic parameters can only be specified with [`extern`] function types with
the `"C"` or `"cdecl"` calling convention.
Expand All @@ -52,4 +51,6 @@ x = bo(5,7);
[_Type_]: types.html#type-expressions
[`extern`]: items/external-blocks.html
[closures]: types/closure.html
[extern function]: items/functions.html#extern-functions
[function items]: types/function-item.html
[unsafe function]: unsafe-functions.html
34 changes: 23 additions & 11 deletions src/types/numeric.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,32 @@
# Numeric types

## Machine types
## Integer types

The machine types are the following:
The unsigned integer types consist of:

* The unsigned word types `u8`, `u16`, `u32`, `u64`, and `u128` with values
drawn from the integer intervals [0, 2^8 - 1], [0, 2^16 - 1], [0, 2^32 - 1],
[0, 2^64 - 1], and [0, 2^128 - 1] respectively.
Type | Minimum | Maximum
-------|---------|-------------------
`u8` | 0 | 2<sup>8</sup>-1
`u16` | 0 | 2<sup>16</sup>-1
`u32` | 0 | 2<sup>32</sup>-1
`u64` | 0 | 2<sup>64</sup>-1
`u128` | 0 | 2<sup>128</sup>-1

* The signed two's complement word types `i8`, `i16`, `i32`, `i64`, and `i128`,
with values drawn from the integer intervals [-(2^7), 2^7 - 1],
[-(2^15), 2^15 - 1], [-(2^31), 2^31 - 1], [-(2^63), 2^63 - 1], and
[-(2^127), 2^127 - 1] respectively.
The signed two's complement integer types consist of:

* The IEEE 754-2008 "binary32" and "binary64" floating-point types: `f32` and
`f64`, respectively.
Type | Minimum | Maximum
-------|--------------------|-------------------
`i8` | -(2<sup>7</sup>) | 2<sup>7</sup>-1
`i16` | -(2<sup>15</sup>) | 2<sup>15</sup>-1
`i32` | -(2<sup>31</sup>) | 2<sup>31</sup>-1
`i64` | -(2<sup>63</sup>) | 2<sup>63</sup>-1
`i128` | -(2<sup>127</sup>) | 2<sup>127</sup>-1


## Floating-point types

The IEEE 754-2008 "binary32" and "binary64" floating-point types are `f32` and
`f64`, respectively.

## Machine-dependent integer types

Expand Down

0 comments on commit 91b928b

Please sign in to comment.