mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-26 11:59:49 +00:00
Diagnose private assoc item accesses
This commit is contained in:
parent
e3d144d17f
commit
eee7de0225
10 changed files with 199 additions and 26 deletions
|
@ -10,7 +10,7 @@ use hir_def::path::ModPath;
|
|||
use hir_expand::{name::Name, HirFileId, InFile};
|
||||
use syntax::{ast, AstPtr, SyntaxNodePtr, TextRange};
|
||||
|
||||
use crate::{Field, MacroKind, Type};
|
||||
use crate::{AssocItem, Field, MacroKind, Type};
|
||||
|
||||
macro_rules! diagnostics {
|
||||
($($diag:ident,)*) => {
|
||||
|
@ -41,6 +41,7 @@ diagnostics![
|
|||
MissingMatchArms,
|
||||
MissingUnsafe,
|
||||
NoSuchField,
|
||||
PrivateAssocItem,
|
||||
PrivateField,
|
||||
ReplaceFilterMapNextWithFindMap,
|
||||
TypeMismatch,
|
||||
|
@ -122,6 +123,13 @@ pub struct NoSuchField {
|
|||
pub field: InFile<AstPtr<ast::RecordExprField>>,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct PrivateAssocItem {
|
||||
pub expr_or_pat:
|
||||
InFile<Either<AstPtr<ast::Expr>, Either<AstPtr<ast::Pat>, AstPtr<ast::SelfParam>>>>,
|
||||
pub item: AssocItem,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct PrivateField {
|
||||
pub expr: InFile<AstPtr<ast::Expr>>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue