diff options
| author | Sam Radhakrishan <sk09idm@gmail.com> | 2019-08-29 02:43:09 +0530 |
|---|---|---|
| committer | Sam Radhakrishan <sk09idm@gmail.com> | 2019-08-29 02:48:36 +0530 |
| commit | fdd8b967c180192fb74bf17f07e2fda040bb9865 (patch) | |
| tree | c4cee5cbdf7c74b396bc1f3142c8513b206733ec | |
| parent | c4223726c354642705d87b9837933e3c3f38a2d8 (diff) | |
| download | rust-fdd8b967c180192fb74bf17f07e2fda040bb9865.tar.gz rust-fdd8b967c180192fb74bf17f07e2fda040bb9865.zip | |
Fixes #63976. Incorrect error message.
Fix incorrect error message when accessing private field of union
| -rw-r--r-- | src/librustc_typeck/check/expr.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/librustc_typeck/check/expr.rs b/src/librustc_typeck/check/expr.rs index d139cd4264c..4943270e193 100644 --- a/src/librustc_typeck/check/expr.rs +++ b/src/librustc_typeck/check/expr.rs @@ -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. |
