diff options
| author | Eric Huss <eric@huss.org> | 2022-01-07 20:20:55 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-01-07 20:20:55 -0800 |
| commit | 83de77dd5e2b853b95a12ac8c6cc202eec81892b (patch) | |
| tree | 57928649c0153e1430b43c8321f382440156a168 /library/std/src | |
| parent | e012a191d768adeda1ee36a99ef8b92d51920154 (diff) | |
| parent | a02639dc09fa0cde2cec73e6260d6702e165b8ce (diff) | |
Rollup merge of #84640 - ids1024:u8_from_char, r=m-ou-se
Implement `TryFrom<char>` for `u8` Previously suggested in https://github.com/rust-lang/rfcs/issues/2854. It makes sense to have this since `char` implements `From<u8>`. Likewise `u32`, `u64`, and `u128` (since #79502) implement `From<char>`.
Diffstat (limited to 'library/std/src')
| -rw-r--r-- | library/std/src/error.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/library/std/src/error.rs b/library/std/src/error.rs index 6ae0bc47a94..ea0c230fa42 100644 --- a/library/std/src/error.rs +++ b/library/std/src/error.rs @@ -478,6 +478,9 @@ impl Error for char::DecodeUtf16Error { } } +#[stable(feature = "u8_from_char", since = "1.59.0")] +impl Error for char::TryFromCharError {} + #[unstable(feature = "map_try_insert", issue = "82766")] impl<'a, K: Debug + Ord, V: Debug> Error for crate::collections::btree_map::OccupiedError<'a, K, V> |
