@@ -944,9 +944,20 @@ fn foo<T>(x: T) where T: Debug {
944
944
```
945
945
946
946
When a generic function is referenced, its type is instantiated based on the
947
- context of the reference. For example, calling the ` iter ` function defined
948
- above on ` [1, 2] ` will instantiate type parameter ` T ` with ` i32 ` , and require
949
- the closure parameter to have type ` Fn(i32) ` .
947
+ context of the reference. For example, calling the ` foo ` function here:
948
+
949
+ ```
950
+ use std::fmt::Debug;
951
+
952
+ fn foo<T>(x: &[T]) where T: Debug {
953
+ // details elided
954
+ # ()
955
+ }
956
+
957
+ foo(&[1, 2]);
958
+ ```
959
+
960
+ will instantiate type parameter ` T ` with ` i32 ` .
950
961
951
962
The type parameters can also be explicitly supplied in a trailing
952
963
[ path] ( #paths ) component after the function name. This might be necessary if
@@ -2768,22 +2779,24 @@ meaning of the operators on standard types is given here.
2768
2779
Like the [ arithmetic operators] ( #arithmetic-operators ) , bitwise operators are
2769
2780
syntactic sugar for calls to methods of built-in traits. This means that
2770
2781
bitwise operators can be overridden for user-defined types. The default
2771
- meaning of the operators on standard types is given here.
2782
+ meaning of the operators on standard types is given here. Bitwise ` & ` , ` | ` and
2783
+ ` ^ ` applied to boolean arguments are equivalent to logical ` && ` , ` || ` and ` != `
2784
+ evaluated in non-lazy fashion.
2772
2785
2773
2786
* ` & `
2774
- : And .
2787
+ : Bitwise AND .
2775
2788
Calls the ` bitand ` method of the ` std::ops::BitAnd ` trait.
2776
2789
* ` | `
2777
- : Inclusive or .
2790
+ : Bitwise inclusive OR .
2778
2791
Calls the ` bitor ` method of the ` std::ops::BitOr ` trait.
2779
2792
* ` ^ `
2780
- : Exclusive or .
2793
+ : Bitwise exclusive OR .
2781
2794
Calls the ` bitxor ` method of the ` std::ops::BitXor ` trait.
2782
2795
* ` << `
2783
2796
: Left shift.
2784
2797
Calls the ` shl ` method of the ` std::ops::Shl ` trait.
2785
2798
* ` >> `
2786
- : Right shift.
2799
+ : Right shift (arithmetic) .
2787
2800
Calls the ` shr ` method of the ` std::ops::Shr ` trait.
2788
2801
2789
2802
#### Lazy boolean operators
0 commit comments