mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-26 20:09:19 +00:00
Report syntax errors from item level macro expansions
This commit is contained in:
parent
71b50f9f09
commit
d1632c2727
11 changed files with 147 additions and 76 deletions
|
@ -10,7 +10,7 @@ use cfg::{CfgExpr, CfgOptions};
|
|||
use either::Either;
|
||||
use hir_def::path::ModPath;
|
||||
use hir_expand::{name::Name, HirFileId, InFile};
|
||||
use syntax::{ast, AstPtr, SyntaxNodePtr, TextRange};
|
||||
use syntax::{ast, AstPtr, SyntaxError, SyntaxNodePtr, TextRange};
|
||||
|
||||
use crate::{AssocItem, Field, Local, MacroKind, Type};
|
||||
|
||||
|
@ -38,8 +38,9 @@ diagnostics![
|
|||
IncorrectCase,
|
||||
InvalidDeriveTarget,
|
||||
IncoherentImpl,
|
||||
MacroError,
|
||||
MacroDefError,
|
||||
MacroError,
|
||||
MacroExpansionParseError,
|
||||
MalformedDerive,
|
||||
MismatchedArgCount,
|
||||
MissingFields,
|
||||
|
@ -132,6 +133,13 @@ pub struct MacroError {
|
|||
pub message: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Eq, PartialEq)]
|
||||
pub struct MacroExpansionParseError {
|
||||
pub node: InFile<SyntaxNodePtr>,
|
||||
pub precise_location: Option<TextRange>,
|
||||
pub errors: Box<[SyntaxError]>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Eq, PartialEq)]
|
||||
pub struct MacroDefError {
|
||||
pub node: InFile<AstPtr<ast::Macro>>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue