let state = Creature::Crab("Ferris");
if let Creature::Crab(name) | Creature::Person(name) = state {
- println!("This creature's name is: {}", name);
+ println!("This creature's name is: {}", name);
}
}
```
- [You can now have irrefutable `if let` and `while let` patterns.][57535] Using
this feature will by default produce a warning as this behaviour can be
unintuitive. E.g. `if let _ = 5 {}`
-- [You can now use `let` bindings, assignments, expression statements, and pattern destructuring in
- const functions.][57175]
+- [You can now use `let` bindings, assignments, expression statements,
+ and irrefutable pattern destructuring in const functions.][57175]
- [You can now call unsafe const functions.][57067] E.g.
```rust
const unsafe fn foo() -> i32 { 5 }
const fn bar() -> i32 {
- unsafe { foo() }
+ unsafe { foo() }
}
```
- [You can now specify multiple attributes in a `cfg_attr` attribute.][57332]
Libraries
---------
-- [The functions `overflowing_{add, sub, mul, shl, shr}` are now `const`
+- [The methods `overflowing_{add, sub, mul, shl, shr}` are now `const`
functions for all numeric types.][57566]
-- [The functions `rotate_left`, `rotate_right`, and `wrapping_{add, sub, mul, shl, shr}`
+- [The methods `rotate_left`, `rotate_right`, and `wrapping_{add, sub, mul, shl, shr}`
are now `const` functions for all numeric types.][57105]
-- [The functions `is_positive` and `is_negative` are now `const` functions for
+- [The methods `is_positive` and `is_negative` are now `const` functions for
all signed numeric types.][57105]
- [The `get` method for all `NonZero` types is now `const`.][57167]
-- [The functions `count_ones`, `count_zeros`, `leading_zeros`, `trailing_zeros`,
+- [The methods `count_ones`, `count_zeros`, `leading_zeros`, `trailing_zeros`,
`swap_bytes`, `from_be`, `from_le`, `to_be`, `to_le` are now `const` for all
numeric types.][57234]
- [`Ipv4Addr::new` is now a `const` function][57234]
Stabilized APIs
---------------
- [`unix::FileExt::read_exact_at`]
-- [`unix::FileExt::write_exact_at`]
+- [`unix::FileExt::write_all_at`]
- [`Option::transpose`]
- [`Result::transpose`]
- [`convert::identity`]
Compatibility Notes
-------------------
-- The functions `str::{trim_left, trim_right, trim_left_matches, trim_right_matches}`
- are now offically deprecated, and their usage will now produce a warning. Please use the
- `str::{trim_start, trim_end, trim_start_matches, trim_end_matches}` functions instead.
+- The methods `str::{trim_left, trim_right, trim_left_matches, trim_right_matches}`
+ are now deprecated in the standard library, and their usage will now produce a warning.
+ Please use the `str::{trim_start, trim_end, trim_start_matches, trim_end_matches}`
+ methods instead.
[57615]: https://github.com/rust-lang/rust/pull/57615/
[57465]: https://github.com/rust-lang/rust/pull/57465/