mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-28 19:17:43 +00:00
Add comment noting that this naive approach is not too naive.
This commit is contained in:
parent
0b1d5f0182
commit
0a0aa11bb1
@ -898,6 +898,9 @@ impl<'a, 'tcx, 'v> Visitor<'v> for PrivacyVisitor<'a, 'tcx> {
|
|||||||
ast::ExprStruct(_, ref fields, _) => {
|
ast::ExprStruct(_, ref fields, _) => {
|
||||||
match ty::expr_ty(self.tcx, expr).sty {
|
match ty::expr_ty(self.tcx, expr).sty {
|
||||||
ty::ty_struct(ctor_id, _) => {
|
ty::ty_struct(ctor_id, _) => {
|
||||||
|
// RFC 736: ensure all unmentioned fields are visible.
|
||||||
|
// Rather than computing the set of unmentioned fields
|
||||||
|
// (i.e. `all_fields - fields`), just check them all.
|
||||||
let all_fields = ty::lookup_struct_fields(self.tcx, ctor_id);
|
let all_fields = ty::lookup_struct_fields(self.tcx, ctor_id);
|
||||||
for field in all_fields {
|
for field in all_fields {
|
||||||
self.check_field(expr.span, ctor_id,
|
self.check_field(expr.span, ctor_id,
|
||||||
|
Loading…
Reference in New Issue
Block a user