2022-08-27 04:24:13 +00:00
|
|
|
//! Errors emitted by symbol_mangling.
|
|
|
|
|
2022-09-13 20:19:32 +00:00
|
|
|
use rustc_errors::{DiagnosticArgValue, IntoDiagnosticArg};
|
2022-09-18 15:45:41 +00:00
|
|
|
use rustc_macros::Diagnostic;
|
2022-08-27 04:24:13 +00:00
|
|
|
use rustc_span::Span;
|
|
|
|
|
2022-09-18 15:45:41 +00:00
|
|
|
#[derive(Diagnostic)]
|
2022-10-22 09:07:54 +00:00
|
|
|
#[diag(symbol_mangling_test_output)]
|
2022-09-13 20:19:32 +00:00
|
|
|
pub struct TestOutput {
|
2022-08-27 04:24:13 +00:00
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
2022-09-13 20:19:32 +00:00
|
|
|
pub kind: Kind,
|
|
|
|
pub content: String,
|
2022-08-27 04:24:13 +00:00
|
|
|
}
|
2022-08-21 04:38:23 +00:00
|
|
|
|
2022-09-13 20:19:32 +00:00
|
|
|
pub enum Kind {
|
|
|
|
SymbolName,
|
|
|
|
Demangling,
|
|
|
|
DemanglingAlt,
|
|
|
|
DefPath,
|
2022-08-21 04:38:23 +00:00
|
|
|
}
|
|
|
|
|
2022-09-13 20:19:32 +00:00
|
|
|
impl IntoDiagnosticArg for Kind {
|
|
|
|
fn into_diagnostic_arg(self) -> DiagnosticArgValue<'static> {
|
|
|
|
let kind = match self {
|
|
|
|
Kind::SymbolName => "symbol-name",
|
|
|
|
Kind::Demangling => "demangling",
|
|
|
|
Kind::DemanglingAlt => "demangling-alt",
|
|
|
|
Kind::DefPath => "def-path",
|
|
|
|
}
|
|
|
|
.into();
|
|
|
|
DiagnosticArgValue::Str(kind)
|
|
|
|
}
|
2022-08-21 04:51:33 +00:00
|
|
|
}
|