]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_symbol_mangling/src/errors.rs
Rollup merge of #103287 - saethlin:faster-len-check, r=thomcc
[rust.git] / compiler / rustc_symbol_mangling / src / errors.rs
1 //! Errors emitted by symbol_mangling.
2
3 use rustc_errors::{DiagnosticArgValue, IntoDiagnosticArg};
4 use rustc_macros::Diagnostic;
5 use rustc_span::Span;
6
7 #[derive(Diagnostic)]
8 #[diag(symbol_mangling_test_output)]
9 pub struct TestOutput {
10     #[primary_span]
11     pub span: Span,
12     pub kind: Kind,
13     pub content: String,
14 }
15
16 pub enum Kind {
17     SymbolName,
18     Demangling,
19     DemanglingAlt,
20     DefPath,
21 }
22
23 impl IntoDiagnosticArg for Kind {
24     fn into_diagnostic_arg(self) -> DiagnosticArgValue<'static> {
25         let kind = match self {
26             Kind::SymbolName => "symbol-name",
27             Kind::Demangling => "demangling",
28             Kind::DemanglingAlt => "demangling-alt",
29             Kind::DefPath => "def-path",
30         }
31         .into();
32         DiagnosticArgValue::Str(kind)
33     }
34 }