feat: add attributes support on struct fields #3870

Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
This commit is contained in:
Benjamin Coenen 2020-04-07 17:58:05 +02:00
parent f6d688d130
commit ab864ed259
4 changed files with 71 additions and 7 deletions

View file

@ -8,8 +8,7 @@ use hir_def::{
AdtId, FunctionId,
};
use hir_expand::{diagnostics::DiagnosticSink, name::Name};
use ra_syntax::ast;
use ra_syntax::AstPtr;
use ra_syntax::{ast, AstPtr};
use rustc_hash::FxHashSet;
use crate::{
@ -82,7 +81,14 @@ impl<'a, 'b> ExprValidator<'a, 'b> {
let variant_data = variant_data(db.upcast(), variant_def);
let lit_fields: FxHashSet<_> = fields.iter().map(|f| &f.name).collect();
let lit_fields: FxHashSet<_> = fields
.iter()
.filter_map(|f| {
// TODO: check if cfg_is_enabled with .attrs ?
Some(&f.name)
})
.collect();
let missed_fields: Vec<Name> = variant_data
.fields()
.iter()