We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 728c955 + c89b9d9 commit 51c6803Copy full SHA for 51c6803
compiler/rustc_resolve/src/diagnostics.rs
@@ -1111,10 +1111,9 @@ impl<'a> Resolver<'a> {
1111
_,
1112
) = binding.kind
1113
{
1114
- let def_id = (&*self).parent(ctor_def_id).expect("no parent for a constructor");
+ let def_id = self.parent(ctor_def_id).expect("no parent for a constructor");
1115
let fields = self.field_names.get(&def_id)?;
1116
- let first_field = fields.first()?; // Handle `struct Foo()`
1117
- return Some(fields.iter().fold(first_field.span, |acc, field| acc.to(field.span)));
+ return fields.iter().map(|name| name.span).reduce(Span::to); // None for `struct Foo()`
1118
}
1119
None
1120
0 commit comments