1
Fork 0

Use field ident spans directly instead of the full field span in diagnostics on local fields

This commit is contained in:
Oli Scherer 2024-07-06 19:21:22 +00:00
parent 28cc0b643d
commit 8c2ea715e9
9 changed files with 49 additions and 45 deletions

View file

@ -1726,11 +1726,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
)) = binding.kind
{
let def_id = self.tcx.parent(ctor_def_id);
return self
.field_def_ids(def_id)?
.iter()
.map(|&field_id| self.def_span(field_id))
.reduce(Span::to); // None for `struct Foo()`
return self.field_idents(def_id)?.iter().map(|&f| f.span).reduce(Span::to); // None for `struct Foo()`
}
None
}