Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir_def/src/nameres/diagnostics.rs')
| -rw-r--r-- | crates/hir_def/src/nameres/diagnostics.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/crates/hir_def/src/nameres/diagnostics.rs b/crates/hir_def/src/nameres/diagnostics.rs index 95061f6015..1eb3844731 100644 --- a/crates/hir_def/src/nameres/diagnostics.rs +++ b/crates/hir_def/src/nameres/diagnostics.rs @@ -6,6 +6,7 @@ use la_arena::Idx; use syntax::ast; use crate::{ + attr::AttrId, item_tree::{self, ItemTreeId}, nameres::LocalModuleId, path::ModPath, @@ -29,6 +30,8 @@ pub enum DefDiagnosticKind { MacroError { ast: MacroCallKind, message: String }, UnimplementedBuiltinMacro { ast: AstId<ast::Macro> }, + + InvalidDeriveTarget { ast: AstId<ast::Item>, id: u32 }, } #[derive(Debug, PartialEq, Eq)] @@ -102,4 +105,15 @@ impl DefDiagnostic { ) -> Self { Self { in_module: container, kind: DefDiagnosticKind::UnimplementedBuiltinMacro { ast } } } + + pub(super) fn invalid_derive_target( + container: LocalModuleId, + ast: AstId<ast::Item>, + id: AttrId, + ) -> Self { + Self { + in_module: container, + kind: DefDiagnosticKind::InvalidDeriveTarget { ast, id: id.ast_index }, + } + } } |