@@ -5,40 +5,44 @@ Language
5
5
--------
6
6
- [ You can now use the ` cfg(target_vendor) ` attribute.] [ 57465 ] E.g.
7
7
` #[cfg(target_vendor="linux")] fn main() { println!("Hello Linux!"); } `
8
+ - [ Integer patterns such as in a match expression can now be exhaustive.] [ 56362 ]
9
+ E.g. You can have match statement on a ` u8 ` that covers ` 0..=255 ` and
10
+ you would no longer be required to have a ` _ => unreachable!() ` case.
8
11
- [ You can now have multiple patterns in ` if let ` and ` while let `
9
12
expressions.] [ 57532 ] You can do this with the same syntax as a ` match `
10
13
expression. E.g.
11
14
``` rust
12
15
enum Creature {
13
- Crab (String ),
14
- Person (String ),
16
+ Crab (String ),
17
+ Lobster (String ),
18
+ Person (String ),
15
19
}
16
20
17
21
fn main () {
18
- let state = Creature :: Crab (" Ferris" );
22
+ let state = Creature :: Crab (" Ferris" );
19
23
20
- if let Creature :: Crab (name ) | Creature :: Person (name ) = state {
21
- println! (" This creature's name is: {}" , name );
22
- }
24
+ if let Creature :: Crab (name ) | Creature :: Person (name ) = state {
25
+ println! (" This creature's name is: {}" , name );
26
+ }
23
27
}
24
28
```
25
29
- [ You can now have irrefutable ` if let ` and ` while let ` patterns.] [ 57535 ] Using
26
30
this feature will by default produce a warning as this behaviour can be
27
31
unintuitive. E.g. ` if let _ = 5 {} `
28
32
- [ You can now use ` let ` bindings, assignments, expression statements, and pattern destructuring in
29
33
const functions.] [ 57175 ]
30
- - [ You can now specify multiple attributes in a ` cfg_attr ` attribute.] [ 57332 ]
31
- E.g. ` #[cfg_attr(all(), must_use, optimize)] `
32
- - [ You can now specify a specific alignment with the ` #[repr(packed)] `
33
- attribute.] [ 57049 ] E.g. ` #[repr(packed(2))] struct Foo(i16, i32); ` is a struct
34
- with an alignment of 2 bytes and a size of 6 bytes.
35
- - [ You can now call unsafe constant functions.] [ 57067 ] E.g.
34
+ - [ You can now call unsafe const functions.] [ 57067 ] E.g.
36
35
``` rust
37
36
const unsafe fn foo () -> i32 { 5 }
38
37
const fn bar () -> i32 {
39
38
unsafe { foo () }
40
39
}
41
40
```
41
+ - [ You can now specify multiple attributes in a ` cfg_attr ` attribute.] [ 57332 ]
42
+ E.g. ` #[cfg_attr(all(), must_use, optimize)] `
43
+ - [ You can now specify a specific alignment with the ` #[repr(packed)] `
44
+ attribute.] [ 57049 ] E.g. ` #[repr(packed(2))] struct Foo(i16, i32); ` is a struct
45
+ with an alignment of 2 bytes and a size of 6 bytes.
42
46
- [ You can now import an item from a module as an ` _ ` .] [ 56303 ] This allows you to
43
47
import a trait's impls, and not have the name in the namespace. E.g.
44
48
``` rust
@@ -64,13 +68,17 @@ Compiler
64
68
65
69
Libraries
66
70
---------
67
- - [ The functions ` overflowing_{add, sub, mul, shl, shr} ` are now constant
71
+ - [ The functions ` overflowing_{add, sub, mul, shl, shr} ` are now ` const `
68
72
functions for all numeric types.] [ 57566 ]
69
- - [ The ` get ` method for all ` NonZero ` types is now constant.] [ 57167 ]
73
+ - [ The functions ` rotate_left ` , ` rotate_right ` , and ` wrapping_{add, sub, mul, shl, shr} `
74
+ are now ` const ` functions for all numeric types.] [ 57105 ]
75
+ - [ The functions ` is_positive ` and ` is_negative ` are now ` const ` functions for
76
+ all signed numeric types.] [ 57105 ]
77
+ - [ The ` get ` method for all ` NonZero ` types is now ` const ` .] [ 57167 ]
70
78
- [ The functions ` count_ones ` , ` count_zeros ` , ` leading_zeros ` , ` trailing_zeros ` ,
71
- ` swap_bytes ` , ` from_be ` , ` from_le ` , ` to_be ` , ` to_le ` are now const for all
79
+ ` swap_bytes ` , ` from_be ` , ` from_le ` , ` to_be ` , ` to_le ` are now ` const ` for all
72
80
numeric types.] [ 57234 ]
73
- - [ ` Ipv4Addr::new ` is now a const function] [ 57234 ]
81
+ - [ ` Ipv4Addr::new ` is now a ` const ` function] [ 57234 ]
74
82
75
83
Stabilized APIs
76
84
---------------
@@ -80,17 +88,25 @@ Stabilized APIs
80
88
- [ ` Result::transpose ` ]
81
89
- [ ` convert::identity ` ]
82
90
- [ ` pin::Pin ` ]
91
+ - [ ` marker::Unpin ` ]
92
+ - [ ` marker::PhantomPinned ` ]
83
93
- [ ` Vec::resize_with ` ]
84
94
- [ ` VecDeque::resize_with ` ]
85
95
- [ ` Duration::as_millis ` ]
86
96
- [ ` Duration::as_micros ` ]
87
97
- [ ` Duration::as_nanos ` ]
88
98
99
+
89
100
Cargo
90
101
-----
91
102
- [ Cargo should now rebuild a crate if a file was modified during the initial
92
103
build.] [ cargo/6484 ]
93
104
105
+ Compatibility Notes
106
+ -------------------
107
+ - The functions ` str::{trim_left, trim_right, trim_left_matches, trim_right_matches} `
108
+ are now offically deprecated, and their usage will now produce a warning. Please use the
109
+ ` str::{trim_start, trim_end, trim_start_matches, trim_end_matches} ` functions instead.
94
110
95
111
[ 57615 ] : https://github.com/rust-lang/rust/pull/57615/
96
112
[ 57465 ] : https://github.com/rust-lang/rust/pull/57465/
@@ -110,18 +126,21 @@ Cargo
110
126
[ 56303 ] : https://github.com/rust-lang/rust/pull/56303/
111
127
[ 56351 ] : https://github.com/rust-lang/rust/pull/56351/
112
128
[ 55982 ] : https://github.com/rust-lang/rust/pull/55982/
129
+ [ 57105 ] : https://github.com/rust-lang/rust/pull/57105
113
130
[ cargo/6484 ] : https://github.com/rust-lang/cargo/pull/6484/
114
- [ `unix::FileExt::read_exact_at` ] : https://doc.rust-lang.org/std/os/unix/fs/trait.FileExt.html#read_exact_at
115
- [ `unix::FileExt::write_exact_at` ] : https://doc.rust-lang.org/std/os/unix/fs/trait.FileExt.html#write_exact_at
116
- [ `Option::transpose` ] : https://doc.rust-lang.org/std/option/enum.Option.html#transpose
117
- [ `Result::transpose` ] : https://doc.rust-lang.org/std/result/enum.Result.html#transpose
131
+ [ `unix::FileExt::read_exact_at` ] : https://doc.rust-lang.org/std/os/unix/fs/trait.FileExt.html#method. read_exact_at
132
+ [ `unix::FileExt::write_exact_at` ] : https://doc.rust-lang.org/std/os/unix/fs/trait.FileExt.html#method. write_exact_at
133
+ [ `Option::transpose` ] : https://doc.rust-lang.org/std/option/enum.Option.html#method. transpose
134
+ [ `Result::transpose` ] : https://doc.rust-lang.org/std/result/enum.Result.html#method. transpose
118
135
[ `convert::identity` ] : https://doc.rust-lang.org/std/convert/fn.identity.html
119
136
[ `pin::Pin` ] : https://doc.rust-lang.org/std/pin/struct.Pin.html
120
- [ `Vec::resize_with` ] : https://doc.rust-lang.org/std/vec/struct.Vec.html#resize_with
121
- [ `VecDeque::resize_with` ] : https://doc.rust-lang.org/std/collections/struct.VecDeque.html#resize_with
122
- [ `Duration::as_millis` ] : https://doc.rust-lang.org/std/time/struct.Duration.html#as_millis
123
- [ `Duration::as_micros` ] : https://doc.rust-lang.org/std/time/struct.Duration.html#as_micros
124
- [ `Duration::as_nanos` ] : https://doc.rust-lang.org/std/time/struct.Duration.html#as_millis
137
+ [ `marker::Unpin` ] : https://doc.rust-lang.org/stable/std/marker/trait.Unpin.html
138
+ [ `marker::PhantomPinned` ] : https://doc.rust-lang.org/nightly/std/marker/struct.PhantomPinned.html
139
+ [ `Vec::resize_with` ] : https://doc.rust-lang.org/std/vec/struct.Vec.html#method.resize_with
140
+ [ `VecDeque::resize_with` ] : https://doc.rust-lang.org/std/collections/struct.VecDeque.html#method.resize_with
141
+ [ `Duration::as_millis` ] : https://doc.rust-lang.org/std/time/struct.Duration.html#method.as_millis
142
+ [ `Duration::as_micros` ] : https://doc.rust-lang.org/std/time/struct.Duration.html#method.as_micros
143
+ [ `Duration::as_nanos` ] : https://doc.rust-lang.org/std/time/struct.Duration.html#method.as_nanos
125
144
[ platform-support ] : https://forge.rust-lang.org/platform-support.html
126
145
127
146
Version 1.32.0 (2019-01-17)
0 commit comments