Skip to content

Commit

Permalink
Fixes #63976. Incorrect error message.
Browse files Browse the repository at this point in the history
Fix incorrect error message when accessing
private field of union
  • Loading branch information
sam09 committed Aug 28, 2019
1 parent c422372 commit fdd8b96
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/librustc_typeck/check/expr.rs
Expand Up @@ -1396,8 +1396,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
self.tcx().sess,
expr.span,
E0616,
"field `{}` of struct `{}` is private",
"field `{}` of `{}` `{}` is private",
field,
if let Some(def_kind) = self.tcx().def_kind(base_did){ def_kind.descr(base_did) }
else { " " },
struct_path
);
// Also check if an accessible method exists, which is often what is meant.
Expand Down

0 comments on commit fdd8b96

Please sign in to comment.