@@ -2007,110 +2007,110 @@ A complete list of the built-in language items follows:
2007
2007
2008
2008
#### Built-in Traits
2009
2009
2010
- ` send `
2010
+ * ` send `
2011
2011
: Able to be sent across task boundaries.
2012
- ` sized `
2012
+ * ` sized `
2013
2013
: Has a size known at compile time.
2014
- ` copy `
2014
+ * ` copy `
2015
2015
: Types that do not move ownership when used by-value.
2016
- ` share `
2016
+ * ` share `
2017
2017
: Able to be safely shared between tasks when aliased.
2018
- ` drop `
2018
+ * ` drop `
2019
2019
: Have destructors.
2020
2020
2021
2021
#### Operators
2022
2022
2023
2023
These language items are traits:
2024
2024
2025
- ` add `
2025
+ * ` add `
2026
2026
: Elements can be added (for example, integers and floats).
2027
- ` sub `
2027
+ * ` sub `
2028
2028
: Elements can be subtracted.
2029
- ` mul `
2029
+ * ` mul `
2030
2030
: Elements can be multiplied.
2031
- ` div `
2031
+ * ` div `
2032
2032
: Elements have a division operation.
2033
- ` rem `
2033
+ * ` rem `
2034
2034
: Elements have a remainder operation.
2035
- ` neg `
2035
+ * ` neg `
2036
2036
: Elements can be negated arithmetically.
2037
- ` not `
2037
+ * ` not `
2038
2038
: Elements can be negated logically.
2039
- ` bitxor `
2039
+ * ` bitxor `
2040
2040
: Elements have an exclusive-or operation.
2041
- ` bitand `
2041
+ * ` bitand `
2042
2042
: Elements have a bitwise ` and ` operation.
2043
- ` bitor `
2043
+ * ` bitor `
2044
2044
: Elements have a bitwise ` or ` operation.
2045
- ` shl `
2045
+ * ` shl `
2046
2046
: Elements have a left shift operation.
2047
- ` shr `
2047
+ * ` shr `
2048
2048
: Elements have a right shift operation.
2049
- ` index `
2049
+ * ` index `
2050
2050
: Elements can be indexed.
2051
- ` eq `
2051
+ * ` eq `
2052
2052
: Elements can be compared for equality.
2053
- ` ord `
2053
+ * ` ord `
2054
2054
: Elements have a partial ordering.
2055
- ` deref `
2055
+ * ` deref `
2056
2056
: ` * ` can be applied, yielding a reference to another type
2057
- ` deref_mut `
2057
+ * ` deref_mut `
2058
2058
: ` * ` can be applied, yielding a mutable reference to another type
2059
2059
2060
2060
2061
2061
These are functions:
2062
2062
2063
- ` str_eq `
2063
+ * ` str_eq `
2064
2064
: Compare two strings (` &str ` ) for equality.
2065
- ` uniq_str_eq `
2065
+ * ` uniq_str_eq `
2066
2066
: Compare two owned strings (` ~str ` ) for equality.
2067
- ` strdup_uniq `
2067
+ * ` strdup_uniq `
2068
2068
: Return a new unique string
2069
2069
containing a copy of the contents of a unique string.
2070
2070
2071
2071
#### Types
2072
2072
2073
- ` unsafe `
2073
+ * ` unsafe `
2074
2074
: A type whose contents can be mutated through an immutable reference
2075
- ` type_id `
2075
+ * ` type_id `
2076
2076
: The type returned by the ` type_id ` intrinsic.
2077
2077
2078
2078
#### Marker types
2079
2079
2080
2080
These types help drive the compiler's analysis
2081
2081
2082
- ` covariant_type `
2082
+ * ` covariant_type `
2083
2083
: The type parameter should be considered covariant
2084
- ` contravariant_type `
2084
+ * ` contravariant_type `
2085
2085
: The type parameter should be considered contravariant
2086
- ` invariant_type `
2086
+ * ` invariant_type `
2087
2087
: The type parameter should be considered invariant
2088
- ` covariant_lifetime `
2088
+ * ` covariant_lifetime `
2089
2089
: The lifetime parameter should be considered covariant
2090
- ` contravariant_lifetime `
2090
+ * ` contravariant_lifetime `
2091
2091
: The lifetime parameter should be considered contravariant
2092
- ` invariant_lifetime `
2092
+ * ` invariant_lifetime `
2093
2093
: The lifetime parameter should be considered invariant
2094
- ` no_send_bound `
2094
+ * ` no_send_bound `
2095
2095
: This type does not implement "send", even if eligible
2096
- ` no_copy_bound `
2096
+ * ` no_copy_bound `
2097
2097
: This type does not implement "copy", even if eligible
2098
- ` no_share_bound `
2098
+ * ` no_share_bound `
2099
2099
: This type does not implement "share", even if eligible
2100
- ` managed_bound `
2100
+ * ` managed_bound `
2101
2101
: This type implements "managed"
2102
2102
2103
- ` fail_ `
2103
+ * ` fail_ `
2104
2104
: Abort the program with an error.
2105
- ` fail_bounds_check `
2105
+ * ` fail_bounds_check `
2106
2106
: Abort the program with a bounds check error.
2107
- ` exchange_malloc `
2107
+ * ` exchange_malloc `
2108
2108
: Allocate memory on the exchange heap.
2109
- ` exchange_free `
2109
+ * ` exchange_free `
2110
2110
: Free memory that was allocated on the exchange heap.
2111
- ` malloc `
2111
+ * ` malloc `
2112
2112
: Allocate memory on the managed heap.
2113
- ` free `
2113
+ * ` free `
2114
2114
: Free memory that was allocated on the managed heap.
2115
2115
2116
2116
> ** Note:** This list is likely to become out of date. We should auto-generate it
@@ -2618,24 +2618,24 @@ Rust defines six symbolic unary operators.
2618
2618
They are all written as prefix operators,
2619
2619
before the expression they apply to.
2620
2620
2621
- ` - `
2621
+ * ` - `
2622
2622
: Negation. May only be applied to numeric types.
2623
- ` * `
2623
+ * ` * `
2624
2624
: Dereference. When applied to a [ pointer] ( #pointer-types ) it denotes the pointed-to location.
2625
2625
For pointers to mutable locations, the resulting [ lvalue] ( #lvalues-rvalues-and-temporaries ) can be assigned to.
2626
2626
On non-pointer types, it calls the ` deref ` method of the ` std::ops::Deref ` trait, or the
2627
2627
` deref_mut ` method of the ` std::ops::DerefMut ` trait (if implemented by the type and required
2628
2628
for an outer expression that will or could mutate the dereference), and produces the
2629
2629
result of dereferencing the ` & ` or ` &mut ` borrowed pointer returned from the overload method.
2630
2630
2631
- ` ! `
2631
+ * ` ! `
2632
2632
: Logical negation. On the boolean type, this flips between ` true ` and
2633
2633
` false ` . On integer types, this inverts the individual bits in the
2634
2634
two's complement representation of the value.
2635
- ` ~ `
2635
+ * ` ~ `
2636
2636
: [ Boxing] ( #pointer-types ) operators. Allocate a box to hold the value they are applied to,
2637
2637
and store the value in it. ` ~ ` creates an owned box.
2638
- ` & `
2638
+ * ` & `
2639
2639
: Borrow operator. Returns a reference, pointing to its operand.
2640
2640
The operand of a borrow is statically proven to outlive the resulting pointer.
2641
2641
If the borrow-checker cannot prove this, it is a compilation error.
@@ -2656,19 +2656,19 @@ defined in the `std::ops` module of the `std` library.
2656
2656
This means that arithmetic operators can be overridden for user-defined types.
2657
2657
The default meaning of the operators on standard types is given here.
2658
2658
2659
- ` + `
2659
+ * ` + `
2660
2660
: Addition and vector/string concatenation.
2661
2661
Calls the ` add ` method on the ` std::ops::Add ` trait.
2662
- ` - `
2662
+ * ` - `
2663
2663
: Subtraction.
2664
2664
Calls the ` sub ` method on the ` std::ops::Sub ` trait.
2665
- ` * `
2665
+ * ` * `
2666
2666
: Multiplication.
2667
2667
Calls the ` mul ` method on the ` std::ops::Mul ` trait.
2668
- ` / `
2668
+ * ` / `
2669
2669
: Quotient.
2670
2670
Calls the ` div ` method on the ` std::ops::Div ` trait.
2671
- ` % `
2671
+ * ` % `
2672
2672
: Remainder.
2673
2673
Calls the ` rem ` method on the ` std::ops::Rem ` trait.
2674
2674
@@ -2679,19 +2679,19 @@ are syntactic sugar for calls to methods of built-in traits.
2679
2679
This means that bitwise operators can be overridden for user-defined types.
2680
2680
The default meaning of the operators on standard types is given here.
2681
2681
2682
- ` & `
2682
+ * ` & `
2683
2683
: And.
2684
2684
Calls the ` bitand ` method of the ` std::ops::BitAnd ` trait.
2685
- ` | `
2685
+ * ` | `
2686
2686
: Inclusive or.
2687
2687
Calls the ` bitor ` method of the ` std::ops::BitOr ` trait.
2688
- ` ^ `
2688
+ * ` ^ `
2689
2689
: Exclusive or.
2690
2690
Calls the ` bitxor ` method of the ` std::ops::BitXor ` trait.
2691
- ` << `
2691
+ * ` << `
2692
2692
: Logical left shift.
2693
2693
Calls the ` shl ` method of the ` std::ops::Shl ` trait.
2694
- ` >> `
2694
+ * ` >> `
2695
2695
: Logical right shift.
2696
2696
Calls the ` shr ` method of the ` std::ops::Shr ` trait.
2697
2697
@@ -2712,22 +2712,22 @@ syntactic sugar for calls to built-in traits.
2712
2712
This means that comparison operators can be overridden for user-defined types.
2713
2713
The default meaning of the operators on standard types is given here.
2714
2714
2715
- ` == `
2715
+ * ` == `
2716
2716
: Equal to.
2717
2717
Calls the ` eq ` method on the ` std::cmp::Eq ` trait.
2718
- ` != `
2718
+ * ` != `
2719
2719
: Unequal to.
2720
2720
Calls the ` ne ` method on the ` std::cmp::Eq ` trait.
2721
- ` < `
2721
+ * ` < `
2722
2722
: Less than.
2723
2723
Calls the ` lt ` method on the ` std::cmp::Ord ` trait.
2724
- ` > `
2724
+ * ` > `
2725
2725
: Greater than.
2726
2726
Calls the ` gt ` method on the ` std::cmp::Ord ` trait.
2727
- ` <= `
2727
+ * ` <= `
2728
2728
: Less than or equal.
2729
2729
Calls the ` le ` method on the ` std::cmp::Ord ` trait.
2730
- ` >= `
2730
+ * ` >= `
2731
2731
: Greater than or equal.
2732
2732
Calls the ` ge ` method on the ` std::cmp::Ord ` trait.
2733
2733
@@ -3413,7 +3413,7 @@ All pointers in Rust are explicit first-class values.
3413
3413
They can be copied, stored into data structures, and returned from functions.
3414
3414
There are four varieties of pointer in Rust:
3415
3415
3416
- Owning pointers (` ~ ` )
3416
+ * Owning pointers (` ~ ` )
3417
3417
: These point to owned heap allocations (or "boxes") in the shared, inter-task heap.
3418
3418
Each owned box has a single owning pointer; pointer and pointee retain a 1:1 relationship at all times.
3419
3419
Owning pointers are written ` ~content ` ,
@@ -3422,7 +3422,7 @@ Owning pointers (`~`)
3422
3422
it involves allocating a new owned box and copying the contents of the old box into the new box.
3423
3423
Releasing an owning pointer immediately releases its corresponding owned box.
3424
3424
3425
- References (` & ` )
3425
+ * References (` & ` )
3426
3426
: These point to memory _ owned by some other value_ .
3427
3427
References arise by (automatic) conversion from owning pointers, managed pointers,
3428
3428
or by applying the borrowing operator ` & ` to some other value,
@@ -3435,7 +3435,7 @@ References (`&`)
3435
3435
with the exception of temporary values,
3436
3436
which are released when the last reference to them is released.
3437
3437
3438
- Raw pointers (` * ` )
3438
+ * Raw pointers (` * ` )
3439
3439
: Raw pointers are pointers without safety or liveness guarantees.
3440
3440
Raw pointers are written ` *content ` ,
3441
3441
for example ` *int ` means a raw pointer to an integer.
@@ -3609,24 +3609,24 @@ call to the method `make_string`.
3609
3609
Types in Rust are categorized into kinds, based on various properties of the components of the type.
3610
3610
The kinds are:
3611
3611
3612
- ` Send `
3612
+ * ` Send `
3613
3613
: Types of this kind can be safely sent between tasks.
3614
3614
This kind includes scalars, owning pointers, owned closures, and
3615
3615
structural types containing only other owned types.
3616
3616
All ` Send ` types are ` 'static ` .
3617
- ` Copy `
3617
+ * ` Copy `
3618
3618
: Types of this kind consist of "Plain Old Data"
3619
3619
which can be copied by simply moving bits.
3620
3620
All values of this kind can be implicitly copied.
3621
3621
This kind includes scalars and immutable references,
3622
3622
as well as structural types containing other ` Copy ` types.
3623
- ` 'static `
3623
+ * ` 'static `
3624
3624
: Types of this kind do not contain any references (except for
3625
3625
references with the ` static ` lifetime, which are allowed).
3626
3626
This can be a useful guarantee for code
3627
3627
that breaks borrowing assumptions
3628
3628
using [ ` unsafe ` operations] ( #unsafe-functions ) .
3629
- ` Drop `
3629
+ * ` Drop `
3630
3630
: This is not strictly a kind,
3631
3631
but its presence interacts with kinds:
3632
3632
the ` Drop ` trait provides a single method ` drop `
@@ -3638,7 +3638,7 @@ The kinds are:
3638
3638
before any of the values it owns run their destructors.
3639
3639
Only ` Send ` types can implement ` Drop ` .
3640
3640
3641
- _ Default_
3641
+ * _ Default_
3642
3642
: Types with destructors, closure environments,
3643
3643
and various other _ non-first-class_ types,
3644
3644
are not copyable at all.
0 commit comments