mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-26 20:09:19 +00:00
internal: refactor macro error
This commit is contained in:
parent
1e4aaee7bb
commit
00303284b5
7 changed files with 178 additions and 198 deletions
|
@ -37,6 +37,7 @@ diagnostics![
|
|||
UnresolvedImport,
|
||||
UnresolvedMacroCall,
|
||||
UnresolvedProcMacro,
|
||||
MacroError,
|
||||
MissingFields,
|
||||
InactiveCode,
|
||||
];
|
||||
|
@ -79,35 +80,12 @@ pub struct UnresolvedProcMacro {
|
|||
pub macro_name: Option<String>,
|
||||
}
|
||||
|
||||
// Diagnostic: macro-error
|
||||
//
|
||||
// This diagnostic is shown for macro expansion errors.
|
||||
#[derive(Debug, Clone, Eq, PartialEq)]
|
||||
pub struct MacroError {
|
||||
pub file: HirFileId,
|
||||
pub node: SyntaxNodePtr,
|
||||
pub node: InFile<SyntaxNodePtr>,
|
||||
pub message: String,
|
||||
}
|
||||
|
||||
impl Diagnostic for MacroError {
|
||||
fn code(&self) -> DiagnosticCode {
|
||||
DiagnosticCode("macro-error")
|
||||
}
|
||||
fn message(&self) -> String {
|
||||
self.message.clone()
|
||||
}
|
||||
fn display_source(&self) -> InFile<SyntaxNodePtr> {
|
||||
InFile::new(self.file, self.node.clone())
|
||||
}
|
||||
fn as_any(&self) -> &(dyn Any + Send + 'static) {
|
||||
self
|
||||
}
|
||||
fn is_experimental(&self) -> bool {
|
||||
// Newly added and not very well-tested, might contain false positives.
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct UnimplementedBuiltinMacro {
|
||||
pub file: HirFileId,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue