]> git.lizzy.rs Git - rust.git/commitdiff
Add comment noting that this naive approach is not too naive.
authorFelix S. Klock II <pnkfelix@pnkfx.org>
Tue, 10 Feb 2015 14:45:36 +0000 (15:45 +0100)
committerFelix S. Klock II <pnkfelix@pnkfx.org>
Tue, 10 Feb 2015 14:45:36 +0000 (15:45 +0100)
src/librustc_privacy/lib.rs

index 4afe8fe7878f8925e4da9e38115062f1fca00f99..96e146fc894f98cddc149c6f850e45546b3519c6 100644 (file)
@@ -898,6 +898,9 @@ fn visit_expr(&mut self, expr: &ast::Expr) {
             ast::ExprStruct(_, ref fields, _) => {
                 match ty::expr_ty(self.tcx, expr).sty {
                     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);
                         for field in all_fields {
                             self.check_field(expr.span, ctor_id,