diff options
| author | bors <bors@rust-lang.org> | 2023-02-26 12:40:05 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-02-26 12:40:05 +0000 |
| commit | c4e0cd966062ca67daed20775f4e8a60c28e57df (patch) | |
| tree | a76fa48fe30ba83326439fadaae6a62890573e4b /compiler/rustc_errors/src/registry.rs | |
| parent | 43ee4d15bf201f72c36abd7f02961df87dead441 (diff) | |
| parent | 9c27fc7d34512a6b3d34247beab4a6ada2476c58 (diff) | |
| download | rust-c4e0cd966062ca67daed20775f4e8a60c28e57df.tar.gz rust-c4e0cd966062ca67daed20775f4e8a60c28e57df.zip | |
Auto merge of #108488 - matthiaskrgr:rollup-i61epcw, r=matthiaskrgr
Rollup of 9 pull requests
Successful merges:
- #107941 (Treat `str` as containing `[u8]` for auto trait purposes)
- #108299 (Require `literal`s for some `(u)int_impl!` parameters)
- #108337 (hir-analysis: make a helpful note)
- #108379 (Add `ErrorGuaranteed` to `hir::{Expr,Ty}Kind::Err` variants)
- #108418 (Replace parse_[sth]_expr with parse_expr_[sth] function names)
- #108424 (rustc_infer: Consolidate obligation elaboration de-duplication)
- #108475 (Fix `VecDeque::shrink_to` and add tests.)
- #108482 (statically guarantee that current error codes are documented)
- #108484 (Remove `from` lang item)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_errors/src/registry.rs')
| -rw-r--r-- | compiler/rustc_errors/src/registry.rs | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/compiler/rustc_errors/src/registry.rs b/compiler/rustc_errors/src/registry.rs index da764d993bb..f26d8e7ebdc 100644 --- a/compiler/rustc_errors/src/registry.rs +++ b/compiler/rustc_errors/src/registry.rs @@ -5,21 +5,17 @@ pub struct InvalidErrorCode; #[derive(Clone)] pub struct Registry { - long_descriptions: FxHashMap<&'static str, Option<&'static str>>, + long_descriptions: FxHashMap<&'static str, &'static str>, } impl Registry { - pub fn new(long_descriptions: &[(&'static str, Option<&'static str>)]) -> Registry { + pub fn new(long_descriptions: &[(&'static str, &'static str)]) -> Registry { Registry { long_descriptions: long_descriptions.iter().copied().collect() } } /// Returns `InvalidErrorCode` if the code requested does not exist in the - /// registry. Otherwise, returns an `Option` where `None` means the error - /// code is valid but has no extended information. - pub fn try_find_description( - &self, - code: &str, - ) -> Result<Option<&'static str>, InvalidErrorCode> { + /// registry. + pub fn try_find_description(&self, code: &str) -> Result<&'static str, InvalidErrorCode> { self.long_descriptions.get(code).copied().ok_or(InvalidErrorCode) } } |
